joabgonzalez/ai-agents-skills/dry-principle
Claude Code and agent skill by joabgonzalez/ai-agents-skills
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Eliminate knowledge duplication via abstraction. Trigger: When same logic appears 3+ times or changing one place requires updating others.
Install
npx vskill@latest install joabgonzalez/ai-agents-skills/dry-principleSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as joabgonzalez/ai-agents-skills/dry-principle.
DRY Principle
Eliminate knowledge duplication through abstraction. DRY is about knowledge duplication, not code duplication—similar-looking code representing different concepts should NOT be merged.
When to Use
- Same logic appears in 3+ places (Rule of Three)
- Changing a rule requires updating multiple files
- Shared configuration or constants duplicated across modules
Don't use for:
- Code that looks similar but represents different business concepts
- Premature abstraction (apply after seeing duplication, not speculatively)
- Trivial one-off operations
Critical Patterns
✅ REQUIRED: Rule of Three — Extract After 3rd Occurrence
Apply DRY when logic appears in 3+ places. Below that, duplication may be acceptable.
✅ REQUIRED: Centralize Configuration
Single source of truth for constants, endpoints, and config values.
✅ REQUIRED: Shared Types
Define types once, import everywhere.
✅ REQUIRED: React Custom Hooks as DRY Abstraction
Extract repeated fetch/state patterns into custom hooks — same Rule of Three applies.
Rule: Apply only after seeing the same hook pattern in 3+ components — not speculatively.
❌ NEVER: Merge Code That Looks Similar but Isn't
DRY is about knowledge duplication, not code similarity.
Decision Tree
Example
Edge Cases
Forced parameter proliferation: If your shared function needs 5+ parameters to handle all callers, DRY may be wrong. The callers may represent genuinely different concerns.
Test helpers: Same test setup code in multiple tests — extract to beforeEach or test fixtures. This is legitimate DRY in tests.
Accidental coupling: Merging two functions because they look similar can accidentally couple unrelated business rules. If they change independently, keep them separate.
Resources
- patterns-examples.md — Advanced patterns, DRY in CSS, template duplication, cross-layer
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/dry-principle/SKILL.md
Popularity
- Repository stars
- 9
- 7-day trend score
- 12
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/joabgonzalez/ai-agents-skills/dry-principle)