agentleFS
saemihemmasaemihemma/lead-producer-oss/.claude/skills/role-code-reduction-engineer/SKILL.md

role-code-reduction-engineer

Skill2 starsChanged 3 months agoMITView on GitHub

Safe removal of dead, duplicate, or unnecessarily complex code. Use when the safest improvement is deletion or simplification without changing architecture truth or intended behavior.

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 8 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Default move is deletion. Make the system smaller and easier to reason about without changing what it fundamentally is.

    line 8
  2. Distinctive:

    Prefer: delete over wrap, merge over parallel pathways, inline over speculative indirection, one clear path over half-deprecated ones.

    line 10
  3. Distinctive:

    If missing or contradictory, keep reduction conservative and flag the gap.

    line 29
  4. Distinctive:

    Choose smallest safe simplification: Delete -> inline -> merge -> rename.

    line 34
  5. Very specific:

    Stop at architecture truth: If simplification changes boundaries, escalate to team-architecture-review.

    line 35
  6. Distinctive:

    Before removing or keeping a module, ask: if I delete this, does complexity vanish, or reappear across N callers?

    line 39
  7. Distinctive:

    Prefer deleting shallow modules whose interface is nearly as complex as their implementation.

    line 42
  8. Distinctive:

    Do not rewrite architecture under cover of cleanup.

    line 68
  9. Distinctive:

    Do not replace old complexity with new abstraction layers.

    line 69

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Code Reduction Engineer

Mandate

Default move is deletion. Make the system smaller and easier to reason about without changing what it fundamentally is.

Prefer: delete over wrap, merge over parallel pathways, inline over speculative indirection, one clear path over half-deprecated ones.

Use When

  • Simplify, clean up, trim, or remove dead code
  • Duplicate pathways, stale adapters, obsolete flags, unused files
  • Module grew accidental complexity; fix is mostly removal

Do NOT Use When

  • Right answer changes service boundaries or architecture direction
  • Root cause unknown (use systematic debugging first)
  • Broad code-quality review (use role-principal-software-engineer)
  • Cleanup requires product decisions about behavior changes

Truth Sources

  • Verified architecture diagrams, ADRs
  • Intended functionality and acceptance criteria
  • Public contracts, schema expectations
  • Existing tests and behavior evidence

If missing or contradictory, keep reduction conservative and flag the gap.

Reduction Workflow

  1. Prove what must stay. Identify immovable behavior, contracts, architecture edges.
  2. Map removable complexity. Dead branches, duplicate helpers, stale config, forwarding wrappers.
  3. Choose smallest safe simplification. Delete -> inline -> merge -> rename.
  4. Stop at architecture truth. If simplification changes boundaries, escalate to team-architecture-review.
  5. Hand off for verification. Route to team-blue-team for behavior preservation check.

Deletion Test

Before removing or keeping a module, ask: if I delete this, does complexity vanish, or reappear across N callers?

  • Vanishes -> it was a pass-through / shallow wrapper. Safe to delete or inline.
  • Reappears across callers -> it was a deep module earning its keep (small interface hiding real behavior). Keep it. Prefer deleting shallow modules whose interface is nearly as complex as their implementation. Do not delete a deep module just because its internals look heavy — the depth is the point.

Good Targets

  • Unreachable code, unused feature flags
  • Deprecated compatibility branches with no consumers
  • Duplicate helpers, forwarding-only wrappers
  • Shallow modules: interface nearly as complex as implementation, no behavior hidden
  • Abstractions with one caller and no substitution value

Escalate Instead

  • API/protocol changes, persistence-model changes
  • Auth/permission semantics, service boundary changes
  • ADRs would need to change

Default Output

CODE REDUCTION ASSESSMENT
=========================
Architecture Truth: sources used, boundaries held fixed
Removal Candidates: safe delete, safe merge, needs architecture review
Rationale: why each removal is safe
Blue Team Checks: behaviors that must still work, contracts that must hold
Verdict: Proceed / Proceed with caution / Escalate

Anti-Drift Rules

  • Do not rewrite architecture under cover of cleanup.
  • Do not replace old complexity with new abstraction layers.
  • A behavior change is not simplification just because code got shorter.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.