aiblueprint-cli 1.4.108 → 1.4.109
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/agents-config/claude-config/mods/agent4everything/.claude-plugin/plugin.json +5 -0
- package/agents-config/claude-config/mods/agent4everything/hooks/hooks.json +1 -0
- package/agents-config/claude-config/mods/agent4everything/hooks/register.ts +96 -0
- package/agents-config/claude-config/mods/aiblueprint/.claude-plugin/plugin.json +71 -0
- package/agents-config/claude-config/mods/aiblueprint/hooks/hooks.json +1 -0
- package/agents-config/claude-config/mods/aiblueprint/hooks/register.tsx +309 -0
- package/agents-config/claude-config/mods/aiblueprint/tests/band.test.tsx +74 -0
- package/agents-config/claude-config/mods/aiblueprint/types/index.d.ts +14 -0
- package/agents-config/claude-config/scripts/.claude/skills/fix-on-my-computer/SKILL.md +8 -74
- package/agents-config/claude-config/scripts/statusline/src/index.ts +1 -0
- package/agents-config/scripts/.claude/skills/fix-on-my-computer/SKILL.md +8 -74
- package/agents-config/scripts/statusline/src/index.ts +1 -0
- package/agents-config/skills/agents-manager/SKILL.md +15 -453
- package/agents-config/skills/apex/SKILL.md +14 -110
- package/agents-config/skills/app-icon/SKILL.md +22 -117
- package/agents-config/skills/appstore-connect/SKILL.md +22 -85
- package/agents-config/skills/audit-memories/SKILL.md +13 -139
- package/agents-config/skills/audit-skills/SKILL.md +6 -65
- package/agents-config/skills/environments-manager/SKILL.md +14 -238
- package/agents-config/skills/grill-me/SKILL.md +8 -22
- package/agents-config/skills/hooks-manager/SKILL.md +8 -54
- package/agents-config/skills/rules-manager/SKILL.md +11 -192
- package/agents-config/skills/skill-manager/SKILL.md +19 -158
- package/agents-config/skills/skill-manager/references/description-recommandation.md +15 -85
- package/agents-config/skills/test-audit/CAMPAIGN.md +117 -0
- package/agents-config/skills/test-audit/LICENSE +23 -0
- package/agents-config/skills/test-audit/SKILL.md +169 -0
- package/agents-config/skills/test-audit/agents/openai.yaml +10 -0
- package/agents-config/skills/test-audit/assets/codex-icon.svg +1 -0
- package/agents-config/skills/use-style/SKILL.md +8 -48
- package/dist/cli.js +115 -72
- package/package.json +1 -1
|
@@ -1,81 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: fix-on-my-computer
|
|
3
|
-
description: Setup wizard
|
|
3
|
+
description: Setup wizard that verifies Bun, installs dependencies, runs tests, and fixes failures until every test passes. Use when the scripts repo is broken on this machine.
|
|
4
4
|
allowed-tools: Bash, Read, Edit, Write, Glob, Grep
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Make this scripts repository work on this machine. Stop only when `bun run test` exits 0.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
1. If `bun --version` fails, stop and tell the user to install Bun from https://bun.sh.
|
|
10
|
+
2. Confirm the directory has a `package.json` with a `test` script. Windows needs WSL.
|
|
11
|
+
3. `bun install`. If it fails, delete `bun.lockb` and retry; then report the error.
|
|
12
|
+
4. `bun run test`. While anything fails, apply the smallest fix (missing dep, import path, `path.join`/`os.homedir()`, credentials, TypeScript) and rerun.
|
|
13
|
+
5. `bun run lint` and fix if needed.
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
## Context
|
|
14
|
-
|
|
15
|
-
Current OS: !`uname -s`
|
|
16
|
-
Current directory: !`pwd`
|
|
17
|
-
Bun version: !`bun --version 2>&1 || echo "NOT_INSTALLED"`
|
|
18
|
-
|
|
19
|
-
## Process
|
|
20
|
-
|
|
21
|
-
### Phase 1: Environment Check
|
|
22
|
-
|
|
23
|
-
1. Verify Bun is installed (`bun --version`)
|
|
24
|
-
- If NOT installed → STOP and tell user: "Install Bun from https://bun.sh"
|
|
25
|
-
2. Verify in correct directory (must have package.json with "test" script)
|
|
26
|
-
3. Check OS: macOS/Linux (full support), Windows (needs WSL)
|
|
27
|
-
|
|
28
|
-
### Phase 2: Install Dependencies
|
|
29
|
-
|
|
30
|
-
4. Run `bun install`
|
|
31
|
-
- If fails: Delete `bun.lockb` and retry
|
|
32
|
-
- If still fails: Report specific error to user
|
|
33
|
-
|
|
34
|
-
### Phase 3: Run Tests
|
|
35
|
-
|
|
36
|
-
5. Run `bun run test`
|
|
37
|
-
6. Record output - note which tests pass/fail
|
|
38
|
-
|
|
39
|
-
### Phase 4: Fix Loop (NEVER STOP UNTIL GREEN)
|
|
40
|
-
|
|
41
|
-
7. While ANY tests fail:
|
|
42
|
-
- Analyze the error message
|
|
43
|
-
- Identify root cause:
|
|
44
|
-
- Missing dependency → `bun install <package>`
|
|
45
|
-
- Wrong import path → Fix the import
|
|
46
|
-
- Cross-platform issue → Use `path.join()`, `os.homedir()`
|
|
47
|
-
- Missing credentials → Check `~/.claude/.credentials.json`
|
|
48
|
-
- File not found → Verify path exists
|
|
49
|
-
- Type error → Fix TypeScript
|
|
50
|
-
- Apply minimal fix
|
|
51
|
-
- Re-run `bun run test`
|
|
52
|
-
- **REPEAT until 100% green**
|
|
53
|
-
|
|
54
|
-
### Phase 5: Final Verification
|
|
55
|
-
|
|
56
|
-
8. Run `bun run test` one final time
|
|
57
|
-
9. Run `bun run lint` (fix if needed)
|
|
58
|
-
|
|
59
|
-
### Phase 6: Victory Report
|
|
60
|
-
|
|
61
|
-
10. Report to user:
|
|
62
|
-
- Total tests passed
|
|
63
|
-
- Fixes applied (list each one)
|
|
64
|
-
- Status: READY TO USE
|
|
65
|
-
|
|
66
|
-
## Testing Commands
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
bun install
|
|
70
|
-
bun run test
|
|
71
|
-
bun run lint
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
## Success Criteria
|
|
75
|
-
|
|
76
|
-
Before declaring success:
|
|
77
|
-
- `bun run test` exits with code 0
|
|
78
|
-
- ALL 186+ tests pass
|
|
79
|
-
- No lint errors
|
|
80
|
-
- All package.json scripts work
|
|
81
|
-
- Repository is READY TO USE
|
|
15
|
+
Report tests passed, each fix, and `READY TO USE`.
|
|
@@ -137,6 +137,7 @@ async function main() {
|
|
|
137
137
|
const maxTokens =
|
|
138
138
|
input.context_window?.context_window_size ||
|
|
139
139
|
config.context.maxContextTokens;
|
|
140
|
+
config.context.maxContextTokens = maxTokens;
|
|
140
141
|
contextPercentage = Math.min(
|
|
141
142
|
100,
|
|
142
143
|
Math.round((contextTokens / maxTokens) * 100),
|
|
@@ -1,81 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: fix-on-my-computer
|
|
3
|
-
description: Setup wizard
|
|
3
|
+
description: Setup wizard that verifies Bun, installs dependencies, runs tests, and fixes failures until every test passes. Use when the scripts repo is broken on this machine.
|
|
4
4
|
allowed-tools: Bash, Read, Edit, Write, Glob, Grep
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Make this scripts repository work on this machine. Stop only when `bun run test` exits 0.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
1. If `bun --version` fails, stop and tell the user to install Bun from https://bun.sh.
|
|
10
|
+
2. Confirm the directory has a `package.json` with a `test` script. Windows needs WSL.
|
|
11
|
+
3. `bun install`. If it fails, delete `bun.lockb` and retry; then report the error.
|
|
12
|
+
4. `bun run test`. While anything fails, apply the smallest fix (missing dep, import path, `path.join`/`os.homedir()`, credentials, TypeScript) and rerun.
|
|
13
|
+
5. `bun run lint` and fix if needed.
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
## Context
|
|
14
|
-
|
|
15
|
-
Current OS: !`uname -s`
|
|
16
|
-
Current directory: !`pwd`
|
|
17
|
-
Bun version: !`bun --version 2>&1 || echo "NOT_INSTALLED"`
|
|
18
|
-
|
|
19
|
-
## Process
|
|
20
|
-
|
|
21
|
-
### Phase 1: Environment Check
|
|
22
|
-
|
|
23
|
-
1. Verify Bun is installed (`bun --version`)
|
|
24
|
-
- If NOT installed → STOP and tell user: "Install Bun from https://bun.sh"
|
|
25
|
-
2. Verify in correct directory (must have package.json with "test" script)
|
|
26
|
-
3. Check OS: macOS/Linux (full support), Windows (needs WSL)
|
|
27
|
-
|
|
28
|
-
### Phase 2: Install Dependencies
|
|
29
|
-
|
|
30
|
-
4. Run `bun install`
|
|
31
|
-
- If fails: Delete `bun.lockb` and retry
|
|
32
|
-
- If still fails: Report specific error to user
|
|
33
|
-
|
|
34
|
-
### Phase 3: Run Tests
|
|
35
|
-
|
|
36
|
-
5. Run `bun run test`
|
|
37
|
-
6. Record output - note which tests pass/fail
|
|
38
|
-
|
|
39
|
-
### Phase 4: Fix Loop (NEVER STOP UNTIL GREEN)
|
|
40
|
-
|
|
41
|
-
7. While ANY tests fail:
|
|
42
|
-
- Analyze the error message
|
|
43
|
-
- Identify root cause:
|
|
44
|
-
- Missing dependency → `bun install <package>`
|
|
45
|
-
- Wrong import path → Fix the import
|
|
46
|
-
- Cross-platform issue → Use `path.join()`, `os.homedir()`
|
|
47
|
-
- Missing credentials → Check `~/.claude/.credentials.json`
|
|
48
|
-
- File not found → Verify path exists
|
|
49
|
-
- Type error → Fix TypeScript
|
|
50
|
-
- Apply minimal fix
|
|
51
|
-
- Re-run `bun run test`
|
|
52
|
-
- **REPEAT until 100% green**
|
|
53
|
-
|
|
54
|
-
### Phase 5: Final Verification
|
|
55
|
-
|
|
56
|
-
8. Run `bun run test` one final time
|
|
57
|
-
9. Run `bun run lint` (fix if needed)
|
|
58
|
-
|
|
59
|
-
### Phase 6: Victory Report
|
|
60
|
-
|
|
61
|
-
10. Report to user:
|
|
62
|
-
- Total tests passed
|
|
63
|
-
- Fixes applied (list each one)
|
|
64
|
-
- Status: READY TO USE
|
|
65
|
-
|
|
66
|
-
## Testing Commands
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
bun install
|
|
70
|
-
bun run test
|
|
71
|
-
bun run lint
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
## Success Criteria
|
|
75
|
-
|
|
76
|
-
Before declaring success:
|
|
77
|
-
- `bun run test` exits with code 0
|
|
78
|
-
- ALL 186+ tests pass
|
|
79
|
-
- No lint errors
|
|
80
|
-
- All package.json scripts work
|
|
81
|
-
- Repository is READY TO USE
|
|
15
|
+
Report tests passed, each fix, and `READY TO USE`.
|
|
@@ -137,6 +137,7 @@ async function main() {
|
|
|
137
137
|
const maxTokens =
|
|
138
138
|
input.context_window?.context_window_size ||
|
|
139
139
|
config.context.maxContextTokens;
|
|
140
|
+
config.context.maxContextTokens = maxTokens;
|
|
140
141
|
contextPercentage = Math.min(
|
|
141
142
|
100,
|
|
142
143
|
Math.round((contextTokens / maxTokens) * 100),
|
|
@@ -1,462 +1,24 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: agents-manager
|
|
3
|
-
description:
|
|
3
|
+
description: Create, edit, debug, and orchestrate Claude Code agents and Task-tool workflows. Use when writing agent files, configuring tools or models, or debugging multi-agent runs.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
user-invocable: true
|
|
4
6
|
---
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
Agents are specialized Claude instances that run in isolated contexts with focused roles and limited tool access. This skill teaches you how to create effective agents, write strong system prompts, configure tool access, and orchestrate multi-agent workflows using the Task tool.
|
|
8
|
+
Create or edit an agent only when the work is autonomous, non-interactive, and returns one final report. Keep requirements, options, and confirmations in the main chat. Agents cannot use `AskUserQuestion` or wait on the user.
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
</objective>
|
|
10
|
+
Project agents live in `.claude/agents/` and override `~/.claude/agents/`. Name is unique kebab-case. Description states when to invoke it. `tools` is a comma list or omitted to inherit all. `model` is `sonnet`, `opus`, `haiku`, or `inherit`.
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
<workflow>
|
|
12
|
+
Write the body as XML (`<role>`, `<constraints>`, `<workflow>`, `<output_format>`) with no markdown headings. Restrict tools to least privilege. Add `Skill` when the agent must call `$find-docs` or `$exa-search`; add `Bash` when those skills need local CLIs. Never put secrets in external queries.
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
- **model**: Optional (`sonnet`, `opus`, `haiku`, or `inherit`)
|
|
23
|
-
5. Write the system prompt (the agent's instructions)
|
|
24
|
-
</workflow>
|
|
14
|
+
- Create or rewrite a prompt: [writing-agent-prompts.md](references/writing-agent-prompts.md), then [agents.md](references/agents.md) for file format, tools, models, and Task invocation.
|
|
15
|
+
- Edit config, tools, model, or Task / `run_in_background` / `resume`: [agents.md](references/agents.md).
|
|
16
|
+
- Debug a failing or looping agent: [debugging-agents.md](references/debugging-agents.md).
|
|
17
|
+
- Multi-agent coordination: [orchestration-patterns.md](references/orchestration-patterns.md).
|
|
18
|
+
- Recovery, retries, communication: [error-handling-and-recovery.md](references/error-handling-and-recovery.md).
|
|
19
|
+
- Long-running context: [context-management.md](references/context-management.md).
|
|
20
|
+
- Eval before trusting a new agent: [evaluation-and-testing.md](references/evaluation-and-testing.md).
|
|
25
21
|
|
|
26
|
-
|
|
27
|
-
```markdown
|
|
28
|
-
---
|
|
29
|
-
name: code-reviewer
|
|
30
|
-
description: Expert code reviewer. Use proactively after code changes to review for quality, security, and best practices.
|
|
31
|
-
tools: Read, Grep, Glob, Bash, Skill
|
|
32
|
-
model: sonnet
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
<role>
|
|
36
|
-
You are a senior code reviewer focused on quality, security, and best practices.
|
|
37
|
-
</role>
|
|
38
|
-
|
|
39
|
-
<focus_areas>
|
|
40
|
-
|
|
41
|
-
- Code quality and maintainability
|
|
42
|
-
- Security vulnerabilities
|
|
43
|
-
- Performance issues
|
|
44
|
-
- Best practices adherence
|
|
45
|
-
</focus_areas>
|
|
46
|
-
|
|
47
|
-
<output_format>
|
|
48
|
-
Provide specific, actionable feedback with file:line references.
|
|
49
|
-
</output_format>
|
|
50
|
-
|
|
51
|
-
```
|
|
52
|
-
</example>
|
|
53
|
-
</quick_start>
|
|
54
|
-
|
|
55
|
-
<file_structure>
|
|
56
|
-
| Type | Location | Scope | Priority |
|
|
57
|
-
|------|----------|-------|----------|
|
|
58
|
-
| **Project** | `.claude/agents/` | Current project only | Highest |
|
|
59
|
-
| **User** | `~/.claude/agents/` | All projects | Lower |
|
|
60
|
-
| **Plugin** | Plugin's `agents/` dir | All projects | Lowest |
|
|
61
|
-
|
|
62
|
-
Project-level agents override user-level when names conflict.
|
|
63
|
-
</file_structure>
|
|
64
|
-
|
|
65
|
-
<configuration>
|
|
66
|
-
<field name="name">
|
|
67
|
-
- Lowercase letters and hyphens only
|
|
68
|
-
- Must be unique
|
|
69
|
-
</field>
|
|
70
|
-
|
|
71
|
-
<field name="description">
|
|
72
|
-
- Natural language description of purpose
|
|
73
|
-
- Include when Claude should invoke this agent
|
|
74
|
-
- Used for automatic agent selection
|
|
75
|
-
</field>
|
|
76
|
-
|
|
77
|
-
<field name="tools">
|
|
78
|
-
- Comma-separated list: `Read, Write, Edit, Bash, Grep`
|
|
79
|
-
- If omitted: inherits all tools from main thread
|
|
80
|
-
- Use `/agents` interface to see all available tools
|
|
81
|
-
</field>
|
|
82
|
-
|
|
83
|
-
<field name="model">
|
|
84
|
-
- `sonnet`, `opus`, `haiku`, or `inherit`
|
|
85
|
-
- `inherit`: uses same model as main conversation
|
|
86
|
-
- If omitted: defaults to configured agent model (usually sonnet)
|
|
87
|
-
</field>
|
|
88
|
-
</configuration>
|
|
89
|
-
|
|
90
|
-
<online_research_tools>
|
|
91
|
-
When an agent may need online research, make the routing explicit in its prompt and grant the required tools.
|
|
92
|
-
|
|
93
|
-
- Use default harness tools for local code, files, git, command output, and browser inspection first.
|
|
94
|
-
- Use `~/.agents/skills/find-docs/SKILL.md` before answering or coding against current libraries, frameworks, SDKs, CLIs, cloud services, APIs, or code examples.
|
|
95
|
-
- Use `~/.agents/skills/exa-search/SKILL.md` for broader online research, recent information, source discovery, similar pages, URL extraction, or cited web answers.
|
|
96
|
-
- Prefer those skills over ad hoc web searches. Built-in `WebSearch` and `WebFetch` are fallback tools unless the task explicitly asks for them.
|
|
97
|
-
- Add `Skill` to restricted tool lists when the agent should invoke these skills. Add `Bash` when the skill needs local CLIs such as `exa-cli` or `ctx7`.
|
|
98
|
-
- Never include secrets, tokens, credentials, personal data, or proprietary code in external queries.
|
|
99
|
-
</online_research_tools>
|
|
100
|
-
|
|
101
|
-
<execution_model>
|
|
102
|
-
<critical_constraint>
|
|
103
|
-
**Agents are black boxes that cannot interact with users.**
|
|
104
|
-
|
|
105
|
-
Agents run in isolated contexts and return their final output to the main conversation. They:
|
|
106
|
-
- ✅ Can use tools like Read, Write, Edit, Bash, Grep, Glob
|
|
107
|
-
- ✅ Can access MCP servers and other non-interactive tools
|
|
108
|
-
- ❌ **Cannot use AskUserQuestion** or any tool requiring user interaction
|
|
109
|
-
- ❌ **Cannot present options or wait for user input**
|
|
110
|
-
- ❌ **User never sees agent's intermediate steps**
|
|
111
|
-
|
|
112
|
-
The main conversation sees only the agent's final report/output.
|
|
113
|
-
</critical_constraint>
|
|
114
|
-
|
|
115
|
-
<workflow_design>
|
|
116
|
-
**Designing workflows with agents:**
|
|
117
|
-
|
|
118
|
-
Use **main chat** for:
|
|
119
|
-
- Gathering requirements from user (AskUserQuestion)
|
|
120
|
-
- Presenting options or decisions to user
|
|
121
|
-
- Any task requiring user confirmation/input
|
|
122
|
-
- Work where user needs visibility into progress
|
|
123
|
-
|
|
124
|
-
Use **agents** for:
|
|
125
|
-
- Research tasks (API documentation lookup, code analysis)
|
|
126
|
-
- Code generation based on pre-defined requirements
|
|
127
|
-
- Analysis and reporting (security review, test coverage)
|
|
128
|
-
- Context-heavy operations that don't need user interaction
|
|
129
|
-
|
|
130
|
-
**Example workflow pattern:**
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
Main Chat: Ask user for requirements (AskUserQuestion)
|
|
134
|
-
↓
|
|
135
|
-
Agent: Research API and create documentation (no user interaction)
|
|
136
|
-
↓
|
|
137
|
-
Main Chat: Review research with user, confirm approach
|
|
138
|
-
↓
|
|
139
|
-
Agent: Generate code based on confirmed plan
|
|
140
|
-
↓
|
|
141
|
-
Main Chat: Present results, handle testing/deployment
|
|
142
|
-
|
|
143
|
-
````
|
|
144
|
-
</workflow_design>
|
|
145
|
-
</execution_model>
|
|
146
|
-
|
|
147
|
-
<system_prompt_guidelines>
|
|
148
|
-
<principle name="be_specific">
|
|
149
|
-
Clearly define the agent's role, capabilities, and constraints.
|
|
150
|
-
</principle>
|
|
151
|
-
|
|
152
|
-
<principle name="use_pure_xml_structure">
|
|
153
|
-
Structure the system prompt with pure XML tags. Remove ALL markdown headings from the body.
|
|
154
|
-
|
|
155
|
-
```markdown
|
|
156
|
-
---
|
|
157
|
-
name: security-reviewer
|
|
158
|
-
description: Reviews code for security vulnerabilities
|
|
159
|
-
tools: Read, Grep, Glob, Bash
|
|
160
|
-
model: sonnet
|
|
161
|
-
---
|
|
162
|
-
|
|
163
|
-
<role>
|
|
164
|
-
You are a senior code reviewer specializing in security.
|
|
165
|
-
</role>
|
|
166
|
-
|
|
167
|
-
<focus_areas>
|
|
168
|
-
- SQL injection vulnerabilities
|
|
169
|
-
- XSS attack vectors
|
|
170
|
-
- Authentication/authorization issues
|
|
171
|
-
- Sensitive data exposure
|
|
172
|
-
</focus_areas>
|
|
173
|
-
|
|
174
|
-
<workflow>
|
|
175
|
-
1. Read the modified files
|
|
176
|
-
2. Identify security risks
|
|
177
|
-
3. Provide specific remediation steps
|
|
178
|
-
4. Rate severity (Critical/High/Medium/Low)
|
|
179
|
-
</workflow>
|
|
180
|
-
````
|
|
181
|
-
|
|
182
|
-
</principle>
|
|
183
|
-
|
|
184
|
-
<principle name="task_specific">
|
|
185
|
-
Tailor instructions to the specific task domain. Don't create generic "helper" agents.
|
|
186
|
-
|
|
187
|
-
❌ Bad: "You are a helpful assistant that helps with code"
|
|
188
|
-
✅ Good: "You are a React component refactoring specialist. Analyze components for hooks best practices, performance anti-patterns, and accessibility issues."
|
|
189
|
-
</principle>
|
|
190
|
-
</system_prompt_guidelines>
|
|
191
|
-
|
|
192
|
-
<agent_xml_structure>
|
|
193
|
-
Agent.md files are system prompts consumed only by Claude. Like skills and slash commands, they should use pure XML structure for optimal parsing and token efficiency.
|
|
194
|
-
|
|
195
|
-
<recommended_tags>
|
|
196
|
-
Common tags for agent structure:
|
|
197
|
-
|
|
198
|
-
- `<role>` - Who the agent is and what it does
|
|
199
|
-
- `<constraints>` - Hard rules (NEVER/MUST/ALWAYS)
|
|
200
|
-
- `<focus_areas>` - What to prioritize
|
|
201
|
-
- `<workflow>` - Step-by-step process
|
|
202
|
-
- `<output_format>` - How to structure deliverables
|
|
203
|
-
- `<success_criteria>` - Completion criteria
|
|
204
|
-
- `<validation>` - How to verify work
|
|
205
|
-
</recommended_tags>
|
|
206
|
-
|
|
207
|
-
<intelligence_rules>
|
|
208
|
-
**Simple agents** (single focused task):
|
|
209
|
-
|
|
210
|
-
- Use role + constraints + workflow minimum
|
|
211
|
-
- Example: code-reviewer, test-runner
|
|
212
|
-
|
|
213
|
-
**Medium agents** (multi-step process):
|
|
214
|
-
|
|
215
|
-
- Add workflow steps, output_format, success_criteria
|
|
216
|
-
- Example: api-researcher, documentation-generator
|
|
217
|
-
|
|
218
|
-
**Complex agents** (research + generation + validation):
|
|
219
|
-
|
|
220
|
-
- Add all tags as appropriate including validation, examples
|
|
221
|
-
- Example: mcp-api-researcher, comprehensive-auditor
|
|
222
|
-
</intelligence_rules>
|
|
223
|
-
|
|
224
|
-
<critical_rule>
|
|
225
|
-
**Remove ALL markdown headings (##, ###) from agent body.** Use semantic XML tags instead.
|
|
226
|
-
|
|
227
|
-
Keep markdown formatting WITHIN content (bold, italic, lists, code blocks, links).
|
|
228
|
-
|
|
229
|
-
For XML structure principles and token efficiency details, see @skills/create-agent-skills/references/use-xml-tags.md - the same principles apply to agents.
|
|
230
|
-
</critical_rule>
|
|
231
|
-
</agent_xml_structure>
|
|
232
|
-
|
|
233
|
-
<invocation>
|
|
234
|
-
<automatic>
|
|
235
|
-
Claude automatically selects agents based on the `description` field when it matches the current task.
|
|
236
|
-
</automatic>
|
|
237
|
-
|
|
238
|
-
<explicit>
|
|
239
|
-
You can explicitly invoke a agent:
|
|
240
|
-
|
|
241
|
-
```
|
|
242
|
-
> Use the code-reviewer agent to check my recent changes
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
```
|
|
246
|
-
> Have the test-writer agent create tests for the new API endpoints
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
</explicit>
|
|
250
|
-
</invocation>
|
|
251
|
-
|
|
252
|
-
<background_execution>
|
|
253
|
-
Agents can run in the background using the `run_in_background` parameter, allowing parallel execution while the main conversation continues.
|
|
254
|
-
|
|
255
|
-
<how_it_works>
|
|
256
|
-
**Starting a background agent:**
|
|
257
|
-
The Task tool accepts `run_in_background: true` to launch agents asynchronously:
|
|
258
|
-
|
|
259
|
-
```
|
|
260
|
-
Task tool call:
|
|
261
|
-
- description: "Analyze security vulnerabilities"
|
|
262
|
-
- prompt: "Review all authentication code for security issues..."
|
|
263
|
-
- subagent_type: "security-reviewer"
|
|
264
|
-
- run_in_background: true
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
The agent starts immediately and returns an `agent_id` for tracking.
|
|
268
|
-
</how_it_works>
|
|
269
|
-
|
|
270
|
-
<retrieving_results>
|
|
271
|
-
**Getting results with TaskOutput:**
|
|
272
|
-
Use the `TaskOutput` tool to retrieve results from background agents:
|
|
273
|
-
|
|
274
|
-
```
|
|
275
|
-
TaskOutput tool call:
|
|
276
|
-
- task_id: "agent-12345" # The agent_id from the Task call
|
|
277
|
-
- block: true # Wait for completion (default)
|
|
278
|
-
- timeout: 30000 # Max wait time in ms
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
**Parameters:**
|
|
282
|
-
| Parameter | Default | Description |
|
|
283
|
-
|-----------|---------|-------------|
|
|
284
|
-
| `task_id` | Required | The agent ID returned from Task tool |
|
|
285
|
-
| `block` | `true` | Wait for completion or check current status |
|
|
286
|
-
| `timeout` | `30000` | Max wait time in milliseconds (up to 600000) |
|
|
287
|
-
|
|
288
|
-
**Non-blocking check:**
|
|
289
|
-
Set `block: false` to check status without waiting:
|
|
290
|
-
|
|
291
|
-
```
|
|
292
|
-
TaskOutput tool call:
|
|
293
|
-
- task_id: "agent-12345"
|
|
294
|
-
- block: false
|
|
295
|
-
```
|
|
296
|
-
|
|
297
|
-
Returns current status: running, completed, or the final result.
|
|
298
|
-
</retrieving_results>
|
|
299
|
-
|
|
300
|
-
<parallel_agents>
|
|
301
|
-
**Launching multiple agents in parallel:**
|
|
302
|
-
|
|
303
|
-
To maximize performance, launch multiple independent agents simultaneously:
|
|
304
|
-
|
|
305
|
-
```
|
|
306
|
-
Single message with multiple Task tool calls:
|
|
307
|
-
|
|
308
|
-
Task 1:
|
|
309
|
-
- description: "Review code quality"
|
|
310
|
-
- prompt: "Check code quality..."
|
|
311
|
-
- subagent_type: "code-reviewer"
|
|
312
|
-
- run_in_background: true
|
|
313
|
-
|
|
314
|
-
Task 2:
|
|
315
|
-
- description: "Run security scan"
|
|
316
|
-
- prompt: "Scan for vulnerabilities..."
|
|
317
|
-
- subagent_type: "security-scanner"
|
|
318
|
-
- run_in_background: true
|
|
319
|
-
|
|
320
|
-
Task 3:
|
|
321
|
-
- description: "Check test coverage"
|
|
322
|
-
- prompt: "Analyze test coverage..."
|
|
323
|
-
- subagent_type: "test-analyzer"
|
|
324
|
-
- run_in_background: true
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
Then retrieve all results:
|
|
328
|
-
|
|
329
|
-
```
|
|
330
|
-
TaskOutput calls for each agent_id
|
|
331
|
-
```
|
|
332
|
-
|
|
333
|
-
</parallel_agents>
|
|
334
|
-
|
|
335
|
-
<when_to_use_background>
|
|
336
|
-
**Use background agents for:**
|
|
337
|
-
|
|
338
|
-
- Long-running analysis (security review, comprehensive code analysis)
|
|
339
|
-
- Multiple independent tasks that can run in parallel
|
|
340
|
-
- Tasks where you want to continue working while waiting
|
|
341
|
-
- Research tasks that may take significant time
|
|
342
|
-
|
|
343
|
-
**Don't use background for:**
|
|
344
|
-
|
|
345
|
-
- Quick operations (< 10 seconds)
|
|
346
|
-
- Tasks that depend on each other sequentially
|
|
347
|
-
- Tasks where immediate results are needed for next step
|
|
348
|
-
- Simple single-file operations
|
|
349
|
-
|
|
350
|
-
**Pattern: Parallel Analysis Pipeline**
|
|
351
|
-
|
|
352
|
-
```
|
|
353
|
-
1. Launch multiple analysis agents in background
|
|
354
|
-
2. Continue with other work or wait
|
|
355
|
-
3. Collect all results
|
|
356
|
-
4. Synthesize findings in main conversation
|
|
357
|
-
```
|
|
358
|
-
|
|
359
|
-
</when_to_use_background>
|
|
360
|
-
|
|
361
|
-
<resuming_agents>
|
|
362
|
-
**Resuming agents:**
|
|
363
|
-
Agents can be resumed using the `resume` parameter with their agent ID:
|
|
364
|
-
|
|
365
|
-
```
|
|
366
|
-
Task tool call:
|
|
367
|
-
- description: "Continue security review"
|
|
368
|
-
- prompt: "Please continue with the remaining files..."
|
|
369
|
-
- subagent_type: "security-reviewer"
|
|
370
|
-
- resume: "agent-12345" # Previous agent ID
|
|
371
|
-
```
|
|
372
|
-
|
|
373
|
-
The agent continues with its full previous context preserved.
|
|
374
|
-
</resuming_agents>
|
|
375
|
-
</background_execution>
|
|
376
|
-
|
|
377
|
-
<management>
|
|
378
|
-
<using_agents_command>
|
|
379
|
-
Run `/agents` for an interactive interface to:
|
|
380
|
-
- View all available agents
|
|
381
|
-
- Create new agents
|
|
382
|
-
- Edit existing agents
|
|
383
|
-
- Delete custom agents
|
|
384
|
-
</using_agents_command>
|
|
385
|
-
|
|
386
|
-
<manual_editing>
|
|
387
|
-
You can also edit agent files directly:
|
|
388
|
-
|
|
389
|
-
- Project: `.claude/agents/agent-name.md`
|
|
390
|
-
- User: `~/.claude/agents/agent-name.md`
|
|
391
|
-
</manual_editing>
|
|
392
|
-
</management>
|
|
393
|
-
|
|
394
|
-
<reference>
|
|
395
|
-
**Core references**:
|
|
396
|
-
|
|
397
|
-
**Agent usage and configuration**: [references/agents.md](references/agents.md)
|
|
398
|
-
|
|
399
|
-
- File format and configuration
|
|
400
|
-
- Model selection (Sonnet 4.5 + Haiku 4.5 orchestration)
|
|
401
|
-
- Tool security and least privilege
|
|
402
|
-
- Prompt caching optimization
|
|
403
|
-
- **Background execution** (run_in_background, TaskOutput, parallel agents)
|
|
404
|
-
- Complete examples
|
|
405
|
-
|
|
406
|
-
**Writing effective prompts**: [references/writing-agent-prompts.md](references/writing-agent-prompts.md)
|
|
407
|
-
|
|
408
|
-
- Core principles and XML structure
|
|
409
|
-
- Description field optimization for routing
|
|
410
|
-
- Extended thinking for complex reasoning
|
|
411
|
-
- Security constraints and strong modal verbs
|
|
412
|
-
- Success criteria definition
|
|
413
|
-
|
|
414
|
-
**Advanced topics**:
|
|
415
|
-
|
|
416
|
-
**Evaluation and testing**: [references/evaluation-and-testing.md](references/evaluation-and-testing.md)
|
|
417
|
-
|
|
418
|
-
- Evaluation metrics (task completion, tool correctness, robustness)
|
|
419
|
-
- Testing strategies (offline, simulation, online monitoring)
|
|
420
|
-
- Evaluation-driven development
|
|
421
|
-
- G-Eval for custom criteria
|
|
422
|
-
|
|
423
|
-
**Error handling and recovery**: [references/error-handling-and-recovery.md](references/error-handling-and-recovery.md)
|
|
424
|
-
|
|
425
|
-
- Common failure modes and causes
|
|
426
|
-
- Recovery strategies (graceful degradation, retry, circuit breakers)
|
|
427
|
-
- Structured communication and observability
|
|
428
|
-
- Anti-patterns to avoid
|
|
429
|
-
|
|
430
|
-
**Context management**: [references/context-management.md](references/context-management.md)
|
|
431
|
-
|
|
432
|
-
- Memory architecture (STM, LTM, working memory)
|
|
433
|
-
- Context strategies (summarization, sliding window, scratchpads)
|
|
434
|
-
- Managing long-running tasks
|
|
435
|
-
- Prompt caching interaction
|
|
436
|
-
|
|
437
|
-
**Orchestration patterns**: [references/orchestration-patterns.md](references/orchestration-patterns.md)
|
|
438
|
-
|
|
439
|
-
- Sequential, parallel, hierarchical, coordinator patterns
|
|
440
|
-
- Sonnet + Haiku orchestration for cost/performance
|
|
441
|
-
- Multi-agent coordination
|
|
442
|
-
- Pattern selection guidance
|
|
443
|
-
|
|
444
|
-
**Debugging and troubleshooting**: [references/debugging-agents.md](references/debugging-agents.md)
|
|
445
|
-
|
|
446
|
-
- Logging, tracing, and correlation IDs
|
|
447
|
-
- Common failure types (hallucinations, format errors, tool misuse)
|
|
448
|
-
- Diagnostic procedures
|
|
449
|
-
- Continuous monitoring
|
|
450
|
-
</reference>
|
|
451
|
-
|
|
452
|
-
<success_criteria>
|
|
453
|
-
A well-configured agent has:
|
|
22
|
+
Prefer `/agents` to create or delete; otherwise edit the markdown file directly.
|
|
454
23
|
|
|
455
|
-
|
|
456
|
-
- Clear role definition in system prompt
|
|
457
|
-
- Appropriate tool restrictions (least privilege)
|
|
458
|
-
- XML-structured system prompt with role, approach, and constraints
|
|
459
|
-
- Description field optimized for automatic routing
|
|
460
|
-
- Successfully tested on representative tasks
|
|
461
|
-
- Model selection appropriate for task complexity (Sonnet for reasoning, Haiku for simple tasks)
|
|
462
|
-
</success_criteria>
|
|
24
|
+
Stop when the agent has valid frontmatter, an XML body, least-privilege tools, a trigger-ready description, and a model that matches the task. Test on a representative task before claiming it works.
|