aiblueprint-cli 1.4.11 → 1.4.13
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/claude-code-config/scripts/.claude/commands/fix-on-my-computer.md +87 -0
- package/claude-code-config/scripts/command-validator/CLAUDE.md +112 -0
- package/claude-code-config/scripts/command-validator/src/__tests__/validator.test.ts +62 -111
- package/claude-code-config/scripts/command-validator/src/cli.ts +5 -3
- package/claude-code-config/scripts/command-validator/src/lib/security-rules.ts +3 -4
- package/claude-code-config/scripts/command-validator/src/lib/types.ts +1 -0
- package/claude-code-config/scripts/command-validator/src/lib/validator.ts +47 -317
- package/claude-code-config/scripts/statusline/CLAUDE.md +29 -7
- package/claude-code-config/scripts/statusline/README.md +89 -1
- package/claude-code-config/scripts/statusline/defaults.json +75 -0
- package/claude-code-config/scripts/statusline/src/index.ts +101 -24
- package/claude-code-config/scripts/statusline/src/lib/config-types.ts +100 -0
- package/claude-code-config/scripts/statusline/src/lib/config.ts +21 -0
- package/claude-code-config/scripts/statusline/src/lib/context.ts +32 -11
- package/claude-code-config/scripts/statusline/src/lib/formatters.ts +360 -22
- package/claude-code-config/scripts/statusline/src/lib/git.ts +100 -0
- package/claude-code-config/scripts/statusline/src/lib/render-pure.ts +177 -0
- package/claude-code-config/scripts/statusline/src/lib/types.ts +11 -0
- package/claude-code-config/scripts/statusline/statusline.config.json +93 -0
- package/claude-code-config/skills/claude-memory/SKILL.md +689 -0
- package/claude-code-config/skills/claude-memory/references/comprehensive-example.md +175 -0
- package/claude-code-config/skills/claude-memory/references/project-patterns.md +334 -0
- package/claude-code-config/skills/claude-memory/references/prompting-techniques.md +411 -0
- package/claude-code-config/skills/claude-memory/references/section-templates.md +347 -0
- package/claude-code-config/skills/create-slash-commands/SKILL.md +1110 -0
- package/claude-code-config/skills/create-slash-commands/references/arguments.md +273 -0
- package/claude-code-config/skills/create-slash-commands/references/patterns.md +947 -0
- package/claude-code-config/skills/create-slash-commands/references/prompt-examples.md +656 -0
- package/claude-code-config/skills/create-slash-commands/references/tool-restrictions.md +389 -0
- package/claude-code-config/skills/create-subagents/SKILL.md +425 -0
- package/claude-code-config/skills/create-subagents/references/context-management.md +567 -0
- package/claude-code-config/skills/create-subagents/references/debugging-agents.md +714 -0
- package/claude-code-config/skills/create-subagents/references/error-handling-and-recovery.md +502 -0
- package/claude-code-config/skills/create-subagents/references/evaluation-and-testing.md +374 -0
- package/claude-code-config/skills/create-subagents/references/orchestration-patterns.md +591 -0
- package/claude-code-config/skills/create-subagents/references/subagents.md +599 -0
- package/claude-code-config/skills/create-subagents/references/writing-subagent-prompts.md +513 -0
- package/dist/cli.js +20 -3
- package/package.json +1 -1
- package/claude-code-config/commands/apex.md +0 -109
- package/claude-code-config/commands/tasks/run-task.md +0 -220
- package/claude-code-config/commands/utils/watch-ci.md +0 -47
- package/claude-code-config/scripts/command-validator/biome.json +0 -29
- package/claude-code-config/scripts/command-validator/bun.lockb +0 -0
- package/claude-code-config/scripts/command-validator/package.json +0 -27
- package/claude-code-config/scripts/command-validator/vitest.config.ts +0 -7
- package/claude-code-config/scripts/hook-post-file.ts +0 -162
- package/claude-code-config/scripts/statusline/biome.json +0 -34
- package/claude-code-config/scripts/statusline/bun.lockb +0 -0
- package/claude-code-config/scripts/statusline/fixtures/test-input.json +0 -25
- package/claude-code-config/scripts/statusline/package.json +0 -19
- package/claude-code-config/scripts/statusline/statusline.config.ts +0 -25
- package/claude-code-config/scripts/statusline/test.ts +0 -20
- package/claude-code-config/scripts/validate-command.js +0 -712
- package/claude-code-config/scripts/validate-command.readme.md +0 -283
|
@@ -0,0 +1,1110 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: create-slash-commands
|
|
3
|
+
description: Expert guidance for creating Claude Code slash commands. Use when working with slash commands, creating custom commands, understanding command structure, or learning YAML configuration.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<objective>
|
|
7
|
+
Create effective slash commands for Claude Code that enable users to trigger reusable prompts with `/command-name` syntax. Slash commands expand as prompts in the current conversation, allowing teams to standardize workflows and operations.
|
|
8
|
+
|
|
9
|
+
Commands can be **global** (available everywhere in `~/.claude/commands/`) or **project-specific** (shared with team in `.claude/commands/`). This skill teaches you to structure commands with proper formatting (XML or Markdown), YAML frontmatter, dynamic context loading, and intelligent argument handling.
|
|
10
|
+
|
|
11
|
+
**CRITICAL WORKFLOW**: This skill enforces a mandatory research phase where you MUST:
|
|
12
|
+
1. Read all reference documentation
|
|
13
|
+
2. Examine existing slash commands for patterns
|
|
14
|
+
3. Understand syntax and best practices
|
|
15
|
+
4. Only then create the command
|
|
16
|
+
|
|
17
|
+
This prevents poorly-structured commands and ensures consistency with established patterns.
|
|
18
|
+
</objective>
|
|
19
|
+
|
|
20
|
+
<quick_start>
|
|
21
|
+
|
|
22
|
+
<workflow>
|
|
23
|
+
1. Create `.claude/commands/` directory (project) or use `~/.claude/commands/` (personal)
|
|
24
|
+
2. Create `command-name.md` file
|
|
25
|
+
3. Add YAML frontmatter (at minimum: `description`)
|
|
26
|
+
4. Write command prompt
|
|
27
|
+
5. Test with `/command-name [args]`
|
|
28
|
+
</workflow>
|
|
29
|
+
|
|
30
|
+
<example>
|
|
31
|
+
**File**: `.claude/commands/optimize.md`
|
|
32
|
+
|
|
33
|
+
```markdown
|
|
34
|
+
---
|
|
35
|
+
description: Analyze this code for performance issues and suggest optimizations
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
Analyze the performance of this code and suggest three specific optimizations:
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Usage**: `/optimize`
|
|
42
|
+
|
|
43
|
+
Claude receives the expanded prompt and analyzes the code in context.
|
|
44
|
+
</example>
|
|
45
|
+
</quick_start>
|
|
46
|
+
|
|
47
|
+
<xml_structure>
|
|
48
|
+
Slash commands can use either XML tags OR Markdown headings in the body (after YAML frontmatter).
|
|
49
|
+
|
|
50
|
+
**Format choice depends on**:
|
|
51
|
+
- User preference (ask if not specified)
|
|
52
|
+
- Command complexity (XML better for complex, Markdown fine for simple)
|
|
53
|
+
- Existing project patterns (match what's already in use)
|
|
54
|
+
|
|
55
|
+
See [references/prompt-examples.md](references/prompt-examples.md) for real examples of both formats in production.
|
|
56
|
+
|
|
57
|
+
<required_tags>
|
|
58
|
+
|
|
59
|
+
**`<objective>`** - What the command does and why it matters
|
|
60
|
+
|
|
61
|
+
```markdown
|
|
62
|
+
<objective>
|
|
63
|
+
What needs to happen and why this matters.
|
|
64
|
+
Context about who uses this and what it accomplishes.
|
|
65
|
+
</objective>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**`<process>` or `<steps>`** - How to execute the command
|
|
69
|
+
|
|
70
|
+
```markdown
|
|
71
|
+
<process>
|
|
72
|
+
Sequential steps to accomplish the objective:
|
|
73
|
+
1. First step
|
|
74
|
+
2. Second step
|
|
75
|
+
3. Final step
|
|
76
|
+
</process>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**`<success_criteria>`** - How to know the command succeeded
|
|
80
|
+
|
|
81
|
+
```markdown
|
|
82
|
+
<success_criteria>
|
|
83
|
+
Clear, measurable criteria for successful completion.
|
|
84
|
+
</success_criteria>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
</required_tags>
|
|
88
|
+
|
|
89
|
+
<conditional_tags>
|
|
90
|
+
|
|
91
|
+
**`<context>`** - When loading dynamic state or files
|
|
92
|
+
|
|
93
|
+
```markdown
|
|
94
|
+
<context>
|
|
95
|
+
Current state: ! `git status`
|
|
96
|
+
Relevant files: @ package.json
|
|
97
|
+
</context>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
(Note: Remove the space after @ in actual usage)
|
|
101
|
+
|
|
102
|
+
**`<verification>`** - When producing artifacts that need checking
|
|
103
|
+
|
|
104
|
+
```markdown
|
|
105
|
+
<verification>
|
|
106
|
+
Before completing, verify:
|
|
107
|
+
- Specific test or check to perform
|
|
108
|
+
- How to confirm it works
|
|
109
|
+
</verification>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**`<testing>`** - When running tests is part of the workflow
|
|
113
|
+
|
|
114
|
+
```markdown
|
|
115
|
+
<testing>
|
|
116
|
+
Run tests: ! `npm test`
|
|
117
|
+
Check linting: ! `npm run lint`
|
|
118
|
+
</testing>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**`<output>`** - When creating/modifying specific files
|
|
122
|
+
|
|
123
|
+
```markdown
|
|
124
|
+
<output>
|
|
125
|
+
Files created/modified:
|
|
126
|
+
- `./path/to/file.ext` - Description
|
|
127
|
+
</output>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
</conditional_tags>
|
|
131
|
+
|
|
132
|
+
<structure_example>
|
|
133
|
+
|
|
134
|
+
```markdown
|
|
135
|
+
---
|
|
136
|
+
name: example-command
|
|
137
|
+
description: Does something useful
|
|
138
|
+
argument-hint: [input]
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
<objective>
|
|
142
|
+
Process #$ARGUMENTS to accomplish [goal].
|
|
143
|
+
|
|
144
|
+
This helps [who] achieve [outcome].
|
|
145
|
+
</objective>
|
|
146
|
+
|
|
147
|
+
<context>
|
|
148
|
+
Current state: ! `relevant command`
|
|
149
|
+
Files: @ relevant/files
|
|
150
|
+
</context>
|
|
151
|
+
|
|
152
|
+
<process>
|
|
153
|
+
1. Parse #$ARGUMENTS
|
|
154
|
+
2. Execute operation
|
|
155
|
+
3. Verify results
|
|
156
|
+
</process>
|
|
157
|
+
|
|
158
|
+
<success_criteria>
|
|
159
|
+
|
|
160
|
+
- Operation completed without errors
|
|
161
|
+
- Output matches expected format
|
|
162
|
+
</success_criteria>
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
</structure_example>
|
|
166
|
+
|
|
167
|
+
<intelligence_rules>
|
|
168
|
+
|
|
169
|
+
**Simple commands** (single operation, no artifacts):
|
|
170
|
+
|
|
171
|
+
- Required: `<objective>`, `<process>`, `<success_criteria>`
|
|
172
|
+
- Example: `/check-todos`, `/first-principles`
|
|
173
|
+
|
|
174
|
+
**Complex commands** (multi-step, produces artifacts):
|
|
175
|
+
|
|
176
|
+
- Required: `<objective>`, `<process>`, `<success_criteria>`
|
|
177
|
+
- Add: `<context>` (if loading state), `<verification>` (if creating files), `<output>` (what gets created)
|
|
178
|
+
- Example: `/commit`, `/create-prompt`, `/run-prompt`
|
|
179
|
+
|
|
180
|
+
**Commands with dynamic arguments**:
|
|
181
|
+
|
|
182
|
+
- Use `#$ARGUMENTS` in `<objective>` or `<process>` tags
|
|
183
|
+
- Include `argument-hint` in frontmatter
|
|
184
|
+
- Make it clear what the arguments are for
|
|
185
|
+
|
|
186
|
+
**Commands that produce files**:
|
|
187
|
+
|
|
188
|
+
- Always include `<output>` tag specifying what gets created
|
|
189
|
+
- Always include `<verification>` tag with checks to perform
|
|
190
|
+
|
|
191
|
+
**Commands that run tests/builds**:
|
|
192
|
+
|
|
193
|
+
- Include `<testing>` tag with specific commands
|
|
194
|
+
- Include pass/fail criteria in `<success_criteria>`
|
|
195
|
+
</intelligence_rules>
|
|
196
|
+
</xml_structure>
|
|
197
|
+
|
|
198
|
+
<arguments_intelligence>
|
|
199
|
+
The skill should intelligently determine whether a slash command needs arguments.
|
|
200
|
+
|
|
201
|
+
<commands_that_need_arguments>
|
|
202
|
+
|
|
203
|
+
**User provides specific input:**
|
|
204
|
+
|
|
205
|
+
- `/fix-issue [issue-number]` - Needs issue number
|
|
206
|
+
- `/review-pr [pr-number]` - Needs PR number
|
|
207
|
+
- `/optimize [file-path]` - Needs file to optimize
|
|
208
|
+
- `/commit [type]` - Needs commit type (optional)
|
|
209
|
+
|
|
210
|
+
**Pattern:** Task operates on user-specified data
|
|
211
|
+
|
|
212
|
+
Include `argument-hint: [description]` in frontmatter and reference `#$ARGUMENTS` in the body.
|
|
213
|
+
</commands_that_need_arguments>
|
|
214
|
+
|
|
215
|
+
<commands_without_arguments>
|
|
216
|
+
|
|
217
|
+
**Self-contained procedures:**
|
|
218
|
+
|
|
219
|
+
- `/check-todos` - Operates on known file (TO-DOS.md)
|
|
220
|
+
- `/first-principles` - Operates on current conversation
|
|
221
|
+
- `/whats-next` - Analyzes current context
|
|
222
|
+
|
|
223
|
+
**Pattern:** Task operates on implicit context (current conversation, known files, project state)
|
|
224
|
+
|
|
225
|
+
Omit `argument-hint` and don't reference `#$ARGUMENTS`.
|
|
226
|
+
</commands_without_arguments>
|
|
227
|
+
|
|
228
|
+
<incorporating_arguments>
|
|
229
|
+
|
|
230
|
+
**In `<objective>` tag:**
|
|
231
|
+
|
|
232
|
+
```markdown
|
|
233
|
+
<objective>
|
|
234
|
+
Fix issue #$ARGUMENTS following project conventions.
|
|
235
|
+
|
|
236
|
+
This ensures bugs are resolved systematically with proper testing.
|
|
237
|
+
</objective>
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
**In `<process>` tag:**
|
|
241
|
+
|
|
242
|
+
```markdown
|
|
243
|
+
<process>
|
|
244
|
+
1. Understand issue #$ARGUMENTS from issue tracker
|
|
245
|
+
2. Locate relevant code
|
|
246
|
+
3. Implement fix
|
|
247
|
+
4. Add tests
|
|
248
|
+
</process>
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
**In `<context>` tag:**
|
|
252
|
+
|
|
253
|
+
```markdown
|
|
254
|
+
<context>
|
|
255
|
+
Issue details: @ issues/#$ARGUMENTS.md
|
|
256
|
+
Related files: ! `grep -r "TODO.*#$ARGUMENTS" src/`
|
|
257
|
+
</context>
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
(Note: Remove the space after the exclamation mark in actual usage)
|
|
261
|
+
</incorporating_arguments>
|
|
262
|
+
|
|
263
|
+
<positional_arguments>
|
|
264
|
+
|
|
265
|
+
For structured input, use `$1`, `$2`, `$3`:
|
|
266
|
+
|
|
267
|
+
```markdown
|
|
268
|
+
---
|
|
269
|
+
argument-hint: <pr-number> <priority> <assignee>
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
<objective>
|
|
273
|
+
Review PR #$1 with priority $2 and assign to $3.
|
|
274
|
+
</objective>
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
**Usage:** `/review-pr 456 high alice`
|
|
278
|
+
</positional_arguments>
|
|
279
|
+
</arguments_intelligence>
|
|
280
|
+
|
|
281
|
+
<file_structure>
|
|
282
|
+
|
|
283
|
+
**Project commands**: `.claude/commands/` (in project root)
|
|
284
|
+
|
|
285
|
+
- Shared with team via version control
|
|
286
|
+
- Project-specific workflows
|
|
287
|
+
- Shows `(project)` in `/help` list
|
|
288
|
+
- Committed to git for team use
|
|
289
|
+
|
|
290
|
+
**Global commands**: `~/.claude/commands/` (user home directory)
|
|
291
|
+
|
|
292
|
+
- Available across all your projects
|
|
293
|
+
- Personal productivity commands
|
|
294
|
+
- Shows `(user)` in `/help` list
|
|
295
|
+
- Not shared with team
|
|
296
|
+
|
|
297
|
+
**File naming**: `command-name.md` → invoked as `/command-name`
|
|
298
|
+
|
|
299
|
+
**Choosing between global and project**:
|
|
300
|
+
|
|
301
|
+
- Use **global** for: Personal workflows, general utilities, commands you use everywhere
|
|
302
|
+
- Use **project** for: Team workflows, project-specific operations, shared conventions
|
|
303
|
+
</file_structure>
|
|
304
|
+
|
|
305
|
+
<yaml_frontmatter>
|
|
306
|
+
|
|
307
|
+
<field name="description">
|
|
308
|
+
**Required** - Describes what the command does
|
|
309
|
+
|
|
310
|
+
```yaml
|
|
311
|
+
description: Analyze this code for performance issues and suggest optimizations
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
Shown in the `/help` command list.
|
|
315
|
+
</field>
|
|
316
|
+
|
|
317
|
+
<field name="allowed-tools">
|
|
318
|
+
**Optional** - Restricts which tools Claude can use
|
|
319
|
+
|
|
320
|
+
```yaml
|
|
321
|
+
allowed-tools: Bash(git add:*), Bash(git status:*), Bash(git commit:*)
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
**Formats**:
|
|
325
|
+
|
|
326
|
+
- Array: `allowed-tools: [Read, Edit, Write]`
|
|
327
|
+
- Single tool: `allowed-tools: SequentialThinking`
|
|
328
|
+
- Bash restrictions: `allowed-tools: Bash(git add:*)`
|
|
329
|
+
|
|
330
|
+
If omitted: All tools available
|
|
331
|
+
</field>
|
|
332
|
+
</yaml_frontmatter>
|
|
333
|
+
|
|
334
|
+
<arguments>
|
|
335
|
+
<all_arguments_string>
|
|
336
|
+
|
|
337
|
+
**Command file**: `.claude/commands/fix-issue.md`
|
|
338
|
+
|
|
339
|
+
```markdown
|
|
340
|
+
---
|
|
341
|
+
description: Fix issue following coding standards
|
|
342
|
+
---
|
|
343
|
+
|
|
344
|
+
Fix issue #$ARGUMENTS following our coding standards
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
**Usage**: `/fix-issue 123 high-priority`
|
|
348
|
+
|
|
349
|
+
**Claude receives**: "Fix issue #123 high-priority following our coding standards"
|
|
350
|
+
</all_arguments_string>
|
|
351
|
+
|
|
352
|
+
<positional_arguments_syntax>
|
|
353
|
+
|
|
354
|
+
**Command file**: `.claude/commands/review-pr.md`
|
|
355
|
+
|
|
356
|
+
```markdown
|
|
357
|
+
---
|
|
358
|
+
description: Review PR with priority and assignee
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
Review PR #$1 with priority $2 and assign to $3
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
**Usage**: `/review-pr 456 high alice`
|
|
365
|
+
|
|
366
|
+
**Claude receives**: "Review PR #456 with priority high and assign to alice"
|
|
367
|
+
|
|
368
|
+
See [references/arguments.md](references/arguments.md) for advanced patterns.
|
|
369
|
+
</positional_arguments_syntax>
|
|
370
|
+
</arguments>
|
|
371
|
+
|
|
372
|
+
<dynamic_context>
|
|
373
|
+
|
|
374
|
+
Execute bash commands before the prompt using the exclamation mark prefix directly before backticks (no space between).
|
|
375
|
+
|
|
376
|
+
**Note:** Examples below show a space after the exclamation mark to prevent execution during skill loading. In actual slash commands, remove the space.
|
|
377
|
+
|
|
378
|
+
Example:
|
|
379
|
+
|
|
380
|
+
```markdown
|
|
381
|
+
---
|
|
382
|
+
description: Create a git commit
|
|
383
|
+
allowed-tools: Bash(git add:*), Bash(git status:*), Bash(git commit:*)
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
## Context
|
|
387
|
+
|
|
388
|
+
- Current git status: ! `git status`
|
|
389
|
+
- Current git diff: ! `git diff HEAD`
|
|
390
|
+
- Current branch: ! `git branch --show-current`
|
|
391
|
+
- Recent commits: ! `git log --oneline -10`
|
|
392
|
+
|
|
393
|
+
## Your task
|
|
394
|
+
|
|
395
|
+
Based on the above changes, create a single git commit.
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
The bash commands execute and their output is included in the expanded prompt.
|
|
399
|
+
</dynamic_context>
|
|
400
|
+
|
|
401
|
+
<file_references>
|
|
402
|
+
|
|
403
|
+
Use `@` prefix to reference specific files:
|
|
404
|
+
|
|
405
|
+
```markdown
|
|
406
|
+
---
|
|
407
|
+
description: Review implementation
|
|
408
|
+
---
|
|
409
|
+
|
|
410
|
+
Review the implementation in @ src/utils/helpers.js
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
(Note: Remove the space after @ in actual usage)
|
|
414
|
+
|
|
415
|
+
Claude can access the referenced file's contents.
|
|
416
|
+
</file_references>
|
|
417
|
+
|
|
418
|
+
<best_practices>
|
|
419
|
+
|
|
420
|
+
**1. Always use XML structure**
|
|
421
|
+
|
|
422
|
+
```yaml
|
|
423
|
+
# All slash commands should have XML-structured bodies
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
After frontmatter, use XML tags:
|
|
427
|
+
|
|
428
|
+
- `<objective>` - What and why (always)
|
|
429
|
+
- `<process>` - How to do it (always)
|
|
430
|
+
- `<success_criteria>` - Definition of done (always)
|
|
431
|
+
- Additional tags as needed (see xml_structure section)
|
|
432
|
+
|
|
433
|
+
**2. Clear descriptions**
|
|
434
|
+
|
|
435
|
+
```yaml
|
|
436
|
+
# Good
|
|
437
|
+
description: Analyze this code for performance issues and suggest optimizations
|
|
438
|
+
|
|
439
|
+
# Bad
|
|
440
|
+
description: Optimize stuff
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
**3. Use dynamic context for state-dependent tasks**
|
|
444
|
+
|
|
445
|
+
```markdown
|
|
446
|
+
Current git status: ! `git status`
|
|
447
|
+
Files changed: ! `git diff --name-only`
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
**4. Restrict tools when appropriate**
|
|
451
|
+
|
|
452
|
+
```yaml
|
|
453
|
+
# For git commands - prevent running arbitrary bash
|
|
454
|
+
allowed-tools: Bash(git add:*), Bash(git status:*), Bash(git commit:*)
|
|
455
|
+
|
|
456
|
+
# For analysis - thinking only
|
|
457
|
+
allowed-tools: SequentialThinking
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
**5. Use #$ARGUMENTS for flexibility**
|
|
461
|
+
|
|
462
|
+
```markdown
|
|
463
|
+
Find and fix issue #$ARGUMENTS
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
**6. Reference relevant files**
|
|
467
|
+
|
|
468
|
+
```markdown
|
|
469
|
+
Review @ package.json for dependencies
|
|
470
|
+
Analyze @ src/database/\* for schema
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
(Note: Remove the space after @ in actual usage)
|
|
474
|
+
</best_practices>
|
|
475
|
+
|
|
476
|
+
<common_patterns>
|
|
477
|
+
|
|
478
|
+
**Simple analysis command**:
|
|
479
|
+
|
|
480
|
+
```markdown
|
|
481
|
+
---
|
|
482
|
+
description: Review this code for security vulnerabilities
|
|
483
|
+
---
|
|
484
|
+
|
|
485
|
+
<objective>
|
|
486
|
+
Review code for security vulnerabilities and suggest fixes.
|
|
487
|
+
</objective>
|
|
488
|
+
|
|
489
|
+
<process>
|
|
490
|
+
1. Scan code for common vulnerabilities (XSS, SQL injection, etc.)
|
|
491
|
+
2. Identify specific issues with line numbers
|
|
492
|
+
3. Suggest remediation for each issue
|
|
493
|
+
</process>
|
|
494
|
+
|
|
495
|
+
<success_criteria>
|
|
496
|
+
|
|
497
|
+
- All major vulnerability types checked
|
|
498
|
+
- Specific issues identified with locations
|
|
499
|
+
- Actionable fixes provided
|
|
500
|
+
</success_criteria>
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
**Git workflow with context**:
|
|
504
|
+
|
|
505
|
+
```markdown
|
|
506
|
+
---
|
|
507
|
+
description: Create a git commit
|
|
508
|
+
allowed-tools: Bash(git add:*), Bash(git status:*), Bash(git commit:*)
|
|
509
|
+
---
|
|
510
|
+
|
|
511
|
+
<objective>
|
|
512
|
+
Create a git commit for current changes following repository conventions.
|
|
513
|
+
</objective>
|
|
514
|
+
|
|
515
|
+
<context>
|
|
516
|
+
- Current status: ! `git status`
|
|
517
|
+
- Changes: ! `git diff HEAD`
|
|
518
|
+
- Recent commits: ! `git log --oneline -5`
|
|
519
|
+
</context>
|
|
520
|
+
|
|
521
|
+
<process>
|
|
522
|
+
1. Review staged and unstaged changes
|
|
523
|
+
2. Stage relevant files
|
|
524
|
+
3. Write commit message following recent commit style
|
|
525
|
+
4. Create commit
|
|
526
|
+
</process>
|
|
527
|
+
|
|
528
|
+
<success_criteria>
|
|
529
|
+
|
|
530
|
+
- All relevant changes staged
|
|
531
|
+
- Commit message follows repository conventions
|
|
532
|
+
- Commit created successfully
|
|
533
|
+
</success_criteria>
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
**Parameterized command**:
|
|
537
|
+
|
|
538
|
+
```markdown
|
|
539
|
+
---
|
|
540
|
+
description: Fix issue following coding standards
|
|
541
|
+
argument-hint: [issue-number]
|
|
542
|
+
---
|
|
543
|
+
|
|
544
|
+
<objective>
|
|
545
|
+
Fix issue #$ARGUMENTS following project coding standards.
|
|
546
|
+
|
|
547
|
+
This ensures bugs are resolved systematically with proper testing.
|
|
548
|
+
</objective>
|
|
549
|
+
|
|
550
|
+
<process>
|
|
551
|
+
1. Understand the issue described in ticket #$ARGUMENTS
|
|
552
|
+
2. Locate the relevant code in codebase
|
|
553
|
+
3. Implement a solution that addresses root cause
|
|
554
|
+
4. Add appropriate tests
|
|
555
|
+
5. Verify fix resolves the issue
|
|
556
|
+
</process>
|
|
557
|
+
|
|
558
|
+
<success_criteria>
|
|
559
|
+
|
|
560
|
+
- Issue fully understood and addressed
|
|
561
|
+
- Solution follows coding standards
|
|
562
|
+
- Tests added and passing
|
|
563
|
+
- No regressions introduced
|
|
564
|
+
</success_criteria>
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
**File-specific command**:
|
|
568
|
+
|
|
569
|
+
```markdown
|
|
570
|
+
---
|
|
571
|
+
description: Optimize code performance
|
|
572
|
+
argument-hint: [file-path]
|
|
573
|
+
---
|
|
574
|
+
|
|
575
|
+
<objective>
|
|
576
|
+
Analyze performance of @ #$ARGUMENTS and suggest specific optimizations.
|
|
577
|
+
|
|
578
|
+
This helps improve application performance through targeted improvements.
|
|
579
|
+
</objective>
|
|
580
|
+
|
|
581
|
+
<process>
|
|
582
|
+
1. Review code in @ #$ARGUMENTS for performance issues
|
|
583
|
+
2. Identify bottlenecks and inefficiencies
|
|
584
|
+
3. Suggest three specific optimizations with rationale
|
|
585
|
+
4. Estimate performance impact of each
|
|
586
|
+
</process>
|
|
587
|
+
|
|
588
|
+
<success_criteria>
|
|
589
|
+
|
|
590
|
+
- Performance issues clearly identified
|
|
591
|
+
- Three concrete optimizations suggested
|
|
592
|
+
- Implementation guidance provided
|
|
593
|
+
- Performance impact estimated
|
|
594
|
+
</success_criteria>
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
**Usage**: `/optimize src/utils/helpers.js`
|
|
598
|
+
|
|
599
|
+
See [references/patterns.md](references/patterns.md) for more examples.
|
|
600
|
+
</common_patterns>
|
|
601
|
+
|
|
602
|
+
<reference_guides>
|
|
603
|
+
|
|
604
|
+
**Slash command specific references:**
|
|
605
|
+
|
|
606
|
+
- [arguments.md](references/arguments.md) - #$ARGUMENTS, positional args, parsing strategies
|
|
607
|
+
- [patterns.md](references/patterns.md) - Git workflows, code analysis, file operations, **subagent patterns**
|
|
608
|
+
- [tool-restrictions.md](references/tool-restrictions.md) - Bash patterns, security best practices
|
|
609
|
+
- [prompt-examples.md](references/prompt-examples.md) - Real-world command examples by pattern
|
|
610
|
+
|
|
611
|
+
**Prompt engineering references from create-prompt skill:**
|
|
612
|
+
|
|
613
|
+
- [clarity-principles.md](../../create-prompt/references/clarity-principles.md) - Being clear and direct
|
|
614
|
+
- [xml-structure.md](../../create-prompt/references/xml-structure.md) - XML tag usage
|
|
615
|
+
- [few-shot-patterns.md](../../create-prompt/references/few-shot-patterns.md) - Example-based prompting
|
|
616
|
+
- [reasoning-techniques.md](../../create-prompt/references/reasoning-techniques.md) - Chain of thought, step-by-step
|
|
617
|
+
- [system-prompt-patterns.md](../../create-prompt/references/system-prompt-patterns.md) - System prompt templates
|
|
618
|
+
- [anthropic-best-practices.md](../../create-prompt/references/anthropic-best-practices.md) - Claude-specific techniques
|
|
619
|
+
- [context-management.md](../../create-prompt/references/context-management.md) - Context windows, long-horizon reasoning
|
|
620
|
+
- [anti-patterns.md](../../create-prompt/references/anti-patterns.md) - Common mistakes to avoid
|
|
621
|
+
</reference_guides>
|
|
622
|
+
|
|
623
|
+
<generation_protocol>
|
|
624
|
+
|
|
625
|
+
<step_0_mandatory_research>
|
|
626
|
+
**CRITICAL: Complete this research phase BEFORE proceeding to any other steps.**
|
|
627
|
+
|
|
628
|
+
You MUST read and understand these materials before creating any slash command:
|
|
629
|
+
|
|
630
|
+
**1. Read ALL reference files in order:**
|
|
631
|
+
|
|
632
|
+
Use the Read tool to read these files:
|
|
633
|
+
- `references/prompt-examples.md` - Real-world patterns and examples
|
|
634
|
+
- `references/patterns.md` - Verified command patterns
|
|
635
|
+
- `references/arguments.md` - Argument handling examples
|
|
636
|
+
- `references/tool-restrictions.md` - Tool restriction patterns
|
|
637
|
+
|
|
638
|
+
**2. Examine existing slash commands:**
|
|
639
|
+
|
|
640
|
+
Use Bash to find and Read existing commands:
|
|
641
|
+
```bash
|
|
642
|
+
find ~/.claude/commands -name "*.md" -type f | head -10
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
Then Read 2-3 relevant existing commands to understand:
|
|
646
|
+
- How they structure their YAML frontmatter
|
|
647
|
+
- What format they use (XML vs Markdown)
|
|
648
|
+
- How they handle arguments (#$ARGUMENTS vs positional)
|
|
649
|
+
- What tool restrictions they apply
|
|
650
|
+
- How they structure their workflow sections
|
|
651
|
+
|
|
652
|
+
**3. Identify the right pattern:**
|
|
653
|
+
|
|
654
|
+
Based on the user's request, match it to one of these patterns from prompt-examples.md:
|
|
655
|
+
- **Pattern 1**: Numbered workflow (git ops, CI, EPCT) - for multi-step processes
|
|
656
|
+
- **Pattern 2**: Reference/docs (CLI wrappers) - for command documentation
|
|
657
|
+
- **Pattern 3**: Section-based analysis (research, investigation) - for analysis tasks
|
|
658
|
+
- **Subagent patterns**: For commands that launch Task tool agents
|
|
659
|
+
- **Hybrid patterns**: Combining multiple approaches
|
|
660
|
+
|
|
661
|
+
**4. Check for similar existing commands:**
|
|
662
|
+
|
|
663
|
+
Before creating a new command, check if a similar command already exists:
|
|
664
|
+
```bash
|
|
665
|
+
grep -l "description.*<similar-concept>" ~/.claude/commands/*.md
|
|
666
|
+
```
|
|
667
|
+
|
|
668
|
+
If a similar command exists, read it to:
|
|
669
|
+
- Avoid duplication
|
|
670
|
+
- Learn from its structure
|
|
671
|
+
- Understand how to differentiate the new command
|
|
672
|
+
|
|
673
|
+
**VERIFICATION CHECKLIST:**
|
|
674
|
+
|
|
675
|
+
Before proceeding to step 1, confirm you have:
|
|
676
|
+
- ✅ Read all 4 reference files
|
|
677
|
+
- ✅ Examined at least 2 existing slash commands
|
|
678
|
+
- ✅ Identified which pattern to use
|
|
679
|
+
- ✅ Checked for similar existing commands
|
|
680
|
+
- ✅ Understand the correct syntax (#$ARGUMENTS, tool restrictions, etc.)
|
|
681
|
+
|
|
682
|
+
**DO NOT PROCEED** until all items are checked. This research phase is non-negotiable and prevents creating poorly structured commands.
|
|
683
|
+
|
|
684
|
+
</step_0_mandatory_research>
|
|
685
|
+
|
|
686
|
+
<step_1_analyze_request>
|
|
687
|
+
**Analyze the user's request** to understand what they want:
|
|
688
|
+
|
|
689
|
+
- What is the command's purpose?
|
|
690
|
+
- Does it need user input (#$ARGUMENTS)?
|
|
691
|
+
- Does it produce files or artifacts?
|
|
692
|
+
- Does it require verification or testing?
|
|
693
|
+
- Is it simple (single-step) or complex (multi-step)?
|
|
694
|
+
- What pattern does it match? (see [references/prompt-examples.md](references/prompt-examples.md))
|
|
695
|
+
|
|
696
|
+
**Intelligence rule**: Only proceed to questions if critical information is missing. If the request is clear, skip directly to format choice.
|
|
697
|
+
</step_1_analyze_request>
|
|
698
|
+
|
|
699
|
+
<step_2_ask_questions_if_needed>
|
|
700
|
+
**INTELLIGENCE RULE**: Only ask questions if critical information is truly missing.
|
|
701
|
+
|
|
702
|
+
If the request is clear, skip directly to scope and format questions. Most requests like "create a command to X" contain enough information to proceed.
|
|
703
|
+
|
|
704
|
+
**Ask clarifying questions** ONLY if essential information is missing:
|
|
705
|
+
|
|
706
|
+
Use AskUserQuestion to gather ONLY what's needed:
|
|
707
|
+
|
|
708
|
+
1. **Command purpose** (if completely unclear):
|
|
709
|
+
- header: "Purpose"
|
|
710
|
+
- question: "What should this command do?"
|
|
711
|
+
- Let user provide via "Other" option
|
|
712
|
+
|
|
713
|
+
2. **Arguments** (if truly ambiguous - rare):
|
|
714
|
+
- header: "Arguments"
|
|
715
|
+
- question: "Does this command need user input?"
|
|
716
|
+
- options: "Yes - takes arguments", "No - uses context only"
|
|
717
|
+
|
|
718
|
+
**SKIP questions for**:
|
|
719
|
+
|
|
720
|
+
- Clear purposes: "create a command to commit and push" → obvious purpose
|
|
721
|
+
- Obvious complexity: "simple command to..." vs "command that monitors and fixes..."
|
|
722
|
+
- Clear arguments: "for [file-path]" → needs args, "to analyze current code" → no args
|
|
723
|
+
- Standard tools: Git commands → Bash(git :\*), file operations → Read/Edit/Write
|
|
724
|
+
|
|
725
|
+
**Default assumptions** (use unless contradicted):
|
|
726
|
+
|
|
727
|
+
- Git operations → `Bash(git :*)`
|
|
728
|
+
- Analysis tasks → No tool restrictions
|
|
729
|
+
- File modifications → `Read, Edit, Write`
|
|
730
|
+
- Complex multi-step → Add verification and testing sections
|
|
731
|
+
</step_2_ask_questions_if_needed>
|
|
732
|
+
|
|
733
|
+
<step_2b_ask_scope>
|
|
734
|
+
**ALWAYS ask about scope** unless explicitly specified in the request:
|
|
735
|
+
|
|
736
|
+
Use AskUserQuestion:
|
|
737
|
+
|
|
738
|
+
- header: "Scope"
|
|
739
|
+
- question: "Where should this command be available?"
|
|
740
|
+
- options:
|
|
741
|
+
- "Global (all projects)" - description: "Saved to ~/.claude/commands/ - available everywhere"
|
|
742
|
+
- "Project only" - description: "Saved to .claude/commands/ - shared with team via git"
|
|
743
|
+
|
|
744
|
+
**Detection rules**:
|
|
745
|
+
|
|
746
|
+
- If request says "global command" → Skip, use global scope
|
|
747
|
+
- If request says "project command" or "team command" → Skip, use project scope
|
|
748
|
+
- Otherwise → ALWAYS ask
|
|
749
|
+
|
|
750
|
+
**Important**: This determines the save location:
|
|
751
|
+
|
|
752
|
+
- Global: `~/.claude/commands/command-name.md`
|
|
753
|
+
- Project: `.claude/commands/command-name.md` (in current working directory)
|
|
754
|
+
</step_2b_ask_scope>
|
|
755
|
+
|
|
756
|
+
<step_3_choose_format>
|
|
757
|
+
**Determine format based on existing patterns:**
|
|
758
|
+
|
|
759
|
+
Before asking the user, check what format existing commands in the target directory use:
|
|
760
|
+
- If creating global command: Check `~/.claude/commands/*.md`
|
|
761
|
+
- If creating project command: Check `.claude/commands/*.md`
|
|
762
|
+
|
|
763
|
+
Read 2-3 existing commands to see if they use XML or Markdown format.
|
|
764
|
+
|
|
765
|
+
**Then ask for format preference**:
|
|
766
|
+
|
|
767
|
+
Use AskUserQuestion:
|
|
768
|
+
|
|
769
|
+
- header: "Format"
|
|
770
|
+
- question: "What format do you prefer for this slash command?"
|
|
771
|
+
- options:
|
|
772
|
+
- First option based on what you found: If most commands use Markdown, make "Markdown (matches existing)" the first option
|
|
773
|
+
- Second option: The alternative format
|
|
774
|
+
- Include note about what existing commands use
|
|
775
|
+
|
|
776
|
+
**Recommendation**:
|
|
777
|
+
- Match existing commands format for consistency
|
|
778
|
+
- XML for complex multi-step commands
|
|
779
|
+
- Markdown for simple straightforward commands
|
|
780
|
+
|
|
781
|
+
See [references/prompt-examples.md](references/prompt-examples.md) for format examples.
|
|
782
|
+
</step_3_choose_format>
|
|
783
|
+
|
|
784
|
+
<step_4_create_frontmatter>
|
|
785
|
+
**Create YAML frontmatter** based on gathered information:
|
|
786
|
+
|
|
787
|
+
```yaml
|
|
788
|
+
---
|
|
789
|
+
name: command-name
|
|
790
|
+
description: Clear description of what it does
|
|
791
|
+
argument-hint: [input] # Only if arguments needed
|
|
792
|
+
allowed-tools: [...] # Only if tool restrictions needed
|
|
793
|
+
---
|
|
794
|
+
```
|
|
795
|
+
|
|
796
|
+
**Frontmatter rules**:
|
|
797
|
+
|
|
798
|
+
- `description`: Always required, clear and concise
|
|
799
|
+
- `argument-hint`: Include if command takes user input
|
|
800
|
+
- `allowed-tools`: Include if restricting tools for security
|
|
801
|
+
- `model`: Include only if need specific model (haiku for speed, opus for complexity)
|
|
802
|
+
</step_4_create_frontmatter>
|
|
803
|
+
|
|
804
|
+
<step_5_create_body>
|
|
805
|
+
**Create command body** in chosen format (XML or Markdown):
|
|
806
|
+
|
|
807
|
+
<xml_body>
|
|
808
|
+
**Always include:**
|
|
809
|
+
|
|
810
|
+
- `<objective>` - What and why
|
|
811
|
+
- `<process>` - How to do it (numbered steps)
|
|
812
|
+
- `<success_criteria>` - Definition of done
|
|
813
|
+
|
|
814
|
+
**Include when relevant:**
|
|
815
|
+
|
|
816
|
+
- `<context>` - Dynamic state (! `commands`) or file references (@ files)
|
|
817
|
+
- `<verification>` - Checks to perform if creating artifacts
|
|
818
|
+
- `<testing>` - Test commands if tests are part of workflow
|
|
819
|
+
- `<output>` - Files created/modified
|
|
820
|
+
|
|
821
|
+
**Reference**: Apply prompt engineering best practices from create-prompt skill:
|
|
822
|
+
|
|
823
|
+
- [clarity-principles.md](../../create-prompt/references/clarity-principles.md) - Being clear and direct
|
|
824
|
+
- [xml-structure.md](../../create-prompt/references/xml-structure.md) - XML tag usage
|
|
825
|
+
- [anthropic-best-practices.md](../../create-prompt/references/anthropic-best-practices.md) - Claude-specific techniques
|
|
826
|
+
</xml_body>
|
|
827
|
+
|
|
828
|
+
<markdown_body>
|
|
829
|
+
**Always include:**
|
|
830
|
+
|
|
831
|
+
- `## Objective` - What and why
|
|
832
|
+
- `## Process` or `## Workflow` - How to do it (numbered list)
|
|
833
|
+
- `## Success Criteria` - Definition of done
|
|
834
|
+
|
|
835
|
+
**Include when relevant:**
|
|
836
|
+
|
|
837
|
+
- `## Context` - Dynamic state or file references
|
|
838
|
+
- `## Verification` - Checks to perform if creating artifacts
|
|
839
|
+
- `## Testing` - Test commands if tests are part of workflow
|
|
840
|
+
- `## Output` - Files created/modified
|
|
841
|
+
</markdown_body>
|
|
842
|
+
</step_5_create_body>
|
|
843
|
+
|
|
844
|
+
<step_6_integrate_arguments>
|
|
845
|
+
**Integrate #$ARGUMENTS** if command takes input:
|
|
846
|
+
|
|
847
|
+
- If user input needed: Add `argument-hint` and use `#$ARGUMENTS` in body
|
|
848
|
+
- If self-contained: Omit `argument-hint` and `#$ARGUMENTS`
|
|
849
|
+
- For structured input: Use positional args `$1`, `$2`, `$3`
|
|
850
|
+
|
|
851
|
+
**Examples**: See [references/arguments.md](references/arguments.md)
|
|
852
|
+
</step_6_integrate_arguments>
|
|
853
|
+
|
|
854
|
+
<step_7_apply_intelligence>
|
|
855
|
+
**Apply appropriate complexity level**:
|
|
856
|
+
|
|
857
|
+
- **Simple commands**: Keep concise (objective + process + success criteria)
|
|
858
|
+
- **Complex commands**: Add context, verification, testing as needed
|
|
859
|
+
- **Don't over-engineer**: Simple tasks stay simple
|
|
860
|
+
- **Don't under-specify**: Complex tasks get full structure
|
|
861
|
+
|
|
862
|
+
**Pattern matching**: Choose pattern from [references/prompt-examples.md](references/prompt-examples.md):
|
|
863
|
+
|
|
864
|
+
- Pattern 1: Numbered workflow (git ops, CI, EPCT)
|
|
865
|
+
- Pattern 2: Reference/docs (CLI wrappers)
|
|
866
|
+
- Pattern 3: Section-based analysis (research, investigation)
|
|
867
|
+
</step_7_apply_intelligence>
|
|
868
|
+
|
|
869
|
+
<step_8_save_file>
|
|
870
|
+
**Save the command file** based on chosen scope:
|
|
871
|
+
|
|
872
|
+
**Global scope** (user selected "Global (all projects)"):
|
|
873
|
+
|
|
874
|
+
- Path: `~/.claude/commands/command-name.md`
|
|
875
|
+
- Available across all projects
|
|
876
|
+
- Personal commands, not shared with team
|
|
877
|
+
|
|
878
|
+
**Project scope** (user selected "Project only"):
|
|
879
|
+
|
|
880
|
+
- Path: `.claude/commands/command-name.md` (in current working directory)
|
|
881
|
+
- Shared with team via version control
|
|
882
|
+
- Project-specific commands
|
|
883
|
+
|
|
884
|
+
**Verification**:
|
|
885
|
+
|
|
886
|
+
- File created at correct location based on scope
|
|
887
|
+
- YAML frontmatter valid
|
|
888
|
+
- Body follows chosen format consistently
|
|
889
|
+
- All required sections present
|
|
890
|
+
|
|
891
|
+
**After saving**:
|
|
892
|
+
|
|
893
|
+
- Confirm location to user
|
|
894
|
+
- Remind them to commit if project scope
|
|
895
|
+
- Provide usage example: `/command-name [args]`
|
|
896
|
+
</step_8_save_file>
|
|
897
|
+
|
|
898
|
+
</generation_protocol>
|
|
899
|
+
|
|
900
|
+
<success_criteria>
|
|
901
|
+
A well-structured slash command meets these criteria:
|
|
902
|
+
|
|
903
|
+
**YAML Frontmatter**:
|
|
904
|
+
|
|
905
|
+
- `description` field is clear and concise
|
|
906
|
+
- `argument-hint` present if command accepts arguments
|
|
907
|
+
- `allowed-tools` specified if tool restrictions needed
|
|
908
|
+
|
|
909
|
+
**XML Structure**:
|
|
910
|
+
|
|
911
|
+
- All three required tags present: `<objective>`, `<process>`, `<success_criteria>`
|
|
912
|
+
- Conditional tags used appropriately based on complexity
|
|
913
|
+
- No raw markdown headings in body
|
|
914
|
+
- All XML tags properly closed
|
|
915
|
+
|
|
916
|
+
**Arguments Handling**:
|
|
917
|
+
|
|
918
|
+
- `#$ARGUMENTS` used when command operates on user-specified data
|
|
919
|
+
- Positional arguments (`$1`, `$2`, etc.) used when structured input needed
|
|
920
|
+
- No `#$ARGUMENTS` reference for self-contained commands
|
|
921
|
+
|
|
922
|
+
**Functionality**:
|
|
923
|
+
|
|
924
|
+
- Command expands correctly when invoked
|
|
925
|
+
- Dynamic context loads properly (bash commands, file references)
|
|
926
|
+
- Tool restrictions prevent unauthorized operations
|
|
927
|
+
- Command accomplishes intended purpose reliably
|
|
928
|
+
|
|
929
|
+
**Quality**:
|
|
930
|
+
|
|
931
|
+
- Clear, actionable instructions in `<process>` tag or `## Workflow` section
|
|
932
|
+
- Measurable completion criteria in `<success_criteria>` tag or `## Success Criteria` section
|
|
933
|
+
- Appropriate level of detail (not over-engineered for simple tasks)
|
|
934
|
+
- Examples provided when beneficial
|
|
935
|
+
</success_criteria>
|
|
936
|
+
|
|
937
|
+
<common_mistakes>
|
|
938
|
+
|
|
939
|
+
## Critical Anti-Patterns to Avoid
|
|
940
|
+
|
|
941
|
+
These are common mistakes that result from skipping the mandatory research phase:
|
|
942
|
+
|
|
943
|
+
### ❌ MISTAKE 1: Skipping the Research Phase
|
|
944
|
+
|
|
945
|
+
**Wrong**:
|
|
946
|
+
```
|
|
947
|
+
User asks to create /quick-search command
|
|
948
|
+
→ Immediately ask scope/format questions
|
|
949
|
+
→ Create command without reading references or existing commands
|
|
950
|
+
→ Use wrong syntax, wrong format, miss best practices
|
|
951
|
+
```
|
|
952
|
+
|
|
953
|
+
**Correct**:
|
|
954
|
+
```
|
|
955
|
+
User asks to create /quick-search command
|
|
956
|
+
→ Read all 4 reference files first
|
|
957
|
+
→ Find and examine existing commands (especially /search if it exists)
|
|
958
|
+
→ Understand patterns and syntax
|
|
959
|
+
→ Then ask questions and create command
|
|
960
|
+
```
|
|
961
|
+
|
|
962
|
+
### ❌ MISTAKE 2: Using Wrong Argument Syntax
|
|
963
|
+
|
|
964
|
+
**Wrong**:
|
|
965
|
+
```markdown
|
|
966
|
+
---
|
|
967
|
+
description: Quick search
|
|
968
|
+
---
|
|
969
|
+
Answer the question: #args
|
|
970
|
+
```
|
|
971
|
+
|
|
972
|
+
**Correct**:
|
|
973
|
+
```markdown
|
|
974
|
+
---
|
|
975
|
+
description: Quick search
|
|
976
|
+
argument-hint: <question>
|
|
977
|
+
---
|
|
978
|
+
User: #$ARGUMENTS
|
|
979
|
+
```
|
|
980
|
+
|
|
981
|
+
The correct syntax is `#$ARGUMENTS` (not `#args`). This is documented in references/arguments.md.
|
|
982
|
+
|
|
983
|
+
### ❌ MISTAKE 3: Not Checking for Similar Commands
|
|
984
|
+
|
|
985
|
+
**Wrong**:
|
|
986
|
+
- Create `/quick-search` without checking if `/search` already exists
|
|
987
|
+
- Result: Duplicate functionality, confusion
|
|
988
|
+
|
|
989
|
+
**Correct**:
|
|
990
|
+
- Check existing commands first: `find ~/.claude/commands -name "*.md"`
|
|
991
|
+
- If similar command exists, read it to understand how to differentiate
|
|
992
|
+
- Consider if the new command is really needed
|
|
993
|
+
|
|
994
|
+
### ❌ MISTAKE 4: Wrong Format Choice
|
|
995
|
+
|
|
996
|
+
**Wrong**:
|
|
997
|
+
- User asks for command
|
|
998
|
+
- Randomly choose XML or Markdown without checking existing commands
|
|
999
|
+
- Result: Inconsistent codebase
|
|
1000
|
+
|
|
1001
|
+
**Correct**:
|
|
1002
|
+
- Check what format existing commands use
|
|
1003
|
+
- Match that format for consistency
|
|
1004
|
+
- Only deviate if user explicitly requests different format
|
|
1005
|
+
|
|
1006
|
+
### ❌ MISTAKE 5: Missing Tool Restrictions
|
|
1007
|
+
|
|
1008
|
+
**Wrong**:
|
|
1009
|
+
```yaml
|
|
1010
|
+
---
|
|
1011
|
+
description: Quick search with Haiku model
|
|
1012
|
+
model: haiku
|
|
1013
|
+
---
|
|
1014
|
+
```
|
|
1015
|
+
|
|
1016
|
+
**Correct**:
|
|
1017
|
+
```yaml
|
|
1018
|
+
---
|
|
1019
|
+
description: Quick search with Haiku model
|
|
1020
|
+
model: haiku
|
|
1021
|
+
allowed-tools: [Grep, Glob, Read]
|
|
1022
|
+
---
|
|
1023
|
+
```
|
|
1024
|
+
|
|
1025
|
+
For speed-optimized commands, restrict tools to prevent using slow agents like Task.
|
|
1026
|
+
|
|
1027
|
+
### ❌ MISTAKE 6: Not Matching Existing Patterns
|
|
1028
|
+
|
|
1029
|
+
**Wrong**:
|
|
1030
|
+
- Create unique structure that doesn't match any existing pattern
|
|
1031
|
+
- Result: Hard to maintain, unfamiliar to users
|
|
1032
|
+
|
|
1033
|
+
**Correct**:
|
|
1034
|
+
- Read prompt-examples.md to see verified patterns
|
|
1035
|
+
- Match your command to Pattern 1, 2, 3, or hybrid
|
|
1036
|
+
- Follow the established structure
|
|
1037
|
+
|
|
1038
|
+
### ❌ MISTAKE 7: Not Including "User: #$ARGUMENTS" at the End
|
|
1039
|
+
|
|
1040
|
+
**Wrong**:
|
|
1041
|
+
```markdown
|
|
1042
|
+
---
|
|
1043
|
+
description: Search command
|
|
1044
|
+
argument-hint: <question>
|
|
1045
|
+
---
|
|
1046
|
+
|
|
1047
|
+
You are a search specialist.
|
|
1048
|
+
|
|
1049
|
+
## Workflow
|
|
1050
|
+
1. Search for the answer
|
|
1051
|
+
2. Provide results
|
|
1052
|
+
```
|
|
1053
|
+
|
|
1054
|
+
**Correct**:
|
|
1055
|
+
```markdown
|
|
1056
|
+
---
|
|
1057
|
+
description: Search command
|
|
1058
|
+
argument-hint: <question>
|
|
1059
|
+
---
|
|
1060
|
+
|
|
1061
|
+
You are a search specialist.
|
|
1062
|
+
|
|
1063
|
+
## Workflow
|
|
1064
|
+
1. Search for the answer
|
|
1065
|
+
2. Provide results
|
|
1066
|
+
|
|
1067
|
+
---
|
|
1068
|
+
|
|
1069
|
+
User: #$ARGUMENTS
|
|
1070
|
+
```
|
|
1071
|
+
|
|
1072
|
+
Many commands end with `User: #$ARGUMENTS` to properly pass the user's input to the command.
|
|
1073
|
+
|
|
1074
|
+
### ❌ MISTAKE 8: Over-Engineering Simple Commands
|
|
1075
|
+
|
|
1076
|
+
**Wrong**:
|
|
1077
|
+
```markdown
|
|
1078
|
+
<objective>Create comprehensive search system</objective>
|
|
1079
|
+
<context>Load all git state</context>
|
|
1080
|
+
<verification>Run extensive checks</verification>
|
|
1081
|
+
<testing>Test all edge cases</testing>
|
|
1082
|
+
```
|
|
1083
|
+
|
|
1084
|
+
For a simple search command, this is too much.
|
|
1085
|
+
|
|
1086
|
+
**Correct**:
|
|
1087
|
+
```markdown
|
|
1088
|
+
You are a rapid search specialist.
|
|
1089
|
+
|
|
1090
|
+
## Workflow
|
|
1091
|
+
1. Search
|
|
1092
|
+
2. Answer
|
|
1093
|
+
|
|
1094
|
+
User: #$ARGUMENTS
|
|
1095
|
+
```
|
|
1096
|
+
|
|
1097
|
+
Match complexity to the task.
|
|
1098
|
+
|
|
1099
|
+
## How to Avoid These Mistakes
|
|
1100
|
+
|
|
1101
|
+
**Follow the Step 0 checklist religiously**:
|
|
1102
|
+
1. ✅ Read all 4 reference files
|
|
1103
|
+
2. ✅ Examine 2-3 existing commands
|
|
1104
|
+
3. ✅ Identify the pattern to use
|
|
1105
|
+
4. ✅ Check for similar commands
|
|
1106
|
+
5. ✅ Understand correct syntax
|
|
1107
|
+
|
|
1108
|
+
**If you skip Step 0, you WILL make these mistakes.**
|
|
1109
|
+
|
|
1110
|
+
</common_mistakes>
|