principle-subtract-before-you-add

Guides removal of dead code and redundant validators before adding features or refactors.

Updated Mar 27, 2026
One-click install
npx skills add https://github.com/gmackie/agent-skills --skill principle-subtract-before-you-add-gmackie
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: principle-subtract-before-you-add
Source: https://github.com/gmackie/agent-skills/tree/main/skills/principle-subtract-before-you-add
Command: npx skills add https://github.com/gmackie/agent-skills --skill principle-subtract-before-you-add-gmackie

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Adding features to an already complex system compounds complexity and makes every subsequent change more brittle. This Skill provides a sequencing principle for engineering work: remove dead weight, redundant validators, and stub references first, then build on the simpler base. ## Core Features & Use Cases - Removal-First Sequencing: Orders deletion before construction so the next addition lands on a smaller, clearer surface. - Speculative-Code Elimination: Cuts validators, parsers, and guards that go beyond what the spec actually demands, including persistence, retry, and schema-migration defenses for out-of-spec features. - Prompt and Reference Simplification: Removes redundant instructions, excessive templates, and stub references with no novel content. - Use Case: Before implementing a new feature in a legacy module, apply this principle to delete unused code paths and speculative guards, reducing the surface area so the new design becomes smaller and more obvious. ## Quick Start Apply the subtract-before-you-add principle to plan my upcoming refactor by identifying what should be deleted first.

Frequently Asked Questions about principle-subtract-before-you-add

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reduce complexity before refactoring legacy code?▼

Remove dead code, redundant validators, and stub references before starting construction. Deletion shrinks the surface area and reveals the essential structure, which usually makes the next design smaller and less brittle.

What is the subtract before you add principle in software design?▼

It is a sequencing rule: cut complexity first, then build. Adding to a complex system compounds complexity, while removing first exposes the core structure and makes the following addition obvious.

When should I delete speculative validators and guards?▼

Delete validators, parsers, and guards that go beyond what the spec demands. Out-of-spec features like persistence, retry-on-startup, and schema migration drag defensive guards behind them, so removing the feature removes the guard burden.

When is subtraction the wrong approach for a codebase?▼

Subtraction is wrong when code serves observed, active usage or when the spec genuinely requires the defensive guards in place. The principle targets dead weight and speculative edge cases, not functionality users depend on.

How does this principle apply to AI prompts and documentation?▼

Simplify prompts by removing redundant instructions and excessive templates. When a reference document contains no novel content, delete it rather than leaving a stub that adds maintenance surface.