跳到正文
cccskills
免费在 GitHub 公开

dry

DRY (Don't Repeat Yourself) review rules for code reviews: find the same knowledge — a rule, a constant, a parser, a validation, a protocol detail — implemented in several places that must change together, and tell it apart from code that merely looks alike. Use when reviewing a diff, a pull request or recent changes for duplication, on "DRY review", "is this duplicated", "copy-paste check", or when a review checklist asks for DRY. Pair it with the solid skill for design and with owasp-asvs for security.

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(1)

  • SKILL.md3.2 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

DRY Review

DRY is about knowledge, not text. A finding is the same decision encoded in two or more places that have to change together — so that changing one and forgetting the other is a bug waiting to happen. Two blocks of similar-looking code that encode different decisions are not duplication, and merging them would couple things that should vary independently.

What to look for

  • Rules and validation — the same allow-list, regex, limit or permission check in a form, an API endpoint and a CLI command.
  • Constants and magic values — a status name, a timeout, a URL, a field name or a path spelled out in several files instead of defined once.
  • Parsers and formats — two hand-written parsers or serializers for the same file, header, JSON shape or command output.
  • Protocol details — the same auth header, retry policy, pagination loop or error mapping re-implemented per client.
  • Copied functions — a helper copied into a second module with small edits, where both copies are still meant to behave the same.
  • Docs and code — a procedure described in two documents, or a value documented in a README and hard-coded elsewhere, when both must stay in sync.

In a diff, check first whether the change adds a copy of something that already exists in the codebase: search for the key identifiers, strings and regexes it introduces.

Not a finding

  • Similar code that encodes different decisions, or would diverge on the next change.
  • Two or three lines of glue, test setup or boilerplate the framework expects.
  • Tests that restate expected values on purpose.
  • Duplication across separately released projects (a public library and a private monorepo) that are deliberately kept standalone.
  • Generated, vendored and lock files.

Severity

  • high — the copies have already drifted: they disagree today, and you can show the input that behaves differently in each.
  • medium — default: the copies are identical now but must change together, and nothing ties them.
  • low — small repeated literals or helpers where a mismatch would be cosmetic.

Reporting a finding

Each finding carries:

  • rule — DRY;
  • locations — file:line of every copy, not just the one in the diff;
  • knowledge — one sentence naming the single decision the copies share;
  • cost — what goes wrong when one copy changes and the other does not (or already has);
  • fix direction — where the one source of truth should live, preferring an existing module, config or constant over a new abstraction.

Verify each finding by reading all copies side by side before keeping it. Fewer, true findings beat a long list.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Safe deployment workflow for Drupal 10/11 sites: pre-flight checks, backup, the correct update sequence (composer install, database updates, config import, cache rebuild), verification, and rollback plan. Use when deploying to any environment, releasing to production, or when the user asks to "push changes live", "update the server", or run a release. Also use for multisite releases where each site needs its own database update pass.

中文简介正在准备中。当前显示原文说明。

siva01c/claude-plugins162026年9月26日 更新

Use this skill when authoring or editing Docker Compose files (compose.yaml / docker-compose.yml), running multi-container stacks, or containerizing a Drupal/PHP application — e.g. "set up a local Drupal stack with nginx and MariaDB", "add Redis to my compose file", "why won't my containers start", "split dev and prod compose configuration". Also trigger for compose commands (up, down, logs, exec, watch) and healthcheck/dependency issues between services.

中文简介正在准备中。当前显示原文说明。

siva01c/claude-plugins162026年9月26日 更新

Use this skill when running local AI models with Docker Model Runner — the `docker model` CLI — e.g. "run an LLM locally with Docker", "pull a model from the ai/ namespace", "connect my app to a local model", "use a local model as backend for the Drupal AI module", or when wiring the `models:` top-level element into a compose.yaml. Covers pulling/running models, OpenAI-compatible endpoints, and Compose integration.

中文简介正在准备中。当前显示原文说明。

siva01c/claude-plugins162026年9月26日 更新

Use for operational Drupal 11 workflows in DDEV environments, including safe updates, backup-first procedures, and troubleshooting commands.

中文简介正在准备中。当前显示原文说明。

siva01c/claude-plugins162026年9月26日 更新

Use when creating or extending Drupal 11 custom modules, including scaffolding, service architecture, and dependency injection best practices.

中文简介正在准备中。当前显示原文说明。

siva01c/claude-plugins162026年9月26日 更新

Use when auditing Drupal 11 custom modules/themes for security issues such as unsafe input handling, XSS risks, SQL injection, and access control gaps.

中文简介正在准备中。当前显示原文说明。

siva01c/claude-plugins162026年9月26日 更新

查看 siva01c 的全部技能

报告此技能的问题