/rp1-dev:tech-debt-collectorfrom rp1-dev
Detects tech debt and bloat by scouting signals, ranking by materiality, validating claims, and reporting up to 5 findings with remediation actions. Works on project roots, files, branches, or PR diffs.
Ships in rp1-dev. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Role: Pure orchestrator for evidence-gated tech debt and software bloat detection.
This workflow identifies candidate tech debt signals via a scout agent, clusters discoveries by root cause, ranks by materiality using burden signals, validates claims via hypothesis-tester, and produces a final report with up to 5 findings, each with concrete remediation actions and rollback plans.
Key Constraints:
hypotheses.md, leads.json, report.md) live at fixed paths under features/tech-debt-collector/; at run start any prior versions are archived into features/tech-debt-collector/runs/<prior-run-id>/ (§1.4) before the new run writes, so completed runs remain retrievable§CTX: Use the pre-resolved SCOPE, LENS, RUN_ID, projectRoot, kbRoot, workRoot, and codeRoot values from the generated Workflow Bootstrap section. Do not hardcode .rp1/work/ or .rp1/context/ paths.
| File | Purpose | When to Load |
|---|---|---|
references/validation-scoring.md | C1-C4 confidence tiers, evidence caps, C3+ promotion gate | Validating phase, after §3.3 collects hypothesis-tester results |
references/report-format.md | Finding template, section ordering, artifact registration | Reporting phase, after §4.1 emits the reporting state |
references/run-archival.md | Archiving a prior run's artifacts | Scoping phase, only when prior-run artifacts exist |
references/scope-resolution.md | SCOPE classification order, PR-reference forms, cross-repository guard | Scoping phase, at §1.1 |
references/lead-processing.md | Root-cause clustering and materiality ranking | Scouting phase, once the scout returns leads |
Objective: Parse and validate the scope parameter, resolving the target for analysis.
Scope Types:
project — Analyze entire project from root/path/to/file — Analyze specific file or directorybranch-name — Analyze named branch (relative to main)pull/NNN/diff — Analyze PR diff onlyRead references/scope-resolution.md and follow it to set SCOPE_TYPE and TARGET. It carries the classification order, accepted PR-reference forms, and the cross-repository guard.
Resolve immutable BASE_COMMIT/HEAD_COMMIT SHAs NOW — before any scout runs — so the report identifies the exact snapshot the analysis observed. PR and branch refs are mutable; capturing them after analysis (or only at reporting) can attribute findings to commits that were never analyzed. §4.2 re-verifies these values at reporting time and fails closed if the refs moved mid-run.
case "$SCOPE_TYPE" in
pr-diff)
BASE_COMMIT=$(gh pr view "$TARGET" --json baseRefOid --jq '.baseRefOid')
HEAD_COMMIT=$(gh pr view "$TARGET" --json headRefOid --jq '.headRefOid')
;;
branch)
BASE_COMMIT=$(git merge-base main "$TARGET")
HEAD_COMMIT=$(git rev-parse "$TARGET")
;;
project|file)
BASE_COMMIT="N/A"
HEAD_COMMIT=$(git rev-parse HEAD)
;;
esac
This is read-only VCS metadata capture, permitted under §6.1.
rp1 agent-tools emit \
--workflow tech-debt-collector \
--type status_change \
--run-id {RUN_ID} \
--step scoping \
--data "{\"status\": \"running\", \"scope_type\": \"$SCOPE_TYPE\", \"target\": \"$TARGET\", \"base_commit\": \"$BASE_COMMIT\", \"head_commit\": \"$HEAD_COMMIT\"}"
If a prior run left artifacts for this scope, read references/run-archival.md and follow it. Otherwise continue to §1.5.
Scoping validation and archival complete. Proceed to Phase 2.
Objective: Dispatch scout agent to discover candidate bloat signals, cluster by root cause, rank by materiality, and select top 8 leads for validation.
Based on scope type and lens, decide how many scout dispatches (1-3):
# Strategy: start with primary lens, optionally add secondary lenses
PRIMARY_LENS="$LENS" # From resolved argument (unused-code, over-abstraction, etc.)
DISPATCH_COUNT=1
# For whole-project scope, use 2-3 dispatches for broader coverage
if [ "$SCOPE_TYPE" = "project" ]; then
DISPATCH_COUNT=2
# First: unused-code (primary), Second: over-abstraction
LENSES=("unused-code" "over-abstraction")
elif [ "$SCOPE_TYPE" = "pr-diff" ]; then
DISPATCH_COUNT=2
# For PR diffs: focus on incoming bloat
LENSES=("$PRIMARY_LENS" "speculative-generalization")
else
# Single dispatch for file-level or branch scope
DISPATCH_COUNT=1
LENSES=("$PRIMARY_LENS")
fi
Emit scouting state:
rp1 agent-tools emit \
--workflow tech-debt-collector \
--type status_change \
--run-id {RUN_ID} \
--step scouting \
--data "{\"status\": \"running\", \"dispatch_count\": $DISPATCH_COUNT}"
Dispatch Template (repeat for each lens; scope is pre-resolved in §1.1 — scouts never re-classify):
{% dispatch_agent "rp1-dev:bloat-scout" %} SCOPE_TYPE={SCOPE_TYPE}, TARGET={TARGET}, LENS={current-lens}, CODE_ROOT={codeRoot}, KB_ROOT={kbRoot} {% enddispatch_agent %}
Each scout dispatch returns ~20-30 leads with structure:
{
"claim": "Module X is unused and can be removed",
"exact_sites": [
{ "file": "src/foo.ts", "lines": "10-50", "symbol": "FooFactory" }
],
"burden_signal": {
"metric": "files",
"value": 8,
"unit": "transitive_deps"
},
"locus": "dead_code",
"cause": "never_used",
"safety_flags": ["hidden_consumer"],
"usage_evidence": "static-partial",
"materiality_score": 0 // Will be computed by orchestrator
}
Read references/lead-processing.md and follow it. It carries root-cause clustering and the materiality ranking signals.
Store lead queue in work artifact or ephemeral state:
# Write clustered + ranked leads to temporary store for phase 3
# This allows resumability if workflow is interrupted
rp1 agent-tools emit \
--workflow tech-debt-collector \
--type btw_update \
--run-id {RUN_ID} \
--data "{\"message\": \"Scouting complete: discovered $TOTAL_LEADS leads, clustered to $CLUSTERED_COUNT, selected top 8 for validation\"}"
Proceed to Phase 3 (Validating).
Objective: Dispatch hypothesis-tester to refute/confirm clustered leads, collect validation results, and assign confidence tiers.
rp1 agent-tools emit \
--workflow tech-debt-collector \
--type status_change \
--run-id {RUN_ID} \
--step validating \
--data "{\"status\": \"running\", \"leads_to_validate\": 8}"
hypothesis-tester is document-driven: it requires FEATURE_ID, KB_ROOT, and WORK_ROOT, and validates the PENDING hypotheses in an existing hypotheses.md. Satisfy that contract by materializing the admitted leads as a hypothesis document, then dispatching once.
Step 1: Write the Hypothesis Document
Write {workRoot}/features/tech-debt-collector/hypotheses.md following the canonical template at plugins/base/skills/artifact-templates/templates/hypothesis-tester/hypothesis-document.md (fall back to the rp1-base:artifact-templates SKILL.md index if the direct path fails). This file is owned by this workflow and overwritten on each run. One entry per admitted lead, IDs HYP-TD-001 … HYP-TD-008:
### HYP-TD-{NNN}: {short title derived from claim}
**Risk Level**: {HIGH if safety_flags non-empty, else MEDIUM}
**Status**: PENDING
**Statement**: {atomic bloat claim, verbatim from lead}
**Context**: Locus: {locus} | Cause: {cause} | Burden: {burden_signal.metric}={burden_signal.value} {burden_signal.unit} | Sites: {exact_sites[0:3]} | Safety flags: {safety_flags} | Usage evidence: {usage_evidence}
**Validation Criteria**:
- CONFIRM if: all refutation attempts fail — no hidden consumers (dynamic dispatch, reflection, re-exports, test mocks), no protected API or backward-compatibility obligation, no semantic difference for redundancy claims, no counterfactual failure from removal
- REJECT if: any refuting evidence is found (a consumer, a protected obligation, a semantic difference, or a failure mode triggered by removal)
**Suggested Method**: CODEBASE_ANALYSIS
Step 2: Dispatch hypothesis-tester (full declared contract)
{% dispatch_agent "rp1-dev:hypothesis-tester" %} FEATURE_ID=tech-debt-collector, KB_ROOT={kbRoot}, WORK_ROOT={workRoot}, CODE_ROOT={codeRoot}, WORKFLOW=tech-debt-collector, RUN_ID={RUN_ID} {% enddispatch_agent %}
The tester validates every PENDING hypothesis in the document (parallelizing independent ones internally), appends findings under ## Validation Findings, and updates each Status to CONFIRMED or REJECTED.
After the dispatch completes, read back {workRoot}/features/tech-debt-collector/hypotheses.md and map each HYP-TD-{NNN} result to its lead:
For each hypothesis result:
IF Result == "CONFIRMED": # claim survived refutation
- Lead is valid; proceed to confidence tier assignment (§3.4)
- Parse `refutation_coverage` from the findings' `Refutation Coverage` field (`complete`|`minor-gaps`|`partial`|`contradicted`) and `unresolved_safety_flags` from the `Safety Flags Unresolved` field (list; empty when "None")
- Store: { lead_id, status: "CONFIRMED", confidence_tier: "TBD", validation_result: { refutation_coverage, unresolved_safety_flags }, evidence: {recorded findings} }
IF Result == "REJECTED": # refuting evidence found
- Lead is refuted; move to retain register
- Store: { lead_id, status: "REJECTED", refutation_evidence: {recorded findings} }
If the tester returns a rejected_hypotheses JSON block, it enumerates the refuted leads. No user gate applies in this workflow — rejection simply routes those leads to the retain register.
Retain Register:
Read references/validation-scoring.md and apply it to the collected results. It carries the C1-C4 tier rules, the evidence caps, and the C3+ promotion gate.
After C3+ gate routing:
Pass to Phase 4:
findings_queue[] — up to 8 C3-C4 leads, each with: { lead_id, claim, exact_sites, burden_signal, materiality_score, locus, cause, confidence_tier, tier_reasoning }needs_measurement[] — C1-C2 leads with missing_evidence descriptionsretain_register[] — rejected leads with refutation evidencevalidation_summary — statistics (total validated, confirmed, rejected, c3_plus_count)Objective: Finalize findings, generate report artifact, and register to Arcade.
rp1 agent-tools emit \
--workflow tech-debt-collector \
--type status_change \
--run-id {RUN_ID} \
--step reporting \
--data "{\"status\": \"running\", \"confirmed_findings\": \"N/A\"}"
Read references/report-format.md and follow it to produce the artifact. It carries the finding template, section ordering, and artifact registration.
Reporting Phase Complete: Report artifact is written and registered to Arcade (if successful). Workflow transitions to completed state.
stateDiagram-v2
[*] --> scoping: /tech-debt-collector invoked
scoping --> scouting: scope validated
scouting --> validating: leads clustered & ranked
validating --> reporting: validation complete
reporting --> [*]: report artifact registered
User-Visible States:
Internal Transitions:
This orchestrator never inspects or modifies source code:
{workRoot}/features/tech-debt-collector/ only (leads.json, hypotheses.md, report.md), read-only VCS metadata capture (gh pr view, git merge-base, git rev-parse) for snapshot pinning and report reproducibility (§1.2, §4.2), mkdir+mv archival of prior-run artifacts confined to {workRoot}/features/tech-debt-collector/runs/ at run start (§1.4) for non-destructive runsgit checkout, git merge, git commit, git push)Source-level discovery and validation happen exclusively inside bloat-scout and hypothesis-tester dispatches; the orchestrator handles only structured lead data, which protects the main context window.
To enable workflow resumability, the orchestrator should persist the discovered and clustered leads between phases. Two options:
.rp1/work/features/tech-debt-collector/leads.json (persists across resume)Recommend work artifact approach for auditability.
If any phase fails:
Partial results are acceptable; never block on transient failures.
What SKILL.md sets; muted values are Claude Code's defaults
Generated from the plugin's indexed repository (rp1-run/rp1) — no native marketplace selected
npx claudepluginhub p/rp1-run-rp1-dev-plugins-dev24 skills in this plugin
/address-pr-feedbackUnified PR feedback workflow - collect, triage, and fix review comments in a single command./arcade-collabStructured guidance for agents to read, classify, and act on user feedback (annotations and direct file edits) from the Arcade./blueprintGuided parent-owned project charter and PRD interviews with durable artifact-only resume./blueprint-archiveArchives a completed PRD to the archives directory with associated features and closure summary./blueprint-auditAudits a PRD against implementation status and guides lifecycle decisions./bootstrapBootstrap a greenfield project with parent-owned interviews and bounded plan, revision, and apply actions.2 plugins in one repository ship this exact skill · first indexed Aug 16, 2026
Other plugins' skills for the same job