swab
Find and apply one small, safe code cleanup improvement with user approval (Boy Scout Rule)
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Find and apply one small, safe code cleanup improvement with user approval (Boy Scout Rule)
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Analyze repos in a workspace — generate compressed codebase indexes (AGENTS.md), per-repo docs, cross-repo dependency map, and master TOC for AI agent consumption
Explain a code element, file, or line range with diagrams and architectural context
Analyze an MCP server's GitHub repository for security risks, malicious intent, and code quality. Produces a trust rating and recommends whether to use it or suggests safer alternatives.
Conduct systematic multi-phase research on a topic and produce a documented findings report
Show a comprehensive project status report with git state, active specs, and suggested next actions
| name | swab |
| mode | agent |
| description | Find and apply one small, safe code cleanup improvement with user approval (Boy Scout Rule) |
| argument-hint |
A deck-cleaning skill that makes one small, focused improvement to the codebase, following the "Boy Scout Rule" — leave the code cleaner than you found it. Identifies the single best small cleanup opportunity and applies it with your approval.
Use TodoWrite to track the swab process:
- Scan codebase for improvement opportunities [in_progress]
- Prioritize and select best cleanup option [pending]
- Present cleanup suggestion to user [pending]
- Apply approved change [pending]
Scan for improvement opportunities:
Grep to search for common code smells across source filesBash to explore project structure and identify main source directoriesGlob to locate specific file types if neededTarget Areas:
d, temp, data, single letters)Update TodoWrite: mark "Scan codebase" as completed.
Update TodoWrite: mark "Prioritize and select best cleanup option" as in_progress.
Selection Criteria:
Priority Order:
Use Read to load the target file and verify the exact text to replace.
Update TodoWrite: mark "Prioritize and select best cleanup option" as completed.
Update TodoWrite: mark "Present cleanup suggestion to user" as in_progress.
Display Format:
🧽 Swabbing the deck... found some mess in {filename}
=== SUGGESTED CLEANUP ===
- {before_code}
+ {after_code}
Reason: {clear_explanation}
Risk: {Low|Medium}
Clean this up? [y/N]
Important: Present ONLY ONE option. Never show multiple options (causes decision paralysis). Save other opportunities for future runs.
Update TodoWrite: mark "Present cleanup suggestion to user" as completed.
Update TodoWrite: mark "Apply approved change" as in_progress.
If approved:
EditRead to verify the change was applied correctlyTodoWriteIf declined:
File Discovery:
Grep to find code patterns and smells across all source filesBash to explore project structure: find . -name "*.js" -not -path "*/node_modules/*" | head -20Glob to locate specific file types if neededCommon Grep Patterns:
# Single-letter variables
grep -rn " [a-z] = " src/ --include="*.{js,ts,py}"
# Magic numbers
grep -rn "[^a-zA-Z0-9_][0-9]\{3,\}[^0-9]" src/ --include="*.{js,ts,py}"
# Commented-out code
grep -rn "^[[:space:]]*//" src/ --include="*.{js,ts}" | head -10
No opportunities found:
🧽 Deck inspection complete.
No obvious cleanup opportunities found in the scanned files.
Your codebase looks pretty tidy already! ✨
Run again later as the code evolves, or try focusing on a specific directory.
Change application failure:
❌ Swab attempt failed.
The suggested change couldn't be applied safely.
This might happen if the file was modified since scanning.
Try running the command again.
This skill integrates with the Code Captain ecosystem by:
TodoWrite for visibility into skill progress