@devobsessed/code-captain 0.0.3

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.
Files changed (55) hide show
  1. package/README.md +214 -0
  2. package/bin/install.js +1048 -0
  3. package/claude-code/README.md +276 -0
  4. package/claude-code/agents/code-captain.md +121 -0
  5. package/claude-code/agents/spec-generator.md +271 -0
  6. package/claude-code/agents/story-creator.md +309 -0
  7. package/claude-code/agents/tech-spec.md +440 -0
  8. package/claude-code/commands/cc-initialize.md +520 -0
  9. package/copilot/README.md +210 -0
  10. package/copilot/chatmodes/Code Captain.chatmode.md +60 -0
  11. package/copilot/docs/best-practices.md +74 -0
  12. package/copilot/prompts/create-adr.prompt.md +468 -0
  13. package/copilot/prompts/create-spec.prompt.md +430 -0
  14. package/copilot/prompts/edit-spec.prompt.md +396 -0
  15. package/copilot/prompts/execute-task.prompt.md +144 -0
  16. package/copilot/prompts/explain-code.prompt.md +292 -0
  17. package/copilot/prompts/initialize.prompt.md +65 -0
  18. package/copilot/prompts/new-command.prompt.md +310 -0
  19. package/copilot/prompts/plan-product.prompt.md +450 -0
  20. package/copilot/prompts/research.prompt.md +329 -0
  21. package/copilot/prompts/status.prompt.md +424 -0
  22. package/copilot/prompts/swab.prompt.md +217 -0
  23. package/cursor/README.md +224 -0
  24. package/cursor/cc.md +183 -0
  25. package/cursor/cc.mdc +69 -0
  26. package/cursor/commands/create-adr.md +504 -0
  27. package/cursor/commands/create-spec.md +430 -0
  28. package/cursor/commands/edit-spec.md +405 -0
  29. package/cursor/commands/execute-task.md +514 -0
  30. package/cursor/commands/explain-code.md +289 -0
  31. package/cursor/commands/initialize.md +397 -0
  32. package/cursor/commands/new-command.md +312 -0
  33. package/cursor/commands/plan-product.md +466 -0
  34. package/cursor/commands/research.md +317 -0
  35. package/cursor/commands/status.md +413 -0
  36. package/cursor/commands/swab.md +209 -0
  37. package/cursor/docs/best-practices.md +74 -0
  38. package/cursor/integrations/azure-devops/create-azure-work-items.md +403 -0
  39. package/cursor/integrations/azure-devops/sync-azure-work-items.md +486 -0
  40. package/cursor/integrations/github/create-github-issues.md +765 -0
  41. package/cursor/integrations/github/scripts/create-issues-batch.sh +272 -0
  42. package/cursor/integrations/github/sync-github-issues.md +237 -0
  43. package/cursor/integrations/github/sync.md +305 -0
  44. package/manifest.json +381 -0
  45. package/package.json +58 -0
  46. package/windsurf/README.md +254 -0
  47. package/windsurf/rules/cc.md +5 -0
  48. package/windsurf/workflows/create-adr.md +331 -0
  49. package/windsurf/workflows/create-spec.md +280 -0
  50. package/windsurf/workflows/edit-spec.md +273 -0
  51. package/windsurf/workflows/execute-task.md +276 -0
  52. package/windsurf/workflows/explain-code.md +292 -0
  53. package/windsurf/workflows/initialize.md +298 -0
  54. package/windsurf/workflows/new-command.md +321 -0
  55. package/windsurf/workflows/status.md +213 -0
