agentleFS
LucfaceLucface/claude-skills/skills/techdebt/SKILL.md

techdebt

Skill1 starsChanged 5 months agoMITView on GitHub

End-of-session tech debt cleanup. Scans for TODOs, dead code, unused imports, type issues, and quick wins before you log off.

6 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 5 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before creating a PR

    line 12
  2. Distinctive:

    After a big feature merge

    line 14
  3. Very specific:

    When the user invokes /techdebt:

    line 18
  4. Very specific:

    If no changes, scan the whole project's src/ directory.

    line 31
  5. Distinctive:

    Delete commented-out code (if > 30 days old per git blame)

    line 79
  6. Distinctive:

    Remove unused local variables

    line 80
  7. Very specific:

    Check for new files in ~/.claude/artifacts/research/ that aren't in ~/.claude/artifacts/research/INDEX.md:

    line 109
  8. Distinctive:

    If any unindexed files found, append them to the appropriate section in INDEX.md with channel tag.

    line 116

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Tech Debt (/techdebt)

End-of-session codebase cleanup scan.

When to Use

  • End of a coding session
  • Before creating a PR
  • Periodic hygiene check
  • After a big feature merge

Instructions

When the user invokes /techdebt:

Step 1: Identify Scope

Determine what to scan:

# Files modified this session (since last commit on main)
BASELINE=$(git merge-base HEAD main 2>/dev/null || echo "HEAD~10")
git diff --name-only $BASELINE HEAD
git diff --name-only  # Unstaged too

If no changes, scan the whole project's src/ directory.

Step 2: Run Parallel Scans

Scan 1 — TODOs and FIXMEs (grep for actionable items):

grep -rn "TODO\|FIXME\|HACK\|XXX\|WORKAROUND" src/ --include="*.ts" --include="*.tsx"

Categorize each:

  • Stale (> 30 days, check git blame)
  • Actionable now (< 5 min fix)
  • Needs ticket (complex, track separately)

Scan 2 — Dead Code (Task tool, subagent_type: "general-purpose"):

Scan these files for dead code:
[file list]

Find:
- Unused exports (exported but never imported)
- Unused functions/variables
- Unreachable code paths
- Commented-out code blocks
- Unused imports

Return file:line for each finding.

Scan 3 — Type Safety (Task tool, subagent_type: "general-purpose"):

Scan these files for type safety issues:
[file list]

Find:
- `as` type assertions that could fail at runtime
- Missing null checks
- Implicit `any` from untyped dependencies
- Type guards that don't fully narrow
- Union types that aren't exhaustively handled

Return file:line and severity for each.

Step 3: Quick Wins

Automatically fix items that are safe:

  • Remove unused imports
  • Delete commented-out code (if > 30 days old per git blame)
  • Remove unused local variables
  • Fix obvious type narrowing gaps

Step 4: Report

## Tech Debt Report

### Auto-Fixed
- Removed N unused imports
- Deleted N lines of dead code
- Fixed N type issues

### Needs Attention
| File | Issue | Effort |
|------|-------|--------|
| src/foo.ts:42 | Stale TODO from 2 months ago | 5 min |
| src/bar.ts:17 | Type assertion could fail | 15 min |

### TODOs Summary
- N stale (> 30 days)
- N actionable now
- N need tickets

### Health Score: X/10

Step 4b: Research Artifact Index Sweep

Check for new files in ~/.claude/artifacts/research/ that aren't in ~/.claude/artifacts/research/INDEX.md:

# Find files newer than INDEX.md
find ~/.claude/artifacts/research/ -name "*.md" -newer ~/.claude/artifacts/research/INDEX.md ! -name "INDEX.md" 2>/dev/null

If any unindexed files found, append them to the appropriate section in INDEX.md with channel tag. Report: "INDEX.md: added N new research artifacts."

Step 5: Offer Next Steps

Would you like me to:
A) Fix the "Needs Attention" items now
B) Create GitHub issues for the complex ones
C) Just note it and move on

Arguments

ArgEffect
--fix-allAuto-fix everything safe, no prompt
--report-onlyNo fixes, just report
--scope "dir"Scan specific directory

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.