Token导航 LogoToken导航

Agent Skill · 研究检索

optimize-agent-prompt(优化 Agent 提示)

用于辅助提示词、系统指令、Agent 行为约束和工作流模板的整理。它适合让 Agent 规范任务边界、统一输出格式、拆分操作步骤或优化提示词可复用性。使用时需要保留真实业务约束,不要把示例当硬规则;涉及自动执行、外部工具或高风险操作时,应在提示词中明确确认步骤、权限边界和失败处理方式。

optimize-agent-prompt 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为调用外部服务;许可证信息还不明确,第三方扫描有提醒项,按安装量在研究检索类的 73,675 个 Skill 里排第 55,093。

总安装 490周安装 20GitHub Stars 4下载 157核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:optimize-agent-prompt(优化 Agent 提示)
来源仓库:https://github.com/sanity-io/agent-context
仓库路径:skills/optimize-agent-prompt
安装命令:
npx skills add https://github.com/sanity-io/agent-context --skill optimize-agent-prompt
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/sanity-io/agent-context --skill optimize-agent-prompt

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于辅助提示词、系统指令、Agent 行为约束和工作流模板的整理,适合规范任务边界、统一输出格式与提升可复用性。适用于自动化脚本编写、客服问答系统与批处理流水线设计等场景。可拆分复合任务为原子操作并定义回滚机制。

安装命令:npx skills add https://github.com/sanity-io/agent-context --skill optimize-agent-prompt;需嵌入真实业务规则而非示例。高风险操作必须在提示词中包含显式确认步骤与失败预案。

来源仓库内路径:skills/optimize-agent-prompt

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/sanity-io/agent-context --skill optimize-agent…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要调用外部服务,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

optimize-agent-prompt 怎么安装?

在终端执行 npx skills add https://github.com/sanity-io/agent-context --skill optimize-agent-prompt。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

optimize-agent-prompt 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

optimize-agent-prompt 需要什么权限?

权限级别是调用外部服务。该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

optimize-agent-prompt 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

optimize-agent-prompt 用的人多吗?

公开数据是累计安装 490 次,近一周安装 20 次,下载 157 次,GitHub 4 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

optimize-agent-prompt 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
optimize-agent-prompt

优化 Agent 提示 · 本页

4904调用外部服务未明确有提醒

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Tune Your Agent

Use this skill to turn a basic agent into a high-quality, conversationally strong, data-aware agent. This is an interactive session — you'll provide exploration data, answer questions about your use case, and get back two artifacts:

  1. Instructions field content — for your Agent Context Document
  2. System prompt — for your agent's code

Prerequisites

  • A working agent — built using the create-agent-with-sanity-context skill or equivalent
  • An Agent Context Document — created in Sanity Studio with the context plugin
  • Exploration data — run the Agent Context Explorer to understand your dataset
npx @sanity/agent-context-explorer \
  --mcp-url https://api.sanity.io/vX/agent-context/PROJECT_ID/DATASET/SLUG \
  --questions ./questions.json \
  --sanity-token $SANITY_API_READ_TOKEN \
  --anthropic-api-key $ANTHROPIC_API_KEY

Paste the contents of exploration-results.md into this conversation when prompted.

Workflow

1. Intake

First, gather the inputs:

  • Exploration data: Ask the user to paste their exploration-results.md
  • Current system prompt: If they have one, review it for context

If the user hasn't run the explorer yet, help them get started:

  1. Ask about their use case and what questions their agent should answer
  2. Generate a questions.json file with 8-15 realistic questions and expected answers
  3. The questions should cover the breadth of what the agent will handle — product lookups, comparisons, troubleshooting, edge cases
  4. Include expected answers so the explorer can validate whether the dataset can actually answer them

Example questions.json structure:

{
  "questions": [
    {
      "question": "What sizes does the Alpine Jacket come in?",
      "expected_answer": "The Alpine Jacket is available in XS, S, M, L, XL, and XXL."
    },
    {
      "question": "Is the Alpine Jacket waterproof?",
      "expected_answer": "The Alpine Jacket is water-resistant but not fully waterproof. For heavy rain, consider the StormShield Parka which has a waterproof membrane."
    }
  ]
}

Once they have exploration data, ask about their use case. Pick relevant questions — don't ask all of them:

Purpose & Audience

  • What does the agent help users do?
  • Who are the users? (customers, internal team, support agents)
  • What's in scope? What's explicitly out of scope?