@@ -0,0 +1,520 @@
1
+ # Initialize Command Workflow
2
+
3
+ ## Command: `initialize`
4
+
5
+ ### Purpose
6
+
7
+ Set up technical foundation and development infrastructure by detecting if this is a greenfield (new) or brownfield (existing) project and executing the appropriate technical setup workflow.
8
+
9
+ ### Detection Logic
10
+
11
+ 1. **Scan current directory** for indicators:
12
+
13
+ - Presence of package.json, requirements.txt, Cargo.toml, go.mod, etc.
14
+ - Existing source code directories (src/, lib/, app/, etc.)
15
+ - Git repository status
16
+ - Configuration files
17
+
18
+ 2. **Classify as**:
19
+ - **Greenfield**: Empty directory or minimal files
20
+ - **Brownfield**: Existing codebase with established structure
21
+
22
+ ---
23
+
24
+ ## Greenfield Workflow
25
+
26
+ ### Phase 1: Technical Foundation Setup
27
+
28
+ #### Greenfield Todo Checklist
29
+
30
+ Use `TodoWrite` to track progress through technical setup:
31
+
32
+ ```json
33
+ {
34
+ "todos": [
35
+ {
36
+ "id": "greenfield-tech-analysis",
37
+ "content": "Determine technology stack and development requirements",
38
+ "status": "in_progress"
39
+ },
40
+ {
41
+ "id": "greenfield-tech-stack",
42
+ "content": "Document technology stack in .code-captain/docs/tech-stack.md",
43
+ "status": "pending"
44
+ },
45
+ {
46
+ "id": "greenfield-structure",
47
+ "content": "Create project directory structure and config files",
48
+ "status": "pending"
49
+ },
50
+ {
51
+ "id": "greenfield-dev-setup",
52
+ "content": "Set up development configuration and tooling",
53
+ "status": "pending"
54
+ },
55
+ {
56
+ "id": "greenfield-readme",
57
+ "content": "Generate technical README.md with setup instructions",
58
+ "status": "pending"
59
+ }
60
+ ]
61
+ }
62
+ ```
63
+
64
+ **Ask focused technical questions**:
65
+
66
+ 1. **Project Type**: "What type of application are you building? (web app, API, mobile app, library, CLI tool, etc.)"
67
+ 2. **Technical Constraints**: "Any required technologies, frameworks, or platforms?"
68
+ 3. **Development Environment**: "What's your preferred development setup? (local, containerized, cloud-based)"
69
+ 4. **Scale Requirements**: "Expected technical scale? (prototype, small team, enterprise)"
70
+
71
+ ### Phase 2: Technology Recommendations
72
+
73
+ Based on technical requirements, recommend:
74
+
75
+ - **Tech Stack**: Languages, frameworks, databases suitable for the project type
76
+ - **Architecture Pattern**: Monolith, microservices, serverless based on scale needs
77
+ - **Development Tools**: Testing frameworks, build tools, linting/formatting
78
+ - **Project Structure**: Directory layout, naming conventions, configuration
79
+
80
+ ### Phase 3: Technical Foundation Setup
81
+
82
+ #### Directory Structure (Pre-existing)
83
+
84
+ The `.code-captain/` directory structure already exists from installation:
85
+
86
+ - `.code-captain/docs/` - For technical documentation
87
+ - `.code-captain/research/` - For research outputs
88
+ - `.code-captain/commands/` - Pre-installed command definitions
89
+
90
+ #### Configuration Files
91
+
92
+ - **Package/dependency files** (package.json, requirements.txt, etc.)
93
+ - **Git configuration** (.gitignore, .gitattributes)
94
+ - **Development configuration** (prettier, eslint, testing config, etc.)
95
+ - **Build and deployment configuration** (if applicable)
96
+
97
+ #### Documentation Creation (Exact File Paths)
98
+
99
+ 1. **`.code-captain/docs/tech-stack.md`** - Technology stack decisions and rationale
100
+ 2. **`.code-captain/docs/code-style.md`** - Coding standards and development patterns
101
+ 3. **`README.md`** - Technical overview and setup instructions
102
+
103
+ ### Phase 4: Next Steps Guidance
104
+
105
+ After technical foundation is complete, provide clear next steps:
106
+
107
+ ```
108
+ 🚀 Technical Foundation Complete!
109
+
110
+ Your development environment is now set up and documented:
111
+ - Technology stack documented and configured
112
+ - Development tools and standards established
113
+ - Project structure and configuration ready
114
+
115
+ ## Recommended Next Steps:
116
+
117
+ ### For New Products:
118
+ Use code-captain subagent: plan-product "your product idea" - Define product vision, strategy, and roadmap
119
+
120
+ ### For Existing Products:
121
+ Use code-captain subagent: create-spec "feature description" - Create detailed feature specifications
122
+ Use code-captain subagent: execute-task - Implement features with TDD workflow
123
+
124
+ ### For Research:
125
+ Use code-captain subagent: research "topic" - Conduct systematic technical research
126
+ Use code-captain subagent: create-adr "decision" - Document architectural decisions
127
+
128
+ Ready to define your product strategy and start building!
129
+ ```
130
+
131
+ ---
132
+
133
+ ## Brownfield Workflow
134
+
135
+ ### Phase 1: Codebase Analysis
136
+
137
+ #### Brownfield Todo Checklist
138
+
139
+ Use `TodoWrite` to track analysis progress:
140
+
141
+ ```json
142
+ {
143
+ "todos": [
144
+ {
145
+ "id": "brownfield-analysis",
146
+ "content": "Analyze existing codebase structure, dependencies, and patterns",
147
+ "status": "in_progress"
148
+ },
149
+ {
150
+ "id": "brownfield-tech-stack",
151
+ "content": "Document current tech stack in .code-captain/docs/tech-stack.md",
152
+ "status": "pending"
153
+ },
154
+ {
155
+ "id": "brownfield-code-style",
156
+ "content": "Analyze and document code patterns in .code-captain/docs/code-style.md",
157
+ "status": "pending"
158
+ },
159
+ {
160
+ "id": "brownfield-architecture",
161
+ "content": "Document system architecture and technical decisions",
162
+ "status": "pending"
163
+ }
164
+ ]
165
+ }
166
+ ```
167
+
168
+ **Scan and analyze**:
169
+
170
+ - **File structure** and organization patterns
171
+ - **Dependencies** and technology stack
172
+ - **Code patterns**, conventions, and architecture
173
+ - **Configuration files** and build processes
174
+ - **Testing setup** and development tools
175
+ - **Documentation gaps** and technical debt
176
+
177
+ ### Phase 2: Documentation Generation
178
+
179
+ #### tech-stack.md
180
+
181
+ ```markdown
182
+ # Technology Stack
183
+
184
+ ## Languages
185
+
186
+ - [Primary language with version]
187
+ - [Secondary languages if any]
188
+
189
+ ## Frameworks & Libraries
190
+
191
+ - [Main framework with version and purpose]
192
+ - [Key dependencies with purposes]
193
+
194
+ ## Infrastructure
195
+
196
+ - [Database technology]
197
+ - [Deployment platform]
198
+ - [CI/CD tools]
199
+
200
+ ## Development Tools
201
+
202
+ - [Package manager]
203
+ - [Testing framework]
204
+ - [Linting/formatting tools]
205
+
206
+ ## Architecture Pattern
207
+
208
+ [Monolith/Microservices/Serverless/etc. with reasoning]
209
+ ```
210
+
211
+ #### code-style.md
212
+
213
+ ```markdown
214
+ # Code Style Guide
215
+
216
+ ## File Organization
217
+
218
+ [Directory structure patterns observed]
219
+
220
+ ## Naming Conventions
221
+
222
+ - [Variable naming patterns]
223
+ - [Function naming patterns]
224
+ - [File naming patterns]
225
+
226
+ ## Code Patterns
227
+
228
+ [Common patterns observed in codebase]
229
+
230
+ ## Testing Patterns
231
+
232
+ [How tests are structured and named]
233
+
234
+ ## Documentation Style
235
+
236
+ [Comment and documentation patterns]
237
+ ```
238
+
239
+ ### Phase 3: Gap Analysis & Recommendations
240
+
241
+ Identify and document:
242
+
243
+ - **Missing technical documentation**
244
+ - **Inconsistent code patterns**
245
+ - **Technical debt and improvement opportunities**
246
+ - **Testing coverage gaps**
247
+ - **Development workflow improvements**
248
+ - **Architecture optimization opportunities**
249
+
250
+ ### Phase 4: Next Steps Guidance
251
+
252
+ After brownfield analysis is complete, provide clear next steps:
253
+
254
+ ```
255
+ 🔍 Technical Foundation Analysis Complete!
256
+
257
+ Your existing project has been analyzed and documented:
258
+ - Current technology stack and architecture documented
259
+ - Code patterns and conventions identified
260
+ - Technical gaps and improvement opportunities noted
261
+
262
+ ## Recommended Next Steps:
263
+
264
+ ### For Product Strategy (Recommended First):
265
+ Use code-captain subagent: plan-product "enhanced product vision" - Define product strategy and roadmap
266
+
267
+ ### For Feature Development:
268
+ Use code-captain subagent: create-spec "feature description" - Create detailed feature specifications
269
+ Use code-captain subagent: execute-task - Implement features following established patterns
270
+
271
+ ### For Technical Improvements:
272
+ Use code-captain subagent: research "technical topic" - Research solutions for identified gaps
273
+ Use code-captain subagent: create-adr "technical decision" - Document architectural improvements
274
+
275
+ Ready to define your product strategy and enhance your codebase!
276
+ ```
277
+
278
+ ---
279
+
280
+ ## CRITICAL: Final Message Requirements
281
+
282
+ **MANDATORY**: The initialize command MUST end with a message that prominently recommends `plan-product` as the next logical step for both greenfield and brownfield projects. This is required because:
283
+
284
+ 1. Initialize handles ONLY technical foundation
285
+ 2. plan-product handles product strategy and vision
286
+ 3. Users need both for complete project setup
287
+ 4. plan-product should be the next step before feature development
288
+
289
+ **Required message format**:
290
+ ```
291
+ 🚀 Technical Foundation Complete! / 🔍 Technical Foundation Analysis Complete!
292
+
293
+ ## Recommended Next Steps:
294
+
295
+ ### For Product Strategy (Recommended First):
296
+ Use code-captain subagent: plan-product "your product idea/vision" - Define product strategy and roadmap
297
+
298
+ ### For Feature Development:
299
+ Use code-captain subagent: create-spec "feature description" - Create detailed feature specifications
300
+ Use code-captain subagent: execute-task - Implement features
301
+
302
+ ### For Technical Improvements:
303
+ Use code-captain subagent: research "topic" - Research solutions for gaps
304
+ Use code-captain subagent: create-adr "decision" - Document architectural decisions
305
+ ```
306
+
307
+ ---
308
+
309
+ ## Claude Code Subagent Integration
310
+
311
+ ### Delegation Patterns
312
+
313
+ The initialize command works within Claude Code's subagent system through:
314
+
315
+ **Automatic Invocation**:
316
+ - Claude Code automatically delegates project setup tasks to code-captain subagent
317
+ - Triggered by keywords: "initialize", "setup project", "analyze codebase"
318
+ - Proactive delegation for greenfield/brownfield detection
319
+
320
+ **Explicit Invocation**:
321
+ ```bash
322
+ # Direct subagent invocation
323
+ > Use the code-captain subagent to initialize this project
324
+ > Have code-captain analyze this existing codebase
325
+ > Ask code-captain to set up technical foundation
326
+ ```
327
+
328
+ ### Subagent Workflow Integration
329
+
330
+ **Phase 1 - Detection**:
331
+ - Use `Read` and `LS` tools to scan project structure
332
+ - Use `Grep` to identify technology indicators
333
+ - Use `Bash` for git status and dependency analysis
334
+ - **Initialize todos** with `TodoWrite` based on detected project type (greenfield/brownfield)
335
+
336
+ **Phase 2 - Analysis**:
337
+ - Use `Task` tool for complex brownfield analysis
338
+ - Delegate specialized analysis to focused subagents if available
339
+ - **Use `TodoWrite` immediately** to initialize phase todos and track structured progress
340
+
341
+ **Phase 3 - Documentation**:
342
+ - Use `Edit` tool for creating structured documentation
343
+ - Use `Write` tool for configuration file generation
344
+ - Use `WebSearch` for technology research and best practices
345
+ - **Update todos** with `TodoWrite` as each documentation file is completed
346
+
347
+ **Phase 4 - Integration**:
348
+ - Configure `.claude/settings.json` for project-specific permissions
349
+ - Set up MCP integrations for platform tools
350
+ - Establish hooks for automated workflows
351
+ - **Finalize todos** with `TodoWrite` marking all tasks as completed
352
+
353
+ ### Context Preservation
354
+
355
+ Since subagents operate in separate contexts:
356
+ - **Document all decisions** in `.code-captain/docs/`
357
+ - **Maintain state** through structured file outputs
358
+ - **Provide clear handoffs** to subsequent commands
359
+ - **Reference project context** in all generated documentation
360
+
361
+ ---
362
+
363
+ ## Implementation Notes
364
+
365
+ ### Tool Integration
366
+
367
+ #### Core Claude Code Tools
368
+
369
+ **File Operations (No Permission Required)**:
370
+ - Use `Read` for reading existing files and codebase scanning
371
+ - Use `LS` for listing directory contents and structure analysis
372
+ - Use `Glob` for finding files based on pattern matching
373
+ - Use `Grep` for searching patterns in file contents and code discovery
374
+
375
+ **File Modification (Permission Required)**:
376
+ - Use `Edit` for creating and modifying documentation files
377
+ - Use `Write` for creating new configuration files
378
+ - Use `MultiEdit` for atomic multi-file changes if needed
379
+
380
+ **System Operations (Permission Required)**:
381
+ - Use `Bash` for git status, package manager operations, and system commands
382
+ - Use `WebSearch` for technology research and documentation lookup
383
+
384
+ **Advanced Operations (No Permission Required)**:
385
+ - Use `Task` for delegating complex multi-step analysis workflows
386
+ - Use `TodoWrite` for structured progress tracking and task management
387
+
388
+ ### Output Locations & File Structure
389
+
390
+ #### Directory Structure (Created by Install Script)
391
+
392
+ ```
393
+ .code-captain/
394
+ ├── commands/ # CC command definitions (pre-installed)
395
+ └── docs/
396
+ ├── best-practices.md # Development best practices (pre-installed)
397
+ ├── code-style.md # Code conventions and patterns
398
+ ├── tech-stack.md # Technology decisions and rationale
399
+ └── architecture.md # System architecture (if complex)
400
+ ```
401
+
402
+ #### Specific File Locations
403
+
404
+ **Docs Directory** (`.code-captain/docs/`):
405
+
406
+ - `best-practices.md` - Development best practices (pre-installed)
407
+ - `code-style.md` - Coding standards, naming conventions, patterns
408
+ - `tech-stack.md` - Technology choices with justifications
409
+ - `architecture.md` - System architecture and technical decisions (if complex)
410
+
411
+ **Research Directory** (`.code-captain/research/`):
412
+
413
+ - Research outputs, technical analysis, and investigation results
414
+
415
+ **Commands Directory** (`.code-captain/commands/`):
416
+
417
+ - Pre-installed CC command definitions (managed by system)
418
+
419
+ **Root Directory**:
420
+
421
+ - `README.md` - Project overview and quick start (only for new projects)
422
+
423
+ ### Todo Integration
424
+
425
+ Each phase should update todos to show progress, enabling Claude Code's todo tracking:
426
+
427
+ #### Example Todo Updates
428
+
429
+ ```javascript
430
+ // Mark analysis complete and start documentation phase
431
+ TodoWrite({
432
+ merge: true,
433
+ todos: [
434
+ { id: "greenfield-tech-analysis", status: "completed" },
435
+ { id: "greenfield-tech-stack", status: "in_progress" },
436
+ ],
437
+ });
438
+
439
+ // Update when creating documentation files
440
+ TodoWrite({
441
+ merge: true,
442
+ todos: [
443
+ { id: "greenfield-tech-stack", status: "completed" },
444
+ { id: "greenfield-dev-setup", status: "completed" },
445
+ { id: "greenfield-readme", status: "in_progress" },
446
+ ],
447
+ });
448
+ ```
449
+
450
+ #### Todo Best Practices
451
+
452
+ - **Always include file paths** in todo content for clarity
453
+ - **Use descriptive IDs** that indicate workflow type (greenfield/brownfield)
454
+ - **Update todos immediately** after completing each task
455
+ - **Mark todos as completed** only after files are actually created
456
+ - **Use `merge: true`** to update existing todos without replacing the entire list
457
+
458
+ #### File Creation Verification
459
+
460
+ Before marking documentation todos as complete, ensure:
461
+
462
+ 1. **Directory exists**: `.code-captain/docs/`
463
+ 2. **File is created**: Use `Edit` tool to create the actual file
464
+ 3. **Content is complete**: File contains all required sections
465
+ 4. **Path is correct**: Double-check exact file path matches todo description
466
+
467
+ #### Claude Code Integration
468
+
469
+ **Permission Configuration**:
470
+ ```json
471
+ {
472
+ "permissions": {
473
+ "allow": [
474
+ "Bash(git status)",
475
+ "Bash(npm install)",
476
+ "Bash(git diff)",
477
+ "Edit(.code-captain/docs/*)",
478
+ "Write(README.md)",
479
+ "Write(.gitignore)"
480
+ ]
481
+ }
482
+ }
483
+ ```
484
+
485
+ **MCP Integration**:
486
+ - Leverage GitHub MCP tools for repository analysis
487
+ - Use Supabase MCP tools for database schema documentation
488
+ - Configure additional MCP servers as needed for project-specific tools
489
+
490
+ **Hooks Configuration**:
491
+ ```json
492
+ {
493
+ "hooks": {
494
+ "PostToolUse": {
495
+ "Edit": "echo '✅ Documentation file updated'",
496
+ "Write": "echo '✅ Configuration file created'"
497
+ }
498
+ }
499
+ }
500
+ ```
501
+
502
+ ### Quick Reference
503
+
504
+ **Key Claude Code Tools for Initialize**:
505
+ - `Read`, `LS`, `Glob`, `Grep` (No permissions) - Analysis and discovery
506
+ - `Edit`, `Write`, `MultiEdit` (Requires permissions) - File creation
507
+ - `Bash` (Requires permissions) - Git and package manager operations
508
+ - `WebSearch` (Requires permissions) - Technology research
509
+ - **`TodoWrite`** (No permissions) - **CRITICAL: Phase tracking and progress management**
510
+ - `Task` (No permissions) - Complex workflow delegation
511
+
512
+ **Required Permissions**:
513
+ ```json
514
+ "allow": ["Bash(git:*)", "Bash(npm:*)", "Edit(.code-captain/docs/*)", "Write(README.md)", "Write(.gitignore)"]
515
+ ```
516
+
517
+ **Essential Files Created**:
518
+ - `.code-captain/docs/tech-stack.md`
519
+ - `.code-captain/docs/code-style.md`
520
+ - `README.md` (greenfield only)