reuse-before-build
Health Pass
- License — License: MIT
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Community trust — 101 GitHub stars
Code Fail
- spawnSync — Synchronous process spawning in evals/prepare.mjs
- process.env — Environment variable access in evals/prepare.mjs
Permissions Pass
- Permissions — No dangerous permissions requested
No AI report is available for this listing yet.
A Take / Borrow / Build workflow for coding agents
reuse-before-build
Discover implementations. Reuse code and tests. Resume with evidence.
One skill folder · No service · No runtime dependency
中文 · Install · Try it · Results · Compatibility · MIT license
An Agent Skill that makes your coding agent look for what already exists before it builds: in your project, the standard library, your installed dependencies, and, when a real gap remains, GitHub and official sources. It then decides Take, Borrow, or Build from code it actually read, not from search snippets or memory.
It targets three habits that cost you later: writing a helper next to one that already exists, adding tests that verify nothing new, and recommending a library whose code and license nobody checked.
What changes in practice
Already-covered behavior. Same task and fixture, observed 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.
Choosing a component for a new design (illustrative workflow):
Request Design durable webhook delivery for a new service.
Discover Look for existing implementations on GitHub and in official repositories.
Inspect Read the core code, failure semantics, tests, and license at a pinned revision.
Decide Take a verified core, Borrow a suitable pattern, Build only the gap.
Deliver Show how those choices shape the architecture; label anything unverified.
See the architecture example. A design-only request produces a design; it does not authorize installing dependencies or writing code.
When to use it
- Good fit: choosing an architecture, library, or component; implementing a feature or helper that may already exist; adding or checking tests; resuming engineering work from a handoff or checkpoint.
- Not needed: typo fixes, renames, and other small local edits. The skill keeps those to a quick local check.
- Invocation: mention
reuse-before-buildin your request. Hosts that choose skills automatically may also load it when a task matches; on your first try, name it explicitly to confirm that it loads.
Install
The installable unit is the skills/reuse-before-build folder: SKILL.md, the references/ it reads on demand, and LICENSE. Copy the whole folder.
Claude Code, for all your projects:
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/
To install it for one project only, copy the folder into that project's .claude/skills/ instead.
Codex, Claude Code, and other agents with the skills CLI (run from your project):
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. The CLI needs Node.js ≥22.20.0; the skill itself does not. For manual copies, PowerShell commands, and other hosts' folders, see 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 cites the files or sources it actually read and explains its choice. To practice first, use the included 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 |
- Effort follows the event. Local inspection comes first. External research starts 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 over impressions. Before adopting an outside library, the agent pins a revision and reads its manifest, license, implementation, and a test or call site. Candidates it could not fully read stay labeled unverified.
- Tests before new tests. It reads the existing runner and assertions, extends them for real gaps, and leaves already-covered behavior alone. New tests use inputs that can tell a right answer from a plausible wrong one.
- Resume with evidence. A handoff note or old test log is a claim to check against the current workspace, and it cannot grant new permissions. See the checkpoint guide.
The rules live in SKILL.md. Details the agent needs only in specific situations, such as inspecting an external candidate or writing a checkpoint, are in references/.
Results
| What was checked | What we saw | Details |
|---|---|---|
| Restructured skill vs. V13 — Claude Opus 5.5, 2026-10-11 | Both versions passed every check across 8 scenarios (17 runs), including the header-only evidence case that V12 failed on Codex. With full evidence, the restructured version still made an adoption decision instead of blocking. No measurable time or token difference. | Report |
Combining with a simplification skill (ponytail) — GPT-6 Luna / high, 2026-09-26, V13 |
8 of 8 explicit combination cases met the scoped criteria: existing tests and code were reused, real gaps were extended, no duplicate implementation or second test runner. Some verification commands repeated. | Report |
| Natural loading in the Codex app — GPT-6 Luna / high, 2026-09-26, V10–V12 | The skill loaded natively in most targeted cases. Known weak spot: with only response headers available, V12 still adopted the candidate in 2 of 3 runs (the no-skill control also did in 2 of 3). | Report |
| Core scenarios — GPT-6 Luna / high, 2026-09-26, V10 | 16 fresh-context scenarios met the scoped criteria, including test reuse, a gap test that caught a planted defect, stale-result detection, and handoff permission checks. | Report |
| Inspecting candidates — GPT-5.6 Luna / medium, 2026-09-26 | 11 runs. Reading of versioned source and license files improved; corroborating tests were still incomplete in live designs. | Report |
| Search timing and test reuse — GPT-5.6 Luna / medium, 2026-09-21 | 17 runs with no-skill controls. With the skill, sufficient tests were reused without edits and a new assertion caught a deliberately wrong implementation; both architecture trials still skipped source and license inspection. | Report |
Each row is a small sample on one host and model, not a success rate. Methods, file hashes, and preserved failures 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.
Installation routes are documented for Codex, Claude Code, GitHub Copilot CLI, Cursor, Gemini CLI, OpenCode, and Windsurf. The compatibility guide separates documented support from observed behavior for each host.
Explore and contribute
- Start with an example: discover implementations for an architecture, reuse code, adapt code, build a missing piece, reuse tests, or resume work.
- Inspect decision boundaries: missing evidence and authorization boundaries. These guides are illustrative; recorded runs are linked above.
- Help improve it: report a reproducible case, check a host, or run an evaluation. Include the revision, host and model, task, expected result, and sanitized evidence.
This is an instruction workflow; behavior depends on the host and model. It adds no tools or runtime enforcement and does not guarantee lower cost. External research needs the agent's existing network access. Evidence checks do not replace security or legal review.
Resuming covers the current task's engineering state. It does not index unrelated conversations, provide global memory, or grant additional permissions. Examples and evaluation assets are optional; the skill itself is the skills/reuse-before-build folder.
MIT · Preserve the copyright and license notice when redistributing.
Reviews (0)
Sign in to leave a review.
Leave a reviewNo results found