principle-subtract-before-you-add
Use when planning the order of an addition, refactor, or rewrite. Clear out dead code and redundancy before building, so the system ends up simpler and no less capable, with a surface the same size or smaller.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 1.6k
- Forks
- 491
01 前言 Front Matter
- name
- principle-subtract-before-you-add
- description
- Use when planning the order of an addition, refactor, or rewrite. Clear out dead code and redundancy before building, so the system ends up simpler and no less capable, with a surface the same size or smaller.
- disable-model-invocation
- true
03 SKILL.md 正文
Subtract before you add
As a system changes, take complexity out before you put new code in. Make simplifying a habit, so every change leaves a design that is simpler, does at least as much, and exposes no more surface than before.
When it applies
Sequencing any addition, refactor, or rewrite. Subtraction is the default.
What to do
- Schedule removal work before construction work, and land it in its own commit.
- Cut to the minimum before polishing.
- Design for observed usage, not hypothetical edge cases.
- Write only the validators, parsers, and guards that the spec and the real trust boundaries call for. Validation at a genuine boundary is required (principle-boundary-discipline); a third copy of it deeper in is not.
- Apply the same rule to prompts and agent instructions: delete redundant instructions and oversized templates.
- When a doc, file, or link target adds nothing new, delete it. Do not leave a stub.
Subtraction shrinks attack surface. Before adding a new admin endpoint, remove the two unused debug endpoints beside it. Dead routes, unused dependencies, and orphaned feature flags are code that still runs, or still ships, with nobody watching it.
The failure it prevents
Building on dead weight, speculative defensive code, and stub files that mislead readers.
Done when
Dead code and redundancy are gone before new code lands.
Related: principle-foundational-thinking, principle-laziness-protocol, principle-sequence-verifiable-units.
04 同仓库更多 Skills
worktable-review-with-annotations
Create, inspect, reply to, update, or resolve situated Worktable annotations. Use when feedback belongs to a Doc section, block, text range, or HTML Doc, or when the user asks to address existing review feedback and coordinate a requested artifact edit.
worktable-find-and-synthesize-context
Find, assess, and synthesize context from Worktable Docs and Records. Use when the user asks what a workspace contains, wants workspace-backed research, needs current facts reconciled across artifacts, or requests a cited synthesis without changing workspace state.
worktable-create-or-update-docs
Create, edit, rename, or maintain narrative Worktable Docs. Use for plans, decisions, briefs, notes, research syntheses, and other durable prose when the user requests a new artifact or a safe update to an existing one.
worktable-create-or-manage-records
Organize repeated structured information as durable Worktable Records. Use for research datasets, inventories, directories, pipelines, trackers, and other collections whose items need identity, fields, filtering, links, validation, or individual updates.
worktable-create-or-manage-interactive-html
Create or improve durable visual and interactive artifacts in Worktable. Use for dashboards, trackers, calculators, mini apps, slide presentations, and other requests that benefit from a polished HTML Doc.
worktable-collaborate-threads
Read, answer, and hand off messages through durable Worktable threads with users or other authenticated participants. Use when the user asks to check addressed messages, reply to a participant, continue a thread, request another agent's help, wait briefly for a response, or watch for comments and messages sent to the agent.