principle-subtract-before-you-add

Guides removal of dead code and redundant logic before implementing additions or refactors.

4|1|Updated Dec 16, 2023
One-click install
npx skills add https://github.com/Shtian/AuthentiClash --skill principle-subtract-before-you-add-shtian
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: principle-subtract-before-you-add
Source: https://github.com/Shtian/AuthentiClash/tree/main/.claude/skills/principle-subtract-before-you-add
Command: npx skills add https://github.com/Shtian/AuthentiClash --skill principle-subtract-before-you-add-shtian

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Adding features to an already complex codebase compounds complexity, making refactors risky and designs unclear. This Skill enforces a subtraction-first sequencing principle so changes are built on a simpler, well-understood base. ## Core Features & Use Cases - Removal-First Sequencing: Directs you to delete dead code, redundant validators, and stub references before writing new code. - Anti-Speculation Guardrails: Prevents speculative validators, parsers, and guards beyond what the spec demands, and discourages designing for unobserved edge cases. - Prompt Simplification: Applies the same principle to prompts by removing redundant instructions and excessive templates. - Use Case: Before adding a new input validation layer to a service, apply this Skill to first strip unused validators and dead branches, then implement the addition on the reduced surface. ## Quick Start Apply the subtract-before-you-add principle to plan my next refactor by identifying what should be removed before I add the new feature.

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 simplify code before adding a new feature?▼

Remove dead code, redundant validators, and stub references first, then build the addition on the simpler base. Sequencing removal before construction reveals the essential structure and usually makes the next design obvious.

What is the subtract before you add principle in refactoring?▼

It is a sequencing rule: cut complexity before investing in new construction. Get to the minimum working surface before polishing, and design for observed usage rather than speculative edge cases.

When should I delete stub references instead of keeping them?▼

Delete a reference when it contains no novel content. Leaving stubs adds surface area without value, so removal keeps the design simpler behind the same or smaller footprint.

Should I add validators for edge cases that might occur?▼

No. The principle prohibits speculative validators, parsers, or guards beyond what the spec demands. Design for observed usage and add handling only when a real case appears.

When is subtraction-first not the right approach?▼

It is less applicable when the existing code is already minimal or when removal risks breaking observed behavior without test coverage. In those cases, verify usage and safety nets before cutting.