/tech-debt

Development L2+ Production medium usage

/tech-debt

Overview

/tech-debt is a production command in the Development category of the Prismatic Platform. It performs comprehensive technical debt analysis across the umbrella codebase, identifying, classifying, prioritizing, and planning the elimination of accumulated technical debt. The command scans for 25+ categories of technical debt including code smells, architectural violations, missing tests, outdated dependencies, documentation gaps, performance bottlenecks, and deferred maintenance items. Each debt item is scored by impact, effort, and risk to produce actionable elimination plans.

This command operates under the L2+ authority level and is executed by the debt-hunter agent. It is part of the platform's 216-command slash command registry, built on the AIAD (Autonomous Intelligence Agent Design) standard. The debt-hunter agent has read access to the entire codebase and integrates with quality metrics, test coverage data, and compilation diagnostics to provide evidence-based debt assessments.

The Prismatic Platform maintains a current quality score of 100/100 with zero quality debt points (QDP), having eliminated all 905 QDP through systematic debt reduction campaigns. /tech-debt was the primary analytical tool driving this achievement, providing the intelligence that guided /quality-enforce and /quality-evolve operations. Even at zero QDP, the command remains essential for preventing debt accumulation and identifying emerging debt before it compounds.

Architecture

The tech-debt system operates as a multi-scanner analysis pipeline that examines the codebase through different debt lenses.

Debt Analysis Architecture

             /tech-debt
                  |
           Debt Orchestrator
                  |
          +-------+-------+-------+
          |       |       |       |
       Code     Arch     Test    Dep
       Scanner  Scanner  Scanner Scanner
          |       |       |       |
    +-----+--+ +-+--+ +-+--+ +--+--+
    |    |   | |  |  | |  |  | |  |  |
   Smell Dup  Dead API  Gap  Cover Hex  Mix
   Check Check Code Conv Check Check Aud  Lock
    |    |   | |  |  | |  |  | |  |  |
    +----+---+-+--+--+-+--+--+-+--+--+
                  |
           Debt Classifier
                  |
          +-------+-------+
          |       |       |
       Priority  Impact   Effort
       Score     Analysis Estimate
          |       |       |
          +-------+-------+
                  |
           Elimination Planner

Debt Categories

CategoryScannerItems TrackedSeverity Range
Code SmellsCodeLong functions, deep nesting, complex conditionalsLow-Medium
DuplicationCodeCopy-paste code, near-duplicatesMedium
Dead CodeCodeUnreachable functions, unused modulesLow
API ViolationsArchitectureBroken contracts, inconsistent interfacesHigh
Missing TestsTestUntested modules, low coverage areasMedium-High
Test QualityTestBrittle tests, slow tests, flaky testsMedium
Outdated DepsDependencyPackages behind latest, security patches pendingMedium-Critical
Documentation GapsCodeMissing @doc, @moduledoc, @specLow-Medium
Performance DebtArchitectureKnown bottlenecks, suboptimal algorithmsMedium-High
Configuration DebtArchitectureHardcoded values, missing config optionsLow

Priority Scoring Formula

Priority = (Impact * 0.4) + (Risk * 0.3) + (Effort_Inverse * 0.2) + (Age * 0.1)

Where:
  Impact:        1-10 scale, business impact of the debt
  Risk:          1-10 scale, probability of debt causing failure
  Effort_Inverse: 10 - Effort(1-10), favoring quick wins
  Age:           1-10 scale, how long the debt has existed

Usage

# Full technical debt analysis
/tech-debt

# Analyze specific application
/tech-debt --app prismatic_web

# Show only high-priority debt
/tech-debt --min-priority 7

# Analyze specific debt category
/tech-debt --category code-smells

# Generate elimination plan
/tech-debt --plan

# Show debt trends over time
/tech-debt --trends --since 30d

# Export debt inventory as JSON
/tech-debt --format json --export ./debt-inventory.json

# Quick summary statistics
/tech-debt --summary

# Show debt introduced since last analysis
/tech-debt --new-debt-only

# Dry run showing scan plan
/tech-debt --dry-run

Practical Examples

# Pre-sprint debt assessment with elimination plan
/tech-debt --plan --max-effort 5 --format markdown --export ./sprint-debt-plan.md

# Focus on security-related technical debt
/tech-debt --category "outdated-deps,api-violations" --min-priority 6

# Application-specific deep analysis
/tech-debt --app prismatic_perimeter --verbose --plan

# Track debt reduction progress
/tech-debt --trends --since 90d --format json --export ./debt-trends.json

# Quick wins analysis (high impact, low effort)
/tech-debt --quick-wins --max-effort 3 --min-impact 7

# CI/CD integration check
/tech-debt --summary --format json --fail-on-new

Options

