Ozzeron/prompt-pack — Prompt Excerpts
Technique: Strict ordered preference list with non-negotiable enforcement + mandatory justification trail
---
name: reuse-before-create
description: DRY discipline core. Before creating anything new, find what already exists. Every coding skill inherits this.
category: meta
version: 0.1.0
triggers: ["writing code", "adding component", "adding util", "creating file", "new helper", "new hook"]
applies_to: [openclaw, cursor, claude-code, generic]
---
# Reuse Before Create
## The rule
**Before writing anything new, search for what already exists. Reuse first; create last.**
The order of preference is strict and non-negotiable:
1. **Reuse as-is** — existing artifact fits, import and use
2. **Extend** — add a prop, option, generic, or branch to existing artifact
3. **Compose** — combine existing artifacts into a new shape without rewriting them
4. **Extract** — pull a shared core out of two near-duplicates; both use the new core
5. **Create new** — only when none of the above apply
Each step further down costs more — both in code volume and in long-term maintenance.
Skipping straight to "create new" without proving the prior steps don't apply is the
default failure mode this skill prevents.
## Justification is not optional
When you do create something new, **a one-line justification is mandatory**, not a
nice-to-have. It belongs in the commit message, the PR description, the handoff, or as
an inline comment near the new artifact.
If you can't write the justification in one sentence, you haven't searched hard enough.
Go back to step 1.
Analysis: Uses ordered enumeration with explicit "non-negotiable" language; enforces justification as a required output artifact; prevents the agent from silently skipping to creation. The triggers frontmatter field enables host-native skill discovery in Cursor without a router.
Excerpt 2: code-review (review/code-review/SKILL.md)
Technique: Preflight checklist pattern — mandatory steps before reading any code; prevents hallucinated "reviews" of files the agent hasn't properly read
## Preflight (do this before reading any source file)
This is a checklist on purpose. Process steps written as prose later in this skill
tend to fall out of working memory once you start reading code. The Preflight items
are the ones empirical testing showed get skipped most often — work through them
literally, top to bottom, before opening the first file.
- [ ] **Routing check.** Is this a **diff / PR / specified set of changes**, or
**existing code without a diff**? If the user did not provide a diff and is asking
you to look at existing files, this is an audit, not a review — stop and route
to `review/frontend-audit` (or another `*-audit` skill), or ask one clarifying
question.
- [ ] **Reading plan.** Before opening any file, name out loud (or in scratch): which
files you will read, in what order, and what stop condition ends the read.
- [ ] **Project conventions, once.** Read `AGENTS.md` / `CLAUDE.md` / project `README`
once at the start.
- [ ] **All four passes are mandatory.** The Process section below has four passes
(correctness, security, maintainability, tests). Pass 4 (tests) is the one most
often dropped silently. If the diff has no tests, you say so explicitly.
If you cannot tick all four, stop and ask. Do not start reading.
Analysis: Checkbox-based preflight borrowed from aviation/surgery checklists; accounts for working memory limitations; calls out empirically-observed failure mode (pass 4 dropout); uses self-routing instruction to send audit requests to the correct skill.
Excerpt 3: Inheritance Declaration
Both skills above include an ## Inherits section:
## Inherits
- [`meta/engineering-principles`](../../meta/engineering-principles/SKILL.md)
- [`meta/token-discipline`](../../meta/token-discipline/SKILL.md)
Technique: Explicit skill inheritance graph — code-review imports both engineering-principles (for the rubric) and token-discipline (for read-order rules). This is not executed at runtime — it is a documentation contract the agent must honor when reading the skill.