Agent 上下文审查
- 作者仓库星标 185,273
- 作者仓库 vscode
Agent Customization
Decision Flow
| Primitive | When to Use |
|---|---|
| agent instructions | Always-on, applies everywhere in the project |
| File Instructions | Explicit via applyTo patterns, or on-demand via description |
| MCP | Integrates external systems, APIs, or data |
| Hooks | Deterministic shell commands at agent lifecycle points (block tools, auto-format, inject context) |
| Custom Agents | Subagents for context isolation, or multi-stage workflows with tool restrictions |
| Prompts | Single focused task with parameterized inputs |
| Skills | On-demand workflow with bundled assets (scripts/templates) |
Quick Reference
Consult the reference docs for templates, domain examples, advanced frontmatter options, asset organization, anti-patterns, and creation checklists. If the references are not enough, load the official documentation links for each primitive.
| Type | File | Location | Reference |
|---|---|---|---|
| agent instructions | copilot-instructions.md, AGENTS.md |
.github/ or root |
Link |
| File Instructions | *.instructions.md |
.github/instructions/ |
Link |
| Prompts | *.prompt.md |
.github/prompts/ |
Link |
| Hooks | *.json |
.github/hooks/ |
Link |
| Custom Agents | *.agent.md |
.github/agents/ |
Link |
| Skills | SKILL.md |
.github/skills/<name>/, .agents/skills/<name>/, .claude/skills/<name>/ |
Link |
User-level: {{VSCODE_USER_PROMPTS_FOLDER}}/ (*.prompt.md, *.instructions.md, *.agent.md; not skills)
Customizations roam with user's settings sync
Creation Process
If you need to explore or validate patterns in the codebase, use a read-only subagent. If the ask-questions tool is available, use it to interview the user and clarify requirements.
Follow these steps when creating any customization file.
1. Determine Scope
Ask the user where they want the customization:
- Workspace: For project-specific, team-shared customizations →
.github/folder - User profile: For personal, cross-workspace customizations →
{{VSCODE_USER_PROMPTS_FOLDER}}/
2. Choose the Right Primitive
Use the Decision Flow above to select the appropriate file type based on the user's need.
3. Create the File
Create the file directly at the appropriate path:
- Use the location tables in each reference file
- Include required frontmatter as needed
- Add the body content following the templates
4. Validate
After creating:
- Confirm the file is in the correct location
- Verify frontmatter syntax (YAML between
---markers) - Check that
descriptionis present and meaningful
Edge Cases
Instructions vs Skill? Does this apply to most work, or specific tasks? Most → Instructions. Specific → Skill.
Skill vs Prompt? Both appear as slash commands in chat (type /). Multi-step workflow with bundled assets → Skill. Single focused task with inputs → Prompt.
Skill vs Custom Agent? Same capabilities for all steps → Skill. Need context isolation (subagent returns single output) or different tool restrictions per stage → Custom Agent.
Hooks vs Instructions? Instructions guide agent behavior (non-deterministic). Hooks enforce behavior via shell commands at lifecycle events like PreToolUse or PostToolUse — they can block operations, require approval, or run formatters deterministically. Hooks can be defined in standalone .json files (see hooks reference) or inline in custom agent frontmatter via the hooks attribute (see agents reference).
Common Pitfalls
Description is the discovery surface. The description field is how the agent decides whether to load a skill, instruction, or agent. If trigger phrases aren't IN the description, the agent won't find it. Use the "Use when..." pattern with specific keywords.
YAML frontmatter silent failures. Unescaped colons in values, tabs instead of spaces, name that doesn't match folder name — all cause silent failures with no error message. Always quote descriptions that contain colons: description: "Use when: doing X".
applyTo: "**" burns context. This means "always included for every file request" — it loads the instruction into the context window on every interaction, even when irrelevant. Use specific globs (**/*.py, src/api/**) unless the instruction truly applies to all files.
- 流狐分类
- 文档
- 作者声明 Agent
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 作者 / 版本 / 许可
- @microsoft · 未声明 license
- 流狐 Token 估算
- 低消耗
- 流狐接入估算
- 需简单配置
- 是否需要外部 API Key
- 未发现要求
- 检测到的系统要求
- 未声明
- 底层运行要求
- 未声明
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- Shell 执行
- 检测到的网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
作者没有在当前 SKILL.md 中定义固定输出样例。 Primitive · When to Use agent instructions · Always-on, applies everywhere in the project File Instructions · Explicit via applyTo patterns, or on-demand via description
Consult the reference docs for templates, domain examples, advanced frontmatter options, asset organization, anti-patterns, and creation checklists. If the references are not enough, load the official documentation links for each primitive.
If you need to explore or validate patterns in the codebase, use a read-only subagent. If the ask-questions tool is available, use it to interview the user and clarify requirements. Follow these steps when creating any customization file.
Ask the user where they want the customization: Workspace: For project-specific, team-shared customizations → .github/ folder User profile: For personal, cross-workspace customizations → {{VSCODEUSERPROMPTSFOLDER}}/
Use the Decision Flow above to select the appropriate file type based on the user's need.
Create the file directly at the appropriate path: Use the location tables in each reference file Include required frontmatter as needed
# Agent Customization
## Decision Flow
| Primitive | When to Use |
|-----------|-------------|
| agent instructions | Always-on, applies everywhere in the project |
| File Instructions | Explicit via `applyTo` patterns, or on-demand via `description` |
| MCP | Integrates external systems, APIs, or data |
| Hooks | Deterministic shell commands at agent lifecycle points (block tools, auto-format, inject context) |
| Custom Agents | Subagents for context isolation, or multi-stage workflows with tool restrictions |
| Prompts | Single focused task with parameterized inputs |
| Skills | On-demand workflow with bundled assets (scripts/templates) |
## Quick Reference
Consult the reference docs for templates, domain examples, advanced frontmatter options, asset organization, anti-patterns, and creation checklists. If the references are not enough, load the official documentation links for each primitive.
| Type | File | Location | Reference |
|------|------|----------|-----------|
| agent instructions | `copilot-instructions.md`, `AGENTS.md` | `.github/` or root | [Link](./references/agent-instructions.md) |
| File Instructions | `*.instructions.md` | `.github/instructions/` | [Link](./references/instructions.md) |
| Prompts | `*.prompt.md` | `.github/prompts/` | [Link](./references/prompts.md) |
| Hooks | `*.json` | `.github/hooks/` | [Link](./references/hooks.md) |
| Custom Agents | `*.agent.md` | `.github/agents/` | [Link](./references/agents.md) |
| Skills | `SKILL.md` | `.github/skills/<name>/`, `.agents/skills/<name>/`, `.claude/skills/<name>/` | [Link](./references/skills.md) |
**User-level**: `{{VSCODE_USER_PROMPTS_FOLDER}}/` (*.prompt.md, *.instructions.md, *.agent.md; not skills)
Customizations roam with user's settings sync
## Creation Process
… 作者原文负责流程事实;流狐只索引当前章节、要点、文件与命令。
章节 -> Decision Flow → Quick Reference → Creation Process → 1. Determine Scope → 2. Choose the Right Primitive → 3. Create the File
要点 -> User-level · Workspace · User profile · Instructions vs Skill? · Skill vs Prompt? · Skill vs Custom Agent? · Hooks vs Instructions? · Description is the discovery surface.
文件/命令 -> applyTo · description · copilot-instructions.md · AGENTS.md · .github/ · .instructions.md · .github/instructions/ · .prompt.md
内容 SHA-256 -> 523ada00ca73
方法与流程
适用与边界
原文中的明确线索
applyTo、description、copilot-instructions.md、AGENTS.md、.github/、.instructions.md、.github/instructions/、.prompt.md