skills-catalog/ln-512-tech-debt-cleaner/SKILL.md
Auto-fixes low-risk tech debt (unused imports, dead code, commented-out code) with >=90% confidence. Use when audit findings need safe automated cleanup.
npx skillsauth add levnikolaevich/claude-code-skills ln-512-tech-debt-cleanerInstall 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.
Paths: File paths (
shared/,references/,../ln-*) are relative to skills repo root. If not found at CWD, locate this SKILL.md directory and go up one level for repo root. Ifshared/is missing, fetch files via WebFetch fromhttps://raw.githubusercontent.com/levnikolaevich/claude-code-skills/master/skills/{path}.
Type: L3 Worker
Automated cleanup of safe, low-risk tech debt findings from codebase audits.
docs/project/codebase_audit.md (ln-620 output) or ln-511 code quality output| Category | Source Prefix | Risk | Auto-Fix Action | |----------|--------------|------|-----------------| | Unused imports | MNT-DC- | LOW | Delete import line | | Unused variables | MNT-DC- | LOW | Delete declaration | | Unused functions (unexported) | MNT-DC- | LOW | Delete function block | | Commented-out code (>5 lines) | MNT-DC- | LOW | Delete comment block | | Backward-compat shims (>6 months) | MNT-DC- | MEDIUM | Delete shim + update re-exports | | Unsupported aliases | MNT-DC- | LOW | Delete alias line | | Trailing whitespace / empty lines | MNT- | LOW | Trim / collapse |
| Category | Reason | |----------|--------| | DRY violations (MNT-DRY-) | Requires architectural decision on where to extract | | God classes (MNT-GOD-) | Requires domain knowledge for splitting | | Security issues (SEC-) | Requires context-specific fix | | Architecture violations (ARCH-) | Requires design decision | | Performance issues (PERF-) | Requires benchmarking | | Any finding with effort M or L | Too complex for auto-fix |
ln-620 codebase audit completes (user triggers manually)docs/project/codebase_audit.md (ln-620 output)MANDATORY READ: Load shared/references/mcp_tool_preferences.md — ALWAYS use hex-line MCP for code files when available. No fallback to standard Read/Edit unless hex-line is down.
MANDATORY READ: Load shared/references/mcp_integration_patterns.md.
Use hex-line as the primary path for code files and hex-graph as the primary path for dead-code reference checks. Built-in Read/Edit/Grep are fallback only when the relevant MCP is unavailable.
Load findings: Read docs/project/codebase_audit.md. Parse findings from Dead Code section (ln-626 results) and Code Quality section (ln-624 results).
Filter to auto-fixable:
node_modules/, vendor/, dist/, build/, *.min.*, generated code, test fixturesVerify each finding (confidence check):
MANDATORY READ: Load shared/references/clean_code_checklist.md
For each candidate fix:
a) Read the target file at specified location
b) Confirm the finding still exists (file may have changed since audit)
c) Confirm removal is safe:
Hex-line acceleration (if available): IF hex-line MCP server is available:
outline(file_path) and discovery-first read_file() before manual cleanup edits. Re-read with edit_ready=true, verbosity="full" only when you need revision/checksums for edit_file.bulk_replace(dry_run=true) to preview, then bulk_replace() to apply.verify(file_path, checksums) to confirm no stale state.find_references() before deleting exports, wrappers, aliases, or shims.Apply fixes with per-fix keep/discard (autoresearch pattern):
MANDATORY READ: Load shared/references/ci_tool_detection.md for discovery hierarchy. Detect lint + typecheck commands once (reuse for all fixes).
Group verified fixes by file. For each file (process files independently):
git add {file} (status: keep)git checkout -- {file} (status: discard), log discarded fixesIf no lint/type commands detected: apply all fixes, skip per-file verification with warning, git add all modified files.
Create commit (kept fixes only):
git add in step 4chore: automated tech debt cleanup
Removed {N} auto-fixable findings from codebase audit:
- {count} unused imports
- {count} dead functions
- {count} commented-out code blocks
- {count} unsupported aliases
Source: docs/project/codebase_audit.md
Confidence threshold: >=90%
Update audit report:
docs/project/codebase_audit.md:
## Last Automated Cleanup
**Date:** YYYY-MM-DD
**Findings fixed:** N of M auto-fixable
**Skipped:** K (confidence <90% or verification failed)
**Build check:** PASSED / SKIPPED
verdict: CLEANED | NOTHING_TO_CLEAN | ALL_DISCARDED
stats:
total_findings: {from audit}
auto_fixable: {filtered count}
kept: {files that passed lint/typecheck}
discarded: {files that failed lint/typecheck}
skipped: {confidence <90 or stale}
fixes:
- file: "src/utils/helpers.ts"
line: 45
category: "unused_function"
removed: "formatDate()"
finding_id: "MNT-DC-003"
status: "keep"
- file: "src/api/v1/auth.ts"
line: 12
category: "unsupported_alias"
removed: "export { newAuth as oldAuth }"
finding_id: "MNT-DC-007"
status: "discard"
discard_reason: "typecheck failed: Type error in auth.ts:15"
commit_sha: "abc1234" | null
git checkout -- {file}), keep other successful files.git add . or git add -A.MANDATORY READ: Load shared/references/quality_summary_contract.md, shared/references/quality_worker_runtime_contract.md
Runtime profile:
quality-workerln-512quality-workerworker, status, verdict, issues, warnings, artifact_pathInvocation rules:
runId and summaryArtifactPathrunId and exact summaryArtifactPathshared/references/clean_code_checklist.mdshared/references/audit_output_schema.mdshared/templates/codebase_audit_template.mdVersion: 1.0.0 Last Updated: 2026-02-15
testing
Checks runtime lifecycle and config validation: bootstrap, shutdown, probes, cleanup, env sync, and fail-fast startup. Use for runtime readiness.
testing
Checks races, deadlocks, async hazards, TOCTOU, blocking I/O, and shared resource contention. Use when auditing concurrency correctness.
testing
Checks diagnosability through structured logs, metrics, traces, correlation IDs, and useful log levels. Use when auditing incident visibility.
development
Finds code that can be safely deleted: unreachable, unused, obsolete compatibility, and commented-out code. Use when pruning dead code.