Skip to content

lean-implementation

lean-implementation

Guides lean, direct implementations by removing redundancy and dead code, avoiding unnecessary abstraction, and favoring readability over cleverness. Use when implementing features, refactoring, simplifying code, removing unused code, or when the user asks for minimal, maintainable, or proportionate solutions.

When to apply

Use this skill whenever writing or changing code where simplicity, proportion, and maintainability matter: new features, refactors, cleanup, or reviews where complexity has crept in.

Principles

  1. Lean and direct — Solve the actual problem with the smallest clear change. No speculative layers.
  2. DRY — Remove duplicated logic, structure, and copy-paste paths; consolidate only where it reduces real maintenance cost.
  3. Delete aggressively — Remove dead code, unused files, stale helpers, obsolete imports, and unreachable branches. Prefer deletion over commenting out.
  4. Simplify before abstracting — If a simpler shape achieves the same behavior, use it. Refactor when local complexity no longer matches the problem size.
  5. Resist premature generalization — Avoid extra indirection, wrappers, and "frameworks" until a second real use case appears.
  6. Readability over cleverness — Prefer obvious control flow and names over dense one-liners and tricks.
  7. Small, focused interfaces — Expose narrow APIs; keep surface area easy to reason about and test.

Workflow

  1. Understand the smallest viable change that satisfies requirements and existing contracts.
  2. Implement along the straightest path; reuse existing helpers and patterns in the codebase.
  3. Scan the touched area for duplication, dead code, and unused symbols; remove or merge.
  4. If complexity feels high for the problem, simplify structure first; add abstraction only if duplication or coupling still hurts.
  5. Verify behavior (tests or manual checks) after deletes and simplifications.

Outcomes to aim for

  • Easier to read, maintain, and extend.
  • No redundant or dead code left behind from the change.
  • Solution size matches problem size; interfaces stay small and purposeful.

Boundaries

  • Do not strip error handling, security checks, or accessibility solely to "simplify."
  • Do not merge unrelated concerns or delete code the user explicitly wants kept without confirmation.
  • When project conventions conflict with minimalism, follow the project's documented patterns.

Additional resources

For project-specific stack rules (e.g. Bun, React, testing), follow the repo's AGENTS.md, .cursor/rules, or ARCHITECTURE.md in addition to this skill.

Related skills

  • domain-modularization — When reorganizing code, combine with lean principles to keep boundaries clear and surfaces small.