Tech Debt Analyzer
ailabs-393/ai-labs-claude-skills
This skill should be used when analyzing technical debt in a codebase, documenting code quality issues, creating technical debt registers, or assessing code maintainability.
Guides refactoring in phases based on Martin Fowler's method: research, test coverage check, planning and small tested steps, with your approval at each phase.
$ npx skills add luongnv89/claude-howto --skill refactor -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install luongnv89/claude-howto refactor --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/luongnv89/claude-howto.git skills-src && mkdir -p .claude/skills && cp -r skills-src/03-skills/refactor .claude/skills/refactor && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "refactor" agent skill from https://github.com/luongnv89/claude-howto/tree/main/03-skills/refactor into .claude/skills/refactor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "refactor", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/luongnv89/claude-howto/tree/main/03-skills/refactorType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add luongnv89/claude-howto --skill refactor -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install luongnv89/claude-howto refactor --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/luongnv89/claude-howto.git skills-src && mkdir -p .agents/skills && cp -r skills-src/03-skills/refactor .agents/skills/refactor && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "refactor" agent skill from https://github.com/luongnv89/claude-howto/tree/main/03-skills/refactor into .agents/skills/refactor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "refactor", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add luongnv89/claude-howto --skill refactor -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install luongnv89/claude-howto refactor --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/luongnv89/claude-howto.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/03-skills/refactor .cursor/skills/refactor && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "refactor" agent skill from https://github.com/luongnv89/claude-howto/tree/main/03-skills/refactor into .cursor/skills/refactor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "refactor", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/luongnv89/claude-howto.git --path 03-skills/refactor--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add luongnv89/claude-howto --skill refactor -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install luongnv89/claude-howto refactor --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/luongnv89/claude-howto.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/03-skills/refactor .gemini/skills/refactor && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "refactor" agent skill from https://github.com/luongnv89/claude-howto/tree/main/03-skills/refactor into .gemini/skills/refactor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "refactor", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install luongnv89/claude-howto refactorInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add luongnv89/claude-howto --skill refactor -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/luongnv89/claude-howto.git skills-src && mkdir -p .github/skills && cp -r skills-src/03-skills/refactor .github/skills/refactor && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "refactor" agent skill from https://github.com/luongnv89/claude-howto/tree/main/03-skills/refactor into .github/skills/refactor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "refactor", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add luongnv89/claude-howto --skill refactor -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install luongnv89/claude-howto refactor --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/luongnv89/claude-howto.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/03-skills/refactor .opencode/skills/refactor && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "refactor" agent skill from https://github.com/luongnv89/claude-howto/tree/main/03-skills/refactor into .opencode/skills/refactor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "refactor", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
refactorGuides refactoring in phases based on Martin Fowler's method: research, test coverage check, planning and small tested steps, with your approval at each phase.
The skill is built on five principles: external behavior stays the same, changes are small, tests are the safety net, refactoring is ongoing, and you approve each phase. Phase 1 is research and analysis. The agent first asks about scope, goals, constraints, timeline pressure and test status, then reads the target code, maps dependencies, notes existing debt markers such as TODOs and FIXMEs, presents its findings and asks for approval to continue.
Phase 2 assesses test coverage by looking for test files, running the existing tests and checking coverage where available. If tests exist and pass, the work moves on; if they are missing or incomplete, the decision comes back to you. Bundled resources include references on code smells and a refactoring catalog, two scripts, `scripts/analyze-complexity.py` and `scripts/detect-smells.py`, and a refactoring plan template.
6 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit 556af8d. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Ships 2 files in scripts/ (Python), which the agent can run.
Shell commands in SKILL.md call:
npmpytestpythonmvnFrom the folder's file list and the shell code blocks in SKILL.md.
Links to these hosts (documentation or services it may open):
code.claude.comFrom URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Systematic Code Refactoring loads about 3k tokens when it runs, and up to ~13k if it reads all its reference files. Until then it costs about 86 tokens; SKILL.md has 1,267 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.
The full file from luongnv89/claude-howto at commit 556af8d, republished under its MIT licence (© luongnv89). 1,267 words, ~2,981 tokens.
.claude/skills/refactor/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.A systematic approach to refactoring code based on Martin Fowler's Refactoring: Improving the Design of Existing Code (2nd Edition). This skill emphasizes safe, incremental changes backed by tests.
"Refactoring is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure." — Martin Fowler
Phase 1: Research & Analysis
↓
Phase 2: Test Coverage Assessment
↓
Phase 3: Code Smell Identification
↓
Phase 4: Refactoring Plan Creation
↓
Phase 5: Incremental Implementation
↓
Phase 6: Review & IterationBefore starting, clarify:
Present findings to user:
"Refactoring without tests is like driving without a seatbelt." — Martin Fowler
Tests are the key enabler of safe refactoring. Without them, you risk introducing bugs.
Check for existing tests
# Look for test files
find . -name "*test*" -o -name "*spec*" | head -20Run existing tests
# JavaScript/TypeScript
npm test
# Python
pytest -v
# Java
mvn testCheck coverage (if available)
# JavaScript
npm run test:coverage
# Python
pytest --cov=.If tests exist and pass:
If tests are missing or incomplete: Present options:
If tests are failing:
For each function being refactored, ensure tests cover:
Use the "red-green-refactor" cycle:
Symptoms of deeper problems in code. They're not bugs, but indicators that the code could be improved.
See references/code-smells.md for the complete catalog.
| Smell | Signs | Impact |
|---|---|---|
| Long Method | Methods > 30-50 lines | Hard to understand, test, maintain |
| Duplicated Code | Same logic in multiple places | Bug fixes needed in multiple places |
| Large Class | Class with too many responsibilities | Violates Single Responsibility |
| Feature Envy | Method uses another class's data more | Poor encapsulation |
| Primitive Obsession | Overuse of primitives instead of objects | Missing domain concepts |
| Long Parameter List | Methods with 4+ parameters | Hard to call correctly |
| Data Clumps | Same data items appearing together | Missing abstraction |
| Switch Statements | Complex switch/if-else chains | Hard to extend |
| Speculative Generality | Code "just in case" | Unnecessary complexity |
| Dead Code | Unused code | Confusion, maintenance burden |
Automated Analysis (if scripts available)
python scripts/detect-smells.py <file>Manual Review
Prioritization Focus on smells that:
Present to user:
For each smell, select an appropriate refactoring from the catalog.
See references/refactoring-catalog.md for the complete list.
| Code Smell | Recommended Refactoring(s) |
|---|---|
| Long Method | Extract Method, Replace Temp with Query |
| Duplicated Code | Extract Method, Pull Up Method, Form Template Method |
| Large Class | Extract Class, Extract Subclass |
| Feature Envy | Move Method, Move Field |
| Primitive Obsession | Replace Primitive with Object, Replace Type Code with Class |
| Long Parameter List | Introduce Parameter Object, Preserve Whole Object |
| Data Clumps | Extract Class, Introduce Parameter Object |
| Switch Statements | Replace Conditional with Polymorphism |
| Speculative Generality | Collapse Hierarchy, Inline Class, Remove Dead Code |
| Dead Code | Remove Dead Code |
Use the template at templates/refactoring-plan.md.
For each refactoring:
CRITICAL: Introduce refactoring gradually in phases.
Phase A: Quick Wins (Low risk, high value)
Phase B: Structural Improvements (Medium risk)
Phase C: Architectural Changes (Higher risk)
Before implementation:
"Change → Test → Green? → Commit → Next step"
For each refactoring step:
Pre-check
Make ONE small change
Verify
If tests pass (green)
If tests fail (red)
Each commit should be:
Example commit messages:
refactor: Extract calculateTotal() from processOrder()
refactor: Rename 'x' to 'customerCount' for clarity
refactor: Remove unused validateOldFormat() methodAfter each sub-phase, report to user:
Run complexity analysis before and after:
python scripts/analyze-complexity.py <file>Present improvements:
Present final results:
Discuss with user:
Always pause and consult user when:
Before:
function processOrder(order) {
// 150 lines of code with:
// - Duplicated validation logic
// - Inline calculations
// - Mixed responsibilities
}Refactoring Steps:
After:
function processOrder(order) {
validateOrder(order);
const total = calculateOrderTotal(order);
notifyCustomer(order, total);
return { order, total };
}scripts/analyze-complexity.py - Analyze code complexity metricsscripts/detect-smells.py - Automated smell detectionLast Updated: August 4, 2026 Claude Code Version: 2.1.220 Sources:
© luongnv89, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 5 other files (scripts, references) in 03-skills/refactor of luongnv89/claude-howto.
Open the folder on GitHubat commit 556af8d
Systematic Code Refactoring next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Systematic Code Refactoring this skillluongnv89/claude-howto | 42k | — | ~3k | Automated safety check: Pass | MIT | |
| Tech Debt Analyzerailabs-393/ai-labs-claude-skills | 454 | 2 repos | ~3.9k | Automated safety check: Pass | MIT | |
| FIXME Resolvertailcallhq/forgecode | 7.6k | — | ~1.1k | Automated safety check: Pass | Apache-2.0 | |
| DesloppifyGit-on-my-level/codex-autorunner | 875 | — | ~3.4k | Automated safety check: Pass | MIT | |
| Code Quality Gatefengshao1227/ccg-workflow | 5.9k | — | ~593 | Automated safety check: Notes | MIT | |
| Smell CheckZhen-Bo/smell-check | 239 | — | ~1.5k | Automated safety check: Pass | MIT |
ailabs-393/ai-labs-claude-skills
This skill should be used when analyzing technical debt in a codebase, documenting code quality issues, creating technical debt registers, or assessing code maintainability.
tailcallhq/forgecode
Finds every FIXME comment in a codebase, groups related ones across files into one task, implements the work they describe and removes the comments once it is done.
Git-on-my-level/codex-autorunner
Codebase health scanner and technical debt tracker. An agent skill from Git-on-my-level/codex-autorunner.
fengshao1227/ccg-workflow
Scans code for complexity, long functions, duplicated blocks, naming problems and code smells with a Node script, then reports and suggests refactors.
Zhen-Bo/smell-check
Runs a smell-first audit on a user-chosen path set: measures structure metrics, applies a named size profile, and reports code smells and test smells with evidence strength.
kucherenko/jscpd
A three-part cleanup guided by jscpd: measure health, then fix duplicated code, remove dead code and simplify the most complex files, finishing by re-measuring the score.
luongnv89/claude-howto
Guides systematic, test-backed refactoring in the style of Martin Fowler, moving through research, planning and small incremental changes with your approval at each phase.
luongnv89/claude-howto
Guides drafting a blog post from an idea and optional source material: research, brainstorming, outlining and version-tracked drafts, with user approval at each step.
luongnv89/claude-howto
Ensure all communication matches brand voice and tone guidelines. Use when creating marketing copy, customer communications, public-facing content, or when…
luongnv89/claude-howto
Reviews code for security, performance, quality and maintainability, using a checklist, a finding template and two metrics scripts.
luongnv89/claude-howto
Runs a quick or deep quiz on Claude Code skills, scores ten feature areas and generates a personalized learning path with prioritized next steps.
luongnv89/claude-howto
Quizzes a learner on one lesson of the Claude Code tutorial with ten questions, scores the answers and points out weak spots.
Categories
Guides refactoring in phases based on Martin Fowler's method: research, test coverage check, planning and small tested steps, with your approval at each phase. The skill is built on five principles: external behavior stays the same, changes are small, tests are the safety net, refactoring is ongoing, and you approve each phase. Phase 1 is research and analysis.
Systematic Code Refactoring fits situations like: cleaning up a tangled module without changing its behavior; reducing technical debt in legacy code; finding and removing code smells.
Run `npx skills add luongnv89/claude-howto --skill refactor -a claude-code`. Or copy the skill folder (03-skills/refactor in luongnv89/claude-howto) into .claude/skills/refactor in your project. Claude Code loads it when a task matches its description.
Run `npx skills add luongnv89/claude-howto --skill refactor -a codex`. Or copy the skill folder (03-skills/refactor in luongnv89/claude-howto) into .agents/skills/refactor in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add luongnv89/claude-howto --skill refactor -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/refactor, .gemini/skills/refactor, .github/skills/refactor and .opencode/skills/refactor in your project.
Going by SKILL.md and its folder, Systematic Code Refactoring needs Python for the scripts in its folder and the command-line tools its instructions call (npm, pytest, python and mvn). Our summary lists: A way to run the project's tests; Python, for the bundled `.py` analysis scripts.
SKILL.md names 1 domain. As links in the text: code.claude.com. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.
Systematic Code Refactoring is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 3k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 9.5k tokens, read only when the agent opens those files.
Skills that share tags, products or a category with Systematic Code Refactoring: Tech Debt Analyzer (ailabs-393/ai-labs-claude-skills, 454 stars), FIXME Resolver (tailcallhq/forgecode, 7.6k stars), Desloppify (Git-on-my-level/codex-autorunner, 875 stars) and Code Quality Gate (fengshao1227/ccg-workflow, 5.9k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
luongnv89 (a GitHub user) maintains it in luongnv89/claude-howto, which has 41,764 GitHub stars. The repository holds 25 skills in this directory. The repository was last updated on September 30, 2026.
Source: luongnv89/claude-howto on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.