prior-work-check
Skill8 starsChanged 3 days agoMITView on GitHub
Use before approving a spec or starting a multi-file implementation to confirm no existing skill, helper, or handler already covers the proposed work.
In this repository34 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- batch-fixSkill
- brainstormingSkill
- code-review-and-qualitySkill
- code-simplificationSkill
- context-engineeringSkill
- fixSkill
- handoffSkill
- implementSkill
- incremental-implementationSkill
- instructionsSkill
- lessonsSkill
- mtk-doctorSkill
- mtk-setupSkill
- mtkSkill
- planning-and-task-breakdownSkill
- pre-commit-reviewSkill
- promote-lessonSkill
- repo-healthSkill
- research-contextSkill
- security-and-hardeningSkill
- setup-auditSkill
- setup-bootstrapSkill
- setup-refreshSkill
- spec-drift-detectionSkill
- spec-driven-developmentSkill
- subagent-implementationSkill
- tech-stack-dotnetSkill
- tech-stack-pythonSkill
- tech-stack-typescriptSkill
- verification-before-completionSkill
- workflow-artifactsSkill
- writing-skillsSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 3 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 25
When the engineer says "let's add an X" and X sounds generic (cache, retry, validator, formatter, normalizer)
- Distinctive: line 36
Look for an existing implementation of the capability under any name.
- Very specific: line 44
If CODE_INDEX.md exists at the repo root, query it with bash scripts/query-code-index.sh find "<keyword>" (case-insensitive row search that …
- Very specific: line 50
If an MCP code-index tool is available (e.g.
- Very specific: line 65
Run the query above (search_prior_work) as usual to catch capability duplication.
- Very specific: line 95
No match after synonyms → PASS.
- Distinctive: line 100
Read-only: it reports, the caller decides.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Prior Work Check
Tool discipline: read-only —
Read/Grep/Globand read-onlyBashqueries. NeverEdit/Write; report what exists and let the caller decide.
Overview
Before writing new code, confirm the codebase doesn't already do this — re-implementing a capability that exists under a different name is the most common waste in mature codebases. Runs once per implement run: spec-driven step 9 for a fresh request, or Phase 0.7's reconciliation mode when the engineer supplied the plan. Lessons and security-impact classification are covered elsewhere (the lessons query in Phase 0, the spec's security-impact step and drift check) and are not repeated here.
When To Use
spec-driven-developmentstep 9, before the implement Phase 2.5 approval gateimplementPhase 0.7 when a pre-written plan is supplied as input — the reconciliation mode below, so already-implemented batches are not re-run- When the engineer says "let's add an X" and X sounds generic (cache, retry, validator, formatter, normalizer)
When NOT To Use
- Typo fixes, single-line config tweaks, or bug fixes where the file in scope is already named
- A second time in the same run — planning does not re-run it
Workflow
Query — search_prior_work
Look for an existing implementation of the capability under any name.
- Extract 2-4 capability keywords from the spec
summaryandsuccess_criteria. Verbs + nouns ("issue token", "retry policy", "currency formatter"). - Run, in parallel:
grep -rn -i "<keyword>" --include="*.cs" --include="*.py" --include="*.ts" --include="*.tsx" --include="*.js" src/(or the active stack's source roots — read.claude/tech-stack).- If
CODE_INDEX.mdexists at the repo root, query it withbash scripts/query-code-index.sh find "<keyword>"(case-insensitive row search that prints each match prefixed with its## <Domain>section) rather than a rawgrep. If the script is absent (repo bootstrapped before v7.17) or the keyword may live outside table rows (domain headings, prose), fall back togrep -i "<keyword>" CODE_INDEX.md. - If an MCP code-index tool is available (e.g.
mcp__ast-index__*), prefer it over raw grep.
- For each hit, report:
- file:line
- one-line summary of what it does
- whether it can be reused, extended, or is genuinely different
Existing-Plan Reconciliation Mode
Invoked by implement Phase 0.7 when the input is a pre-written plan
(supplied by the engineer) rather than a fresh request. A supplied plan may be
stale — some batches were implemented since it was written. Re-implementing done
work is waste and a drift risk, so reconcile the plan against current code
before the Phase 2.5 gate:
- Run the query above (
search_prior_work) as usual to catch capability duplication. - Per-batch satisfied-check (read-only). For each batch in the supplied
plan, take its
acceptance/verification/ linkedsuccess_criteriaand probe current code for whether it is already satisfied:- grep for the batch's target symbols and
change_manifestpaths (and any public-contract signatures) and read the relevant lines; - where a batch has a runnable, non-mutating
verification, note whether it already passes. Never mutate state to find out. - Classify each batch:
already-satisfied|partially-done|not-started, each withfile:lineevidence.
- grep for the batch's target symbols and
- Emit a reconciliation table (batch id → classification → evidence). The
orchestrator then, before Phase 2.5: marks
already-satisfiedbatches complete/skipped in the JSON sidecar and ticks them intasks/todo.mdwith a one-line note naming what was pruned; surfacespartially-donebatches for the engineer to re-scope. Never silently re-run a done batch, and never edit source here — this mode only classifies and reports.
Output
### Prior Work Check
- match: src/Auth/TokenService.cs:42 — already issues JWTs. **Reuse, do not
reimplement.** Spec should be revised to extend, not create.
- (no other matches; synonyms tried: "token", "jwt", "bearer")Verdict
- An existing implementation the spec would duplicate →
BLOCKED; revise the spec to reuse or extend it before the gate. - A near match that could be extended →
PROCEED_WITH_CHANGES; the engineer decides, and a deviation is justified in writing. - No match after synonyms →
PASS.
Rules
- A grep miss is not a confirmed absence. If the capability is generic, widen the search with synonyms before declaring
PASS. - Read-only: it reports, the caller decides.
Verification
- The query ran with output captured, and at least one synonym was tried
- In reconciliation mode, every supplied batch is classified with
file:lineevidence - Verdict matches the strongest match found
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

