@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.
- package/README.md +214 -0
- package/bin/install.js +1048 -0
- package/claude-code/README.md +276 -0
- package/claude-code/agents/code-captain.md +121 -0
- package/claude-code/agents/spec-generator.md +271 -0
- package/claude-code/agents/story-creator.md +309 -0
- package/claude-code/agents/tech-spec.md +440 -0
- package/claude-code/commands/cc-initialize.md +520 -0
- package/copilot/README.md +210 -0
- package/copilot/chatmodes/Code Captain.chatmode.md +60 -0
- package/copilot/docs/best-practices.md +74 -0
- package/copilot/prompts/create-adr.prompt.md +468 -0
- package/copilot/prompts/create-spec.prompt.md +430 -0
- package/copilot/prompts/edit-spec.prompt.md +396 -0
- package/copilot/prompts/execute-task.prompt.md +144 -0
- package/copilot/prompts/explain-code.prompt.md +292 -0
- package/copilot/prompts/initialize.prompt.md +65 -0
- package/copilot/prompts/new-command.prompt.md +310 -0
- package/copilot/prompts/plan-product.prompt.md +450 -0
- package/copilot/prompts/research.prompt.md +329 -0
- package/copilot/prompts/status.prompt.md +424 -0
- package/copilot/prompts/swab.prompt.md +217 -0
- package/cursor/README.md +224 -0
- package/cursor/cc.md +183 -0
- package/cursor/cc.mdc +69 -0
- package/cursor/commands/create-adr.md +504 -0
- package/cursor/commands/create-spec.md +430 -0
- package/cursor/commands/edit-spec.md +405 -0
- package/cursor/commands/execute-task.md +514 -0
- package/cursor/commands/explain-code.md +289 -0
- package/cursor/commands/initialize.md +397 -0
- package/cursor/commands/new-command.md +312 -0
- package/cursor/commands/plan-product.md +466 -0
- package/cursor/commands/research.md +317 -0
- package/cursor/commands/status.md +413 -0
- package/cursor/commands/swab.md +209 -0
- package/cursor/docs/best-practices.md +74 -0
- package/cursor/integrations/azure-devops/create-azure-work-items.md +403 -0
- package/cursor/integrations/azure-devops/sync-azure-work-items.md +486 -0
- package/cursor/integrations/github/create-github-issues.md +765 -0
- package/cursor/integrations/github/scripts/create-issues-batch.sh +272 -0
- package/cursor/integrations/github/sync-github-issues.md +237 -0
- package/cursor/integrations/github/sync.md +305 -0
- package/manifest.json +381 -0
- package/package.json +58 -0
- package/windsurf/README.md +254 -0
- package/windsurf/rules/cc.md +5 -0
- package/windsurf/workflows/create-adr.md +331 -0
- package/windsurf/workflows/create-spec.md +280 -0
- package/windsurf/workflows/edit-spec.md +273 -0
- package/windsurf/workflows/execute-task.md +276 -0
- package/windsurf/workflows/explain-code.md +292 -0
- package/windsurf/workflows/initialize.md +298 -0
- package/windsurf/workflows/new-command.md +321 -0
- package/windsurf/workflows/status.md +213 -0
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
# Explain Code Command
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
The `explain-code` command provides comprehensive, AI-powered explanations of code segments, functions, classes, or entire files. It combines natural language explanations with visual diagrams to help developers understand complex code quickly and thoroughly.
|
|
6
|
+
|
|
7
|
+
## Command Syntax
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
cc: explain-code [target]
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Parameters
|
|
14
|
+
|
|
15
|
+
### Target (Required)
|
|
16
|
+
|
|
17
|
+
- `[function-name]` - Specific function to explain
|
|
18
|
+
- `[class-name]` - Entire class explanation
|
|
19
|
+
- `[file-path]` - Explain entire file
|
|
20
|
+
- `[line-range]` - Explain specific lines (e.g., "125-150")
|
|
21
|
+
- `current-selection` - Explain currently selected code in IDE
|
|
22
|
+
|
|
23
|
+
The command automatically:
|
|
24
|
+
|
|
25
|
+
- Includes visual diagrams (flowcharts, sequence diagrams, class diagrams)
|
|
26
|
+
- Uses intermediate complexity level (technical but accessible)
|
|
27
|
+
- Provides full context (includes dependencies and related components)
|
|
28
|
+
- Saves explanations to `.code-captain/explanations/` for future reference
|
|
29
|
+
|
|
30
|
+
## Examples
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Explain a specific function
|
|
34
|
+
cc: explain-code calculateUserDiscount
|
|
35
|
+
|
|
36
|
+
# Explain a class
|
|
37
|
+
cc: explain-code PaymentProcessor
|
|
38
|
+
|
|
39
|
+
# Explain entire file
|
|
40
|
+
cc: explain-code src/auth/AuthService.js
|
|
41
|
+
|
|
42
|
+
# Explain specific line range
|
|
43
|
+
cc: explain-code "src/utils/helpers.js:45-78"
|
|
44
|
+
|
|
45
|
+
# Explain currently selected code in IDE
|
|
46
|
+
cc: explain-code current-selection
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Output Structure
|
|
50
|
+
|
|
51
|
+
All explanations are displayed in chat and automatically saved to `.code-captain/explanations/`
|
|
52
|
+
|
|
53
|
+
### Chat Display
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
📋 Function Overview
|
|
57
|
+
├── Purpose: What this code does
|
|
58
|
+
├── Parameters: Input expectations
|
|
59
|
+
├── Return Value: What it outputs
|
|
60
|
+
├── Key Logic: Step-by-step breakdown
|
|
61
|
+
└── Usage Examples: How to call it
|
|
62
|
+
|
|
63
|
+
🔄 Execution Flow
|
|
64
|
+
├── [Flowchart diagram showing decision paths]
|
|
65
|
+
├── Decision points and branches
|
|
66
|
+
├── Error handling paths
|
|
67
|
+
└── Performance characteristics
|
|
68
|
+
|
|
69
|
+
🏗️ Architecture Context
|
|
70
|
+
├── Where this fits in the system
|
|
71
|
+
├── Dependencies and related components
|
|
72
|
+
├── Design patterns used
|
|
73
|
+
└── Integration points
|
|
74
|
+
|
|
75
|
+
⚡ Technical Details
|
|
76
|
+
├── Time complexity
|
|
77
|
+
├── Memory usage
|
|
78
|
+
├── Potential issues
|
|
79
|
+
└── Optimization opportunities
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Saved Format
|
|
83
|
+
|
|
84
|
+
````markdown
|
|
85
|
+
# Code Explanation: [Target Name]
|
|
86
|
+
|
|
87
|
+
_Generated on [DATE]_
|
|
88
|
+
|
|
89
|
+
## Overview
|
|
90
|
+
|
|
91
|
+
[Natural language summary]
|
|
92
|
+
|
|
93
|
+
## Execution Flow
|
|
94
|
+
|
|
95
|
+
```mermaid
|
|
96
|
+
[Generated diagram]
|
|
97
|
+
```
|
|
98
|
+
````
|
|
99
|
+
|
|
100
|
+
## Detailed Breakdown
|
|
101
|
+
|
|
102
|
+
[Step-by-step explanation]
|
|
103
|
+
|
|
104
|
+
## Architecture Context
|
|
105
|
+
|
|
106
|
+
[How it fits in the system]
|
|
107
|
+
|
|
108
|
+
## Usage Examples
|
|
109
|
+
|
|
110
|
+
[Code examples]
|
|
111
|
+
|
|
112
|
+
## Related Components
|
|
113
|
+
|
|
114
|
+
[Links to other explanations]
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
_Generated by Code Captain on [timestamp]_
|
|
119
|
+
_Last updated: [timestamp]_
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## File Organization
|
|
124
|
+
|
|
125
|
+
Saved explanations are stored with date prefixes for chronological organization:
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
.code-captain/
|
|
130
|
+
└── explanations/
|
|
131
|
+
├── 2024-01-15-AuthenticationFlow.md
|
|
132
|
+
├── 2024-01-16-PaymentProcessor.md
|
|
133
|
+
├── 2024-01-16-UserService.md
|
|
134
|
+
└── 2024-01-17-SearchAlgorithm.md
|
|
135
|
+
|
|
136
|
+
````
|
|
137
|
+
|
|
138
|
+
Files are named using the format: `[DATE]-[target-name].md` where DATE is YYYY-MM-DD format.
|
|
139
|
+
|
|
140
|
+
## Auto-Save Behavior
|
|
141
|
+
|
|
142
|
+
All explanations are automatically saved to `.code-captain/explanations/` using the format `[DATE]-[target-name].md`. The system uses the same date determination process as the research command to ensure consistent timestamps.
|
|
143
|
+
|
|
144
|
+
## Date Determination Process
|
|
145
|
+
|
|
146
|
+
### Primary Method: File System Timestamp
|
|
147
|
+
|
|
148
|
+
1. **CREATE** directory if not exists: `.code-captain/explanations/`
|
|
149
|
+
2. **CREATE** temporary file: `.code-captain/explanations/.date-check`
|
|
150
|
+
3. **READ** file creation timestamp from filesystem
|
|
151
|
+
4. **EXTRACT** date in YYYY-MM-DD format
|
|
152
|
+
5. **DELETE** temporary file
|
|
153
|
+
6. **STORE** date in variable for file naming
|
|
154
|
+
|
|
155
|
+
### Fallback Method: User Confirmation
|
|
156
|
+
|
|
157
|
+
If file system method fails:
|
|
158
|
+
|
|
159
|
+
1. **STATE**: "I need to confirm today's date for the explanation file"
|
|
160
|
+
2. **ASK**: "What is today's date? (YYYY-MM-DD format)"
|
|
161
|
+
3. **WAIT** for user response
|
|
162
|
+
4. **VALIDATE** format matches `^\d{4}-\d{2}-\d{2}$`
|
|
163
|
+
5. **STORE** date for file naming
|
|
164
|
+
|
|
165
|
+
**Example filename:** `.code-captain/explanations/2024-01-15-AuthenticationFlow.md`
|
|
166
|
+
|
|
167
|
+
## Integration Points
|
|
168
|
+
|
|
169
|
+
### With Other Commands
|
|
170
|
+
```bash
|
|
171
|
+
# Saved explanations can be referenced by other commands
|
|
172
|
+
cc: research authentication
|
|
173
|
+
cc: create-spec payment-processing
|
|
174
|
+
cc: execute-task "optimize the user search"
|
|
175
|
+
|
|
176
|
+
# AI can access saved explanations from .code-captain/explanations/
|
|
177
|
+
# to provide better context for other commands
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### With IDE Integration
|
|
181
|
+
|
|
182
|
+
- Hover over function calls to see saved explanations
|
|
183
|
+
- Right-click context menu: "Explain with Code Captain"
|
|
184
|
+
- Inline explanation widgets for complex code blocks
|
|
185
|
+
|
|
186
|
+
## Management Commands
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
# List all saved explanations
|
|
190
|
+
cc: list-explanations
|
|
191
|
+
|
|
192
|
+
# Search explanations
|
|
193
|
+
cc: search-explanations "authentication"
|
|
194
|
+
|
|
195
|
+
# Show explanation history
|
|
196
|
+
cc: explanation-history calculateDiscount
|
|
197
|
+
|
|
198
|
+
# Update outdated explanations when code changes
|
|
199
|
+
cc: refresh-explanations --check-code-changes
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## Diagram Types Generated
|
|
203
|
+
|
|
204
|
+
### Flowcharts
|
|
205
|
+
|
|
206
|
+
- Control flow through functions
|
|
207
|
+
- Decision trees for complex logic
|
|
208
|
+
- Error handling paths
|
|
209
|
+
|
|
210
|
+
### Sequence Diagrams
|
|
211
|
+
|
|
212
|
+
- Function call sequences
|
|
213
|
+
- API interaction flows
|
|
214
|
+
- Database transaction flows
|
|
215
|
+
|
|
216
|
+
### Class Diagrams
|
|
217
|
+
|
|
218
|
+
- Object relationships
|
|
219
|
+
- Inheritance hierarchies
|
|
220
|
+
- Dependency structures
|
|
221
|
+
|
|
222
|
+
### Architecture Diagrams
|
|
223
|
+
|
|
224
|
+
- Component interactions
|
|
225
|
+
- Data flow through system
|
|
226
|
+
- Service communication patterns
|
|
227
|
+
|
|
228
|
+
## Output Characteristics
|
|
229
|
+
|
|
230
|
+
All explanations use a consistent intermediate technical level that balances accessibility with depth:
|
|
231
|
+
|
|
232
|
+
- **Technical but accessible**: Explains how the code works with some optimization details
|
|
233
|
+
- **Full context**: Always includes related functions, dependencies, and architectural context
|
|
234
|
+
- **Visual diagrams**: Every explanation includes appropriate flowcharts, sequence diagrams, or class diagrams
|
|
235
|
+
- **Comprehensive coverage**: Shows how the code fits in the entire system
|
|
236
|
+
|
|
237
|
+
## AI Processing Workflow
|
|
238
|
+
|
|
239
|
+
1. **Code Analysis**: Parse syntax, identify patterns, measure complexity
|
|
240
|
+
2. **Context Gathering**: Understand surrounding code and dependencies
|
|
241
|
+
3. **Explanation Generation**: Create intermediate-level natural language description
|
|
242
|
+
4. **Diagram Creation**: Generate appropriate visual representations (flowcharts, sequence, class diagrams)
|
|
243
|
+
5. **Formatting**: Structure output for both chat display and markdown file
|
|
244
|
+
6. **Auto-Save**: Save explanation to `.code-captain/explanations/` with date-prefixed filename `[DATE]-[target-name].md`
|
|
245
|
+
|
|
246
|
+
## Error Handling
|
|
247
|
+
|
|
248
|
+
### Common Issues
|
|
249
|
+
|
|
250
|
+
- **Code not found**: "Could not locate [target]. Please check the path/name."
|
|
251
|
+
- **Too complex**: "This code is very complex. Consider breaking into smaller explanations."
|
|
252
|
+
- **Limited context**: "Some context may be missing. Ensure related files are accessible."
|
|
253
|
+
|
|
254
|
+
### Fallback Behaviors
|
|
255
|
+
|
|
256
|
+
- If diagrams fail to generate, provide text-based flow description
|
|
257
|
+
- If target is ambiguous, offer multiple options to choose from
|
|
258
|
+
- If code is too large, suggest breaking into smaller segments
|
|
259
|
+
|
|
260
|
+
## Success Metrics
|
|
261
|
+
|
|
262
|
+
Track effectiveness through:
|
|
263
|
+
|
|
264
|
+
- Explanation clarity ratings from users
|
|
265
|
+
- Frequency of re-explanations for same code
|
|
266
|
+
- Time saved in code reviews and onboarding
|
|
267
|
+
- Reduction in "what does this do?" questions during development
|
|
268
|
+
|
|
269
|
+
## Future Enhancements
|
|
270
|
+
|
|
271
|
+
### Planned Features
|
|
272
|
+
|
|
273
|
+
- Interactive explanations with expandable sections
|
|
274
|
+
- Voice-generated explanations for accessibility
|
|
275
|
+
- Integration with code review tools
|
|
276
|
+
- Automatic explanation updates when code changes
|
|
277
|
+
- Explanation versioning and history tracking
|
|
278
|
+
|
|
279
|
+
### Advanced Capabilities
|
|
280
|
+
|
|
281
|
+
- Performance profiling integration
|
|
282
|
+
- Security vulnerability highlighting in explanations
|
|
283
|
+
- Code quality suggestions as part of explanations
|
|
284
|
+
- Integration with documentation generation tools
|
|
285
|
+
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
```
|
|
289
|
+
````
|
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
# Initialize Command Workflow
|
|
2
|
+
|
|
3
|
+
## Command: `cc: 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 `todo_write` 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
|
+
cc: plan-product "your product idea" - Define product vision, strategy, and roadmap
|
|
119
|
+
|
|
120
|
+
### For Existing Products:
|
|
121
|
+
cc: create-spec "feature description" - Create detailed feature specifications
|
|
122
|
+
cc: execute-task - Implement features with TDD workflow
|
|
123
|
+
|
|
124
|
+
### For Research:
|
|
125
|
+
cc: research "topic" - Conduct systematic technical research
|
|
126
|
+
cc: 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 `todo_write` 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
|
+
cc: plan-product "enhanced product vision" - Define product strategy and roadmap
|
|
266
|
+
|
|
267
|
+
### For Feature Development:
|
|
268
|
+
cc: create-spec "feature description" - Create detailed feature specifications
|
|
269
|
+
cc: execute-task - Implement features following established patterns
|
|
270
|
+
|
|
271
|
+
### For Technical Improvements:
|
|
272
|
+
cc: research "technical topic" - Research solutions for identified gaps
|
|
273
|
+
cc: create-adr "technical decision" - Document architectural improvements
|
|
274
|
+
|
|
275
|
+
Ready to define your product strategy and enhance your codebase!
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## CRITICAL: Final Message Requirements
|
|
283
|
+
|
|
284
|
+
**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:
|
|
285
|
+
|
|
286
|
+
1. Initialize handles ONLY technical foundation
|
|
287
|
+
2. plan-product handles product strategy and vision
|
|
288
|
+
3. Users need both for complete project setup
|
|
289
|
+
4. plan-product should be the next step before feature development
|
|
290
|
+
|
|
291
|
+
**Required message format**:
|
|
292
|
+
```
|
|
293
|
+
🚀 Technical Foundation Complete! / 🔍 Technical Foundation Analysis Complete!
|
|
294
|
+
|
|
295
|
+
## Recommended Next Steps:
|
|
296
|
+
|
|
297
|
+
### For Product Strategy (Recommended First):
|
|
298
|
+
cc: plan-product "your product idea/vision" - Define product strategy and roadmap
|
|
299
|
+
|
|
300
|
+
### For Feature Development:
|
|
301
|
+
cc: create-spec "feature description" - Create detailed feature specifications
|
|
302
|
+
cc: execute-task - Implement features
|
|
303
|
+
|
|
304
|
+
### For Technical Improvements:
|
|
305
|
+
cc: research "topic" - Research solutions for gaps
|
|
306
|
+
cc: create-adr "decision" - Document architectural decisions
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## Implementation Notes
|
|
312
|
+
|
|
313
|
+
### Tool Integration
|
|
314
|
+
|
|
315
|
+
- Use `codebase_search` for semantic understanding
|
|
316
|
+
- Use `file_search` for pattern discovery
|
|
317
|
+
- Use `todo_write` for progress tracking throughout both workflows
|
|
318
|
+
- Use `edit_file` to create documentation files
|
|
319
|
+
|
|
320
|
+
### Output Locations & File Structure
|
|
321
|
+
|
|
322
|
+
#### Directory Structure (Created by Install Script)
|
|
323
|
+
|
|
324
|
+
```
|
|
325
|
+
.code-captain/
|
|
326
|
+
├── commands/ # CC command definitions (pre-installed)
|
|
327
|
+
└── docs/
|
|
328
|
+
├── best-practices.md # Development best practices (pre-installed)
|
|
329
|
+
├── code-style.md # Code conventions and patterns
|
|
330
|
+
├── tech-stack.md # Technology decisions and rationale
|
|
331
|
+
└── architecture.md # System architecture (if complex)
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
#### Specific File Locations
|
|
335
|
+
|
|
336
|
+
**Docs Directory** (`.code-captain/docs/`):
|
|
337
|
+
|
|
338
|
+
- `best-practices.md` - Development best practices (pre-installed)
|
|
339
|
+
- `code-style.md` - Coding standards, naming conventions, patterns
|
|
340
|
+
- `tech-stack.md` - Technology choices with justifications
|
|
341
|
+
- `architecture.md` - System architecture and technical decisions (if complex)
|
|
342
|
+
|
|
343
|
+
**Research Directory** (`.code-captain/research/`):
|
|
344
|
+
|
|
345
|
+
- Research outputs, technical analysis, and investigation results
|
|
346
|
+
|
|
347
|
+
**Commands Directory** (`.code-captain/commands/`):
|
|
348
|
+
|
|
349
|
+
- Pre-installed CC command definitions (managed by system)
|
|
350
|
+
|
|
351
|
+
**Root Directory**:
|
|
352
|
+
|
|
353
|
+
- `README.md` - Project overview and quick start (only for new projects)
|
|
354
|
+
|
|
355
|
+
### Todo Integration
|
|
356
|
+
|
|
357
|
+
Each phase should update todos to show progress, enabling Cursor's todo tracking:
|
|
358
|
+
|
|
359
|
+
#### Example Todo Updates
|
|
360
|
+
|
|
361
|
+
```javascript
|
|
362
|
+
// Mark analysis complete and start documentation phase
|
|
363
|
+
todo_write({
|
|
364
|
+
merge: true,
|
|
365
|
+
todos: [
|
|
366
|
+
{ id: "greenfield-tech-analysis", status: "completed" },
|
|
367
|
+
{ id: "greenfield-tech-stack", status: "in_progress" },
|
|
368
|
+
],
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
// Update when creating documentation files
|
|
372
|
+
todo_write({
|
|
373
|
+
merge: true,
|
|
374
|
+
todos: [
|
|
375
|
+
{ id: "greenfield-tech-stack", status: "completed" },
|
|
376
|
+
{ id: "greenfield-dev-setup", status: "completed" },
|
|
377
|
+
{ id: "greenfield-readme", status: "in_progress" },
|
|
378
|
+
],
|
|
379
|
+
});
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
#### Todo Best Practices
|
|
383
|
+
|
|
384
|
+
- **Always include file paths** in todo content for clarity
|
|
385
|
+
- **Use descriptive IDs** that indicate workflow type (greenfield/brownfield)
|
|
386
|
+
- **Update todos immediately** after completing each task
|
|
387
|
+
- **Mark todos as completed** only after files are actually created
|
|
388
|
+
- **Use `merge: true`** to update existing todos without replacing the entire list
|
|
389
|
+
|
|
390
|
+
#### File Creation Verification
|
|
391
|
+
|
|
392
|
+
Before marking documentation todos as complete, ensure:
|
|
393
|
+
|
|
394
|
+
1. **Directory exists**: `.code-captain/docs/`
|
|
395
|
+
2. **File is created**: Use `write` tool to create the actual file
|
|
396
|
+
3. **Content is complete**: File contains all required sections
|
|
397
|
+
4. **Path is correct**: Double-check exact file path matches todo description
|