# Principle subtract before you add

> Principle subtract before you add is an open-source agent skill for developer tools. Guides an agent to remove dead code and extra guards before adding new work. It is available on Claude Code.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code
- **Website:** https://github.com/michael-denyer/pstack-claude/tree/main/plugins/pstack/skills/principle-subtract-before-you-add
- **Repository:** https://github.com/michael-denyer/pstack-claude
- **GitHub stars:** 5,057
- **License:** MIT
- **Skill name:** principle-subtract-before-you-add
- **Collection:** https://github.com/michael-denyer/pstack-claude
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-01

## About

This skill sets an ordering rule for changes to a codebase: when an addition, refactor or rewrite is planned, the agent first strips out dead code, redundant validators and stub references, then builds on the simpler base. It treats simplification as an ongoing habit, aiming to leave a design a little leaner and more capable while keeping the same or a smaller public surface.

The instructions push the agent toward a minimal first version. Work is sequenced so removal comes before construction and polish comes after the minimum is in place. Validators, parsers and guards are kept to what the specification requires rather than speculative edge cases, and prompts or templates are trimmed of repeated instructions. Reference files with no new content are deleted instead of left as placeholders.

The skill is written as plain guidance with no scripts or bundled tools. It applies to any codebase the agent is working in, and it is packaged as part of the pstack Claude Code plugin marketplace.

## When your agent uses it

> Apply when sequencing an addition, refactor, or rewrite. Remove dead code, redundant validators, and stub references first, then build on the simpler base.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/michael-denyer/pstack-claude/tree/HEAD/plugins/pstack/skills/principle-subtract-before-you-add)
- [License: MIT](https://github.com/michael-denyer/pstack-claude/tree/HEAD/plugins/pstack/skills/principle-subtract-before-you-add)

## Features

- **Removal before construction:** Sets the order of work so dead code and stale references are cleared before new code is written.
- **Minimal first version:** Pushes the agent to reach a working minimum before investing in polish or quality.
- **Lean validation:** Limits validators, parsers and guards to what the specification actually requires.
- **Prompt trimming:** Removes redundant instructions and excessive templates from prompts the agent maintains.
- **Stub cleanup:** Deletes reference files that add no novel content rather than leaving empty stubs behind.

## Good for

- Refactor a module by first deleting unused functions and imports
- Plan a new feature starting from a smaller, cleaned-up base
- Strip redundant input validation before adding a new parser
- Trim bloated prompt templates in an AI application
- Remove placeholder reference docs before rewriting a project's documentation

## Install

### Claude Code

This skill ships in the `pstack` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add michael-denyer/pstack-claude
/plugin install pstack@pstack-claude
```

Or copy only this skill to `~/.claude/skills/principle-subtract-before-you-add`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/principle-subtract-before-you-add &&
cp -R "$tmp/plugins/pstack/skills/principle-subtract-before-you-add" ~/.claude/skills/principle-subtract-before-you-add &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/principle-subtract-before-you-add` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/principle-subtract-before-you-add` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/principle-subtract-before-you-add &&
cp -R "$tmp/plugins/pstack/skills/principle-subtract-before-you-add" ~/.agents/skills/principle-subtract-before-you-add &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/principle-subtract-before-you-add` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/principle-subtract-before-you-add` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/principle-subtract-before-you-add &&
cp -R "$tmp/plugins/pstack/skills/principle-subtract-before-you-add" ~/.cursor/skills/principle-subtract-before-you-add &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/principle-subtract-before-you-add` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/michael-denyer/pstack-claude.git --path plugins/pstack/skills/principle-subtract-before-you-add
```

Or copy the folder to `~/.gemini/skills/principle-subtract-before-you-add` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/principle-subtract-before-you-add`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/principle-subtract-before-you-add &&
cp -R "$tmp/plugins/pstack/skills/principle-subtract-before-you-add" ~/.copilot/skills/principle-subtract-before-you-add &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/principle-subtract-before-you-add` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git
```

Then copy `pstack-claude/plugins/pstack/skills/principle-subtract-before-you-add` into your agent's skills folder as `principle-subtract-before-you-add`. Agents that support SKILL.md read one folder per skill.

## FAQ

### Does Principle subtract before you add need any scripts or extra tools?

No. It ships as instructions only, with no scripts, and it does not set any allowed tools.

### When does the agent use Principle subtract before you add?

It applies when the agent is sequencing an addition, refactor or rewrite, as described in its trigger description.

### Is Principle subtract before you add tied to one AI client?

It is packaged as a Claude Code plugin skill in the pstack-claude marketplace, so it is listed for Claude Code.

### How do I install Principle subtract before you add in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/principle-subtract-before-you-add to use it in all your projects, or to .claude/skills/principle-subtract-before-you-add in one project. Or install the pstack plugin, which includes it: /plugin marketplace add michael-denyer/pstack-claude, then /plugin install pstack@pstack-claude.

### Does Principle subtract before you add run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Principle subtract before you add?

Claude Code. It reads skills in the SKILL.md format; the install steps on this page show where to put the folder.

### What are the best alternatives to Principle subtract before you add?

The closest alternatives to Principle subtract before you add are Principle laziness protocol, Code simplifier, Principle build the lever, Principle foundational thinking and Principle never block on the human.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Principle laziness protocol](https://ai-powered.com/skills/principle-laziness-protocol): Principle laziness protocol is an open-source agent skill for developer tools.
- [Code simplifier](https://ai-powered.com/skills/code-simplifier): Code simplifier is an open-source agent skill for developer tools.
- [Principle build the lever](https://ai-powered.com/skills/principle-build-the-lever): Principle build the lever is an open-source agent skill for developer tools.
- [Principle foundational thinking](https://ai-powered.com/skills/principle-foundational-thinking): Principle foundational thinking is an open-source agent skill for developer tools.
- [Principle never block on the human](https://ai-powered.com/skills/principle-never-block-on-the-human): Principle never block on the human is an open-source agent skill for developer tools.
- [Principle redesign from first principles](https://ai-powered.com/skills/principle-redesign-from-first-principles): Principle redesign from first principles is an open-source agent skill for developer tools.
- [Principle sequence verifiable units](https://ai-powered.com/skills/principle-sequence-verifiable-units): Principle sequence verifiable units is an open-source agent skill for developer tools.
- [Principle minimize reader load](https://ai-powered.com/skills/principle-minimize-reader-load): Principle minimize reader load is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/principle-subtract-before-you-add
