CommunityProgramación y desarrollogithub.com

simplify-project

Scan a codebase for structural simplifications (deepening shallow modules, removing pass-through layers, speculative seams, and dead code), present candidates with before/after code, then design and plan whichever one the user picks.

¿Qué es simplify-project?

simplify-project is a Claude Code agent skill that scan a codebase for structural simplifications (deepening shallow modules, removing pass-through layers, speculative seams, and dead code), present candidates with before/after code, then design and plan whichever one the user picks.

Compatible con✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/kingkupps/skills/tree/HEAD/skills/simplify-project

Installed? Explore more Programación y desarrollo skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

Preguntar en tu IA favorita

Abre un nuevo chat con esta habilidad de agente ya precargada.

Documentación

Simplify Project

Find where the codebase's structure costs more than it earns, and propose changes that make it smaller and deeper. The aim is leverage for callers, locality for maintainers, and code that is easy to test and navigate.

Read the glossary and decision records first, per the project-documentation skill. Name modules with glossary terms ("the Order intake module", not "the OrderHandler" or "the Order service"), and don't re-propose what a decision record already settled.

Vocabulary

Use these terms exactly in every candidate, brief, and plan. Don't substitute component, service, or unit (for module), API or signature (for interface), or boundary (for seam).

  • Module: anything with an interface and an implementation, at any scale: a function, class, package, or slice across tiers.
  • Interface: everything a caller must know to use the module correctly: types, plus invariants, ordering constraints, error modes, required configuration, and performance characteristics.
  • Implementation: the code inside a module.
  • Depth: behavior a caller can exercise per unit of interface they must learn. Deep: a lot of behavior behind a small interface. Shallow: an interface nearly as complex as the implementation.
  • Seam: where a module's interface lives; a place you can alter behavior without editing in that place. Where a seam goes is a separate decision from what sits behind it.
  • Adapter: a concrete thing that satisfies an interface at a seam, such as an HTTP client in production or an in-memory fake in tests.
  • Leverage: what callers get from depth. One implementation pays back across many call sites and tests.
  • Locality: what maintainers get from depth. Change, bugs, and knowledge concentrate in one place.

Principles

  • The deletion test. Imagine deleting the module. If complexity vanishes, it was a pass-through: remove it. If complexity reappears across callers, it earns its keep.
  • The interface is the test surface. Callers and tests cross the same seam. Needing to test past the interface means the module is the wrong shape.
  • One adapter is a hypothetical seam; two is a real one. A seam with one adapter is indirection. Production plus a test fake counts as two.
  • Depth belongs to the interface, not the implementation. A deep module can be built from small parts with their own internal seams; just don't expose them through its interface.

Candidate kinds

  • Deepen: merge a cluster of shallow modules behind one smaller interface. Signs: understanding one concept means bouncing between many small modules; pure functions extracted only for testability while the bugs hide in how they're called; modules leaking across their seams.
  • Remove: delete what fails the deletion test: pass-through layers, single-adapter seams, unused code, abstractions built for variation that never arrived.

When deepening, classify the cluster's dependencies. The category decides how the deepened module is tested:

CategoryExampleTesting across the seam
In-processPure computation, in-memory stateTest through the new interface directly. No adapter.
Local stand-inPGLite for Postgres, in-memory filesystemRun the stand-in in tests. The seam stays internal.
Remote, ownedYour own services over the networkDefine a port: HTTP or queue adapter in production, in-memory adapter in tests.
Third-partyStripe, TwilioInject as a port; tests use a fake adapter.

Process

1. Scope

If the user named a direction (a module, subsystem, or pain point), use it. Otherwise, find hot spots in a good stretch of git log: the files and areas that change most. Simplifying code that changes often pays off soonest. If changes are scattered with no clear hot spot, widen the net.

2. Explore

Spawn a fresh-context subagent to walk the scoped area. Its brief includes the scope, the Vocabulary, Principles, and Candidate kinds sections above, and the relevant glossary terms. Ask it to explore organically rather than follow a checklist, apply the deletion test to anything it suspects is shallow, note which areas are untested or hard to test through their current interface, and report candidates with file paths and code excerpts.

Read the code behind each candidate yourself before reporting it.

3. Report

Write the report to ./.scratch/simplify-project-<YYYYMMDD>.md and show it in chat. Rank candidates strongest first. For each:

  • Title: names the change ("Deepen Order intake", "Remove the pricing seam").
  • Kind and strength: Deepen or Remove; Strong, Worth exploring, or Speculative.
  • Files.
  • Problem: one or two sentences in vocabulary terms.
  • Before / after: short code excerpts of the current implementation and of how the interface and a typical caller would look afterward. Illustrative, not a full implementation.
  • Wins: short bullets naming the gain in vocabulary terms ("locality: pricing bugs live in one module", "interface shrinks from 6 functions to 1"). Never "cleaner" or "more maintainable".
  • Tests: which existing tests would be replaced, and what would be tested at the new interface.
  • Decision conflict, if any. Surface a candidate that contradicts a decision record only when the friction justifies reopening the decision, and say why.

End with a top recommendation and the reason for it, then ask which candidate to pursue. Don't propose detailed interfaces yet.

If the user rejects a candidate for a reason a future run would need to know to avoid re-suggesting it, offer a decision record. Skip ephemeral reasons ("not right now") and self-evident ones.

4. Design it twice

Run this for every Deepen candidate the user picks. Remove candidates have no new interface to design; go to step 5.

  1. Frame the problem for the user: the constraints any new interface must satisfy, the dependencies and their categories, and a rough code sketch that makes the constraints concrete. Show it, then immediately continue so the user reads while the subagents work.

  2. Spawn 3 or more subagents in parallel, each with a technical brief (file paths, coupling details, dependency categories, what sits behind the seam, the Vocabulary section, and the relevant glossary terms) and a different constraint:

    • Minimize the interface: 1 to 3 entry points, maximum leverage per entry point.
    • Maximize flexibility: support many use cases and extension.
    • Optimize for the most common caller: make the default case trivial.
    • If dependencies cross a seam: design around ports and adapters.

    Each returns the interface (types plus invariants, ordering, and error modes), a usage example, what the implementation hides, its adapters, and where leverage is high or thin.

  3. Present each design, then compare them on depth, locality, and seam placement. Recommend one, or a hybrid if parts combine well. Be opinionated. Append the designs and recommendation to the report file.

5. Plan and implement

Read ~/.claude/skills/plan-harshly/SKILL.md and follow it, starting from the chosen candidate and design. The design tree should cover seam placement, what sits behind the seam, which tests are replaced and which are added, and the order in which call sites migrate.

Implement only after the user confirms the plan, following the tdd skill. Replace tests rather than layering them: once tests at the new interface cover the behavior, delete the old tests on the shallow modules they replace.

Skills relacionados