@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,413 @@
1
+ # Code Captain Status Command (cc: status)
2
+
3
+ ## Overview
4
+ A command that provides developers with a comprehensive status report when starting work or switching context. Analyzes current git state, active work, and project health to orient developers and suggest next actions.
5
+
6
+ ## Command Structure
7
+
8
+ ```bash
9
+ cc: status
10
+ ```
11
+
12
+ Simple, no parameters needed. Works in any git repository with optional Code Captain project structure.
13
+
14
+ ## Core Functionality
15
+
16
+ ### 1. Git Status & Context Analysis
17
+ **Current Position:**
18
+ - Branch name and relationship to main/origin
19
+ - Commits ahead/behind main branch
20
+ - Last commit message and timestamp
21
+ - Uncommitted changes summary (files modified, added, deleted)
22
+ - Stash status if any
23
+
24
+ **Recent Activity:**
25
+ - Last 3-5 commits on current branch
26
+ - Recent activity on main branch that might affect current work
27
+ - Branch age and creation context
28
+
29
+ ### 2. Active Work Detection
30
+ **Code Captain Integration:**
31
+ - Scan `.code-captain/specs/` for active specifications
32
+ - Parse current task progress from most recent spec's tasks.md
33
+ - Identify completed vs pending tasks
34
+ - Determine current user story context
35
+
36
+ **Project Context:**
37
+ - Detect if work appears to be mid-feature vs starting fresh
38
+ - Identify obvious next steps based on file changes
39
+ - Check for TODO comments in recently modified files
40
+
41
+ ### 3. Project Health Check
42
+ **Basic Viability:**
43
+ - Can the project build/compile? (language-specific checks)
44
+ - Are core services startable?
45
+ - Any obvious configuration issues?
46
+ - Dependencies status (package.json, requirements.txt, etc.)
47
+
48
+ **Immediate Blockers:**
49
+ - Merge conflicts that need resolution
50
+ - Missing environment variables or config files
51
+ - Failed builds or critical errors
52
+
53
+ ### 4. Contextual Command Suggestions
54
+ **Based on Current State:**
55
+ - If mid-task: Suggest `cc: execute-task`
56
+ - If no active work: Suggest `cc: create-spec`
57
+ - If specifications exist: Suggest `cc: create-github-issues`
58
+ - Always suggest `cc: swab` for code cleanup
59
+
60
+ ## Output Format
61
+
62
+ **Important**: The status report should be output as **clean, formatted text** (not wrapped in code blocks) for optimal readability in the chat interface.
63
+
64
+ ### Standard Status Report
65
+
66
+ ⚓ Code Captain Status Report
67
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
68
+
69
+ 📍 CURRENT POSITION
70
+ Branch: feature/dashboard-websockets (2 commits ahead of main)
71
+ Last commit: "Add WebSocket connection hook" (2 hours ago)
72
+ Uncommitted: 3 modified files in src/components/
73
+
74
+ 📋 ACTIVE WORK
75
+ Spec: Real-time Dashboard with WebSocket Integration
76
+ Progress: Story 2 (User receives real-time notifications) - In Progress
77
+ Tasks completed: 3/6 tasks (50%)
78
+ Last completed: 2.3 Create notification display component ✅
79
+ Next task: 2.4 Implement client-side WebSocket connection
80
+
81
+ 🎯 SUGGESTED ACTIONS
82
+ • Continue with task 2.4 (WebSocket connection management)
83
+ • Commit current changes before switching tasks
84
+ • Review recent main branch changes (3 new commits)
85
+
86
+ ⚡ QUICK COMMANDS
87
+ cc: execute-task # Continue current task
88
+ cc: commit-wip # Commit work in progress
89
+ cc: sync-main # Pull latest from main
90
+ cc: swab # Quick code cleanup
91
+
92
+ ### Clean State Example
93
+
94
+ ⚓ Code Captain Status Report
95
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
96
+
97
+ 📍 CURRENT POSITION
98
+ Branch: main (up to date)
99
+ Last commit: "Fix user authentication bug" (1 day ago)
100
+ Working directory: Clean ✅
101
+
102
+ 📋 ACTIVE WORK
103
+ No active specifications found
104
+ Ready to start new work
105
+
106
+ 🎯 SUGGESTED ACTIONS
107
+ • Start new feature development
108
+ • Review pending issues or backlog
109
+ • Perform maintenance tasks
110
+
111
+ ⚡ QUICK COMMANDS
112
+ cc: create-spec # Plan new feature
113
+ cc: swab # Clean up existing code
114
+ cc: review-specs # Check previous specifications
115
+
116
+ ### Problem State Example
117
+
118
+ ⚓ Code Captain Status Report
119
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
120
+
121
+ 📍 CURRENT POSITION
122
+ Branch: feature/payment-flow (5 commits ahead, 2 behind main)
123
+ Last commit: "WIP: payment validation" (3 days ago)
124
+ Uncommitted: 7 modified files, 2 conflicts
125
+
126
+ ⚠️ IMMEDIATE ATTENTION
127
+ • Merge conflicts in src/api/payments.js, package.json
128
+ • Branch is 2 commits behind main (potential conflicts)
129
+ • Stashed changes from 2 days ago
130
+
131
+ 📋 ACTIVE WORK
132
+ Spec: Payment Processing Integration
133
+ Progress: Story 1 (User completes payment flow) - In Progress
134
+ Tasks completed: 3/5 tasks (60%)
135
+ Status: Task 1.4 appears incomplete
136
+ Next task: 1.4 Validate payment with external API
137
+
138
+ 🎯 SUGGESTED ACTIONS
139
+ • Resolve merge conflicts first
140
+ • Sync with main branch changes
141
+ • Review stashed changes for relevance
142
+ • Continue or restart task 1.4
143
+
144
+ ⚡ QUICK COMMANDS
145
+ cc: execute-task # Continue current task
146
+ cc: swab # Code cleanup
147
+
148
+ ## Implementation Details
149
+
150
+ ### Output Presentation
151
+
152
+ **Critical**: When Code Captain executes the status command, the report should be presented as **clean, formatted text** directly in the chat response, NOT wrapped in code blocks or markdown formatting. This ensures maximum readability and a professional presentation.
153
+
154
+ The status report uses Unicode characters (⚓, 📍, 📋, 🎯, ⚡, ⚠️) and box-drawing characters (━) for visual appeal. These should be output exactly as shown in the examples above.
155
+
156
+ ### Git Analysis
157
+ **Commands to Run:**
158
+ ```bash
159
+ git status --porcelain # File changes
160
+ git log --oneline -5 # Recent commits
161
+ git log main..HEAD --oneline # Commits ahead
162
+ git log HEAD..main --oneline # Commits behind
163
+ git stash list # Stashed changes
164
+ git branch -v # Branch info
165
+ ```
166
+
167
+ **Parsing Logic:**
168
+ - Extract meaningful context from commit messages
169
+ - Detect work patterns (feature vs bug fix vs refactor)
170
+ - Identify if work appears complete or in-progress
171
+ - Calculate time since last activity
172
+
173
+ ### Code Captain Integration
174
+
175
+ **Spec Detection:**
176
+ ```bash
177
+ # Find most recent spec directory
178
+ LATEST_SPEC=$(ls -t .code-captain/specs/*/spec.md | head -1 | xargs dirname)
179
+
180
+ # Read overall progress from user stories overview
181
+ cat "$LATEST_SPEC/user-stories/README.md"
182
+
183
+ # Find all individual story files
184
+ ls "$LATEST_SPEC/user-stories/story-"*.md
185
+ ```
186
+
187
+ **Task Progress Analysis:**
188
+
189
+ For each individual story file (`user-stories/story-N-{name}.md`), parse the Implementation Tasks section:
190
+
191
+ ```bash
192
+ # Count completed tasks (marked with [x])
193
+ grep -c "^\- \[x\].*✅" story-file.md
194
+
195
+ # Count total tasks (any checkbox)
196
+ grep -c "^\- \[[x ]\]" story-file.md
197
+
198
+ # Find next incomplete task
199
+ grep -n "^\- \[ \]" story-file.md | head -1
200
+ ```
201
+
202
+ **Story Status Detection:**
203
+
204
+ Parse the story status from the header:
205
+ ```bash
206
+ # Extract status from story file header
207
+ grep "^> \*\*Status:\*\*" story-file.md
208
+ ```
209
+
210
+ Possible statuses:
211
+ - `Not Started` - No tasks completed
212
+ - `In Progress` - Some tasks completed, some remaining
213
+ - `Completed ✅` - All tasks and acceptance criteria completed
214
+
215
+ **Progress Analysis:**
216
+ - Count completed vs total tasks across all stories
217
+ - Identify current active story (has In Progress status)
218
+ - Extract next logical task from current story
219
+ - Detect if entire spec work is complete
220
+ - Parse progress summary from `user-stories/README.md` table
221
+
222
+ **Active Work Prioritization:**
223
+
224
+ 1. **Multiple specs exist**: Show the most recently modified spec (based on file timestamps)
225
+ 2. **Single spec, multiple stories**: Show the story with "In Progress" status, or first "Not Started" story if none in progress
226
+ 3. **All stories complete**: Show overall completion status and suggest next actions
227
+ 4. **No specs found**: Indicate no Code Captain specifications exist
228
+
229
+ **Task Parsing Edge Cases:**
230
+
231
+ Handle various task formats that may exist in story files:
232
+ ```bash
233
+ # Standard format with checkmark
234
+ - [x] 1.1 Implement authentication ✅
235
+
236
+ # Format without checkmark emoji
237
+ - [x] 1.1 Implement authentication
238
+
239
+ # Incomplete task
240
+ - [ ] 1.2 Add validation logic
241
+
242
+ # Tasks with sub-items (count as single task)
243
+ - [x] 1.3 Database setup
244
+ - Created user table
245
+ - Added indexes
246
+ ```
247
+
248
+ **Validation:**
249
+ - Only count top-level task items (lines starting with `- [`)
250
+ - Ignore indented sub-items
251
+ - Handle both `[x]` and `[X]` as completed
252
+ - Treat any other character in brackets as incomplete
253
+
254
+ ### Project Health Checks
255
+ **Language-Specific:**
256
+ ```bash
257
+ # Node.js
258
+ npm run build --if-present
259
+ node -c package.json
260
+
261
+ # Python
262
+ python -m py_compile main.py
263
+ pip check
264
+
265
+ # General
266
+ # Check for .env.example vs .env
267
+ # Verify critical config files exist
268
+ ```
269
+
270
+ ### Command Suggestion Logic
271
+ **Decision Tree:**
272
+ 1. **Is there a merge conflict?** → Suggest conflict resolution
273
+ 2. **Is working directory dirty?** → Suggest commit or stash
274
+ 3. **Is branch behind main?** → Suggest sync
275
+ 4. **Is there an active task?** → Suggest continue task
276
+ 5. **Is current task complete?** → Suggest next task
277
+ 6. **No active work?** → Suggest create spec
278
+ 7. **Always:** → Suggest swab for cleanup
279
+
280
+ ## Usage Patterns
281
+
282
+ ### Morning Routine
283
+ ```bash
284
+ # Developer starts their day
285
+ $ cc: status
286
+
287
+ # Gets oriented on yesterday's work
288
+ # Sees exactly what to do next
289
+ # Jumps into flow state quickly
290
+ ```
291
+
292
+ ### Context Switching
293
+ ```bash
294
+ # After meetings, interruptions, or breaks
295
+ $ cc: status
296
+
297
+ # Quick reminder of current state
298
+ # Understand what changed while away
299
+ # Resume work efficiently
300
+ ```
301
+
302
+ ### Project Handoff
303
+ ```bash
304
+ # When picking up someone else's work
305
+ $ cc: status
306
+
307
+ # Understand current project state
308
+ # See what was being worked on
309
+ # Get oriented without diving into code
310
+ ```
311
+
312
+ ## Error Handling
313
+
314
+ ### Not a Git Repository
315
+ ```bash
316
+ ❌ Not in a git repository
317
+ Initialize git first: git init
318
+ ```
319
+
320
+ ### No Code Captain Structure
321
+ ```bash
322
+ ⚓ Code Captain Status Report
323
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
324
+
325
+ 📍 CURRENT POSITION
326
+ Branch: main (up to date)
327
+ Last commit: "Initial commit" (1 hour ago)
328
+ Working directory: Clean ✅
329
+
330
+ 📋 ACTIVE WORK
331
+ No Code Captain specifications found
332
+ Project structure: Standard git repository
333
+
334
+ 🎯 SUGGESTED ACTIONS
335
+ • Set up Code Captain workflow
336
+ • Create first feature specification
337
+
338
+ ⚡ QUICK COMMANDS
339
+ cc: init # Initialize Code Captain
340
+ cc: create-spec # Create first specification
341
+ ```
342
+
343
+ ### Corrupted Project State
344
+ ```bash
345
+ ⚠️ PROJECT ISSUES DETECTED
346
+ • package.json syntax error
347
+ • Missing critical dependencies
348
+ • Build process failing
349
+
350
+ 🔧 SUGGESTED FIXES
351
+ • Fix package.json syntax
352
+ • Run npm install or equivalent
353
+ • Check build configuration
354
+
355
+ ⚡ RECOVERY COMMANDS
356
+ cc: doctor # Diagnose and fix common issues
357
+ cc: reset-deps # Reinstall dependencies
358
+ ```
359
+
360
+ ## Security & Privacy
361
+
362
+ ### Local-Only Analysis
363
+ - All analysis happens locally
364
+ - No external API calls or data transmission
365
+ - Git history and file contents remain private
366
+
367
+ ### Sensitive Information
368
+ - Avoid displaying sensitive data in commit messages
369
+ - Mask environment variables or config values
370
+ - Sanitize file paths that might contain personal info
371
+
372
+ ## Performance Considerations
373
+
374
+ ### Fast Execution
375
+ - Target <2 second execution time
376
+ - Cache expensive operations when possible
377
+ - Limit git log queries to reasonable ranges
378
+
379
+ ### Incremental Analysis
380
+ - Store last analysis timestamp
381
+ - Only re-analyze changed files/commits
382
+ - Use git's efficient diffing for change detection
383
+
384
+ ## Integration Points
385
+
386
+ ### Existing Code Captain Commands
387
+ - Status should inform other commands about current state
388
+ - Share analysis results to avoid duplicate work
389
+ - Coordinate with task execution and spec management
390
+
391
+ ### Future Enhancements
392
+ - Integration with GitHub/GitLab for PR status
393
+ - Team activity awareness (without external dependencies)
394
+ - Customizable status report sections
395
+ - Export status for external tools or dashboards
396
+
397
+ ## Success Metrics
398
+
399
+ ### Developer Experience
400
+ - Time to context restoration after interruptions
401
+ - Frequency of "what was I working on?" moments
402
+ - Accuracy of suggested next actions
403
+ - Adoption rate and daily usage patterns
404
+
405
+ ### Project Health
406
+ - Early detection of project issues
407
+ - Improved workflow consistency
408
+ - Better task completion rates
409
+ - Reduced context switching overhead
410
+
411
+ ---
412
+
413
+ *⚓ Keep your bearings, maintain your heading, and always know where you stand in the code.*
@@ -0,0 +1,209 @@
1
+ # Code Captain Swab Command (cc: swab)
2
+
3
+ ## Overview
4
+
5
+ A deck-cleaning agent that makes one small, focused improvement to the codebase, following the "Boy Scout Rule" - leave the code cleaner than you found it. This command identifies the single best small cleanup opportunity and applies it with your approval.
6
+
7
+ ## Usage
8
+
9
+ ```bash
10
+ cc: swab
11
+ ```
12
+
13
+ **Note:** No options, no flags, no complexity. Just simple deck cleaning.
14
+
15
+ ## Command Process
16
+
17
+ ### Step 1: Codebase Scanning
18
+
19
+ **Scan for improvement opportunities:**
20
+
21
+ - Search project files for common code smells
22
+ - Analyze file patterns and naming conventions
23
+ - Identify low-risk, high-impact improvements
24
+ - Focus on clarity and maintainability wins
25
+
26
+ **Target Areas:**
27
+ - Unclear variable names (`d`, `temp`, `data`, single letters)
28
+ - Magic numbers that should be constants
29
+ - Missing error handling on JSON.parse, API calls
30
+ - Commented-out code blocks
31
+ - Inconsistent formatting patterns
32
+ - Overly abbreviated names
33
+ - Unused imports or variables
34
+
35
+ ### Step 2: Opportunity Prioritization
36
+
37
+ **Selection Criteria:**
38
+ 1. **Clarity Impact** - How much clearer will the code be?
39
+ 2. **Risk Level** - How certain are we this won't break anything?
40
+ 3. **Scope** - Prefer 1-10 line changes maximum
41
+ 4. **Confidence** - Only suggest changes we're 100% certain about
42
+
43
+ **Priority Order:**
44
+ 1. Variable/function name improvements
45
+ 2. Magic number extraction to constants
46
+ 3. Adding missing error handling
47
+ 4. Removing dead code
48
+ 5. Formatting consistency fixes
49
+
50
+ ### Step 3: Present Single Best Option
51
+
52
+ **Display Format:**
53
+ ```
54
+ 🧽 Swabbing the deck... found some mess in {filename}
55
+
56
+ === SUGGESTED CLEANUP ===
57
+
58
+ - {before_code}
59
+ + {after_code}
60
+
61
+ Reason: {clear_explanation}
62
+ Risk: {Low|Medium}
63
+
64
+ Clean this up? [y/N]
65
+ ```
66
+
67
+ ### Step 4: Apply Change
68
+
69
+ **If approved:**
70
+ - Make the exact replacement using search/replace
71
+ - Verify the change was applied correctly
72
+ - Show success message: "✅ Deck swabbed! One less mess aboard."
73
+
74
+ **If declined:**
75
+ - Exit gracefully with: "🧽 Deck inspection complete. No changes made."
76
+
77
+ ## Core Rules
78
+
79
+ 1. **One change only** - Never fix multiple things at once
80
+ 2. **Small changes** - Maximum 10 lines modified
81
+ 3. **Safe changes** - If uncertain, do nothing
82
+ 4. **Your approval required** - Always ask before applying
83
+ 5. **Exact replacements** - Surgical precision, no formatting noise
84
+ 6. **Conservative approach** - Better to find nothing than break something
85
+
86
+ ## AI Implementation Prompt
87
+
88
+ ```
89
+ You are a code reviewer cleaning up small messes on the ship.
90
+
91
+ MISSION: Find exactly ONE small, safe cleanup opportunity in the codebase.
92
+
93
+ RULES:
94
+ - Find ONE small cleanup only (1-10 lines max changed)
95
+ - Prioritize clarity and safety over cleverness
96
+ - Preserve all existing functionality exactly
97
+ - Be extremely conservative - if ANY uncertainty, do nothing
98
+ - Provide exact search/replace strings
99
+ - Focus on high-impact, zero-risk improvements
100
+
101
+ SCAN PRIORITIES:
102
+ 1. Unclear variable names (single letters, abbreviations)
103
+ 2. Magic numbers that should be named constants
104
+ 3. Missing error handling (JSON.parse, fetch, etc.)
105
+ 4. Dead/commented code removal
106
+ 5. Minor formatting consistency
107
+
108
+ CODEBASE CONTEXT: {scanned_files_content}
109
+
110
+ RESPONSE FORMAT:
111
+ If you find a good cleanup opportunity:
112
+ {
113
+ "cleanup": "Brief description of the improvement",
114
+ "filename": "path/to/file.js",
115
+ "searchText": "exact text to find (with proper whitespace)",
116
+ "replaceText": "exact replacement text (with proper whitespace)",
117
+ "reasoning": "Why this specific change helps readability/maintainability",
118
+ "riskLevel": "Low|Medium",
119
+ "linesChanged": number_of_lines_modified
120
+ }
121
+
122
+ If no clear, safe cleanup exists:
123
+ {
124
+ "cleanup": null,
125
+ "message": "No obvious cleanup opportunities found. Codebase looks tidy!"
126
+ }
127
+
128
+ CRITICAL: Only suggest changes you are 100% confident about. When in doubt, suggest nothing.
129
+ ```
130
+
131
+ ## Implementation Details
132
+
133
+ ### Codebase Scanning Strategy
134
+
135
+ **File Discovery:**
136
+ - Use `codebase_search` to find code patterns and smells across all source files
137
+ - Use `list_dir` to explore project structure and identify main source directories
138
+ - Use `file_search` to locate specific file types if needed
139
+ - Focus on recently modified files first (higher likelihood of improvement opportunities)
140
+
141
+ **Content Analysis:**
142
+ - Read file contents for analysis
143
+ - Use `codebase_search` for pattern detection
144
+ - Focus on files under 500 lines for simplicity
145
+ - Prioritize recently modified files
146
+
147
+ ### Change Application
148
+
149
+ **File Modification:**
150
+ ```bash
151
+ # Use search_replace tool for exact string replacement
152
+ search_replace(
153
+ file_path=target_file,
154
+ old_string=exact_match_text,
155
+ new_string=improved_text
156
+ )
157
+ ```
158
+
159
+ **Verification:**
160
+ - Re-read file to confirm change applied correctly
161
+ - Run basic syntax validation if available
162
+ - Ensure no unintended modifications occurred
163
+
164
+ ### Error Handling
165
+
166
+ **No opportunities found:**
167
+ ```
168
+ 🧽 Deck inspection complete.
169
+
170
+ No obvious cleanup opportunities found in the scanned files.
171
+ Your codebase looks pretty tidy already! ✨
172
+
173
+ Run again later as the code evolves, or try focusing on a specific directory.
174
+ ```
175
+
176
+ **Multiple opportunities found:**
177
+ - Always pick the highest-impact, lowest-risk option
178
+ - Never present multiple options (causes decision paralysis)
179
+ - Save other opportunities for future runs
180
+
181
+ **Change application failure:**
182
+ ```
183
+ ❌ Swab attempt failed.
184
+
185
+ The suggested change couldn't be applied safely.
186
+ This might happen if the file was modified since scanning.
187
+ Try running the command again.
188
+ ```
189
+
190
+ ## Integration Notes
191
+
192
+ This command integrates with the existing Code Captain ecosystem by:
193
+
194
+ 1. **Following established patterns** - Uses same markdown structure as other commands
195
+ 2. **Leveraging existing tools** - Uses `codebase_search`, `read_file`, `search_replace`
196
+ 3. **Maintaining simplicity** - No complex configuration or state management
197
+ 4. **Respecting user control** - Always asks permission before making changes
198
+
199
+ ## Future Enhancements
200
+
201
+ Potential future improvements (not in initial version):
202
+
203
+ - **Directory targeting**: `cc: swab src/components/`
204
+ - **File type filtering**: `cc: swab --js-only`
205
+ - **Batch mode**: `cc: swab --batch` (apply multiple small changes)
206
+ - **Learning**: Remember which types of cleanups user prefers
207
+ - **Metrics**: Track improvements made over time
208
+
209
+ But for now: Keep it simple. One command, one small improvement, user approval required.
@@ -0,0 +1,74 @@
1
+ # Development Best Practices
2
+
3
+ ## Context
4
+
5
+ Global development guidelines for Agent OS projects.
6
+
7
+ ## Core Principles
8
+
9
+ ### Keep It Simple
10
+
11
+ - Implement code in the fewest lines possible
12
+ - Avoid over-engineering solutions
13
+ - Choose straightforward approaches over clever ones
14
+
15
+ ### Optimize for Readability
16
+
17
+ - Prioritize code clarity over micro-optimizations
18
+ - Write self-documenting code with clear variable names
19
+ - Add comments for "why" not "what"
20
+
21
+ ### DRY (Don't Repeat Yourself)
22
+
23
+ - Extract repeated business logic to private methods
24
+ - Extract repeated UI markup to reusable components
25
+ - Create utility functions for common operations
26
+
27
+ ### File Structure
28
+
29
+ - Keep files focused on a single responsibility
30
+ - Group related functionality together
31
+ - Use consistent naming conventions
32
+
33
+ ## Critical Thinking and Decision Making
34
+
35
+ ### Challenge Ideas and Assumptions
36
+
37
+ - Question the "why" behind every technical decision
38
+ - Identify unstated assumptions in requirements and designs
39
+ - Ask "What could go wrong?" for proposed solutions
40
+ - Consider edge cases and failure scenarios
41
+
42
+ ### Provide Constructive Pushback
43
+
44
+ - Disagree when you have evidence-based concerns
45
+ - Offer alternative approaches with clear reasoning
46
+ - Challenge overly complex solutions in favor of simpler ones
47
+ - Point out potential security, performance, or maintainability issues
48
+
49
+ ### Focus on Evidence Over Agreement
50
+
51
+ - Base decisions on data, benchmarks, and measurable outcomes
52
+ - Cite specific examples when discussing trade-offs
53
+ - Reference industry standards and established patterns
54
+ - Avoid "yes, and..." responses when "no, because..." is more appropriate
55
+
56
+ ### Question Popular Choices
57
+
58
+ - Don't assume popularity equals correctness
59
+ - Evaluate if trendy technologies actually solve the problem
60
+ - Consider long-term maintenance costs of new frameworks
61
+ - Assess if existing solutions already meet the need
62
+
63
+ ## Dependencies
64
+
65
+ ### Choose Libraries Wisely
66
+
67
+ When adding third-party dependencies:
68
+
69
+ - Select the most popular and actively maintained option
70
+ - Check the library's GitHub repository for:
71
+ - Recent commits (within last 6 months)
72
+ - Active issue resolution
73
+ - Number of stars/downloads
74
+ - Clear documentation