Get the FREE Ultimate OpenClaw Setup Guide →

techdebt

npx machina-cli add skill 7dieuuoc/ChernyCode/techdebt --openclaw
Files (1)
SKILL.md
1.9 KB

Technical Debt Finder

Identify and fix technical debt in the codebase.

What to Look For

Code Duplication

  • Functions with similar logic that could be consolidated
  • Copy-pasted code blocks
  • Repeated patterns that should be abstracted

Dead Code

  • Unused imports
  • Unused functions or classes
  • Commented-out code blocks
  • Unreachable code paths

Outdated Patterns

  • Deprecated API usage
  • Old-style string formatting (% or .format) vs f-strings
  • Type hints using typing.List instead of list
  • Missing type hints on public functions

Code Smells

  • Functions longer than 50 lines
  • Too many parameters (more than 5)
  • Deep nesting (more than 3 levels)
  • Magic numbers without constants
  • Overly complex conditionals

Missing Best Practices

  • Missing docstrings on public functions
  • Missing error handling
  • Hardcoded values that should be config
  • Missing tests for critical paths

Workflow

  1. Scan the Codebase

    • Look for patterns matching the issues above
    • Prioritize by impact and ease of fix
  2. Report Findings

    • List issues by category
    • Include file paths and line numbers
    • Estimate severity (high/medium/low)
  3. Fix Issues

    • Start with high-severity, easy fixes
    • Create atomic commits for each fix
    • Run tests after each change
  4. Verify

    • Run linter: ruff check .
    • Run tests: pytest
    • Ensure no new issues introduced

Arguments

Optionally specify a directory or file to focus on.

Usage:

  • /techdebt - Scan entire project
  • /techdebt src/ - Scan specific directory
  • /techdebt src/utils.py - Scan specific file

Output

Provide a summary of:

  • Issues found (by category)
  • Issues fixed
  • Remaining items for future sessions

Source

git clone https://github.com/7dieuuoc/ChernyCode/blob/main/cursor_personal_skills/techdebt/SKILL.mdView on GitHub

Overview

Technical Debt Finder helps locate and fix technical debt across a codebase, including duplicated code, dead code, outdated patterns, and code smells. It emphasizes running at the end of sessions to clean up. It follows a practical workflow from scanning to verification.

How This Skill Works

It scans the repository for defined issue types such as code duplication, dead code, outdated patterns, code smells, and missing best practices. It then reports findings with file paths and severity, and guides creating atomic commits. After fixes, run the linter and tests to verify no new issues are introduced.

When to Use It

  • At the end of a coding session to clean up debt before closing the sprint
  • During refactoring or feature work to prevent debt from creeping in
  • In code reviews to catch issues before merging
  • Before release to ensure code health and reduce risk
  • When replacing deprecated patterns or removing dead code

Quick Start

  1. Step 1: Run /techdebt to scan the project or /techdebt <path> for a specific scope
  2. Step 2: Review findings by category and severity to plan fixes
  3. Step 3: Implement fixes as atomic commits and verify with linter and tests

Best Practices

  • Run the scan after each session to catch debt early
  • Prioritize fixes by impact and ease of fix
  • Create atomic commits for each fix
  • Add tests for critical paths and update existing ones
  • Run linter and tests after changes (ruff check . and pytest)

Example Use Cases

  • Consolidate two similar data parsing functions to remove duplication in the data intake module
  • Remove an unused import and a dead code block found in the reporting module
  • Replace deprecated API usage and update string formatting to f-strings; switch typing.List to built-in list
  • Add docstrings to public functions and implement basic error handling
  • Refactor a function with more than 5 parameters into smaller helpers

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers