
Dry Principle
- 140 installs
- 36 repo stars
- Updated July 14, 2026
- oimiragieo/agent-studio
Refactor duplicated logic, extract shared utilities, and align implementations when agents touch UI handlers, services, or helpers that repeat the same behavior.
About
dry-principle trains agents to spot repetition, propose shared abstractions, and avoid copy-paste drift while implementing features. It encodes Don't Repeat Yourself judgment so refactors happen during active development, keeping SaaS and API codebases easier to test, extend, and reason about over time.
- Flags harmful duplication
- Suggests shared abstractions
- Balances reuse vs clarity
- Applies across layers
- Improves maintainability early
Dry Principle by the numbers
- 140 all-time installs (skills.sh)
- +1 installs in the week ending Aug 4, 2026 (Skillselion tracking)
- Ranked #387 of 1,352 Code Review & Quality skills by installs in the Skillselion catalog
- Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/oimiragieo/agent-studio --skill dry-principleAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 140 |
|---|---|
| repo stars | ★ 36 |
| Last updated | July 14, 2026 |
| Repository | oimiragieo/agent-studio ↗ |
What it does
Refactor duplicated logic, extract shared utilities, and align implementations when agents touch UI handlers, services, or helpers that repeat the same behavior.
Files
Dry Principle Skill
<identity> You are a coding standards expert specializing in dry principle. You help developers write better code by applying established guidelines and best practices. </identity>
<capabilities>
- Review code for guideline compliance
- Suggest improvements based on best practices
- Explain why certain patterns are preferred
- Help refactor code to meet standards
</capabilities>
<instructions> When reviewing or writing code, apply these guidelines:
- Follow the DRY (Don't Repeat Yourself) Principle and Avoid Duplicating Code or Logic.
- Avoid writing the same code more than once. Instead, reuse your code using functions, classes, modules, libraries, or other abstractions.
- Modify code in one place if you need to change or update it.
</instructions>
<examples> Example usage:
User: "Review this code for dry principle compliance"
Agent: [Analyzes code against guidelines and provides specific feedback]</examples>
Iron Laws
1. NEVER extract to a shared abstraction until you have at least 3 concrete instances of the same logic — premature extraction creates wrong abstractions that are harder to remove than the original duplication. 2. ALWAYS maintain a single source of truth for configuration values — the same constant or config value defined in two places will diverge and cause bugs. 3. NEVER apply DRY to coincidentally similar code that serves different purposes — coupling unrelated concepts through shared abstractions creates cascading change requirements. 4. ALWAYS prefer readability over DRY when the abstraction requires indirection that obscures what the code does — a small amount of duplication is often better than an obscure helper. 5. NEVER use copy-paste as a first resort for new similar functionality — always check whether an existing abstraction can be extended or parameterized first.
Anti-Patterns
| Anti-Pattern | Why It Fails | Correct Approach |
|---|---|---|
| Extracting on the second occurrence (Rule of Two) | Two instances may be coincidentally similar; wrong abstraction is worse than duplication | Wait for the third occurrence before extracting; use the Rule of Three |
| Coupling unrelated concepts through shared helpers | Changes to one domain break the other; creates unexpected dependencies | Only extract when the shared logic genuinely represents the same domain concept |
| Over-abstracting to eliminate all apparent duplication | Creates complex indirection that requires reading 3 files to understand 1 operation | Prefer 3 readable duplicate lines over 1 inscrutable abstraction |
| Same constant defined in multiple configuration files | Values diverge silently; one-off changes cause hard-to-trace bugs | Single config module or environment variable; import everywhere |
| DRY applied to test code (reducing fixture duplication) | Test setup that's too DRY becomes hard to read in isolation | Tests should be self-contained; some duplication in test setup is acceptable |
Memory Protocol (MANDATORY)
Before starting:
cat .claude/context/memory/learnings.mdAfter completing: Record any new patterns or exceptions discovered.
ASSUME INTERRUPTION: Your context may reset. If it's not in memory, it didn't happen.
Invoke the dry-principle skill and follow it exactly as presented to you
'use strict';
/**
* Post-execute hook for dry-principle
* Auto-generated by enterprise-bundle-scaffolder
*
* Records metrics after skill execution.
*/
function postExecute(_context) {
// Record execution metrics
return { ok: true, skill: 'dry-principle' };
}
module.exports = { postExecute };
'use strict';
/**
* Pre-execute hook for dry-principle
* Auto-generated by enterprise-bundle-scaffolder
*
* Validates inputs before skill execution.
*/
function preExecute(context) {
// Validate skill invocation context
if (!context || typeof context !== 'object') {
return { allow: true, message: 'dry-principle: no context to validate' };
}
return { allow: true };
}
module.exports = { preExecute };
dry-principle Research Requirements
Generated: 2026-02-28
Skill Description
This rule enforces the Don't Repeat Yourself principle to avoid code duplication and improve maintainability.
Research Areas
- Current best practices for dry-principle
- Industry standards and tooling
- Integration patterns
Source References
- To be populated by skill-updater research phase
dry-principle Rules
Purpose
This rule enforces the Don't Repeat Yourself principle to avoid code duplication and improve maintainability.
Best Practices
- Follow the guidelines consistently
- Apply rules during code review
- Use as reference when writing new code
Integration Points
See SKILL.md for complete documentation.
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "dry-principleInput",
"description": "Input schema for This rule enforces the Don't Repeat Yourself principle to avoid code duplication and improve maintainability.",
"type": "object",
"additionalProperties": true,
"properties": {
"target": {
"type": "string",
"description": "Target file or path for the skill to operate on"
},
"options": {
"type": "object",
"description": "Additional options for skill execution",
"additionalProperties": true
}
}
}
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "dry-principleOutput",
"type": "object",
"additionalProperties": true,
"properties": {
"ok": {
"type": "boolean"
},
"summary": {
"type": "string"
}
}
}
#!/usr/bin/env node
/**
* dry-principle - Rule-based Skill
* Converted from: dry-principle.mdc
*/
const fs = require('fs');
const path = require('path');
// Parse arguments
const args = process.argv.slice(2);
const options = {};
for (let i = 0; i < args.length; i++) {
if (args[i].startsWith('--')) {
const key = args[i].slice(2);
const value = args[i + 1] && !args[i + 1].startsWith('--') ? args[++i] : true;
options[key] = value;
}
}
if (options.help) {
console.log(`
dry-principle - Code Guidelines Skill
Usage:
node main.cjs --check <file> Check a file against guidelines
node main.cjs --list List all guidelines
node main.cjs --help Show this help
Description:
This rule enforces the Don't Repeat Yourself principle to avoid code duplication and improve maintainability.
`);
process.exit(0);
}
if (options.list) {
console.log('Guidelines for dry-principle:');
console.log('See SKILL.md for full guidelines');
process.exit(0);
}
console.log('dry-principle skill loaded. Use with Claude for code review.');
dry-principle Implementation Template
Goal
- Define target outcome and acceptance criteria.
TDD
1. Red 2. Green 3. Refactor
Verification
- lint
- format
- targeted tests