本文へ移動
cccskills
無料GitHub で公開

dry-principle

This rule enforces the Don't Repeat Yourself principle to avoid code duplication and improve maintainability.

インストール方法を見る

含まれるファイル(10)

  • SKILL.md4.3 KB
  • commands/dry-principle.md113 B
  • hooks/post-execute.cjs304 B
  • hooks/pre-execute.cjs421 B
  • references/research-requirements.md386 B
  • rules/dry-principle.md341 B
  • schemas/input.schema.json577 B
  • schemas/output.schema.json257 B
  • scripts/main.cjs1.1 KB
  • templates/implementation-template.md187 B

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

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-PatternWhy It FailsCorrect Approach
Extracting on the second occurrence (Rule of Two)Two instances may be coincidentally similar; wrong abstraction is worse than duplicationWait for the third occurrence before extracting; use the Rule of Three
Coupling unrelated concepts through shared helpersChanges to one domain break the other; creates unexpected dependenciesOnly extract when the shared logic genuinely represents the same domain concept
Over-abstracting to eliminate all apparent duplicationCreates complex indirection that requires reading 3 files to understand 1 operationPrefer 3 readable duplicate lines over 1 inscrutable abstraction
Same constant defined in multiple configuration filesValues diverge silently; one-off changes cause hard-to-trace bugsSingle 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 isolationTests should be self-contained; some duplication in test setup is acceptable

Memory Protocol (MANDATORY)

Before starting:

cat .claude/context/memory/learnings.md

After completing: Record any new patterns or exceptions discovered.

ASSUME INTERRUPTION: Your context may reset. If it's not in memory, it didn't happen.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Ensure accessibility in UI components including semantic HTML, ARIA attributes, keyboard navigation, and WCAG 2.2 AA compliance.

日本語の概要は準備中です。原文の説明を表示しています。

oimiragieo/agent-studio432026年7月14日 更新

Use when you want to improve response quality through meta-cognitive reasoning. Applies 15+ reasoning methods to reconsider and refine initial outputs.

日本語の概要は準備中です。原文の説明を表示しています。

oimiragieo/agent-studio432026年7月14日 更新

N-round opposing-stance debates for trade-off analysis. Assigns pro/con roles to agents, runs structured debate rounds with quality scoring, and produces a moderator synthesis with confidence-rated recommendation. Generalizable to architecture, technology, security, and design decisions.

日本語の概要は準備中です。原文の説明を表示しています。

oimiragieo/agent-studio432026年7月14日 更新

Force adversarial code review stance that eliminates confirmation bias — reviewer must find issues or re-analyze

日本語の概要は準備中です。原文の説明を表示しています。

oimiragieo/agent-studio432026年7月14日 更新

Creates specialized AI agents on-demand when no existing agent matches a request. Use when the Router cannot find a suitable agent for a task. Enables self-evolution by generating persistent agents.

日本語の概要は準備中です。原文の説明を表示しています。

oimiragieo/agent-studio432026年7月14日 更新

LLM-as-judge evaluation framework with 5-dimension rubric (accuracy, groundedness, coherence, completeness, helpfulness) for scoring AI-generated content quality with weighted composite scores and evidence citations

日本語の概要は準備中です。原文の説明を表示しています。

oimiragieo/agent-studio432026年7月14日 更新

oimiragieo のスキルをすべて見る

このスキルの問題を報告する