agentleFS
mmccallammccalla/coding-agent-skill-library/skills/dry-principle/SKILL.md

dry-principle

Skill4 starsChanged 5 months agoApache-2.0View on GitHub

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

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 8 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

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

    line 13
  2. Distinctive:

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

    line 17
  3. Distinctive:

    Keep intentionally separate code paths where similar-looking logic serves different business meanings.

    line 25
  4. Distinctive:

    Add tests to prove the consolidated behaviour remains correct.

    line 26
  5. Distinctive:

    Do not abstract merely because two blocks look similar.

    line 30
  6. Distinctive:

    Do not create a shared abstraction that hides meaningful differences.

    line 31
  7. Distinctive:

    Do not centralise volatile code too early.

    line 32
  8. Distinctive:

    Prefer explicit duplication over a misleading abstraction.

    line 33

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

Verification

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

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.