dot_claude/skills/refactor/SKILL.md
--- name: refactor description: "Identify and apply refactoring opportunities — supports full analysis, cleanup, simplify, structure, naming, and DRY focus modes." allowed-tools: Read, Glob, Grep, Edit, Write, Bash(git diff:*), Bash(git branch:*) argument-hint: [file/dir|staged] [full|cleanup|simplify|structure|naming|dry] --- ## Context - Branch: !`git branch --show-current` - Changed files: !`git diff --name-only HEAD` - Diff stats: !`git diff --stat HEAD` ## Task Analyze code for refactori
npx skillsauth add letstakeawalk/dotfiles dot_claude/skills/refactorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
git branch --show-currentgit diff --name-only HEADgit diff --stat HEADAnalyze code for refactoring opportunities, present findings, apply with user approval.
$ARGUMENTS may contain a target and/or focus mode.
staged, or empty (defaults to changed files)full, cleanup, simplify, structure, naming, dryIf empty, ask which mode:
| Mode | What |
|------|------|
| full | All categories |
| cleanup | Dead code, unused imports, debug artifacts, commented-out code |
| simplify | Unnecessary indirection, premature abstractions, over-nested logic |
| structure | Extract/split large functions (>50 lines) and files (>300 lines), move misplaced code |
| naming | Inconsistent names, misleading names, missing is_/has_ prefixes on booleans |
| dry | Within-file and cross-file duplication, copy-pasted code with minor variations |
Read all target files + surrounding module context. Identify existing patterns and conventions.
Identify opportunities based on mode. Present findings only — no changes yet.
### Refactoring Opportunities
**Target:** [what was analyzed, which mode]
### Findings
1. src/auth.rs:L42: bug: `validate_and_process_token` is 80 lines. Extract `validate_token`, `process_token`, `log_auth_event`.
2. src/auth.rs:L15: nit: `fn helper` → `extract_bearer_token`.
3. src/utils.rs:L30: nit: unused import `std::collections::BTreeMap`. Remove.
### Verdict: [count] bug / [count] risk / [count] nit
Severity: bug (structural issues, large functions, significant duplication), risk (naming, minor duplication, verbose patterns), nit (unused imports, dead code, cosmetic).
Ask user which findings to apply.
For each approved refactor: make edit, verify surrounding code (imports, callers).
Spawn matching *-reviewer agent(s) on changed files. Fix trivial issues, flag the rest.
development
Analyze test coverage gaps — untested public APIs, missing edge cases, uncovered error paths. Spawns the test-analyzer agent.
tools
--- name: review description: "Code review — detects language and spawns the appropriate reviewer agent. Works with diffs, staged changes, files, or directories." allowed-tools: Read, Glob, Grep, Edit, Write, Bash(git diff:*), Bash(git log:*), Bash(git status:*), Bash(git branch:*) argument-hint: [file/dir|staged|lang] [security|performance|idioms|bugs|tests] [--fix] [--deep] --- ## Context - Branch: !`git branch --show-current` - Changed files: !`git diff --name-only HEAD` - Diff stats: !`git
testing
This skill should be used when the user says 'remember this', 'save this for later', 'note this down', 'always do X', 'never do Y', or wants to persist a decision or preference across sessions.
tools
--- name: qa description: "Run QA on the current project. Auto-detects project type and runs browser testing for frontend projects. Use after implementing features to verify they work end-to-end." allowed-tools: Read, Glob, Grep, Bash(bun run:*), Bash(npm run:*), Bash(curl:*), Bash(lsof:*), Bash(kill:*), mcp__plugin_playwright_playwright__* argument-hint: [url or flow to test] [--fix] --- ## Task Verify the project works end-to-end by running it and testing interactively. Not a code review — t