Language & Locale

  • What languages/locales should the agent support?
  • Are there locale-specific content rules?

Tone & Style

  • Formal or casual? Warm or efficient?
  • How verbose? Chat-length or detailed?
  • First person ("I") or brand voice ("We")?

Behavior

  • When should it ask clarifying questions vs answer directly?
  • Should it proactively suggest related things?
  • How should it handle uncertainty?

Constraints

  • What should it never discuss? (competitors, pricing, legal advice)
  • What should redirect to humans?
  • Any hard business rules?

2. Transform

Using the exploration data and user answers, extract:

  • Data inventory: What content types exist and what they're for
  • Query patterns: Which types/fields to use for which questions, with examples
  • Critical rules: Operational rules that prevent wasted queries and context blowups (locale filters, null fields, required projections)
  • Limitations: What's NOT in the dataset (pricing, inventory, etc.)

This becomes the instructions field content. Don't skip critical rules — these prevent the most common failures.

3. Draft

Produce both artifacts:

A. Instructions field content

  • Critical rules (locale filters, projections, null fields) — put first
  • Schema reference table
  • Query patterns with copy-paste GROQ examples
  • Fallback strategy (what to try when queries fail)
  • Known limitations

B. System prompt

  • Role statement
  • Response style (length, format, clarifying behavior)
  • Boundaries and guardrails
  • Working with content (query efficiency)
  • Accuracy rules

Present both to the user clearly, explaining what goes where.

4. Validate

Before finalizing, verify the exploration data and drafted instructions cover everything needed:

Schema Coverage:

  • All document types from the MCP schema appear in Schema Reference
  • If types are missing, flag them — user may need to add exploration questions

Query Pattern Quality:

  • Each pattern includes a projection ({field1, field2}) — not full documents
  • Each pattern includes a slice ([0...N]) — limits results
  • Reference fields use dereference (->) not just ._ref

Required Sections:

  • Critical Rules section exists and comes first
  • Fallback Strategy section exists
  • Known Limitations section exists

Content Quality:

  • Rules use imperative language ("Always...", "Never...")
  • Patterns are copy-paste ready (no placeholders)
  • Limitations include what happens when you query them

If gaps exist, ask the user whether to:

  • Run more exploration with additional questions
  • Add the missing sections manually based on domain knowledge
  • Ship with documented blind spots

5. Iterate

Refine based on feedback. If the user wants to test against tricky questions, help them evaluate the drafts.


Two Prompt Surfaces

SurfaceWhat goes hereHow it gets to the agent
Agent Context Document → instructions fieldDataset knowledge: schema, query patterns, limitations, field gotchasInjected automatically via MCP
System promptAgent behavior: role, tone, response style, guardrailsYou control this in code

The key distinction:

  • Instructions field = what the agent knows about the data
  • System prompt = how the agent behaves and communicates

Don't duplicate dataset knowledge in your system prompt — that's what the instructions field is for.

Quick Reference

This concern...Instructions fieldSystem prompt
Schema reference (document types, fields)✅❌
Query patterns that work✅❌
Field naming gotchas✅❌
Data limitations (null fields, external systems)✅❌
Agent role and persona❌✅
Tone of voice❌✅
Response length and format❌✅
"Never mention competitors"❌✅
"Pricing not in dataset, check website"✅❌
"Always direct pricing questions to website"❌✅

Instructions Field Structure

The instructions field content should be ordered for maximum impact — put the most critical guidance first.

1. Critical Rules (FIRST)

