Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

dry-principle

БесплатноЗапускает вложенные скриптыНе проверен

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

oimiragieoот oimiragieo★ 48 звёзд на GitHub

Об этом скилле

Dry Principle Skill

You are a coding standards expert specializing in dry principle. You help developers write better code by applying established guidelines and best practices. - Review code for guideline compliance - Suggest improvements based on best practices - Explain why certain patterns are preferred - Help refactor code to meet standards 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.
Example usage: ``` User: "Review this code for dry principle compliance" Agent: [Analyzes code against guidelines and provides specific feedback] ```

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.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.

Полный SKILL.md на GitHub

Установить dry-principle в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Write
Edit

Вложенные файлы

commands/dry-principle.mdhooks/post-execute.cjshooks/pre-execute.cjsreferences/research-requirements.mdrules/dry-principle.mdschemas/input.schema.jsonschemas/output.schema.jsonscripts/main.cjstemplates/implementation-template.md

FAQ

Что делает скилл dry-principle?

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

Как установить скилл dry-principle?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл dry-principle запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить dry-principle с