code-quality

tylermorganme's avatarfrom tylermorganme

Run code quality checks including duplication detection (jscpd), unused dependency analysis (depcheck), and complexity metrics. Use when the user asks to check code quality, find duplicate code, detect copy-paste, find unused packages, or analyze code complexity.

⭐0stars🔀0forks📁View on GitHub🕐Updated Jan 6, 2026

When & Why to Use This Skill

This Claude skill automates essential code quality audits by identifying duplicate code blocks, detecting unused npm dependencies, and calculating cyclomatic complexity. It helps developers maintain a clean, efficient, and maintainable codebase by providing actionable insights into technical debt and architectural complexity, making it an indispensable tool for proactive software maintenance.

Use Cases

  • Refactoring legacy codebases: Automatically identify and consolidate duplicated logic (copy-paste code) to reduce technical debt and improve maintainability.
  • Dependency optimization: Scan projects to detect and remove unused packages from package.json, reducing bundle size and minimizing security vulnerabilities.
  • Complexity auditing: Locate high-complexity functions that exceed cyclomatic thresholds, helping developers target specific areas for decomposition and better testability.
  • Automated Quality Gates: Integrate these checks into CI/CD pipelines or pre-commit hooks to enforce strict standards for code duplication and complexity before merging.
namecode-quality
descriptionRun code quality checks including duplication detection (jscpd), unused dependency analysis (depcheck), and complexity metrics. Use when the user asks to check code quality, find duplicate code, detect copy-paste, find unused packages, or analyze code complexity.

Code Quality Skill

Run automated code quality checks on the codebase.

Available Scripts

All scripts are in scripts/ and output results to stdout.

Duplication Detection (jscpd)

Finds copy-pasted code blocks:

node .claude/skills/code-quality/scripts/check-duplication.js [path] [--threshold N]
  • path: Directory to scan (default: src/)
  • --threshold N: Fail if duplication exceeds N% (default: 5)
  • --min-lines N: Minimum lines to consider a clone (default: 10)

Unused Dependencies (depcheck)

Finds packages in package.json that aren't imported:

node .claude/skills/code-quality/scripts/check-deps.js [path]
  • path: Project root with package.json (default: current directory)

Complexity Analysis

Reports functions exceeding complexity thresholds:

node .claude/skills/code-quality/scripts/check-complexity.js [path] [--max-complexity N]
  • path: Directory to scan (default: src/)
  • --max-complexity N: Report functions exceeding this cyclomatic complexity (default: 10)

Quick Start

Run all checks:

# From project root
node .claude/skills/code-quality/scripts/check-duplication.js crop-api/src/lib
node .claude/skills/code-quality/scripts/check-deps.js crop-api
node .claude/skills/code-quality/scripts/check-complexity.js crop-api/src/lib

CI Integration

Add to CI pipeline to enforce quality gates:

# Fail if duplication > 3%
npx jscpd src/lib --min-lines 10 --threshold 3

# Fail if unused deps found
npx depcheck --ignores="@types/*"