一键导入
no-duplicate-logic
Use when adding a case, check, or branch to a function that already exists, especially after jumping straight to the insertion point.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when adding a case, check, or branch to a function that already exists, especially after jumping straight to the insertion point.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when about to show any prose a human will read - docs, README, commit bodies, UI copy, store text.
Use when building any mechanic that could fail on a machine out of reach - a shipped product, a CLI a user runs, a server.
Use when doing any work in a project that has the instincts plugin installed
Use when touching build scripts, release or packaging steps, publish flows, or CI config.
Use when about to build something someone proposed, especially when the proposer sounds confident and the idea sounds obviously fine.
Use when adding any cross-cutting change - a new gate, limit, permission check, or rule that must apply everywhere.
| name | no-duplicate-logic |
| description | Use when adding a case, check, or branch to a function that already exists, especially after jumping straight to the insertion point. |
Before you add logic to a function that already exists, read the whole function. The case you're about to write is often already handled a few lines down. A second block that produces the same result doesn't replace the first — both run, and the output silently doubles. The fix you needed was usually three lines added to the block that's already there, not a new block beside it.
This is not the same as fixing in the shared layer. That's about where a bug lives across callers. This is narrower: don't paste a parallel branch inside one function without reading what's already in it.
Adding a case, branch, check, or emit to an existing function, handler, switch, or validation pass — especially when you jumped straight to the insertion point without reading the rest of the function.
Before adding logic that emits a result keyed by some id or name, search the whole function for that id or that result. If a block already handles it, extend that block instead of adding a new one. Read the function top to bottom before you insert anything into it.
A validation function already emits a "bad-name" issue for a record. You add a new block to emit "bad-name" without noticing the existing one a screen above. Now every bad-named record produces two identical issues, and a count somewhere is quietly off by a factor of two. The real change was three lines inside the block that was already there. Reading the function before inserting would have shown it.
| Thought | Reality |
|---|---|
| "I'll just add the block here" | The block may already exist above; read first. |
| "It's a new case" | Check it's actually new before you write it. |
| "The function's long, I'll jump to the spot" | Jumping to the spot is how you duplicate the spot. |