# Dry Principle

> Applies DRY to remove harmful duplication while avoiding misleading abstraction. Use when refactoring repeated knowledge, schemas, validation rules, or agent instructions.

- **Type:** Skill
- **Install:** `agentstack add skill-mmccalla-coding-agent-skill-library-dry-principle`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [mmccalla](https://agentstack.voostack.com/s/mmccalla)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** Apache-2.0
- **Upstream author:** [mmccalla](https://github.com/mmccalla)
- **Source:** https://github.com/mmccalla/coding-agent-skill-library/tree/main/skills/dry-principle

## Install

```sh
agentstack add skill-mmccalla-coding-agent-skill-library-dry-principle
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# DRY Principle

## When to use

Use this skill when reviewing repeated code, configuration, schemas, prompts, tests, error handling, validation or business rules.

## Objective

Remove duplication of knowledge and behaviour where it creates maintenance risk, while preserving clarity and avoiding premature abstraction.

## Procedure

1. Identify the duplicated elements.
2. Classify the duplication as harmless coincidence, repeated syntax, repeated business rule, repeated validation, repeated integration logic, repeated configuration, repeated prompt or repeated agent instruction.
3. Consolidate only when the duplication represents the same knowledge or is likely to change together.
4. Choose the least complex consolidation mechanism: helper function, constant, schema, shared module, template, configuration, policy or test fixture.
5. Keep intentionally separate code paths where similar-looking logic serves different business meanings.
6. Add tests to prove the consolidated behaviour remains correct.

## Rules

- Do not abstract merely because two blocks look similar.
- Do not create a shared abstraction that hides meaningful differences.
- Do not centralise volatile code too early.
- Prefer explicit duplication over a misleading abstraction.
- Centralise business rules, validation rules, schemas and security policies when they must remain consistent.

## References

- [C2 Wiki — Don't Repeat Yourself](https://wiki.c2.com/?DontRepeatYourself)

## Verification

- [ ] Duplication removed or deliberately retained with reason.
- [ ] Any new abstraction justified as safe.
- [ ] Tests or checks run reported.
- [ ] Residual risks or assumptions stated.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [mmccalla](https://github.com/mmccalla)
- **Source:** [mmccalla/coding-agent-skill-library](https://github.com/mmccalla/coding-agent-skill-library)
- **License:** Apache-2.0

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-mmccalla-coding-agent-skill-library-dry-principle
- Seller: https://agentstack.voostack.com/s/mmccalla
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
