@devobsessed/code-captain 0.0.9 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bin/install.js +13 -13
- package/claude-code/commands/cc-create-spec.md +627 -0
- package/copilot/README.md +27 -27
- package/copilot/prompts/create-adr.prompt.md +1 -1
- package/copilot/prompts/create-spec.prompt.md +1 -1
- package/copilot/prompts/edit-spec.prompt.md +1 -1
- package/copilot/prompts/execute-task.prompt.md +1 -1
- package/copilot/prompts/explain-code.prompt.md +1 -1
- package/copilot/prompts/initialize.prompt.md +1 -1
- package/copilot/prompts/new-command.prompt.md +3 -3
- package/copilot/prompts/plan-product.prompt.md +1 -1
- package/copilot/prompts/research.prompt.md +1 -1
- package/copilot/prompts/status.prompt.md +1 -1
- package/copilot/prompts/swab.prompt.md +1 -1
- package/cursor/cc.mdc +45 -0
- package/manifest.json +101 -93
- package/package.json +1 -1
- /package/copilot/{chatmodes/Code Captain.chatmode.md → agents/Code Captain.agent.md} +0 -0
|
@@ -0,0 +1,627 @@
|
|
|
1
|
+
# Enhanced Create Spec Command (create-spec)
|
|
2
|
+
|
|
3
|
+
## Command: `create-spec`
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Generate comprehensive feature specifications using a contract-first approach that ensures complete alignment between developer and AI before creating any supporting files. This command eliminates presumptuous file creation by establishing a clear "contract" through structured clarification rounds.
|
|
8
|
+
|
|
9
|
+
## Command Process
|
|
10
|
+
|
|
11
|
+
### Phase 1: Contract Establishment (No File Creation)
|
|
12
|
+
|
|
13
|
+
**Mission Statement:**
|
|
14
|
+
|
|
15
|
+
> Your goal is to turn my rough feature idea into a very clear work specification. You will deliver the complete spec package only after we both agree on the requirements contract. **Important: Challenge ideas that don't make technical or business sense - it's better to surface concerns early than build the wrong thing.**
|
|
16
|
+
|
|
17
|
+
#### Step 1.1: Initial Context Scan
|
|
18
|
+
|
|
19
|
+
- Scan existing `.code-captain/specs/` for related specifications
|
|
20
|
+
- Analyze current codebase architecture and patterns using `Grep`, `Glob`, and `Task` tools
|
|
21
|
+
- Load project context files (`tech-stack.md`, `code-style.md`, `objective.md`)
|
|
22
|
+
- **Output:** Context summary (no files created yet)
|
|
23
|
+
|
|
24
|
+
#### Step 1.2: Gap Analysis & Silent Enumeration
|
|
25
|
+
|
|
26
|
+
**Internal Process (not shown to user):**
|
|
27
|
+
|
|
28
|
+
- Silently list every missing fact, constraint, or requirement
|
|
29
|
+
- Identify ambiguities in the initial description
|
|
30
|
+
- Note potential integration points and dependencies
|
|
31
|
+
- Catalog unknowns across these domains:
|
|
32
|
+
- Purpose & business value
|
|
33
|
+
- Target audience & user personas
|
|
34
|
+
- Technical constraints & requirements
|
|
35
|
+
- Success criteria & acceptance tests
|
|
36
|
+
- Scope boundaries (in/out of scope)
|
|
37
|
+
- UI/UX requirements & design constraints
|
|
38
|
+
- Performance & scalability needs
|
|
39
|
+
- Security & compliance requirements
|
|
40
|
+
- Integration points with existing systems
|
|
41
|
+
- Risk tolerance & implementation approach
|
|
42
|
+
|
|
43
|
+
#### Step 1.3: Structured Clarification Loop
|
|
44
|
+
|
|
45
|
+
**Rules:**
|
|
46
|
+
|
|
47
|
+
- Ask ONE focused question at a time
|
|
48
|
+
- After each answer, re-scan codebase for additional context if relevant
|
|
49
|
+
- Continue until reaching 95% confidence on deliverable
|
|
50
|
+
- Each question should target the highest-impact unknown
|
|
51
|
+
- **Never declare "final question"** - let the conversation flow naturally
|
|
52
|
+
- Let the user signal when they're ready to lock the contract
|
|
53
|
+
- **Challenge ideas that don't make technical or business sense** - better to surface concerns early than build the wrong thing
|
|
54
|
+
|
|
55
|
+
**Critical Analysis Responsibility:**
|
|
56
|
+
|
|
57
|
+
- If requirements seem technically infeasible with current architecture, explain why and suggest alternatives
|
|
58
|
+
- If scope seems too large for a single feature, recommend breaking it down
|
|
59
|
+
- If user requests conflict with existing patterns found in codebase, point out the inconsistency
|
|
60
|
+
- If business logic doesn't align with stated user value, ask clarifying questions
|
|
61
|
+
- If performance/security/scalability concerns arise, surface them proactively
|
|
62
|
+
|
|
63
|
+
**Pushback Phrasing Examples:**
|
|
64
|
+
|
|
65
|
+
- "I see a potential issue with [requirement] because [technical reason]. Would [alternative approach] work better?"
|
|
66
|
+
- "Based on your existing codebase, [proposed approach] might conflict with [existing pattern]. How should we handle this?"
|
|
67
|
+
- "The scope you're describing sounds like it might be 3-4 separate features. Should we focus on [core piece] first?"
|
|
68
|
+
- "I'm concerned that [requirement] could create [specific problem]. Have you considered [alternative]?"
|
|
69
|
+
|
|
70
|
+
**Question Categories (examples):**
|
|
71
|
+
|
|
72
|
+
- "What specific user problem does this solve, and who experiences it?"
|
|
73
|
+
- "Should this integrate with [existing system found in codebase], or remain separate?"
|
|
74
|
+
- "What does 'success' look like - how will we measure if this works?"
|
|
75
|
+
- "Are there performance requirements (response time, throughput, scale)?"
|
|
76
|
+
- "What UI/UX constraints exist - web only, mobile responsive, accessibility needs?"
|
|
77
|
+
- "What's your risk tolerance - prefer stable/proven approaches or cutting-edge solutions?"
|
|
78
|
+
|
|
79
|
+
**Transition to Contract:**
|
|
80
|
+
|
|
81
|
+
- When confidence is high, present contract without declaring it "final"
|
|
82
|
+
- Use phrases like "I think I have enough to create a solid contract" or "Based on our discussion, here's what I understand"
|
|
83
|
+
- Always leave room for more questions if needed
|
|
84
|
+
|
|
85
|
+
#### Step 1.4: Echo Check (Contract Proposal)
|
|
86
|
+
|
|
87
|
+
When confident, present a contract proposal with any concerns surfaced:
|
|
88
|
+
|
|
89
|
+
**Format:**
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
## Specification Contract
|
|
93
|
+
|
|
94
|
+
**Deliverable:** [One clear sentence describing what will be built]
|
|
95
|
+
|
|
96
|
+
**Must Include:** [Critical requirement that makes this valuable]
|
|
97
|
+
|
|
98
|
+
**Hardest Constraint:** [Biggest technical/business limitation to navigate]
|
|
99
|
+
|
|
100
|
+
**Success Criteria:** [How we'll know it's working correctly]
|
|
101
|
+
|
|
102
|
+
**Scope Boundaries:**
|
|
103
|
+
- Included: [2-3 key features]
|
|
104
|
+
- Excluded: [2-3 things we won't build]
|
|
105
|
+
|
|
106
|
+
**Technical Concerns (if any):**
|
|
107
|
+
- [Specific concern about feasibility, performance, or architecture]
|
|
108
|
+
- [Suggested alternative or mitigation approach]
|
|
109
|
+
|
|
110
|
+
**Recommendations:**
|
|
111
|
+
- [Suggestions for improving the approach based on codebase analysis]
|
|
112
|
+
- [Ways to reduce risk or complexity]
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
Options:
|
|
116
|
+
- Type 'yes' to lock this contract and create the spec package
|
|
117
|
+
- Type 'edit: [your changes]' to modify the contract
|
|
118
|
+
- Type 'risks' to explore potential implementation risks in detail
|
|
119
|
+
- Type 'blueprint' to see the planned folder structure and documents
|
|
120
|
+
- Ask more questions if anything needs clarification
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Phase 2: Spec Package Creation (Post-Agreement Only)
|
|
124
|
+
|
|
125
|
+
**Triggered only after user confirms contract with 'yes'**
|
|
126
|
+
|
|
127
|
+
#### Step 2.1: Initialize Tracking
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
# Use TodoWrite to track creation process
|
|
131
|
+
1. Get current date and create spec folder structure
|
|
132
|
+
2. Generate core specification document
|
|
133
|
+
3. Create user stories with acceptance criteria
|
|
134
|
+
4. Generate technical sub-specifications
|
|
135
|
+
5. Create implementation task breakdown
|
|
136
|
+
6. Present package for user review and validation
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
#### Step 2.2: Determine Current Date
|
|
140
|
+
|
|
141
|
+
Get current date by running: `npx @devobsessed/code-captain date`
|
|
142
|
+
|
|
143
|
+
This returns the current date in `YYYY-MM-DD` format for folder naming:
|
|
144
|
+
`.code-captain/specs/[DATE]-[feature-name]/`
|
|
145
|
+
|
|
146
|
+
#### Step 2.3: Create Directory Structure
|
|
147
|
+
|
|
148
|
+
**Generated folder (using determined date):**
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
.code-captain/specs/[DATE]-{feature-name}/
|
|
152
|
+
├── spec.md # Main specification (from contract)
|
|
153
|
+
├── spec-lite.md # Condensed version for AI context
|
|
154
|
+
├── user-stories/ # Individual user story files
|
|
155
|
+
│ ├── README.md # Overview and progress tracking
|
|
156
|
+
│ ├── story-1-{name}.md # Individual user story with focused tasks
|
|
157
|
+
│ ├── story-2-{name}.md # Each story kept small and manageable
|
|
158
|
+
│ └── story-N-{name}.md # Max 5-7 implementation tasks per story
|
|
159
|
+
└── sub-specs/ # Technical deep-dives
|
|
160
|
+
├── technical-spec.md # Architecture & implementation details
|
|
161
|
+
├── database-schema.md # Database changes (if needed)
|
|
162
|
+
├── api-spec.md # API documentation (if needed)
|
|
163
|
+
└── ui-wireframes.md # UI/UX specifications (if needed)
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
#### Step 2.4: Generate Core Documents
|
|
167
|
+
|
|
168
|
+
**spec.md** - Built directly from the locked contract:
|
|
169
|
+
|
|
170
|
+
```markdown
|
|
171
|
+
# [Feature Name] Specification
|
|
172
|
+
|
|
173
|
+
> Created: [DATE from Step 2.2 determination process]
|
|
174
|
+
> Status: Planning
|
|
175
|
+
> Contract Locked: Yes
|
|
176
|
+
|
|
177
|
+
## Contract Summary
|
|
178
|
+
|
|
179
|
+
[Echo check content verbatim]
|
|
180
|
+
|
|
181
|
+
## Detailed Requirements
|
|
182
|
+
|
|
183
|
+
[Expanded from clarification responses]
|
|
184
|
+
|
|
185
|
+
## Implementation Approach
|
|
186
|
+
|
|
187
|
+
[Technical strategy based on codebase analysis]
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**user-stories/ folder structure** - Individual user story files for better organization:
|
|
191
|
+
|
|
192
|
+
**user-stories/README.md** - Overview and progress tracking:
|
|
193
|
+
|
|
194
|
+
```markdown
|
|
195
|
+
# User Stories Overview
|
|
196
|
+
|
|
197
|
+
> **Specification:** [Feature Name] > **Created:** [DATE] > **Status:** Planning
|
|
198
|
+
|
|
199
|
+
## Stories Summary
|
|
200
|
+
|
|
201
|
+
| Story | Title | Status | Tasks | Progress |
|
|
202
|
+
| ----- | ------------- | ----------- | ----- | -------- |
|
|
203
|
+
| 1 | [Story title] | Not Started | 5 | 0/5 |
|
|
204
|
+
| 2 | [Story title] | Not Started | 4 | 0/4 |
|
|
205
|
+
| 3 | [Story title] | Not Started | 6 | 0/6 |
|
|
206
|
+
|
|
207
|
+
**Total Progress:** 0/15 tasks (0%)
|
|
208
|
+
|
|
209
|
+
## Story Dependencies
|
|
210
|
+
|
|
211
|
+
- Story 2 depends on Story 1 completion
|
|
212
|
+
- Story 3 can run parallel to Story 2
|
|
213
|
+
|
|
214
|
+
## Quick Links
|
|
215
|
+
|
|
216
|
+
- [Story 1: User Login](./story-1-user-login.md)
|
|
217
|
+
- [Story 2: Password Reset](./story-2-password-reset.md)
|
|
218
|
+
- [Story 3: Profile Management](./story-3-profile-management.md)
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
**user-stories/story-1-{name}.md** - Individual story files (max 5-7 tasks each):
|
|
222
|
+
|
|
223
|
+
```markdown
|
|
224
|
+
# Story 1: [Title from contract deliverable]
|
|
225
|
+
|
|
226
|
+
> **Status:** Not Started
|
|
227
|
+
> **Priority:** High
|
|
228
|
+
> **Dependencies:** None
|
|
229
|
+
|
|
230
|
+
## User Story
|
|
231
|
+
|
|
232
|
+
**As a** [user type from clarification]
|
|
233
|
+
**I want to** [action from contract]
|
|
234
|
+
**So that** [value from contract must-include]
|
|
235
|
+
|
|
236
|
+
## Acceptance Criteria
|
|
237
|
+
|
|
238
|
+
- [ ] Given [context], when [action], then [outcome]
|
|
239
|
+
- [ ] Given [context], when [action], then [outcome]
|
|
240
|
+
- [ ] Given [context], when [action], then [outcome]
|
|
241
|
+
|
|
242
|
+
## Implementation Tasks
|
|
243
|
+
|
|
244
|
+
- [ ] 1.1 Write tests for [specific component]
|
|
245
|
+
- [ ] 1.2 [Focused technical step]
|
|
246
|
+
- [ ] 1.3 [Focused technical step]
|
|
247
|
+
- [ ] 1.4 [Focused technical step]
|
|
248
|
+
- [ ] 1.5 Verify acceptance criteria are met
|
|
249
|
+
- [ ] 1.6 Verify all tests pass
|
|
250
|
+
|
|
251
|
+
## Notes
|
|
252
|
+
|
|
253
|
+
[Any specific technical considerations, risks, or dependencies for this story]
|
|
254
|
+
|
|
255
|
+
## Definition of Done
|
|
256
|
+
|
|
257
|
+
- [ ] All tasks completed
|
|
258
|
+
- [ ] All acceptance criteria met
|
|
259
|
+
- [ ] Tests passing
|
|
260
|
+
- [ ] Code reviewed
|
|
261
|
+
- [ ] Documentation updated
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
#### Step 2.5: Generate Technical Sub-Specs
|
|
265
|
+
|
|
266
|
+
**Only create relevant sub-specs based on contract requirements:**
|
|
267
|
+
|
|
268
|
+
- **technical-spec.md**: Always created - architecture, patterns, dependencies
|
|
269
|
+
- **database-schema.md**: Only if database changes needed (determined during clarification)
|
|
270
|
+
- **api-spec.md**: Only if new API endpoints required
|
|
271
|
+
- **ui-wireframes.md**: Only if UI/UX requirements were discussed
|
|
272
|
+
|
|
273
|
+
**Cross-reference integration**: Each sub-spec references relevant user stories from the user-stories/ folder to maintain traceability between technical details and user value.
|
|
274
|
+
|
|
275
|
+
#### Step 2.6: Create User Stories Folder Structure
|
|
276
|
+
|
|
277
|
+
**user-stories/ folder** - Organized individual story files with focused task groups:
|
|
278
|
+
|
|
279
|
+
**Structure Philosophy:**
|
|
280
|
+
|
|
281
|
+
- Each user story gets its own file for better organization
|
|
282
|
+
- Implementation tasks are kept small and focused (max 5-7 per story)
|
|
283
|
+
- Complex stories are broken into multiple smaller stories
|
|
284
|
+
- README.md provides overview and progress tracking
|
|
285
|
+
- Acceptance criteria become verification checkpoints
|
|
286
|
+
- Each story follows TDD: test → implement → verify acceptance criteria
|
|
287
|
+
|
|
288
|
+
**Benefits of Folder Structure:**
|
|
289
|
+
|
|
290
|
+
- **Manageability**: Each file stays focused and readable
|
|
291
|
+
- **Navigation**: Easy to find and work on specific stories
|
|
292
|
+
- **Parallel Work**: Multiple developers can work on different stories
|
|
293
|
+
- **Version Control**: Smaller, focused diffs when stories change
|
|
294
|
+
- **Progress Tracking**: Clear visibility of completion status
|
|
295
|
+
- **Traceability**: Every technical task traces to user value
|
|
296
|
+
|
|
297
|
+
**File Organization:**
|
|
298
|
+
|
|
299
|
+
- **README.md**: Overview, progress summary, dependencies
|
|
300
|
+
- **story-N-{name}.md**: Individual stories with focused tasks (5-7 tasks max)
|
|
301
|
+
- **Story Naming**: Clear, descriptive names for easy identification
|
|
302
|
+
- **Task Numbering**: N.1, N.2, N.3... within each story file
|
|
303
|
+
|
|
304
|
+
**Task Breakdown Strategy:**
|
|
305
|
+
|
|
306
|
+
- If a story would have >7 tasks, split into multiple stories
|
|
307
|
+
- Each story should deliver standalone user value
|
|
308
|
+
- Tasks within a story should be cohesive and related
|
|
309
|
+
- Always start with tests (N.1 Write tests...)
|
|
310
|
+
- Always end with verification (N.X Verify acceptance criteria met)
|
|
311
|
+
|
|
312
|
+
#### Step 2.7: Final Package Review & User Validation
|
|
313
|
+
|
|
314
|
+
Present complete package with file references:
|
|
315
|
+
|
|
316
|
+
```
|
|
317
|
+
Specification package created successfully!
|
|
318
|
+
|
|
319
|
+
.code-captain/specs/[DATE]-feature-name/
|
|
320
|
+
├── spec.md - Main specification document
|
|
321
|
+
├── spec-lite.md - AI context summary
|
|
322
|
+
├── user-stories/ - Individual user story files
|
|
323
|
+
│ ├── README.md - Overview and progress tracking
|
|
324
|
+
│ ├── story-1-{name}.md - Focused story with 5-7 tasks
|
|
325
|
+
│ ├── story-2-{name}.md - Manageable task groups
|
|
326
|
+
│ └── story-N-{name}.md - Easy navigation and parallel work
|
|
327
|
+
└── sub-specs/
|
|
328
|
+
├── technical-spec.md - Technical requirements
|
|
329
|
+
[Additional specs as created]
|
|
330
|
+
|
|
331
|
+
**Stories Created:** [N] user stories with focused task groups (max 5-7 tasks each)
|
|
332
|
+
**Total Tasks:** [X] implementation tasks across all stories
|
|
333
|
+
**Organization:** Each story is self-contained for better workflow management
|
|
334
|
+
|
|
335
|
+
Please take a moment to review the specification documents. The spec captures everything we discussed, including:
|
|
336
|
+
- [Brief summary of key features/requirements]
|
|
337
|
+
- [Notable technical approach or constraint]
|
|
338
|
+
- [Implementation approach or user story highlights]
|
|
339
|
+
|
|
340
|
+
Please read through the files and let me know:
|
|
341
|
+
- Does this accurately capture your vision?
|
|
342
|
+
- Are there any missing requirements or incorrect assumptions?
|
|
343
|
+
- Are the user stories appropriately sized (5-7 tasks each)?
|
|
344
|
+
- Should any stories be split further or combined?
|
|
345
|
+
|
|
346
|
+
The user-stories folder structure allows you to:
|
|
347
|
+
- Work on one story at a time for focused development
|
|
348
|
+
- Track progress easily with the README overview
|
|
349
|
+
- Assign different stories to different team members
|
|
350
|
+
- Keep task lists manageable and actionable
|
|
351
|
+
|
|
352
|
+
Once you're satisfied with the specification, I can help you start implementation with the first story, or we can make any needed adjustments.
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
## Key Improvements Over Original
|
|
356
|
+
|
|
357
|
+
### 1. Contract-First Approach
|
|
358
|
+
|
|
359
|
+
- **No presumptuous file creation** - Nothing gets built until contract is locked
|
|
360
|
+
- **Structured clarification** - One question at a time, building understanding
|
|
361
|
+
- **Echo check validation** - Clear contract summary before proceeding
|
|
362
|
+
|
|
363
|
+
### 2. Codebase-Aware Questioning
|
|
364
|
+
|
|
365
|
+
- **Context scanning between questions** - Each answer triggers fresh codebase analysis
|
|
366
|
+
- **Integration-focused queries** - Questions shaped by what exists in the codebase
|
|
367
|
+
- **Architecture consistency** - Recommendations align with existing patterns
|
|
368
|
+
|
|
369
|
+
### 3. User Control & Transparency
|
|
370
|
+
|
|
371
|
+
- **Clear decision points** - User explicitly approves before file creation
|
|
372
|
+
- **Risk assessment option** - Can explore implementation risks before committing
|
|
373
|
+
- **Blueprint preview** - Can see planned structure before creation
|
|
374
|
+
- **Edit capability** - Can modify contract before locking
|
|
375
|
+
|
|
376
|
+
### 4. Efficient Clarification Process
|
|
377
|
+
|
|
378
|
+
- **Gap enumeration** - Systematically identifies all unknowns
|
|
379
|
+
- **95% confidence threshold** - Stops asking when ready to deliver
|
|
380
|
+
- **Token efficiency** - Focused questions, no verbose explanations during clarification
|
|
381
|
+
|
|
382
|
+
## Example Usage Flow
|
|
383
|
+
|
|
384
|
+
```
|
|
385
|
+
Developer: Use code-captain subagent: create-spec "real-time multiplayer chat with blockchain integration"
|
|
386
|
+
|
|
387
|
+
Agent: I'm ready to help you create a comprehensive specification.
|
|
388
|
+
|
|
389
|
+
Let me first scan your codebase to understand the current architecture...
|
|
390
|
+
|
|
391
|
+
[Scans existing code, finds a simple React app with basic authentication]
|
|
392
|
+
|
|
393
|
+
I found your existing React application with basic user authentication, but I'm seeing some potential concerns with your request.
|
|
394
|
+
|
|
395
|
+
First question: You mentioned "real-time multiplayer chat with blockchain integration" - I see technical challenges with this combination. Real-time chat typically requires sub-100ms latency, but blockchain transactions can take seconds or minutes to confirm. What specific problem are you trying to solve with blockchain in a chat context?
|
|
396
|
+
|
|
397
|
+
Developer: I want messages to be permanently stored and verifiable, plus users should pay crypto to send messages to prevent spam
|
|
398
|
+
|
|
399
|
+
Agent: I understand the anti-spam goal, but I'm concerned about the user experience. If users have to wait 30+ seconds for transaction confirmation before each message appears, that breaks the "real-time" chat experience.
|
|
400
|
+
|
|
401
|
+
Would a hybrid approach work better - immediate message delivery with blockchain settlement in the background? Or are you thinking of a different model where users pre-purchase message credits?
|
|
402
|
+
|
|
403
|
+
Developer: Oh, that's a good point. Let's do the hybrid approach with background settlement
|
|
404
|
+
|
|
405
|
+
Agent: [Continues with more informed questions about the hybrid architecture...]
|
|
406
|
+
|
|
407
|
+
## Specification Contract
|
|
408
|
+
|
|
409
|
+
**Deliverable:** Hybrid real-time chat with immediate message delivery and background blockchain verification for anti-spam
|
|
410
|
+
|
|
411
|
+
**Must Include:** Sub-second message delivery while maintaining blockchain verification for spam prevention
|
|
412
|
+
|
|
413
|
+
**Hardest Constraint:** Balancing real-time UX with blockchain settlement delays and gas cost management
|
|
414
|
+
|
|
415
|
+
**Technical Concerns:**
|
|
416
|
+
- Gas costs could make casual chat expensive ($1-5 per message during network congestion)
|
|
417
|
+
- Background settlement failures need graceful handling and user notification
|
|
418
|
+
- Wallet integration adds authentication complexity to existing simple auth system
|
|
419
|
+
|
|
420
|
+
**Recommendations:**
|
|
421
|
+
- Consider Layer 2 solution (Polygon) to reduce gas costs to $0.01-0.10 per message
|
|
422
|
+
- Implement message batching to settle multiple messages in single transaction
|
|
423
|
+
- Add fallback mode for when blockchain settlement fails
|
|
424
|
+
|
|
425
|
+
**Success Criteria:** Messages appear instantly, spam is prevented via crypto payments, blockchain verification happens within 5 minutes
|
|
426
|
+
|
|
427
|
+
**Scope Boundaries:**
|
|
428
|
+
- Included: Real-time chat, wallet integration, background blockchain settlement
|
|
429
|
+
- Excluded: Advanced chat features (file sharing, voice), custom token creation
|
|
430
|
+
|
|
431
|
+
---
|
|
432
|
+
Options: [yes/edit/risks/blueprint]
|
|
433
|
+
|
|
434
|
+
Developer: yes
|
|
435
|
+
|
|
436
|
+
Agent: Contract locked! Creating specification package...
|
|
437
|
+
|
|
438
|
+
[Creates files that account for the technical concerns and hybrid architecture discussed]
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
This approach ensures that every specification is built on solid understanding rather than assumptions, while respecting the developer's time and maintaining control over the process.
|
|
442
|
+
|
|
443
|
+
---
|
|
444
|
+
|
|
445
|
+
## Claude Code Subagent Integration
|
|
446
|
+
|
|
447
|
+
### Delegation Patterns
|
|
448
|
+
|
|
449
|
+
The create-spec command works within Claude Code's subagent system through:
|
|
450
|
+
|
|
451
|
+
**Automatic Invocation**:
|
|
452
|
+
- Claude Code automatically delegates specification tasks to code-captain subagent
|
|
453
|
+
- Triggered by keywords: "create spec", "feature specification", "spec package"
|
|
454
|
+
- Proactive delegation for contract-first specification workflows
|
|
455
|
+
|
|
456
|
+
**Explicit Invocation**:
|
|
457
|
+
```bash
|
|
458
|
+
# Direct subagent invocation
|
|
459
|
+
> Use the code-captain subagent to create a spec for user authentication
|
|
460
|
+
> Have code-captain create a specification for the payment system
|
|
461
|
+
> Ask code-captain to generate a feature spec for notifications
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
### Subagent Workflow Integration
|
|
465
|
+
|
|
466
|
+
**Phase 1 - Contract Establishment**:
|
|
467
|
+
- Use `Read` and `Glob` tools to scan existing specs and project structure
|
|
468
|
+
- Use `Grep` to identify existing patterns and integration points
|
|
469
|
+
- Use `Task` tool for complex codebase analysis
|
|
470
|
+
- **No file creation** until contract is locked
|
|
471
|
+
|
|
472
|
+
**Phase 2 - Clarification Loop**:
|
|
473
|
+
- Use `Read` to load project context files
|
|
474
|
+
- Use `Grep` and `Glob` for context scanning between questions
|
|
475
|
+
- **Use `TodoWrite` immediately** when contract is locked to track spec creation progress
|
|
476
|
+
|
|
477
|
+
**Phase 3 - Spec Package Creation**:
|
|
478
|
+
- Use `Bash` tool for `npx @devobsessed/code-captain date` to get current date
|
|
479
|
+
- Use `Write` tool for creating specification files
|
|
480
|
+
- Use `Edit` tool for modifying existing documentation
|
|
481
|
+
- **Update todos** with `TodoWrite` as each spec file is completed
|
|
482
|
+
|
|
483
|
+
**Phase 4 - Validation**:
|
|
484
|
+
- Present complete package to user for review
|
|
485
|
+
- **Finalize todos** with `TodoWrite` marking all tasks as completed
|
|
486
|
+
|
|
487
|
+
### Context Preservation
|
|
488
|
+
|
|
489
|
+
Since subagents operate in separate contexts:
|
|
490
|
+
- **Document all decisions** in `.code-captain/specs/`
|
|
491
|
+
- **Maintain state** through structured file outputs
|
|
492
|
+
- **Provide clear handoffs** to subsequent commands (execute-task)
|
|
493
|
+
- **Reference project context** in all generated specification documents
|
|
494
|
+
|
|
495
|
+
---
|
|
496
|
+
|
|
497
|
+
## Implementation Notes
|
|
498
|
+
|
|
499
|
+
### Tool Integration
|
|
500
|
+
|
|
501
|
+
#### Core Claude Code Tools
|
|
502
|
+
|
|
503
|
+
**File Operations (No Permission Required)**:
|
|
504
|
+
- Use `Read` for reading existing files and spec scanning
|
|
505
|
+
- Use `Glob` for finding files based on pattern matching
|
|
506
|
+
- Use `Grep` for searching patterns in file contents and code discovery
|
|
507
|
+
|
|
508
|
+
**File Modification (Permission Required)**:
|
|
509
|
+
- Use `Edit` for creating and modifying specification files
|
|
510
|
+
- Use `Write` for creating new spec documents and folder structures
|
|
511
|
+
|
|
512
|
+
**System Operations (Permission Required)**:
|
|
513
|
+
- Use `Bash` for date retrieval (`npx @devobsessed/code-captain date`)
|
|
514
|
+
- Use `WebSearch` for technology research and best practices
|
|
515
|
+
|
|
516
|
+
**Advanced Operations (No Permission Required)**:
|
|
517
|
+
- Use `Task` for delegating complex multi-step analysis workflows
|
|
518
|
+
- Use `TodoWrite` for structured progress tracking and task management
|
|
519
|
+
|
|
520
|
+
### Output Locations & File Structure
|
|
521
|
+
|
|
522
|
+
#### Directory Structure
|
|
523
|
+
|
|
524
|
+
```
|
|
525
|
+
.code-captain/specs/[DATE]-{feature-name}/
|
|
526
|
+
├── spec.md # Main specification (from contract)
|
|
527
|
+
├── spec-lite.md # Condensed version for AI context
|
|
528
|
+
├── user-stories/ # Individual user story files
|
|
529
|
+
│ ├── README.md # Overview and progress tracking
|
|
530
|
+
│ ├── story-1-{name}.md # Individual user story with focused tasks
|
|
531
|
+
│ ├── story-2-{name}.md # Each story kept small and manageable
|
|
532
|
+
│ └── story-N-{name}.md # Max 5-7 implementation tasks per story
|
|
533
|
+
└── sub-specs/ # Technical deep-dives
|
|
534
|
+
├── technical-spec.md # Architecture & implementation details
|
|
535
|
+
├── database-schema.md # Database changes (if needed)
|
|
536
|
+
├── api-spec.md # API documentation (if needed)
|
|
537
|
+
└── ui-wireframes.md # UI/UX specifications (if needed)
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
### Todo Integration
|
|
541
|
+
|
|
542
|
+
Each phase should update todos to show progress, enabling Claude Code's todo tracking:
|
|
543
|
+
|
|
544
|
+
#### Example Todo Updates
|
|
545
|
+
|
|
546
|
+
```javascript
|
|
547
|
+
// Initialize todos when contract is locked
|
|
548
|
+
TodoWrite({
|
|
549
|
+
todos: [
|
|
550
|
+
{ content: "Get current date and create spec folder structure", status: "in_progress", activeForm: "Creating spec folder structure" },
|
|
551
|
+
{ content: "Generate core specification document", status: "pending", activeForm: "Generating core specification" },
|
|
552
|
+
{ content: "Create user stories with acceptance criteria", status: "pending", activeForm: "Creating user stories" },
|
|
553
|
+
{ content: "Generate technical sub-specifications", status: "pending", activeForm: "Generating technical sub-specs" },
|
|
554
|
+
{ content: "Present package for user review", status: "pending", activeForm: "Presenting package for review" },
|
|
555
|
+
],
|
|
556
|
+
});
|
|
557
|
+
|
|
558
|
+
// Update when creating specification files
|
|
559
|
+
TodoWrite({
|
|
560
|
+
todos: [
|
|
561
|
+
{ content: "Get current date and create spec folder structure", status: "completed", activeForm: "Creating spec folder structure" },
|
|
562
|
+
{ content: "Generate core specification document", status: "completed", activeForm: "Generating core specification" },
|
|
563
|
+
{ content: "Create user stories with acceptance criteria", status: "in_progress", activeForm: "Creating user stories" },
|
|
564
|
+
{ content: "Generate technical sub-specifications", status: "pending", activeForm: "Generating technical sub-specs" },
|
|
565
|
+
{ content: "Present package for user review", status: "pending", activeForm: "Presenting package for review" },
|
|
566
|
+
],
|
|
567
|
+
});
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
#### Todo Best Practices
|
|
571
|
+
|
|
572
|
+
- **Always include file paths** in todo content for clarity
|
|
573
|
+
- **Use descriptive content** that indicates current phase
|
|
574
|
+
- **Update todos immediately** after completing each task
|
|
575
|
+
- **Mark todos as completed** only after files are actually created
|
|
576
|
+
- **Include activeForm** for clear status display during execution
|
|
577
|
+
|
|
578
|
+
#### File Creation Verification
|
|
579
|
+
|
|
580
|
+
Before marking documentation todos as complete, ensure:
|
|
581
|
+
|
|
582
|
+
1. **Directory exists**: `.code-captain/specs/[DATE]-{feature-name}/`
|
|
583
|
+
2. **File is created**: Use `Write` tool to create the actual file
|
|
584
|
+
3. **Content is complete**: File contains all required sections
|
|
585
|
+
4. **Path is correct**: Double-check exact file path matches todo description
|
|
586
|
+
|
|
587
|
+
#### Claude Code Integration
|
|
588
|
+
|
|
589
|
+
**Permission Configuration**:
|
|
590
|
+
```json
|
|
591
|
+
{
|
|
592
|
+
"permissions": {
|
|
593
|
+
"allow": [
|
|
594
|
+
"Bash(npx @devobsessed/code-captain date)",
|
|
595
|
+
"Write(.code-captain/specs/*)",
|
|
596
|
+
"Edit(.code-captain/specs/*)"
|
|
597
|
+
]
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
```
|
|
601
|
+
|
|
602
|
+
**MCP Integration**:
|
|
603
|
+
- Leverage GitHub MCP tools for repository analysis
|
|
604
|
+
- Use project-specific MCP servers for additional context
|
|
605
|
+
- Configure additional MCP servers as needed for project-specific tools
|
|
606
|
+
|
|
607
|
+
### Quick Reference
|
|
608
|
+
|
|
609
|
+
**Key Claude Code Tools for Create-Spec**:
|
|
610
|
+
- `Read`, `Glob`, `Grep` (No permissions) - Analysis and discovery
|
|
611
|
+
- `Edit`, `Write` (Requires permissions) - File creation
|
|
612
|
+
- `Bash` (Requires permissions) - Date retrieval
|
|
613
|
+
- `WebSearch` (Requires permissions) - Technology research
|
|
614
|
+
- **`TodoWrite`** (No permissions) - **CRITICAL: Phase tracking and progress management**
|
|
615
|
+
- `Task` (No permissions) - Complex workflow delegation
|
|
616
|
+
|
|
617
|
+
**Required Permissions**:
|
|
618
|
+
```json
|
|
619
|
+
"allow": ["Bash(npx @devobsessed/code-captain date)", "Write(.code-captain/specs/*)", "Edit(.code-captain/specs/*)"]
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
**Essential Files Created**:
|
|
623
|
+
- `.code-captain/specs/[DATE]-{feature-name}/spec.md`
|
|
624
|
+
- `.code-captain/specs/[DATE]-{feature-name}/spec-lite.md`
|
|
625
|
+
- `.code-captain/specs/[DATE]-{feature-name}/user-stories/README.md`
|
|
626
|
+
- `.code-captain/specs/[DATE]-{feature-name}/user-stories/story-*.md`
|
|
627
|
+
- `.code-captain/specs/[DATE]-{feature-name}/sub-specs/technical-spec.md`
|