@hustle-together/api-dev-tools 3.10.0 → 3.11.1
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/api-dev-state.json +159 -0
- package/.claude/commands/README.md +185 -0
- package/.claude/commands/add-command.md +209 -0
- package/.claude/commands/api-create.md +499 -0
- package/.claude/commands/api-env.md +50 -0
- package/.claude/commands/api-interview.md +331 -0
- package/.claude/commands/api-research.md +331 -0
- package/.claude/commands/api-status.md +259 -0
- package/.claude/commands/api-verify.md +231 -0
- package/.claude/commands/beepboop.md +97 -0
- package/.claude/commands/busycommit.md +112 -0
- package/.claude/commands/commit.md +83 -0
- package/.claude/commands/cycle.md +142 -0
- package/.claude/commands/gap.md +86 -0
- package/.claude/commands/green.md +142 -0
- package/.claude/commands/issue.md +192 -0
- package/.claude/commands/plan.md +168 -0
- package/.claude/commands/pr.md +122 -0
- package/.claude/commands/red.md +142 -0
- package/.claude/commands/refactor.md +142 -0
- package/.claude/commands/spike.md +142 -0
- package/.claude/commands/summarize.md +94 -0
- package/.claude/commands/tdd.md +144 -0
- package/.claude/commands/worktree-add.md +315 -0
- package/.claude/commands/worktree-cleanup.md +281 -0
- package/.claude/hooks/api-workflow-check.py +227 -0
- package/.claude/hooks/enforce-deep-research.py +185 -0
- package/.claude/hooks/enforce-disambiguation.py +155 -0
- package/.claude/hooks/enforce-documentation.py +192 -0
- package/.claude/hooks/enforce-environment.py +253 -0
- package/.claude/hooks/enforce-external-research.py +328 -0
- package/.claude/hooks/enforce-interview.py +421 -0
- package/.claude/hooks/enforce-refactor.py +189 -0
- package/.claude/hooks/enforce-research.py +159 -0
- package/.claude/hooks/enforce-schema.py +186 -0
- package/.claude/hooks/enforce-scope.py +160 -0
- package/.claude/hooks/enforce-tdd-red.py +250 -0
- package/.claude/hooks/enforce-verify.py +186 -0
- package/.claude/hooks/periodic-reground.py +154 -0
- package/.claude/hooks/session-startup.py +151 -0
- package/.claude/hooks/track-tool-use.py +626 -0
- package/.claude/hooks/verify-after-green.py +282 -0
- package/.claude/hooks/verify-implementation.py +225 -0
- package/.claude/research/index.json +6 -0
- package/.claude/settings.json +93 -0
- package/.claude/settings.local.json +11 -0
- package/.claude-plugin/marketplace.json +112 -0
- package/.skills/README.md +291 -0
- package/.skills/_shared/convert-commands.py +192 -0
- package/.skills/_shared/hooks/api-workflow-check.py +227 -0
- package/.skills/_shared/hooks/enforce-deep-research.py +185 -0
- package/.skills/_shared/hooks/enforce-disambiguation.py +155 -0
- package/.skills/_shared/hooks/enforce-documentation.py +192 -0
- package/.skills/_shared/hooks/enforce-environment.py +253 -0
- package/.skills/_shared/hooks/enforce-external-research.py +328 -0
- package/.skills/_shared/hooks/enforce-interview.py +421 -0
- package/.skills/_shared/hooks/enforce-refactor.py +189 -0
- package/.skills/_shared/hooks/enforce-research.py +159 -0
- package/.skills/_shared/hooks/enforce-schema.py +186 -0
- package/.skills/_shared/hooks/enforce-scope.py +160 -0
- package/.skills/_shared/hooks/enforce-tdd-red.py +250 -0
- package/.skills/_shared/hooks/enforce-verify.py +186 -0
- package/.skills/_shared/hooks/periodic-reground.py +154 -0
- package/.skills/_shared/hooks/session-startup.py +151 -0
- package/.skills/_shared/hooks/track-tool-use.py +626 -0
- package/.skills/_shared/hooks/verify-after-green.py +282 -0
- package/.skills/_shared/hooks/verify-implementation.py +225 -0
- package/.skills/_shared/install.sh +114 -0
- package/.skills/_shared/settings.json +93 -0
- package/.skills/add-command/SKILL.md +222 -0
- package/.skills/api-create/SKILL.md +512 -0
- package/.skills/api-env/SKILL.md +63 -0
- package/.skills/api-interview/SKILL.md +344 -0
- package/.skills/api-research/SKILL.md +344 -0
- package/.skills/api-status/SKILL.md +272 -0
- package/.skills/api-verify/SKILL.md +244 -0
- package/.skills/beepboop/SKILL.md +110 -0
- package/.skills/busycommit/SKILL.md +125 -0
- package/.skills/commit/SKILL.md +96 -0
- package/.skills/cycle/SKILL.md +155 -0
- package/.skills/gap/SKILL.md +99 -0
- package/.skills/green/SKILL.md +155 -0
- package/.skills/issue/SKILL.md +205 -0
- package/.skills/plan/SKILL.md +181 -0
- package/.skills/pr/SKILL.md +135 -0
- package/.skills/red/SKILL.md +155 -0
- package/.skills/refactor/SKILL.md +155 -0
- package/.skills/spike/SKILL.md +155 -0
- package/.skills/summarize/SKILL.md +107 -0
- package/.skills/tdd/SKILL.md +157 -0
- package/.skills/update-todos/SKILL.md +228 -0
- package/.skills/worktree-add/SKILL.md +328 -0
- package/.skills/worktree-cleanup/SKILL.md +294 -0
- package/CHANGELOG.md +97 -0
- package/README.md +66 -20
- package/bin/cli.js +7 -6
- package/package.json +22 -11
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "3.0.0",
|
|
3
|
+
"created_at": null,
|
|
4
|
+
"endpoint": null,
|
|
5
|
+
"library": null,
|
|
6
|
+
"session_id": null,
|
|
7
|
+
"turn_count": 0,
|
|
8
|
+
"last_turn_timestamp": null,
|
|
9
|
+
"research_queries": [],
|
|
10
|
+
"prompt_detections": [
|
|
11
|
+
{
|
|
12
|
+
"timestamp": "2025-12-27T15:58:25.936482",
|
|
13
|
+
"prompt_preview": "can you push 3.2.0 to npm please",
|
|
14
|
+
"detection": {
|
|
15
|
+
"detected": true,
|
|
16
|
+
"terms": [
|
|
17
|
+
"3.2.0"
|
|
18
|
+
],
|
|
19
|
+
"patterns_matched": [
|
|
20
|
+
"technical_term"
|
|
21
|
+
],
|
|
22
|
+
"confidence": "high"
|
|
23
|
+
},
|
|
24
|
+
"injected": true
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"timestamp": "2025-12-27T16:07:06.370872",
|
|
28
|
+
"prompt_preview": "3.11.1",
|
|
29
|
+
"detection": {
|
|
30
|
+
"detected": true,
|
|
31
|
+
"terms": [
|
|
32
|
+
"3.11.1"
|
|
33
|
+
],
|
|
34
|
+
"patterns_matched": [
|
|
35
|
+
"technical_term"
|
|
36
|
+
],
|
|
37
|
+
"confidence": "high"
|
|
38
|
+
},
|
|
39
|
+
"injected": true
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"timestamp": "2025-12-27T17:51:34.506745",
|
|
43
|
+
"prompt_preview": "npm notice 10.7kB templates/ui-showcase/_components/PreviewCard.tsx\nnpm notice 23.3kB templates/ui-s...",
|
|
44
|
+
"detection": {
|
|
45
|
+
"detected": true,
|
|
46
|
+
"terms": [
|
|
47
|
+
"install from a",
|
|
48
|
+
"error",
|
|
49
|
+
"api",
|
|
50
|
+
"package",
|
|
51
|
+
"url",
|
|
52
|
+
"token",
|
|
53
|
+
"install",
|
|
54
|
+
"@hustle-together/api-dev-tools",
|
|
55
|
+
"hustle-together-api",
|
|
56
|
+
"3.11.1"
|
|
57
|
+
],
|
|
58
|
+
"patterns_matched": [
|
|
59
|
+
"always_research",
|
|
60
|
+
"technical_term",
|
|
61
|
+
"question_pattern"
|
|
62
|
+
],
|
|
63
|
+
"confidence": "critical"
|
|
64
|
+
},
|
|
65
|
+
"injected": true
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
"phases": {
|
|
69
|
+
"disambiguation": {
|
|
70
|
+
"status": "not_started",
|
|
71
|
+
"clarified": null,
|
|
72
|
+
"search_variations": [],
|
|
73
|
+
"description": "Pre-research disambiguation to clarify ambiguous requests"
|
|
74
|
+
},
|
|
75
|
+
"scope": {
|
|
76
|
+
"status": "not_started",
|
|
77
|
+
"confirmed": false,
|
|
78
|
+
"description": "Initial scope understanding and confirmation"
|
|
79
|
+
},
|
|
80
|
+
"research_initial": {
|
|
81
|
+
"status": "not_started",
|
|
82
|
+
"sources": [],
|
|
83
|
+
"summary_approved": false,
|
|
84
|
+
"description": "Context7/WebSearch research for live documentation"
|
|
85
|
+
},
|
|
86
|
+
"interview": {
|
|
87
|
+
"status": "not_started",
|
|
88
|
+
"questions": [],
|
|
89
|
+
"user_question_count": 0,
|
|
90
|
+
"structured_question_count": 0,
|
|
91
|
+
"decisions": {},
|
|
92
|
+
"description": "Structured interview about requirements (generated FROM research)"
|
|
93
|
+
},
|
|
94
|
+
"research_deep": {
|
|
95
|
+
"status": "not_started",
|
|
96
|
+
"sources": [],
|
|
97
|
+
"proposed_searches": [],
|
|
98
|
+
"approved_searches": [],
|
|
99
|
+
"skipped_searches": [],
|
|
100
|
+
"description": "Deep dive based on interview answers (adaptive, not shotgun)"
|
|
101
|
+
},
|
|
102
|
+
"schema_creation": {
|
|
103
|
+
"status": "not_started",
|
|
104
|
+
"schema_file": null,
|
|
105
|
+
"schema_approved": false,
|
|
106
|
+
"description": "Zod schema creation from research"
|
|
107
|
+
},
|
|
108
|
+
"environment_check": {
|
|
109
|
+
"status": "not_started",
|
|
110
|
+
"keys_verified": [],
|
|
111
|
+
"keys_missing": [],
|
|
112
|
+
"confirmed": false,
|
|
113
|
+
"description": "API key and environment verification"
|
|
114
|
+
},
|
|
115
|
+
"tdd_red": {
|
|
116
|
+
"status": "not_started",
|
|
117
|
+
"test_file": null,
|
|
118
|
+
"test_count": 0,
|
|
119
|
+
"test_matrix_approved": false,
|
|
120
|
+
"description": "Write failing tests first"
|
|
121
|
+
},
|
|
122
|
+
"tdd_green": {
|
|
123
|
+
"status": "not_started",
|
|
124
|
+
"implementation_file": null,
|
|
125
|
+
"all_tests_passing": false,
|
|
126
|
+
"description": "Minimal implementation to pass tests"
|
|
127
|
+
},
|
|
128
|
+
"verify": {
|
|
129
|
+
"status": "not_started",
|
|
130
|
+
"gaps_found": 0,
|
|
131
|
+
"gaps_fixed": 0,
|
|
132
|
+
"intentional_omissions": [],
|
|
133
|
+
"re_research_done": false,
|
|
134
|
+
"description": "Re-research after Green to verify implementation matches docs"
|
|
135
|
+
},
|
|
136
|
+
"tdd_refactor": {
|
|
137
|
+
"status": "not_started",
|
|
138
|
+
"description": "Code cleanup while keeping tests green"
|
|
139
|
+
},
|
|
140
|
+
"documentation": {
|
|
141
|
+
"status": "not_started",
|
|
142
|
+
"files_updated": [],
|
|
143
|
+
"manifest_updated": false,
|
|
144
|
+
"openapi_updated": false,
|
|
145
|
+
"research_cached": false,
|
|
146
|
+
"description": "Update manifests, OpenAPI, cache research"
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
"verification": {
|
|
150
|
+
"all_sources_fetched": false,
|
|
151
|
+
"schema_matches_docs": false,
|
|
152
|
+
"tests_cover_params": false,
|
|
153
|
+
"all_tests_passing": false,
|
|
154
|
+
"coverage_percent": null,
|
|
155
|
+
"post_green_verification": false
|
|
156
|
+
},
|
|
157
|
+
"research_index": {},
|
|
158
|
+
"reground_history": []
|
|
159
|
+
}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# API Development Slash Commands v3.0
|
|
2
|
+
|
|
3
|
+
**Interview-driven, research-first API development workflow with continuous verification loops**
|
|
4
|
+
|
|
5
|
+
## What's New in v3.0
|
|
6
|
+
|
|
7
|
+
- **Phase 1: Disambiguation** - Search variations before research
|
|
8
|
+
- **Phase 10: Verify** - Re-research after tests pass to catch memory errors
|
|
9
|
+
- **Adaptive Research** - Propose searches based on context, not shotgun
|
|
10
|
+
- **Questions FROM Research** - Interview generates questions from discovered params
|
|
11
|
+
- **7-Turn Re-grounding** - Periodic context injection prevents dilution
|
|
12
|
+
- **Research Freshness** - 7-day cache with staleness warnings
|
|
13
|
+
|
|
14
|
+
## Hook Architecture (9 Hooks)
|
|
15
|
+
|
|
16
|
+
| Hook | Event | Purpose |
|
|
17
|
+
|------|-------|---------|
|
|
18
|
+
| `session-startup.py` | SessionStart | Inject state at session start |
|
|
19
|
+
| `enforce-external-research.py` | UserPromptSubmit | Detect API terms, require research |
|
|
20
|
+
| `enforce-research.py` | PreToolUse | Block writes until research done |
|
|
21
|
+
| `enforce-interview.py` | PreToolUse | Inject interview decisions |
|
|
22
|
+
| `verify-implementation.py` | PreToolUse | Require test file before route |
|
|
23
|
+
| `track-tool-use.py` | PostToolUse | Log research, count turns |
|
|
24
|
+
| `periodic-reground.py` | PostToolUse | Re-ground every 7 turns |
|
|
25
|
+
| `verify-after-green.py` | PostToolUse | Trigger Phase 10 after test pass |
|
|
26
|
+
| `api-workflow-check.py` | Stop | Block if phases incomplete |
|
|
27
|
+
|
|
28
|
+
## Available Commands
|
|
29
|
+
|
|
30
|
+
### Complete Workflow
|
|
31
|
+
|
|
32
|
+
**`/api-create [endpoint-name]`**
|
|
33
|
+
- Runs all 13 phases automatically
|
|
34
|
+
- Loop-back architecture at every checkpoint
|
|
35
|
+
- See [api-create.md](api-create.md) for full flow
|
|
36
|
+
|
|
37
|
+
### Individual Phases
|
|
38
|
+
|
|
39
|
+
**`/api-interview [endpoint-name]`**
|
|
40
|
+
- Questions GENERATED from research findings
|
|
41
|
+
- Different question types: enum, continuous, boolean
|
|
42
|
+
- See [api-interview.md](api-interview.md)
|
|
43
|
+
|
|
44
|
+
**`/api-research [library-or-service]`**
|
|
45
|
+
- Adaptive propose-approve flow (not shotgun)
|
|
46
|
+
- Research cached with 7-day freshness
|
|
47
|
+
- See [api-research.md](api-research.md)
|
|
48
|
+
|
|
49
|
+
**`/api-verify [endpoint-name]`** (NEW)
|
|
50
|
+
- Manual Phase 10 verification
|
|
51
|
+
- Re-read docs, compare to implementation
|
|
52
|
+
- Report gaps, loop back or document omissions
|
|
53
|
+
- See [api-verify.md](api-verify.md)
|
|
54
|
+
|
|
55
|
+
**`/api-env [endpoint-name]`**
|
|
56
|
+
- Check API keys and environment
|
|
57
|
+
- See [api-env.md](api-env.md)
|
|
58
|
+
|
|
59
|
+
**`/api-status [endpoint-name]`**
|
|
60
|
+
- Track progress through 13 phases
|
|
61
|
+
- See [api-status.md](api-status.md)
|
|
62
|
+
|
|
63
|
+
### TDD Commands
|
|
64
|
+
|
|
65
|
+
From [@wbern/claude-instructions](https://github.com/wbern/claude-instructions):
|
|
66
|
+
- `/red` - Write ONE failing test
|
|
67
|
+
- `/green` - Minimal implementation to pass
|
|
68
|
+
- `/refactor` - Clean up while tests pass
|
|
69
|
+
- `/cycle [description]` - Full Red → Green → Refactor
|
|
70
|
+
|
|
71
|
+
## 13-Phase Flow
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
Phase 1: DISAMBIGUATION - Clarify ambiguous terms
|
|
75
|
+
Phase 2: SCOPE - Confirm understanding
|
|
76
|
+
Phase 3: INITIAL RESEARCH - 2-3 targeted searches
|
|
77
|
+
Phase 4: INTERVIEW - Questions FROM research
|
|
78
|
+
Phase 5: DEEP RESEARCH - Adaptive propose-approve
|
|
79
|
+
Phase 6: SCHEMA - Zod from research + interview
|
|
80
|
+
Phase 7: ENVIRONMENT - Verify API keys
|
|
81
|
+
Phase 8: TDD RED - Write failing tests
|
|
82
|
+
Phase 9: TDD GREEN - Minimal implementation
|
|
83
|
+
Phase 10: VERIFY - Re-research, find gaps
|
|
84
|
+
Phase 11: TDD REFACTOR - Clean up code
|
|
85
|
+
Phase 12: DOCUMENTATION - Update manifests
|
|
86
|
+
Phase 13: COMPLETION - Final verification
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## State File
|
|
90
|
+
|
|
91
|
+
All progress tracked in `.claude/api-dev-state.json`:
|
|
92
|
+
|
|
93
|
+
```json
|
|
94
|
+
{
|
|
95
|
+
"version": "3.0.0",
|
|
96
|
+
"endpoint": "brandfetch",
|
|
97
|
+
"turn_count": 23,
|
|
98
|
+
"phases": {
|
|
99
|
+
"disambiguation": { "status": "complete" },
|
|
100
|
+
"scope": { "status": "complete" },
|
|
101
|
+
"research_initial": { "status": "complete" },
|
|
102
|
+
"interview": { "status": "complete", "decisions": {...} },
|
|
103
|
+
"research_deep": {
|
|
104
|
+
"proposed_searches": [...],
|
|
105
|
+
"approved_searches": [...],
|
|
106
|
+
"skipped_searches": [...]
|
|
107
|
+
},
|
|
108
|
+
"verify": {
|
|
109
|
+
"gaps_found": 2,
|
|
110
|
+
"gaps_fixed": 2,
|
|
111
|
+
"intentional_omissions": [...]
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
"reground_history": [...]
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Research Cache
|
|
119
|
+
|
|
120
|
+
Research cached in `.claude/research/`:
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
.claude/research/
|
|
124
|
+
├── brandfetch/
|
|
125
|
+
│ ├── 2025-12-08_initial.md
|
|
126
|
+
│ ├── 2025-12-08_deep.md
|
|
127
|
+
│ └── CURRENT.md
|
|
128
|
+
└── index.json ← Freshness tracking (7-day validity)
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Quick Start
|
|
132
|
+
|
|
133
|
+
### Automated
|
|
134
|
+
```bash
|
|
135
|
+
/api-create my-endpoint
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Manual Step-by-Step
|
|
139
|
+
```bash
|
|
140
|
+
/api-research [library] # Initial research
|
|
141
|
+
/api-interview [endpoint] # Questions from research
|
|
142
|
+
/api-env [endpoint] # Verify environment
|
|
143
|
+
/red # Failing tests
|
|
144
|
+
/green # Make tests pass
|
|
145
|
+
/api-verify [endpoint] # Compare to docs
|
|
146
|
+
/refactor # Clean up
|
|
147
|
+
/commit # Semantic commit
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Installation
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
npx @hustle-together/api-dev-tools --scope=project
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Installs:
|
|
157
|
+
- Commands in `.claude/commands/`
|
|
158
|
+
- Hooks in `.claude/hooks/`
|
|
159
|
+
- Settings in `.claude/settings.json`
|
|
160
|
+
- State template in `.claude/api-dev-state.json`
|
|
161
|
+
- Research index in `.claude/research/index.json`
|
|
162
|
+
|
|
163
|
+
### Team-Wide
|
|
164
|
+
|
|
165
|
+
Add to `package.json`:
|
|
166
|
+
```json
|
|
167
|
+
{
|
|
168
|
+
"scripts": {
|
|
169
|
+
"postinstall": "npx @hustle-together/api-dev-tools --scope=project"
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Key Principles
|
|
175
|
+
|
|
176
|
+
1. **Loop Until Green** - Every verification loops back if not successful
|
|
177
|
+
2. **Continuous Interviews** - Checkpoints at EVERY phase transition
|
|
178
|
+
3. **Adaptive Research** - Propose based on context, not shotgun
|
|
179
|
+
4. **Self-Documenting** - State file captures everything
|
|
180
|
+
5. **Verify After Green** - Re-research to catch memory errors
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
**Version:** 3.0.0
|
|
185
|
+
**Last Updated:** 2025-12-08
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Guide for creating new slash commands
|
|
3
|
+
argument-hint: <command-name> <description>
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## General Guidelines
|
|
7
|
+
|
|
8
|
+
### Output Style
|
|
9
|
+
|
|
10
|
+
- **Never explicitly mention TDD** in code, comments, commits, PRs, or issues
|
|
11
|
+
- Write natural, descriptive code without meta-commentary about the development process
|
|
12
|
+
- The code should speak for itself - TDD is the process, not the product
|
|
13
|
+
|
|
14
|
+
# Slash Command Creator Guide
|
|
15
|
+
|
|
16
|
+
## How This Command Works
|
|
17
|
+
|
|
18
|
+
The `/add-command` command shows this guide for creating new slash commands. It includes:
|
|
19
|
+
|
|
20
|
+
- Command structure and syntax
|
|
21
|
+
- Common patterns and examples
|
|
22
|
+
- Security restrictions and limitations
|
|
23
|
+
- Frontmatter options
|
|
24
|
+
|
|
25
|
+
**Note for AI**: When creating commands, you CAN use bash tools like `Bash(mkdir:*)`, `Bash(ls:*)`, `Bash(git status:*)` in the `allowed-tools` frontmatter of NEW commands - but ONLY for operations within the current project directory. This command itself doesn't need bash tools since it's just documentation.
|
|
26
|
+
|
|
27
|
+
## Command Locations
|
|
28
|
+
|
|
29
|
+
- **Personal**: `~/.claude/commands/` (available across all projects)
|
|
30
|
+
- **Project**: `.claude/commands/` (shared with team, shows "(project)")
|
|
31
|
+
|
|
32
|
+
## Basic Structure
|
|
33
|
+
|
|
34
|
+
```markdown
|
|
35
|
+
---
|
|
36
|
+
allowed-tools: Read, Glob, Grep, Bash(git status:*), Task
|
|
37
|
+
description: Brief description of what this command does
|
|
38
|
+
argument-hint: [required-arg] [optional-arg]
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
# Command Title
|
|
42
|
+
|
|
43
|
+
Your command instructions here.
|
|
44
|
+
|
|
45
|
+
Arguments: $ARGUMENTS
|
|
46
|
+
|
|
47
|
+
File reference: @path/to/file.js
|
|
48
|
+
|
|
49
|
+
Bash command output: (exclamation)git status(backticks)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## ⚠️ Security Restrictions
|
|
53
|
+
|
|
54
|
+
**Bash Commands (exclamation prefix)**: Limited to current working directory only.
|
|
55
|
+
|
|
56
|
+
- ✅ Works: `! + backtick + git status + backtick` (in project dir)
|
|
57
|
+
- ❌ Blocked: `! + backtick + ls /outside/project + backtick` (outside project)
|
|
58
|
+
- ❌ Blocked: `! + backtick + pwd + backtick` (if referencing dirs outside project)
|
|
59
|
+
|
|
60
|
+
**File References (`@` prefix)**: No directory restrictions.
|
|
61
|
+
|
|
62
|
+
- ✅ Works: `@/path/to/system/file.md`
|
|
63
|
+
- ✅ Works: `@../other-project/file.js`
|
|
64
|
+
|
|
65
|
+
## Common Patterns
|
|
66
|
+
|
|
67
|
+
### Simple Command
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
echo "Review this code for bugs and suggest fixes" > ~/.claude/commands/review.md
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Command with Arguments
|
|
74
|
+
|
|
75
|
+
**Note for AI**: The example below uses a fullwidth dollar sign ($, U+FF04) to prevent interpolation in this documentation. When creating actual commands, use the regular `$` character.
|
|
76
|
+
|
|
77
|
+
```markdown
|
|
78
|
+
Fix issue $ARGUMENTS following our coding standards
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Command with File References
|
|
82
|
+
|
|
83
|
+
```markdown
|
|
84
|
+
Compare @src/old.js with @src/new.js and explain differences
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Command with Bash Output (Project Directory Only)
|
|
88
|
+
|
|
89
|
+
```markdown
|
|
90
|
+
---
|
|
91
|
+
allowed-tools: Bash(git status:*), Bash(git branch:*), Bash(git log:*)
|
|
92
|
+
---
|
|
93
|
+
Current status: (!)git status(`)
|
|
94
|
+
Current branch: (!)git branch --show-current(`)
|
|
95
|
+
Recent commits: (!)git log --oneline -5(`)
|
|
96
|
+
|
|
97
|
+
Create commit for these changes.
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Note**: Only works with commands in the current project directory.
|
|
101
|
+
|
|
102
|
+
### Namespaced Command
|
|
103
|
+
|
|
104
|
+
**Note for AI**: The example below uses a fullwidth dollar sign ($, U+FF04) to prevent interpolation in this documentation. When creating actual commands, use the regular `$` character.
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
mkdir -p ~/.claude/commands/ai
|
|
108
|
+
echo "Ask GPT-5 about: $ARGUMENTS" > ~/.claude/commands/ai/gpt5.md
|
|
109
|
+
# Creates: /ai:gpt5
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Frontmatter Options
|
|
113
|
+
|
|
114
|
+
- `allowed-tools`: Tools this command can use
|
|
115
|
+
- **Important**: Intrusive tools like `Write`, `Edit`, `NotebookEdit` should NEVER be allowed in commands unless the user explicitly requests them. These tools modify files and should only be used when the command's purpose is to make changes.
|
|
116
|
+
- ✅ Safe for most commands: `Read`, `Glob`, `Grep`, `Bash(git status:*)`, `Task`, `AskUserQuestion`
|
|
117
|
+
- `description`: Brief description (shows in /help)
|
|
118
|
+
- `argument-hint`: Help text for arguments
|
|
119
|
+
- `model`: Specific model to use
|
|
120
|
+
|
|
121
|
+
## Best Practices
|
|
122
|
+
|
|
123
|
+
### Safe Commands (No Security Issues)
|
|
124
|
+
|
|
125
|
+
```markdown
|
|
126
|
+
# System prompt editor (file reference only)
|
|
127
|
+
(@)path/to/system/prompt.md
|
|
128
|
+
|
|
129
|
+
Edit your system prompt above.
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Project-Specific Commands (Bash OK)
|
|
133
|
+
|
|
134
|
+
```markdown
|
|
135
|
+
---
|
|
136
|
+
allowed-tools: Bash(git status:*), Bash(npm list:*)
|
|
137
|
+
---
|
|
138
|
+
Current git status: (!)git status(`)
|
|
139
|
+
Package info: (!)npm list --depth=0(`)
|
|
140
|
+
|
|
141
|
+
Review project state and suggest next steps.
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Cross-Directory File Access (Use @ not !)
|
|
145
|
+
|
|
146
|
+
```markdown
|
|
147
|
+
# Compare config files
|
|
148
|
+
Compare (@)path/to/system.md with (@)project/config.md
|
|
149
|
+
|
|
150
|
+
Show differences and suggest improvements.
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Usage
|
|
154
|
+
|
|
155
|
+
After creating: `/<command-name> [arguments]`
|
|
156
|
+
|
|
157
|
+
Example: `/review` or `/ai:gpt5 "explain this code"`
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
## 🛡 Project Rules (Injected into every command)
|
|
161
|
+
|
|
162
|
+
1. **NO BROKEN BUILDS:**
|
|
163
|
+
- Run `pnpm test` before every `/commit`
|
|
164
|
+
- Ensure all tests pass
|
|
165
|
+
- Fix any type errors immediately
|
|
166
|
+
|
|
167
|
+
2. **API DEVELOPMENT:**
|
|
168
|
+
- All new APIs MUST have Zod request/response schemas
|
|
169
|
+
- All APIs MUST be documented in both:
|
|
170
|
+
- OpenAPI spec ([src/lib/openapi/](src/lib/openapi/))
|
|
171
|
+
- API test manifest ([src/app/api-test/api-tests-manifest.json](src/app/api-test/api-tests-manifest.json))
|
|
172
|
+
- Test ALL parameters and edge cases
|
|
173
|
+
- Include code examples and real-world outputs
|
|
174
|
+
|
|
175
|
+
3. **TDD WORKFLOW:**
|
|
176
|
+
- ALWAYS use /red → /green → /refactor cycle
|
|
177
|
+
- NEVER write implementation without failing test first
|
|
178
|
+
- Use /cycle for feature development
|
|
179
|
+
- Use characterization tests for refactoring
|
|
180
|
+
|
|
181
|
+
4. **API KEY MANAGEMENT:**
|
|
182
|
+
- Support three loading methods:
|
|
183
|
+
- Server environment variables
|
|
184
|
+
- NEXT_PUBLIC_ variables (client-side)
|
|
185
|
+
- Custom headers (X-OpenAI-Key, X-Anthropic-Key, etc.)
|
|
186
|
+
- Never hardcode API keys
|
|
187
|
+
- Always validate key availability before use
|
|
188
|
+
|
|
189
|
+
5. **COMPREHENSIVE TESTING:**
|
|
190
|
+
- When researching APIs, read actual implementation code
|
|
191
|
+
- Discover ALL possible parameters (not just documented ones)
|
|
192
|
+
- Test with various parameter combinations
|
|
193
|
+
- Document custom headers, query params, request/response schemas
|
|
194
|
+
- Include validation rules and testing notes
|
|
195
|
+
|
|
196
|
+
6. **NO UI BLOAT:**
|
|
197
|
+
- This is an API project with minimal frontend
|
|
198
|
+
- Only keep necessary test/documentation interfaces
|
|
199
|
+
- Delete unused components immediately
|
|
200
|
+
- No unnecessary UI libraries or features
|
|
201
|
+
|
|
202
|
+
7. **DOCUMENTATION:**
|
|
203
|
+
- If you change an API, you MUST update:
|
|
204
|
+
- OpenAPI spec
|
|
205
|
+
- api-tests-manifest.json
|
|
206
|
+
- Code examples
|
|
207
|
+
- Testing notes
|
|
208
|
+
- Document expected behavior and edge cases
|
|
209
|
+
- Include real-world output examples
|