| name | dry |
| description | Catches duplicated knowledge, logic, or structure that should have a single authoritative source. Use when the user asks to "find duplication", "deduplicate", "DRY this up", or requests an explicit quality review of code, docs, or data models. |
| license | Apache-2.0 |
| metadata | {"author":"Oleg Shulyakov","version":"1.0.2","source":"github.com/olegshulyakov/agent.md","catalog":"productivity","category":"quality","tags":["dry","duplication","refactor","simplicity"]} |
DRY
Every piece of knowledge must have a single source of truth in the system.
Duplication forces every future change to be made in multiple places, and guarantees they will eventually diverge.
Principle
Flag anything that repeats a fact, rule, structure, or decision already expressed elsewhere.
When producing new work, always check whether the knowledge already exists before expressing it again.
Mode
Producing — apply before or during creation to avoid introducing duplication.
Auditing — apply to an existing artifact to find and consolidate duplicated knowledge.
Determine the mode from context. If unclear, ask.
Workflow
When Producing
- Before adding a fact, rule, constant, or structure — check if it already exists in the system.
- If it exists — reference or import it; do not restate it.
- If it does not exist — establish it as the single source of truth and reference it everywhere else.
- Flag any cases where a shared source does not yet exist and one should be created.
When Auditing
- Identify the target — any artifact: code, schema, config, spec, doc, or process definition.
- Map the knowledge units — identify distinct facts, rules, structures, and decisions expressed in the artifact.
- Scan for repetition — apply the relevant checklist sections below.
- Assess each finding — confirm the copies are truly the same knowledge, not coincidentally similar values. Avoid false positives on separate concerns that happen to look alike.
- Recommend consolidation — identify where the single source of truth should live and how the copies should reference it.
Checklist
Apply the sections relevant to the artifact being reviewed.
Code
Configuration & Schema
Documentation & Specs
Process & Tooling
Output
When producing, inline guidance is sufficient — note what was reused or centralised before finalising the artifact.
When auditing, use this structure:
Findings:
- [High/Medium/Low] Short title — locations of all copies
What knowledge is duplicated, where each copy lives, and recommended consolidation approach.
Summary:
[One sentence: how many findings, the highest-risk divergence risk, and the highest-priority consolidation.]
Omit Findings if none. In that case, say "No DRY violations found." and note any near-duplicates reviewed and kept as intentionally separate concerns.
Rules
- Confirm copies represent the same knowledge, not merely similar-looking values with independent meanings. Two unrelated constants that happen to share a value are not a DRY violation.
- Do not conflate DRY with YAGNI or KISS. Do not flag unused code or complexity unless the root cause is unintended duplication.
- Prefer consolidation that makes the single source of truth obvious and easy to find. A shared module, named constant, or referenced doc beats an inline comment.
- Do not modify the artifact unless the user explicitly asks for changes after the audit.
- If context is insufficient to confirm two copies share the same knowledge, mark it as an open question rather than a violation.
- Prefer fewer high-confidence findings over speculative commentary.