Put this section at the top. Operational rules that prevent wasted queries and context blowups. Copy these directly from the exploration data's "Critical Rules" section:

  • Required filters (e.g., locale filters to avoid duplicates)
  • Fields that are always null (don't waste queries on them)
  • When to use semantic search vs structured queries

Don't generalize or rewrite these — use the exact rules from the exploration.

2. Schema Reference

What's in the dataset and what each content type is for. Use the Schema Reference table from the exploration data.

3. Query Patterns

How to find things effectively. Copy the working patterns from the exploration data — these are tested and known to work. Ensure all examples include projections and slices.

4. Known Limitations

What's NOT available — this prevents hallucinations. Copy from the exploration data's "Known Limitations" section.

5. About [Brand] (optional)

Brief context about the company/domain. This helps the agent sound knowledgeable but isn't essential for query accuracy. Put it last.


System Prompt Structure

Role Statement

Who the agent is. Keep it to 2-3 sentences.

You are a shopping assistant for [Company]. You help customers find products,
compare options, and answer questions about features and compatibility.
You're friendly, knowledgeable, and concise.

Your Knowledge Source

Directs the agent to treat MCP tool descriptions as its operating manual. This is critical for instruction compliance.

## Your Knowledge Source

All your knowledge about [domain] comes from the MCP tools. **The MCP server's instructions are your operating manual** — they tell you:

- Which document types to query for which questions
- Query patterns that actually work (and which don't)
- Critical rules you must follow (filters, projections, etc.)
- What data exists and what doesn't

**Before writing any query, check the MCP tool descriptions.** They contain specific guidance that overrides general intuition. If the instructions say to use a specific document type or filter, do it — even if another approach seems reasonable.

Response Style

## How to Respond

- Give direct answers first, then add detail if helpful
- Keep responses concise — a few sentences for simple questions
- Use bullet points for comparisons or feature lists
- Don't narrate your process ("Let me look that up...")

Clarifying Questions

When and how to ask for more information.

## When to Ask for Clarification

For broad or ambiguous questions, ask a focused clarifying question rather than dumping everything you know. Example:

User: "What speaker should I get?"
Good: "To recommend the right speaker, it helps to know: what room is it for, and what's your budget range?"
Bad: [500-word overview of every speaker in the catalog]

If you can give a useful partial answer, do that AND ask for clarification.

Boundaries

## What You Can't Help With

- Pricing — direct users to the website
- Order status or account issues — direct to support@company.com
- Warranty claims — direct to the warranty page

Guardrails

## Never

- Never mention competitor products by name
- Never make up information — if you don't know, say so
- Never share internal processes or system details
- Never promise discounts or special treatment

Accuracy

Keep this lightweight — the MCP already covers grounding in data. Focus on the persona angle:

## Accuracy

Always provide factually correct answers grounded in the content you retrieve. It's OK to say "I'm not sure about that" — better than guessing wrong.

Behavioral Goals

A well-tuned agent should:

Ask Clarifying Questions

For broad queries, ask a focused question instead of dumping everything. "What room is this for?" is better than a 500-word product overview.

Appropriate Length

Short and direct for narrow questions. Structured and scannable for complex ones. Never verbose just to be thorough.

Honest About Gaps

When the dataset lacks something: acknowledge it simply, redirect helpfully, offer alternatives. "I don't have pricing — you can check on our website. Want me to help compare features instead?"

Never Leak Internals

Users should never see schema names, document types, field names, or query syntax. The agent knows these things but doesn't expose them.


Core Principles

Speak On Behalf Of, Not About

The agent represents the brand — not the database. Users want answers, not architecture.

Bad (talking about the dataset):

"The pricing data is not available in this dataset. It is managed in an external Commerce API system."

Good (talking on behalf of the brand):

"I don't have current pricing available. You can check pricing on our website or contact our sales team."

Bad (exposing internals):

"I queried the product type and found 3 results. Based on the media altText fields, it appears to come in black and white."

Good (clean answer):

"It comes in black and white."

Handle Gaps Gracefully

When the agent doesn't have information:

  1. Acknowledge simply — "I don't have that information"
  2. Redirect helpfully — "You can find pricing on our website"
  3. Offer alternatives — "I can help you compare features if that's useful"

Never guess. Never make up answers. Never blame the data.

Keep Technical Details Internal

The agent needs to know about document types, field names, and query patterns. But users should never see this machinery. Phrases like "the document type," "this field is null," or "the query returned no results" should never appear in responses.


What NOT to Do

  • Don't duplicate dataset knowledge in your system prompt. That's what the instructions field is for.
  • Don't let the agent talk like a database. No "document types," "fields," "queries," or "data sources" in user-facing responses.
  • Don't use "Context MCP" in customer-facing prompts. The product name is "Agent Context."
  • Don't skip exploration. Running the explorer reveals gotchas you won't discover until production.
  • Don't be vague about boundaries. "Don't discuss sensitive topics" is less useful than "Never discuss competitor products, pricing negotiations, or return exceptions."
  • Don't optimize for verbosity. Longer answers aren't better answers. Teach the agent to be appropriately concise.

平台分布

Codex

34.74%
按下载量换算55

Claude

33.79%
按下载量换算53

Cursor

19.14%
按下载量换算30

Gemini CLI

9.85%
按下载量换算15

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

调用外部服务

该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills