cyclomatic-complexity
Refactor code to reduce cyclomatic complexity so it stays readable, maintainable, and aligned with the long-term vision of the…
Simplification audit or authorized codebase simplification whose stated objective is to remove accidental complexity. Use for evidence-backed deletion or consolidation of dead code, duplicate state, redundant APIs or layers, ownerless abstractions, obsolete compatibility or
Claude Code
$ npx -y skills add tt-a1i/simplify-codebase --skill simplify-codebase --agent claude-code
Codex
$ npx skills add tt-a1i/simplify-codebase --skill simplify-codebase -a codex -y
Cursor
$ npx skills add tt-a1i/simplify-codebase --skill simplify-codebase -a cursor -y
Gemini CLI
$ npx skills add tt-a1i/simplify-codebase --skill simplify-codebase -a gemini-cli -y
GitHub Copilot
$ npx skills add tt-a1i/simplify-codebase --skill simplify-codebase -a github-copilot -y
OpenCode
$ npx skills add tt-a1i/simplify-codebase --skill simplify-codebase -a opencode -y
Windsurf
$ npx skills add tt-a1i/simplify-codebase --skill simplify-codebase -a windsurf -y
name: simplify-codebase description: Simplification audit or authorized codebase simplification whose stated objective is to remove accidental complexity. Use for evidence-backed deletion or consolidation of dead code, duplicate state, redundant APIs or layers, ownerless abstractions, obsolete compatibility or design records, and over-engineering in any language; also use for 代码简化 or 熵回收. Do not use for general code review, onboarding, style-only refactoring, or performance tuning.
Reduce the number of concepts and obligations a codebase must keep coherent. Line-count reduction is supporting evidence, not the objective. A successful run may conclude that the inspected surface is already justified.
First choose the authority mode:
Then choose the coverage scope:
Deleting a reachable capability, supported interface, stored representation, or compatibility path is a product decision. Describe the consequence and obtain direction unless the user has already chosen it.
1. Read the repository's instructions, architecture and decision records, manifests, test guidance, and generated-file conventions. 2. Inspect version-control state and preserve unrelated work. Identify vendored, generated, migration, fixture, and public-package surfaces before classifying them. 3. Trace the runtime path from entrypoints through configuration, registration, dispatch, persistence, processes, and wire boundaries. Record public, dynamic, persisted, generated, and compatibility-sensitive contracts. 4. In Change mode, discover the repository's real verification commands and capture a proportional baseline when feasible. A failing baseline narrows what the final checks can prove.
Preserve authorization, trust-boundary validation, security isolation, accessibility essentials, data-loss prevention, stored-format compatibility, and cleanup that establishes quiescence. Treat changes to these protections as their own explicitly authorized objective, not an incidental simplification.
The contract map is complete when all in-scope entrypoints and authority boundaries are enumerated, each is traced far enough to name its owner and observable contract, and every uninspected or externally unknowable surface is recorded as a blind spot.
For every Broad engagement, and for Focused work involving dynamic architecture or dependency substitution, read [investigation.md](references/investigation.md). Build a coverage map before ranking findings; the first plausible deletion must not end the survey.
For concurrency, cancellation, readiness, cleanup, defensive copies, validation, authorization, security isolation, accessibility, data-loss prevention, or cross-process data, also read [boundaries-and-lifecycle.md](references/boundaries-and-lifecycle.md).
Use repository-native search, compiler and linter output, dependency metadata, and history as discovery instruments. Treat their findings as leads until runtime consumers and contracts have been examined.
For every in-scope lead that reaches consumer-map evidence or could retire a meaningful contract, record:
Finding ID: a stable report-local identifier such as S1 or S2 Candidate: the exact contract, representation, or layer to remove or merge Locus: the ownership boundary, symbols, and exact paths or lines when verified Topology: confirmed node and relationship IDs, primary locus, related nodes, route, and cut set when useful; otherwise not applicable Burden: the concepts, synchronization, publication, or testing cost it creates Reachability: production, non-production, dynamic, external, and persisted consumers Rationale: why it exists and whether that reason remains current Cut: declarations, implementations, branches, artifacts, docs, and dependencies affected Consequence: observable capability or compatibility behavior surrendered Confidence / risk: evidence strength, uncertainty, blast radius, and reversibility Proof: the smallest check that would expose an incorrect cut Net effect: maintenance concepts removed minus replacement or migration machinery added
Keep Finding IDs stable within the run so the summary, proof record, source links, and any visual companion refer to the same candidate. Do not invent a line number, owner, relationship, or route to fill the location fields. Mark unknown facts as unresolved.
Prove cut boundaries below file granularity when the candidate shares an artifact with surviving consumers. Account for candidate-exclusive selectors, members, fields, keys, registry entries, generated fragments, and fixtures without disturbing the surviving owners.
Keep or downgrade the candidate when a real consumer exists, dynamic reachability remains unresolved, a current decision still owns the design, the change merely relocates complexity, the result is outside scope or retires no meaningful obligation, or the available check cannot distinguish success from accidental breakage.
Rank confidence separately from benefit. A high-value guess does not outrank a smaller proved cut.
Candidate proof is complete when every qualifying lead is classified as ranked, rejected, or unresolved, and every unresolved lead names the fact required to decide it.
In Survey
先证明,再删除。让代码库少维护一些事实、状态与契约。 simplify-codebase 是一个面向现有代码库的 Agent Skill。它帮助编码智能体识别并安全移除偶然复杂度,同时保护仍然有效的行为、边界与兼容性。 它不追求“删得多”。它关心的是:一次改动能否减少团队今后必须持续保持一致的概念和义务。
Refactor code to reduce cyclomatic complexity so it stays readable, maintainable, and aligned with the long-term vision of the…
Ask which skill or flow fits your situation. A router over the skills in this repo.