OptionTypeDefaultDescription
--appstringallSpecific application to analyze
--categorystringallDebt categories (comma-separated)
--min-priorityinteger1Minimum priority score threshold (1-10)
--planflagfalseGenerate elimination plan
--trendsflagfalseShow debt trends over time
--sincedurationallTime filter for trends and new debt
--summaryflagfalseShow summary statistics only
--quick-winsflagfalseFilter to high-impact, low-effort items
--new-debt-onlyflagfalseShow only newly introduced debt
--formatenumtextOutput format: text, json, markdown
--exportpathnoneExport results to file
--verboseflagfalseDetailed debt descriptions with code locations
--max-effortinteger10Maximum effort score for filtering
--min-impactinteger1Minimum impact score for filtering
--fail-on-newflagfalseExit code 1 if new debt detected (CI mode)
--dry-runflagfalseShow scan plan without executing

Execution Flow

Phase 1: Baseline Assessment

The orchestrator loads the previous debt inventory (stored in .claude/quality-dna/debt-inventory.json) and the current quality metrics. This baseline enables delta analysis: identifying newly introduced debt versus existing items.

Phase 2: Multi-Scanner Execution

All four scanners execute in parallel across the codebase. The code scanner analyzes ASTs for structural debt patterns. The architecture scanner checks module boundaries, API contracts, and dependency topology. The test scanner assesses coverage gaps and test quality. The dependency scanner audits Hex packages and Mix lock state.

Phase 3: Debt Classification

Discovered debt items are classified by category, severity, and location. Each item receives priority scoring based on the formula combining impact, risk, effort, and age. Items are deduplicated against the existing inventory to prevent double-counting.

Phase 4: Trend Analysis

When trend data is available, the system computes debt velocity: items added versus items eliminated per period. Accelerating debt accumulation triggers warnings. Consistent debt reduction confirms healthy development practices.

Phase 5: Elimination Planning

When --plan is requested, the system generates prioritized elimination plans. Plans group related debt items, estimate total effort, identify dependencies between items, and suggest the optimal elimination order. Quick wins (high impact, low effort) are highlighted for immediate action.

Phase 6: Reporting

Results are formatted for the requested output. Text format provides a readable debt inventory with priority rankings. JSON format enables integration with external tools and dashboards. Markdown format produces documents suitable for sprint planning and stakeholder communication.

Integration Points

ComponentIntegration TypeDescription
/quality-enforceConsumerDebt analysis drives enforcement priorities
/quality-evolveConsumerEvolution targets debt items
/quality-gatesEnforcementDebt thresholds enforce gate passage
/find-lowfruitPeerLow-hanging fruit identification
/refactorDownstreamRefactoring eliminates structural debt
/regression-checkPeerRegression checks prevent debt reintroduction
Quality DNAStateDebt inventory persisted in quality DNA
TelemetryMonitoringDebt metrics and trend data

Best Practices

Continuous Debt Monitoring

Run /tech-debt --summary at the start of every development session. Early detection of new debt is far less costly than discovering accumulated debt during a milestone review. Integrate --fail-on-new in CI pipelines to prevent debt introduction.

Sprint-Aligned Elimination

Use /tech-debt --plan --max-effort 5 to generate sprint-sized elimination plans. Dedicating 10-20% of each sprint to debt elimination prevents accumulation while maintaining feature velocity. Quick wins provide visible progress and team motivation.

Category Rotation

Rotate debt elimination focus across categories rather than addressing all categories simultaneously. One sprint focused on code smells, the next on test gaps, the next on outdated dependencies. This produces deeper cleanup in each category.

Quick Wins First

Start every debt elimination campaign with /tech-debt --quick-wins. High-impact, low-effort items provide immediate quality improvement and build momentum for tackling more complex debt items.

Error Handling

Error CodeDescriptionResolution
SCAN_TIMEOUTScanner exceeded time limitNarrow scope with --app or --category
BASELINE_MISSINGNo previous debt inventory for comparisonFirst run creates baseline; trends unavailable
AST_PARSE_ERRORCannot parse source file for analysisCheck file for syntax errors
COVERAGE_DATA_STALETest coverage data older than codeRun mix test --cover to refresh
HEX_UNAVAILABLECannot reach Hex for dependency auditUse cached package data
INVENTORY_CORRUPTDebt inventory file corruptedRegenerate with full scan

Advanced Usage

Custom Debt Rules

Add project-specific debt detection rules:

/tech-debt --custom-rules ./debt-rules/prismatic-debt-patterns.yaml

Debt Budget Enforcement

Set maximum allowable debt per application:

/tech-debt --budget --max-items-per-app 10 --fail-on-budget-exceeded

Historical Debt Archaeology

Analyze when specific debt items were introduced using git history:

/tech-debt --archaeology --item "unused_module:prismatic_legacy" --format markdown

Doctrine Compliance

All commands operate under the NO MERCY, NO DOUBTS doctrine:

  • NO MERCY: Zero tolerance for incomplete execution or quality violations. Technical debt is identified and tracked without exception. No debt item is dismissed as "acceptable."
  • NO DOUBTS: Full investigation before action, evidence-based results. Every debt item includes source location, evidence, priority scoring rationale, and recommended elimination approach.

Connect & Contribute

Created by Tomáš Korcak (korczis) | Open Source under GHL