AGENT SKILL

techdebt

Find and safely remove duplicated or redundant code in current context or a provided scope, e.g. `scope:git diff main..HEAD`.

License 许可
MIT
所属仓库
japurcell/skills
最近更新
2026-11-11
Stars
★ 0
Forks
0

01 前言 Front Matter

name
techdebt
description
Find and safely remove duplicated or redundant code in current context or a provided scope, e.g. `scope:git diff main..HEAD`.
argument-hint
[scope:<path or git diff range>]
disable-model-invocation
true

02 资源文件 2

03 SKILL.md 正文

/techdebt

Remove duplicated code while preserving behavior. Prefer small, safe, validated changes over broad cleanup.

1. Route

Before starting, activate or load the delegate-to-subagents skill so that you delegate tasks to the most suitable subagents for each task type when useful.

2. Scope

If candidates are already provided, use them and skip discovery.

Otherwise, use a fast-tier subagent to resolve scope:

  1. If input contains scope:..., inspect that scope.
  2. Else inspect git status and git diff HEAD.
  3. If no meaningful changes are found, report that and stop. Do not broaden scope unless the user asks.

Build a shortlist of changed functions, classes, modules, tests, configs, scripts, handlers, or UI units.

3. Find duplication

Dispatch 1-3 code-explorer subagents scaled to scope size, or inspect the relevant code directly for a narrow scope.

Search shortlist items against relevant nearby/codebase patterns for:

  • exact duplicates
  • near duplicates
  • reimplemented helpers/utilities
  • repeated validation, parsing, SQL, HTTP, error handling, config, shell, UI, or test setup logic

Classify each finding as:

  • exact
  • near
  • reimplementation

If no meaningful duplication is found, report that and stop.

4. Prioritize

Process safe, in-scope candidates in this order:

  1. same file/module
  2. same layer/service area
  3. same abstraction level across modules
  4. broader architecture or UI/CSS only if explicitly requested

Prefer:

  • exact duplicates over near duplicates
  • existing helpers over new abstractions
  • minimal behavior-preserving diffs
  • backend/test refactors over cosmetic churn

Default to the top 1–3 safest candidates unless the user requested broader cleanup.

5. Refactor and validate

For each selected candidate:

  1. Dispatch one refactoring subagent.
  2. Refactoring subagent must:
    • make the smallest behavior-preserving change
    • reuse existing structure and conventions
    • avoid new top-level patterns if equivalent ones exist
    • activate or load the tdd skill only when tests must be added or changed
  3. Dispatch one validation subagent.
  4. Validation subagent runs relevant checks: tests, lint, type-check, build, or targeted commands.
  5. If validation fails, fix and revalidate; otherwise revert that candidate.

Continue to the next safe candidate. Stop only when remaining candidates are unsafe, ambiguous, out of scope, or require a user choice.

Ask the user before changes involving:

  • public API changes
  • architectural choices
  • visual/UI behavior risk
  • broad convention or naming changes
  • unrelated refactors

6. Report

Return a concise summary:

  • scope used
  • duplicates removed
  • shared helpers/abstractions introduced
  • validation commands and results
  • candidates kept, fixed, reverted, skipped, or blocked
  • recommended next dedupe targets, if any

04 同仓库更多 Skills

japurcell
japurcell/skills

spec-create

Create or revise a portable behavioral SPEC for a feature or whole product. Use when specifying a new idea, documenting an existing system for reimplementation, or defining a change while preserving compatibility. Implementation planning is a separate task.

产品经理
★ 0
japurcell
japurcell/skills

prd-ralph

Complete at most one eligible unfinished PRD task, verify it, log progress, and optionally create one scoped commit.

产品经理
★ 0
japurcell
japurcell/skills

fsdp-style-guide

Mandatory for all UI/UX design, implementation, review, audit, or visual regression tasks. Always use for any work that affects user-facing appearance, behavior, accessibility, branding, layout, navigation, forms, dialogs, alerts, tables, or visual design.

设计师
★ 0
japurcell
japurcell/skills

agency-priorities

Provide self-contained USDA strategic goals and Forest Service priorities for agency briefings, proposals, and work-plan alignment. Use when explaining agency direction or evaluating how a project contributes to USDA and Forest Service priorities.

★ 0
japurcell
japurcell/skills

accomplishment-report

Create a concise Forest Service executive accomplishment report when all work in an ExecPlan is completed, or update its existing report. Use at ExecPlan closeout and when asked to report completed work, agency alignment, and estimated AI-assisted versus human-only time and cost savings.

行政与办公人员
★ 0
japurcell
japurcell/skills

writing-for-agents

Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md.

内容创作者写作与文案
★ 0