with one click
code-hygiene-refactor
Select a bounded, behavior-preserving code-hygiene batch.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Select a bounded, behavior-preserving code-hygiene batch.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
Security and privacy review for scoped changes.
Evidence-based gate for creating a new skill or agent profile.
UI, accessibility, and interaction-quality review.
Performance investigation using reproducible measurements.
Markdown and governance structure lint checklist.
Create a bounded session handoff with collision-resistant identity.
| schema | fcvw/skill@1 |
| name | code-hygiene-refactor |
| description | Select a bounded, behavior-preserving code-hygiene batch. |
| version | 1.1.1 |
| trigger_keywords | ["code hygiene","duplication","dead code","higiene de código"] |
| session_types | ["refactoring","audit"] |
Drive active cleanup of duplication, stale files, unnecessary code, oversized modules, and retroactive technical debt while preserving behavior. This skill is a Markdown-only operational tool: it tells the agent what to inspect, what to block, and what evidence to record.
Load this skill when:
#tech-debt;Active plan and scope, changed-path and ownership evidence, similar-code search, dependency/consumer references, focused behavior checks, and rollback or restoration source for removals.
Use the smallest scan compatible with the risk:
| Scan | Use when | Evidence |
|---|---|---|
| Local | One file or one function is changing. | Similar-code search, direct callers, before/after behavior. |
| Module | A component, route, service, prompt pack, or folder is changing. | Inventory table, imports/callers, tests, duplication candidates. |
| Systemic | Multiple modules, legacy migration, or retroactive adoption. | Dependency/impact map, phased plan, rollback, characterization tests. |
Classify each finding before editing:
| Finding | Required action |
|---|---|
| Duplicate code | Extract only when the shared rule is truly identical; otherwise document intentional variation. |
| Large file | Load anti-monolith-guard; split by responsibility before adding behavior. |
| Dead code | Mark CANDIDATE_FOR_REMOVAL; remove only after validation. |
| Stale file | Mark authoritative source and obsolete copy; remove only inside a plan. |
| Catch-all utility | Split by domain capability or keep scoped with explicit owner. |
| Repeated prompt | Move stable prompt rule to versioned AI/resource doc; keep context examples separate. |
| Missing tests | Add characterization or manual validation before structural change. |
| Hidden dependency | Make dependency explicit or document order/contract before moving code. |
Create or fill a report using governance/TEMPLATE_CODE_HYGIENE_REPORT.md when the scan is module-level or systemic. For local scans, add this compact block to the active plan:
## Code Hygiene Scan
- Skill loaded: `skills/code-hygiene-refactor/SKILL.md`
- Scan level: `local` / `module` / `systemic`
- Duplicate candidates:
- Large/monolithic candidates:
- Dead/stale candidates:
- Cleanup batch selected:
- Behavior preservation evidence:
- Deferred debt:
The cleanup is complete only when duplication, monolith risk, stale files, or dead code were reduced or explicitly deferred with evidence and a follow-up plan.