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