@hustle-together/api-dev-tools 3.10.1 → 3.12.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/agents/code-reviewer.md +170 -0
- package/.claude/agents/docs-generator.md +80 -0
- package/.claude/agents/implementation-reviewer.md +119 -0
- package/.claude/agents/parallel-researcher.md +52 -0
- package/.claude/agents/research-validator.md +116 -0
- package/.claude/agents/schema-generator.md +70 -0
- package/.claude/agents/test-writer.md +104 -0
- package/.claude/api-dev-state.json +331 -0
- package/.claude/commands/README.md +196 -0
- package/.claude/commands/add-command.md +212 -0
- package/.claude/commands/api-create.md +510 -0
- package/.claude/commands/api-env.md +51 -0
- package/.claude/commands/api-interview.md +344 -0
- package/.claude/commands/api-research.md +357 -0
- package/.claude/commands/api-status.md +279 -0
- package/.claude/commands/api-verify.md +232 -0
- package/.claude/commands/beepboop.md +96 -0
- package/.claude/commands/busycommit.md +111 -0
- package/.claude/commands/commit.md +82 -0
- package/.claude/commands/cycle.md +137 -0
- package/.claude/commands/gap.md +85 -0
- package/.claude/commands/green.md +137 -0
- package/.claude/commands/issue.md +187 -0
- package/.claude/commands/ntfy-setup.md +91 -0
- package/.claude/commands/ntfy-test.md +74 -0
- package/.claude/commands/plan.md +167 -0
- package/.claude/commands/pr.md +121 -0
- package/.claude/commands/publish.md +40 -0
- package/.claude/commands/red.md +137 -0
- package/.claude/commands/refactor.md +137 -0
- package/.claude/commands/spike.md +137 -0
- package/.claude/commands/summarize.md +93 -0
- package/.claude/commands/tdd.md +139 -0
- package/.claude/commands/worktree-add.md +307 -0
- package/.claude/commands/worktree-cleanup.md +275 -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 +144 -0
- package/.claude/settings.local.json +12 -0
- package/.claude-plugin/marketplace.json +103 -0
- package/.skills/README.md +293 -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 +227 -0
- package/.skills/api-create/SKILL.md +623 -0
- package/.skills/api-env/SKILL.md +64 -0
- package/.skills/api-interview/SKILL.md +357 -0
- package/.skills/api-research/SKILL.md +370 -0
- package/.skills/api-status/SKILL.md +292 -0
- package/.skills/api-verify/SKILL.md +245 -0
- package/.skills/beepboop/SKILL.md +111 -0
- package/.skills/busycommit/SKILL.md +126 -0
- package/.skills/commit/SKILL.md +97 -0
- package/.skills/cycle/SKILL.md +152 -0
- package/.skills/gap/SKILL.md +100 -0
- package/.skills/green/SKILL.md +152 -0
- package/.skills/issue/SKILL.md +202 -0
- package/.skills/plan/SKILL.md +182 -0
- package/.skills/pr/SKILL.md +136 -0
- package/.skills/publish/SKILL.md +160 -0
- package/.skills/red/SKILL.md +152 -0
- package/.skills/refactor/SKILL.md +152 -0
- package/.skills/spike/SKILL.md +152 -0
- package/.skills/summarize/SKILL.md +108 -0
- package/.skills/tdd/SKILL.md +154 -0
- package/.skills/update-todos/SKILL.md +250 -0
- package/.skills/worktree-add/SKILL.md +322 -0
- package/.skills/worktree-cleanup/SKILL.md +290 -0
- package/CHANGELOG.md +115 -0
- package/README.md +161 -7101
- package/bin/cli.js +448 -805
- package/commands/README.md +66 -31
- package/commands/add-command.md +8 -5
- package/commands/beepboop.md +4 -5
- package/commands/busycommit.md +2 -3
- package/commands/commit.md +2 -3
- package/commands/cycle.md +2 -7
- package/commands/gap.md +2 -3
- package/commands/green.md +2 -7
- package/commands/hustle-api-continue.md +8 -5
- package/commands/hustle-api-create.md +70 -29
- package/commands/hustle-api-env.md +1 -0
- package/commands/hustle-api-interview.md +32 -19
- package/commands/hustle-api-research.md +47 -21
- package/commands/hustle-api-sessions.md +8 -7
- package/commands/hustle-api-status.md +21 -1
- package/commands/hustle-api-verify.md +14 -13
- package/commands/hustle-combine.md +488 -241
- package/commands/hustle-ui-create-page.md +113 -50
- package/commands/hustle-ui-create.md +179 -26
- package/commands/issue.md +3 -8
- package/commands/plan.md +2 -3
- package/commands/pr.md +2 -3
- package/commands/red.md +2 -7
- package/commands/refactor.md +2 -7
- package/commands/spike.md +2 -7
- package/commands/summarize.md +2 -3
- package/commands/tdd.md +2 -7
- package/commands/worktree-add.md +208 -216
- package/commands/worktree-cleanup.md +172 -178
- package/hooks/api-workflow-check.py +5 -3
- package/hooks/enforce-component-type-confirm.py +97 -0
- package/hooks/lib/__init__.py +1 -0
- package/hooks/lib/greptile.py +355 -0
- package/hooks/lib/ntfy.py +209 -0
- package/hooks/notify-input-needed.py +73 -0
- package/hooks/notify-phase-complete.py +90 -0
- package/hooks/run-code-review.py +246 -0
- package/hooks/track-token-usage.py +121 -0
- package/package.json +33 -12
- package/scripts/collect-test-results.ts +102 -77
- package/scripts/extract-parameters.ts +112 -70
- package/scripts/generate-test-manifest.ts +118 -77
- package/templates/.env.example +57 -0
- package/templates/BRAND_GUIDE.md +92 -52
- package/templates/CLAUDE-SECTION.md +40 -37
- package/templates/SPEC.json +186 -38
- package/templates/api-dev-state.json +33 -4
- package/templates/api-showcase/_components/APICard.tsx +22 -18
- package/templates/api-showcase/_components/APIModal.tsx +110 -64
- package/templates/api-showcase/_components/APIShowcase.tsx +53 -35
- package/templates/api-showcase/_components/APITester.tsx +128 -67
- package/templates/api-showcase/page.tsx +4 -4
- package/templates/api-test/page.tsx +51 -30
- package/templates/api-test/test-structure/route.ts +43 -34
- package/templates/component/Component.stories.tsx +41 -39
- package/templates/component/Component.test.tsx +96 -78
- package/templates/component/Component.tsx +63 -52
- package/templates/component/Component.types.ts +10 -6
- package/templates/component/Component.visual.spec.ts +170 -0
- package/templates/component/index.ts +2 -2
- package/templates/dev-tools/_components/DevToolsLanding.tsx +8 -8
- package/templates/dev-tools/page.tsx +4 -3
- package/templates/mcp-servers.json +30 -2
- package/templates/page/page.e2e.test.ts +56 -48
- package/templates/page/page.tsx +3 -3
- package/templates/shared/HeroHeader.tsx +16 -15
- package/templates/shared/index.ts +1 -1
- package/templates/ui-showcase/_components/PreviewCard.tsx +20 -20
- package/templates/ui-showcase/_components/PreviewModal.tsx +149 -108
- package/templates/ui-showcase/_components/UIShowcase.tsx +43 -35
- package/templates/ui-showcase/page.tsx +4 -4
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-writer
|
|
3
|
+
description: Test case generator from schemas and interview decisions. Use during Phase 8 (TDD Red) to create comprehensive failing tests before implementation.
|
|
4
|
+
tools: Read, Write, Grep, Glob
|
|
5
|
+
model: sonnet
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Test Writer Agent
|
|
9
|
+
|
|
10
|
+
You are a TDD specialist that writes comprehensive, failing tests based on schemas and interview decisions.
|
|
11
|
+
|
|
12
|
+
## Your Role
|
|
13
|
+
|
|
14
|
+
1. **Analyze schemas** - Understand request/response structure
|
|
15
|
+
2. **Apply interview decisions** - Test user-specified behaviors
|
|
16
|
+
3. **Write failing tests** - Tests that define expected behavior
|
|
17
|
+
4. **Cover edge cases** - Error handling, validation, edge cases
|
|
18
|
+
|
|
19
|
+
## Input Format
|
|
20
|
+
|
|
21
|
+
You will receive:
|
|
22
|
+
|
|
23
|
+
- Zod schemas for request/response
|
|
24
|
+
- Interview decisions (error handling, formats, etc.)
|
|
25
|
+
- Target test file path
|
|
26
|
+
- Endpoint path and method
|
|
27
|
+
|
|
28
|
+
## Output Format
|
|
29
|
+
|
|
30
|
+
Generate comprehensive test file:
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
34
|
+
import { NextRequest } from "next/server";
|
|
35
|
+
import { POST } from "../route";
|
|
36
|
+
|
|
37
|
+
describe("[Endpoint] API", () => {
|
|
38
|
+
describe("POST /api/v2/[endpoint]", () => {
|
|
39
|
+
// Happy path tests
|
|
40
|
+
it("should return data with valid request", async () => {
|
|
41
|
+
const request = new NextRequest("http://localhost/api/v2/endpoint", {
|
|
42
|
+
method: "POST",
|
|
43
|
+
body: JSON.stringify({
|
|
44
|
+
/* valid data */
|
|
45
|
+
}),
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const response = await POST(request);
|
|
49
|
+
const data = await response.json();
|
|
50
|
+
|
|
51
|
+
expect(response.status).toBe(200);
|
|
52
|
+
expect(data).toHaveProperty("result");
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// Validation tests
|
|
56
|
+
it("should return 400 for missing required fields", async () => {
|
|
57
|
+
const request = new NextRequest("http://localhost/api/v2/endpoint", {
|
|
58
|
+
method: "POST",
|
|
59
|
+
body: JSON.stringify({}),
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const response = await POST(request);
|
|
63
|
+
expect(response.status).toBe(400);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// Error handling tests (from interview)
|
|
67
|
+
it("should handle API errors gracefully", async () => {
|
|
68
|
+
// Mock external API failure
|
|
69
|
+
vi.spyOn(global, "fetch").mockRejectedValueOnce(new Error("API down"));
|
|
70
|
+
|
|
71
|
+
const request = new NextRequest("http://localhost/api/v2/endpoint", {
|
|
72
|
+
method: "POST",
|
|
73
|
+
body: JSON.stringify({
|
|
74
|
+
/* valid data */
|
|
75
|
+
}),
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const response = await POST(request);
|
|
79
|
+
expect(response.status).toBe(500);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
// Format tests (from interview)
|
|
83
|
+
it("should return requested format", async () => {
|
|
84
|
+
// Test based on interview format decisions
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Test Categories
|
|
91
|
+
|
|
92
|
+
1. **Happy Path** - Valid requests return expected data
|
|
93
|
+
2. **Validation** - Invalid input returns 400 with helpful message
|
|
94
|
+
3. **Error Handling** - API failures handled per interview decisions
|
|
95
|
+
4. **Authentication** - API key handling
|
|
96
|
+
5. **Edge Cases** - Empty data, nulls, large payloads
|
|
97
|
+
|
|
98
|
+
## Guidelines
|
|
99
|
+
|
|
100
|
+
1. **Tests MUST fail initially** - Implementation doesn't exist yet
|
|
101
|
+
2. **One assertion per test** - Clear failure messages
|
|
102
|
+
3. **Use interview decisions** - Error strategy, formats, etc.
|
|
103
|
+
4. **Mock external APIs** - Don't make real API calls in tests
|
|
104
|
+
5. **Cover 100%** - Every schema field should be tested
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "3.12.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
|
+
"timestamp": "2025-12-27T22:31:26.336088",
|
|
69
|
+
"prompt_preview": "1. CREATE PR\n - Go to GitHub: https://github.com/hustle-together/api-dev-tools\n - Create PR from...",
|
|
70
|
+
"detection": {
|
|
71
|
+
"detected": true,
|
|
72
|
+
"terms": [
|
|
73
|
+
"create pr",
|
|
74
|
+
"update version (i can do this for you now)",
|
|
75
|
+
"api",
|
|
76
|
+
"package",
|
|
77
|
+
"test",
|
|
78
|
+
"publish",
|
|
79
|
+
"@hustle-together/api-dev-tools",
|
|
80
|
+
"1.0.0",
|
|
81
|
+
"3.12.0",
|
|
82
|
+
"package.json"
|
|
83
|
+
],
|
|
84
|
+
"patterns_matched": [
|
|
85
|
+
"always_research",
|
|
86
|
+
"question_pattern",
|
|
87
|
+
"technical_term"
|
|
88
|
+
],
|
|
89
|
+
"confidence": "critical"
|
|
90
|
+
},
|
|
91
|
+
"injected": true
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"timestamp": "2025-12-27T22:32:03.480897",
|
|
95
|
+
"prompt_preview": "File Purpose\nworkflow-demo.html (247KB) Main interactive workflow demo\nexecution-trace-COMPREH...",
|
|
96
|
+
"detection": {
|
|
97
|
+
"detected": true,
|
|
98
|
+
"terms": [
|
|
99
|
+
"write integration demo",
|
|
100
|
+
"api",
|
|
101
|
+
"interview-driven-api"
|
|
102
|
+
],
|
|
103
|
+
"patterns_matched": [
|
|
104
|
+
"question_pattern",
|
|
105
|
+
"always_research",
|
|
106
|
+
"technical_term"
|
|
107
|
+
],
|
|
108
|
+
"confidence": "critical"
|
|
109
|
+
},
|
|
110
|
+
"injected": true
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"timestamp": "2025-12-27T22:35:36.217406",
|
|
114
|
+
"prompt_preview": "> File Purpose\nworkflow-demo.html (247KB) Main interactive workflow demo\nexecution-trace-COMPR...",
|
|
115
|
+
"detection": {
|
|
116
|
+
"detected": true,
|
|
117
|
+
"terms": [
|
|
118
|
+
"write integration demo",
|
|
119
|
+
"api",
|
|
120
|
+
"view",
|
|
121
|
+
"interview-driven-api"
|
|
122
|
+
],
|
|
123
|
+
"patterns_matched": [
|
|
124
|
+
"technical_term",
|
|
125
|
+
"question_pattern",
|
|
126
|
+
"always_research"
|
|
127
|
+
],
|
|
128
|
+
"confidence": "critical"
|
|
129
|
+
},
|
|
130
|
+
"injected": true
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"timestamp": "2025-12-27T22:36:41.163781",
|
|
134
|
+
"prompt_preview": "how do i merge it i am on the comment page ",
|
|
135
|
+
"detection": {
|
|
136
|
+
"detected": true,
|
|
137
|
+
"terms": [
|
|
138
|
+
"how do"
|
|
139
|
+
],
|
|
140
|
+
"patterns_matched": [
|
|
141
|
+
"always_research",
|
|
142
|
+
"question_pattern"
|
|
143
|
+
],
|
|
144
|
+
"confidence": "critical"
|
|
145
|
+
},
|
|
146
|
+
"injected": true
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"timestamp": "2025-12-27T22:40:21.674198",
|
|
150
|
+
"prompt_preview": "ok i did it check the main now please",
|
|
151
|
+
"detection": {
|
|
152
|
+
"detected": false,
|
|
153
|
+
"terms": [],
|
|
154
|
+
"patterns_matched": [],
|
|
155
|
+
"confidence": "none"
|
|
156
|
+
},
|
|
157
|
+
"injected": false
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"timestamp": "2025-12-27T22:43:21.172124",
|
|
161
|
+
"prompt_preview": "wait was the github master updated witht he most current push?",
|
|
162
|
+
"detection": {
|
|
163
|
+
"detected": true,
|
|
164
|
+
"terms": [],
|
|
165
|
+
"patterns_matched": [],
|
|
166
|
+
"confidence": "low"
|
|
167
|
+
},
|
|
168
|
+
"injected": true
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"timestamp": "2025-12-27T22:45:59.739199",
|
|
172
|
+
"prompt_preview": "ok now update the npm package, make a skill for this as well based on my api-dev-tools and mcp if th...",
|
|
173
|
+
"detection": {
|
|
174
|
+
"detected": true,
|
|
175
|
+
"terms": [
|
|
176
|
+
"update the npm package, make a skill for this as w",
|
|
177
|
+
"package",
|
|
178
|
+
"api"
|
|
179
|
+
],
|
|
180
|
+
"patterns_matched": [
|
|
181
|
+
"always_research",
|
|
182
|
+
"technical_term",
|
|
183
|
+
"question_pattern"
|
|
184
|
+
],
|
|
185
|
+
"confidence": "critical"
|
|
186
|
+
},
|
|
187
|
+
"injected": true
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"timestamp": "2025-12-27T22:49:36.519292",
|
|
191
|
+
"prompt_preview": "/Users/alfonso/Documents/GitHub/api-dev-tools/demo/hustle-together/workflow-demo-backup-20251212-134...",
|
|
192
|
+
"detection": {
|
|
193
|
+
"detected": true,
|
|
194
|
+
"terms": [
|
|
195
|
+
"api",
|
|
196
|
+
"0.0.1"
|
|
197
|
+
],
|
|
198
|
+
"patterns_matched": [
|
|
199
|
+
"always_research",
|
|
200
|
+
"technical_term"
|
|
201
|
+
],
|
|
202
|
+
"confidence": "critical"
|
|
203
|
+
},
|
|
204
|
+
"injected": true
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"timestamp": "2025-12-27T22:52:43.366799",
|
|
208
|
+
"prompt_preview": "help me use that publish skill how do i get that code?",
|
|
209
|
+
"detection": {
|
|
210
|
+
"detected": true,
|
|
211
|
+
"terms": [
|
|
212
|
+
"how do",
|
|
213
|
+
"publish"
|
|
214
|
+
],
|
|
215
|
+
"patterns_matched": [
|
|
216
|
+
"technical_term",
|
|
217
|
+
"always_research",
|
|
218
|
+
"question_pattern"
|
|
219
|
+
],
|
|
220
|
+
"confidence": "critical"
|
|
221
|
+
},
|
|
222
|
+
"injected": true
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"timestamp": "2025-12-27T22:53:54.327491",
|
|
226
|
+
"prompt_preview": "id rather use the terminal command to open the pafge",
|
|
227
|
+
"detection": {
|
|
228
|
+
"detected": true,
|
|
229
|
+
"terms": [],
|
|
230
|
+
"patterns_matched": [],
|
|
231
|
+
"confidence": "low"
|
|
232
|
+
},
|
|
233
|
+
"injected": true
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"timestamp": "2025-12-27T22:58:35.375132",
|
|
237
|
+
"prompt_preview": "No no, I use a secret key, so you just open my page for me, and I just gave it access by using my se...",
|
|
238
|
+
"detection": {
|
|
239
|
+
"detected": true,
|
|
240
|
+
"terms": [
|
|
241
|
+
"secret",
|
|
242
|
+
"key"
|
|
243
|
+
],
|
|
244
|
+
"patterns_matched": [
|
|
245
|
+
"technical_term"
|
|
246
|
+
],
|
|
247
|
+
"confidence": "high"
|
|
248
|
+
},
|
|
249
|
+
"injected": true
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
"timestamp": "2025-12-27T22:59:14.000695",
|
|
253
|
+
"prompt_preview": "No, that's dumb. Normally you just give me some commands that I run in terminal and they just work.N...",
|
|
254
|
+
"detection": {
|
|
255
|
+
"detected": true,
|
|
256
|
+
"terms": [
|
|
257
|
+
"publish"
|
|
258
|
+
],
|
|
259
|
+
"patterns_matched": [
|
|
260
|
+
"technical_term",
|
|
261
|
+
"question_pattern"
|
|
262
|
+
],
|
|
263
|
+
"confidence": "high"
|
|
264
|
+
},
|
|
265
|
+
"injected": true
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
"timestamp": "2025-12-27T22:59:56.192298",
|
|
269
|
+
"prompt_preview": " npm login run that and i will tap the security code access then you can run the publish command",
|
|
270
|
+
"detection": {
|
|
271
|
+
"detected": true,
|
|
272
|
+
"terms": [
|
|
273
|
+
"publish"
|
|
274
|
+
],
|
|
275
|
+
"patterns_matched": [
|
|
276
|
+
"technical_term"
|
|
277
|
+
],
|
|
278
|
+
"confidence": "high"
|
|
279
|
+
},
|
|
280
|
+
"injected": true
|
|
281
|
+
}
|
|
282
|
+
],
|
|
283
|
+
"phases": {
|
|
284
|
+
"disambiguation": {
|
|
285
|
+
"status": "not_started"
|
|
286
|
+
},
|
|
287
|
+
"scope": {
|
|
288
|
+
"status": "not_started"
|
|
289
|
+
},
|
|
290
|
+
"research_initial": {
|
|
291
|
+
"status": "not_started"
|
|
292
|
+
},
|
|
293
|
+
"interview": {
|
|
294
|
+
"status": "not_started"
|
|
295
|
+
},
|
|
296
|
+
"research_deep": {
|
|
297
|
+
"status": "not_started"
|
|
298
|
+
},
|
|
299
|
+
"schema_creation": {
|
|
300
|
+
"status": "not_started"
|
|
301
|
+
},
|
|
302
|
+
"environment_check": {
|
|
303
|
+
"status": "not_started"
|
|
304
|
+
},
|
|
305
|
+
"tdd_red": {
|
|
306
|
+
"status": "not_started"
|
|
307
|
+
},
|
|
308
|
+
"tdd_green": {
|
|
309
|
+
"status": "not_started"
|
|
310
|
+
},
|
|
311
|
+
"verify": {
|
|
312
|
+
"status": "not_started"
|
|
313
|
+
},
|
|
314
|
+
"tdd_refactor": {
|
|
315
|
+
"status": "not_started"
|
|
316
|
+
},
|
|
317
|
+
"documentation": {
|
|
318
|
+
"status": "not_started"
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
"verification": {
|
|
322
|
+
"all_sources_fetched": false,
|
|
323
|
+
"schema_matches_docs": false,
|
|
324
|
+
"tests_cover_params": false,
|
|
325
|
+
"all_tests_passing": false,
|
|
326
|
+
"coverage_percent": null,
|
|
327
|
+
"post_green_verification": false
|
|
328
|
+
},
|
|
329
|
+
"research_index": {},
|
|
330
|
+
"reground_history": []
|
|
331
|
+
}
|
|
@@ -0,0 +1,196 @@
|
|
|
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
|
+
|
|
34
|
+
- Runs all 13 phases automatically
|
|
35
|
+
- Loop-back architecture at every checkpoint
|
|
36
|
+
- See [api-create.md](api-create.md) for full flow
|
|
37
|
+
|
|
38
|
+
### Individual Phases
|
|
39
|
+
|
|
40
|
+
**`/api-interview [endpoint-name]`**
|
|
41
|
+
|
|
42
|
+
- Questions GENERATED from research findings
|
|
43
|
+
- Different question types: enum, continuous, boolean
|
|
44
|
+
- See [api-interview.md](api-interview.md)
|
|
45
|
+
|
|
46
|
+
**`/api-research [library-or-service]`**
|
|
47
|
+
|
|
48
|
+
- Adaptive propose-approve flow (not shotgun)
|
|
49
|
+
- Research cached with 7-day freshness
|
|
50
|
+
- See [api-research.md](api-research.md)
|
|
51
|
+
|
|
52
|
+
**`/api-verify [endpoint-name]`** (NEW)
|
|
53
|
+
|
|
54
|
+
- Manual Phase 10 verification
|
|
55
|
+
- Re-read docs, compare to implementation
|
|
56
|
+
- Report gaps, loop back or document omissions
|
|
57
|
+
- See [api-verify.md](api-verify.md)
|
|
58
|
+
|
|
59
|
+
**`/api-env [endpoint-name]`**
|
|
60
|
+
|
|
61
|
+
- Check API keys and environment
|
|
62
|
+
- See [api-env.md](api-env.md)
|
|
63
|
+
|
|
64
|
+
**`/api-status [endpoint-name]`**
|
|
65
|
+
|
|
66
|
+
- Track progress through 13 phases
|
|
67
|
+
- See [api-status.md](api-status.md)
|
|
68
|
+
|
|
69
|
+
### TDD Commands
|
|
70
|
+
|
|
71
|
+
From [@wbern/claude-instructions](https://github.com/wbern/claude-instructions):
|
|
72
|
+
|
|
73
|
+
- `/red` - Write ONE failing test
|
|
74
|
+
- `/green` - Minimal implementation to pass
|
|
75
|
+
- `/refactor` - Clean up while tests pass
|
|
76
|
+
- `/cycle [description]` - Full Red → Green → Refactor
|
|
77
|
+
|
|
78
|
+
## 13-Phase Flow
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
Phase 1: DISAMBIGUATION - Clarify ambiguous terms
|
|
82
|
+
Phase 2: SCOPE - Confirm understanding
|
|
83
|
+
Phase 3: INITIAL RESEARCH - 2-3 targeted searches
|
|
84
|
+
Phase 4: INTERVIEW - Questions FROM research
|
|
85
|
+
Phase 5: DEEP RESEARCH - Adaptive propose-approve
|
|
86
|
+
Phase 6: SCHEMA - Zod from research + interview
|
|
87
|
+
Phase 7: ENVIRONMENT - Verify API keys
|
|
88
|
+
Phase 8: TDD RED - Write failing tests
|
|
89
|
+
Phase 9: TDD GREEN - Minimal implementation
|
|
90
|
+
Phase 10: VERIFY - Re-research, find gaps
|
|
91
|
+
Phase 11: TDD REFACTOR - Clean up code
|
|
92
|
+
Phase 12: DOCUMENTATION - Update manifests
|
|
93
|
+
Phase 13: COMPLETION - Final verification
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## State File
|
|
97
|
+
|
|
98
|
+
All progress tracked in `.claude/api-dev-state.json`:
|
|
99
|
+
|
|
100
|
+
```json
|
|
101
|
+
{
|
|
102
|
+
"version": "3.0.0",
|
|
103
|
+
"endpoint": "brandfetch",
|
|
104
|
+
"turn_count": 23,
|
|
105
|
+
"phases": {
|
|
106
|
+
"disambiguation": { "status": "complete" },
|
|
107
|
+
"scope": { "status": "complete" },
|
|
108
|
+
"research_initial": { "status": "complete" },
|
|
109
|
+
"interview": { "status": "complete", "decisions": {...} },
|
|
110
|
+
"research_deep": {
|
|
111
|
+
"proposed_searches": [...],
|
|
112
|
+
"approved_searches": [...],
|
|
113
|
+
"skipped_searches": [...]
|
|
114
|
+
},
|
|
115
|
+
"verify": {
|
|
116
|
+
"gaps_found": 2,
|
|
117
|
+
"gaps_fixed": 2,
|
|
118
|
+
"intentional_omissions": [...]
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"reground_history": [...]
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Research Cache
|
|
126
|
+
|
|
127
|
+
Research cached in `.claude/research/`:
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
.claude/research/
|
|
131
|
+
├── brandfetch/
|
|
132
|
+
│ ├── 2025-12-08_initial.md
|
|
133
|
+
│ ├── 2025-12-08_deep.md
|
|
134
|
+
│ └── CURRENT.md
|
|
135
|
+
└── index.json ← Freshness tracking (7-day validity)
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Quick Start
|
|
139
|
+
|
|
140
|
+
### Automated
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
/api-create my-endpoint
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Manual Step-by-Step
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
/api-research [library] # Initial research
|
|
150
|
+
/api-interview [endpoint] # Questions from research
|
|
151
|
+
/api-env [endpoint] # Verify environment
|
|
152
|
+
/red # Failing tests
|
|
153
|
+
/green # Make tests pass
|
|
154
|
+
/api-verify [endpoint] # Compare to docs
|
|
155
|
+
/refactor # Clean up
|
|
156
|
+
/commit # Semantic commit
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Installation
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
npx @hustle-together/api-dev-tools --scope=project
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Installs:
|
|
166
|
+
|
|
167
|
+
- Commands in `.claude/commands/`
|
|
168
|
+
- Hooks in `.claude/hooks/`
|
|
169
|
+
- Settings in `.claude/settings.json`
|
|
170
|
+
- State template in `.claude/api-dev-state.json`
|
|
171
|
+
- Research index in `.claude/research/index.json`
|
|
172
|
+
|
|
173
|
+
### Team-Wide
|
|
174
|
+
|
|
175
|
+
Add to `package.json`:
|
|
176
|
+
|
|
177
|
+
```json
|
|
178
|
+
{
|
|
179
|
+
"scripts": {
|
|
180
|
+
"postinstall": "npx @hustle-together/api-dev-tools --scope=project"
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Key Principles
|
|
186
|
+
|
|
187
|
+
1. **Loop Until Green** - Every verification loops back if not successful
|
|
188
|
+
2. **Continuous Interviews** - Checkpoints at EVERY phase transition
|
|
189
|
+
3. **Adaptive Research** - Propose based on context, not shotgun
|
|
190
|
+
4. **Self-Documenting** - State file captures everything
|
|
191
|
+
5. **Verify After Green** - Re-research to catch memory errors
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
**Version:** 3.0.0
|
|
196
|
+
**Last Updated:** 2025-12-08
|