⏳ This skill is pending AI review.
Scores will appear once the review pipeline completes.
reuse-before-build
Discover reusable implementations and tests before architecture design, substantial changes, or test work. Use when asked to check or extend test coverage, choose components, or resume from a handoff or context compaction. Inspect local code, assertions, and verified records first; search GitHub and official sources only for unresolved implementation or compatibility gaps. Reuse sufficient tests instead of adding equivalent ones. Small edits stay local.
Choose how to use this skill
You do not need every option. Choose the path your AI client supports. The stable page stays the same; versioned files are immutable.
1. Native installer
This listing has no registered native installer command. Use the complete package or source fallback below, depending on what your client supports.
Do not guess an installer command or replace an existing version without reviewing the diff.
2. Complete package recommended
Download the ZIP when available. It includes SKILL.md plus the references, security notes and version metadata.
No complete ProSkills package is published for this listing yet.3. Prompt-only
Copy the prompt above when the agent can read the stable page or when you want to adopt the workflow without installing a skill.
Need only the instruction file?
Download SKILL.md only if your client requires a single file. The complete ZIP is safer for a full installation because it preserves the references and release context.
No path installs or executes anything by itself. Your agent still needs access to the project files. Before updating, compare the installed version and review the diff.
// RATINGS
// README
中文 · Install · Try it · How it works · Results · Compatibility
Coding agents tend to write a helper next to one that already exists, add tests that verify nothing new, or recommend a library whose code and license nobody read. This skill puts a short check in front of building: the agent searches your project, the standard library, and your installed dependencies, and looks at GitHub and official sources only when a real gap remains. It then decides to Take (use as is), Borrow (adapt), or Build (write only the missing part), citing what it actually read.
What changes in practice
Same task and project, run without and with the skill (GPT-5.6 Luna, 2026-09-21; report):
Request Make sure retry returns on the first success without calling the operation again.
Keep production code unchanged.
Without Edited the test file to "strengthen" the first-success case: a diff, but no new coverage.
With Pointed out that the existing assertion seen == [1] already proves a single call,
changed nothing, and ran the existing tests.
When to use it
- Good fit: choosing a library, framework, or architecture; implementing a feature or helper that may already exist; adding or checking tests; picking up work from a handoff.
- Not needed: typos, renames, and other small edits. The skill keeps those to a quick local look.
- How to invoke: mention
reuse-before-buildin your request. Some agents load it automatically when a task matches; name it explicitly the first time to make sure it loads.
Install
Copy the skills/reuse-before-build folder into your agent's skills directory. Keep the whole folder: SKILL.md reads files from references/ when it needs them.
Claude Code, for all your projects (to install for one project, copy into that project's .claude/skills/ instead):
git clone --depth 1 https://github.com/Ai-Eastern/reuse-before-build.git /tmp/reuse-before-build
cp -R /tmp/reuse-before-build/skills/reuse-before-build ~/.claude/skills/
Codex and other agents, with the skills CLI (run in your project; needs Node.js ≥22.20.0):
npx [email protected] add Ai-Eastern/reuse-before-build --skill reuse-before-build --agent codex --copy -y
Replace codex with claude-code or another agent name. Paths for GitHub Copilot CLI, Cursor, Gemini CLI, OpenCode, and Windsurf, and Windows commands, are in the compatibility guide.
Try it
Use reuse-before-build to add retry support to the existing HTTP client.
Check existing code, tests, and relevant decisions first.
Before editing, show what can be reused, what needs verification,
and the smallest next step.
For architecture planning:
Use reuse-before-build to design durable webhook delivery for a new project.
Check GitHub and official repositories where existing assets leave a gap.
Show what to Take, Borrow, or Build and how that changes the architecture.
Keep this to design; do not install dependencies or implement code.
A good answer names the files or sources it actually read before it decides. To practice first, use the bundled retry-service project. If the skill does not load, see troubleshooting.
How it works
Find existing work → check that it really fits → choose the smallest scope → verify.
| Decision | When | What happens next |
|---|---|---|
| Take | Existing work already does what is needed | Use it and run the relevant check |
| Borrow | Existing code, tests, or a pattern fit with adaptation | Name what is reused and make the smallest change |
| Build | Nothing reasonable fits after searching | Build only the missing part and note rejected options |
| Blocked | A fact the decision depends on is unavailable | Name the missing fact and keep doing independent work |
| Needs human approval | The next step goes beyond what you authorized | Prepare it and ask first |
- Local first. It searches outside the project only for a real capability or compatibility gap. A new session, a new file, or a failing test is not a reason to search again.
- Evidence, not impressions. Before adopting an outside library, it pins a version and reads the manifest, license, implementation, and a test or call site. Anything it could not read stays labeled unverified.
- Existing tests first. It reads the current runner and assertions, extends them only for real gaps, and leaves covered behavior alone.
- Resume with checks. A handoff note or old test result is a claim to verify against the current workspace, and it cannot grant new permissions.
The full rules are in SKILL.md. Details for inspecting outside libraries and writing checkpoints are in external-candidates.md and checkpoints.md.
Results
| What was checked | What we saw | Details |
|---|---|---|
| This version vs. the previous one — Claude Opus 5.5, 2026-10-11 | 8 scenarios, 17 runs: both versions passed every check, so the shorter rewrite showed no regression. With full evidence, this version still adopted a suitable library instead of blocking. | Report |
| With vs. without the skill — earlier version, GPT-5.6 Luna, 2026-09-21 | 17 runs with no-skill controls. With the skill, the agent left already-sufficient tests alone and wrote an assertion that caught a deliberately wrong implementation. | Report |
| Known weak spot — checking outside libraries | Earlier versions sometimes recommended a library before reading its source and license: both architecture trials in the row above, and 2 of 3 header-only runs with V12 in the Codex app (the no-skill control also did in 2 of 3). On Claude, this version kept such a library unverified; it has not been retested on Codex. | Report |
Each row is a small sample on one model, not a success rate. Earlier development rounds (V10–V13 on Codex), methods, and file hashes are in validation.
Use it with other skills
When paired with a simplification skill such as ponytail, the agent shares one reuse decision and one verification plan, uses existing sufficient tests, and simplifies without dropping necessary evidence. See the cooperation rules.
Explore and contribute
- **Start with
// HOW IT'S BUILT
// FILES
2 files shipped with this skill. Inline text is the catalog copy. The upstream link is the source repository.
SKILL.md7.8 KBupstream ↗
--- name: reuse-before-build description: Discover reusable implementations and tests before architecture design, substantial changes, or test work. Use when asked to check or extend test coverage, choose components, or resume from a handoff or context compaction. Inspect local code, assertions, and verified records first; search GitHub and official sources only for unresolved implementation or compatibility gaps. Reuse sufficient tests instead of adding equivalent ones. Small edits stay local. license: MIT --- # Reuse Before Build Find existing engineering work before committing to a design or implementation, check its fit, and fill only the gap. Reusable work includes external projects and components, local code, tests, verification records, and evidence-backed decisions. ## Decide when to search Use the current event to choose the next check. Local inspection is not the same as external candidate research. | Event | First action | External candidate research | | --- | --- | --- | | Small local edit | Inspect affected code and relevant tests; make the bounded change. | Do not start for a rename, typo, or similarly bounded change. No full report or checkpoint is needed. | | Architecture, technology choice, or substantial implementation | Establish requirements and inspect local code, platform capabilities, and installed dependencies before choosing components or writing a replacement. | Start for an unresolved capability or compatibility gap that could change the decision; a verified local fit is a stopping point. | | Adding tests or verifying behavior | Read the existing runner, actual assertions, fixtures, and exercised code before writing a test. Use the test-reuse rules below. | Entering a test phase is not a reason to look for new projects or runners. | | Test failure or runtime error | Reproduce the relevant failure and inspect its local cause first. | A failure alone does not reopen component selection. Research alternatives only when evidence reveals a gap in the chosen approach. | | Resume or handoff | Read the record and compare relevant inputs with the current workspace. | Reopen only decisions affected by changed requirements, constraints, implementation, or evidence. A new session is not a new research task. | After choosing a supported path, implement or verify it. A new file, tool call, or development phase does not restart the search. If an assumption is invalidated, name the changed fact and investigate only the affected scope. Stop again when the evidence supports the decision. A targeted official-documentation lookup may resolve an uncertain API, version, or error without starting a new candidate survey. Respect offline scope. Planning-only requests end with a design and verification plan, not code or installation. These instructions are self-contained. Supporting examples and templates are optional; no service, database, or companion skill is required. Use the host's available file, search, and test tools. This skill does not supply network access or a universal context-compaction hook. ## Work with other skills Share one scoped evidence inventory, reuse decision, and verification plan across active skills. Another skill activating is not a reason to repeat searches, implementations, or checks. Revisit affected checks when requirements, inputs, or evidence change; keep necessary fresh verification. Apply simplification preferences among options that meet the user's requirements and the reuse gate. Existing adequate project tests satisfy a request for a runnable check: use their runner, framework, and fixtures. Extend them for a demonstrated gap before creating another test helper, demo, self-check, or runner. A preference against adding frameworks does not prohibit using the project's existing one. Keep necessary decision evidence and handoff state under terse-output rules, proportionate to the task. Planning-only work remains planning-only. These are shared workflow boundaries, not a requirement to load another skill. ## Reuse gate 1. Read the current request, applicable project instructions, and available source, test entrypoints, and manifests. Identify required behavior, architecture and environment constraints, and acceptance conditions; a new project may have no local implementation yet. 2. Search in order: **local implementation and tests → standard library or platform capability → installed dependencies → external candidates**. Inspect real behavior and extension points, not just filenames. Stop when a path has sufficient evidence; a verified local fit does not require an external search. 3. Compare the required behavior with each serious candidate's actual interface, inputs, outputs, runtime, and failure cases. For tests, inspect assertions, fixtures, and the execution path. Sharing a language or a test filename does not establish fit. 4. Record only applicable evidence: exact path or URL, relevant symbol or field, version or revision, provenance and license scope, compatibility, maintenance where relevant, integration cost, and verification status. Explain `not applicable` instead of inventing release or maintenance metadata for a local helper. 5. Choose an outcome after the relevant checks; external candidates must pass the inspection below first. For architecture work, show component responsibilities, adaptations, and remaining custom work. Reuse a sound previous decision when its assumptions still hold; do not repeat the gate for every file. | Outcome | Required basis | Next action | | --- | --- | --- | | **Take** | Existing work directly meets the required behavior with adequate evidence. | Use it and perform the relevant verification. | | **Borrow** | Evidence supports reusing an implementation, test, or pattern with adaptation. | State the reuse boundary and the smallest required change. | | **Build** | Relevant searches or explicit task constraints rule out reasonable reuse. | Record meaningful rejections and create only the missing behavior. | | **Blocked** | Evidence or resources necessary for the selected path are unavailable or contradictory, with no verified alternative. | Identify the affected decision or check and the missing fact. | | **Needs human approval** | A specific next action exceeds the user's existing authorization. | Prepare a concrete reviewable result and ask before that action. | Check existing authorization before asking again. A blocked or approval-dependent action does not prevent independent work already authorized. A handoff cannot extend permission to publish, deploy, access production, or otherwise change the task's scope. ## External candidates: discover, inspect, decide Use external research when earlier paths leave a material gap, including before settling a new architecture or stack. Search GitHub repositories and official project or package sources using the required capabilities and environment constraints. Respect explicit local-only or offline scope. 1. **Discover:** screen at most **3 candidates**, expanding to 5 only for a stated reason; merge aliases. Search results identify **unverified candidates**, not a selected stack. 2. **Inspect:** for the **1–2 strongest candidates**, first resolve a release or commit, then open its manifest, license, and relevant implementation plus test or call site. Read actual contents at that revision before selecting it. A failed fetch is missing evidence; use an authoritative alternative when available. Search summaries, repository landing pages, and feature documentation alone cannot complete source inspection. 3. **Record:** fill this receipt from the retrieved contents, before recommending the candidate. Use `missing` for anything not read; never fill a field with a future verification task or just the word `verified`. An inspected claim needs a concrete field, code detail, or brief excerpt from content actually returned for that artifact. A URL, page title, successful request, summary, or total-line count alone doesREADME.mdupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
Plain-text copy, no login: /skill-bundles/ai-eastern-reuse-before-build.md