Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add BlackBeltTechnology/pi-agent-dashboard --skill reverse-spec-for-rebuildgit clone --depth 1 https://github.com/BlackBeltTechnology/pi-agent-dashboardWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/blackbelttechnology/pi-agent-dashboard/reverse-spec-for-rebuild)<a href="https://agentmods.dev/skills/blackbelttechnology/pi-agent-dashboard/reverse-spec-for-rebuild"><img src="https://agentmods.dev/badge/skills/blackbelttechnology/pi-agent-dashboard/reverse-spec-for-rebuild/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/blackbelttechnology/pi-agent-dashboard/reverse-spec-for-rebuild"><img src="https://agentmods.dev/badge/skills/blackbelttechnology/pi-agent-dashboard/reverse-spec-for-rebuild.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00091 | $0.06762 |
| Opus 5.5 | $0.00036 | $0.02705 |
| Sonnet 5.5 | $0.00018 | $0.01352 |
| Haiku 4.5 | $0.00009 | $0.00676 |
Grade C, and why
reverse-spec-for-rebuild scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Recursive force deletehighDestructive command
rm -rf with a variable or a broad path is one typo away from removing the wrong tree.
trap 'rm -rf "$d"' EXIT How it starts
The opening of the file, as written. The whole thing — 388 lines — stays where its author put it; the contents beside it link to each section on GitHub.
reverse-spec-for-rebuild
Turn existing code into a rebuild package: enough data shapes, business rules, implicit behavior, provenance and known unknowns that a team can rebuild the same business logic and use cases without the original source. Works in any git repository; a kb tree and the OpenSpec CLI are optional accelerators.
Not the same as a kb-oriented behavioral spec generator: those strip line numbers and rule catalogs on purpose. This skill keeps them, so its output never goes under a kb-indexed root.
Methodology (provenance citations, confidence levels, state/edge/error
checklists, entry-point completeness) adapted and rewritten from greenfield
(Apache-2.0); see the package NOTICE.
When to use
- A system will be rewritten (new stack, new team, vendor exit) and its business logic must survive.
- You need a catalog of business rules, including the implicit ones that live in defaults, exception handlers and ordering.
- You need to know what is NOT known about a system (registered gaps).
Skip for a single trivial file, or when you only want searchable docs.
Inputs
- Target directory (default: repository root) and an optional single capability.
- Optional previous rebuild package (for stable identifiers on re-run).
- Optional protected roots override (default
openspec docs packages .pi).
Procedure
G below is node <this skill dir>/scripts/guard.mjs (the deterministic guards in
scripts/guard.mjs: check-dest, sweep, lint-spec, lint-cite), run from the
repository root. PKG is .reverse-spec-scratch/<target-slug>/rebuild/
(<target-slug> = output of G slug <target>: root for the repository root,
else a kebab-case form of the canonical repo-relative path plus a short hash —
never ./.., never shared by two targets; it exits 2 for a target outside
the repository. Never derive the slug by hand).
- Scratch must be ignored.
git check-ignore -q .reverse-spec-scratch/(keep the trailing slash: adir/ignore pattern does not match a not-yet-existing path without it). If it is not ignored,ask_userbefore writing anything: on consent append.reverse-spec-scratch/to.git/info/exclude(never to a committed ignore file); on refusal stop. - Run id + sweep leftovers. Set
RUN_ID=$(G new-run)(UTC timestamp plus random suffix, so concurrent runs never share it); every transient validation id of this run is_rsfr-val-$RUN_ID-<cap>. RunG sweep— it removes only abandonedopenspec/specs/_rsfr-val-*dirs (owner process gone, or no owner marker and untouched for 10 minutes); a concurrent run's live dirs and other skills' transient dirs are untouched. - Resolve the target. Confirm the path exists; record
git rev-parse HEADforPKG/README.md. In this order: 0. Lock the target.SLUG=$(G slug <target>), thenG lock "$SLUG" "$RUN_ID". Exit 1 = another run holds this target (never share aPKG):ask_userwhether that run is still active. Only when the user confirms it is dead, run theG break-lock "$SLUG" <owner>command the error names, thenG lockagain (acquisition is exclusive, so a racing run cannot also win). Locks never expire on their own, so a long step never loses ownership. Release withG unlock "$SLUG" "$RUN_ID"at step 14, and whenever the run stops early.- Snapshot first. When a previous package is supplied (possibly
PKGitself), copy itsrules.md,quirks.md,gaps.md,README.mdand_ids.json(when present) into.reverse-spec-scratch/<target-slug>/previous-$RUN_ID/, thenchmod -R a-wit. This frozen snapshot is the ONLY "previous package" every merge of this run reads — neverPKG, which each merge rewrites. - Then move aside. If a package still sits at
PKG, move it toPKG.prev-$RUN_ID. Create an emptyPKG. - Seed the id high-water marks. With a previous package:
G seed-ids PKG/_ids.json <snapshot dir>; without one:G seed-ids PKG/_ids.json PKG(creates an all-zero file)._ids.jsonholds the highestBR/QUIRK/GAPnumber ever allocated, including ids the previous package already retired.
- Snapshot first. When a previous package is supplied (possibly
- Discover. One subagent with
prompts/discovery.md(KB_AVAILABLE=kbtooling orAGENTS.mdfiles present). It returns a capability manifest. Save it asPKG/_manifest.jsonand runG check-manifest PKG/_manifest.json; on exit 2 (an unsafe or duplicate capability name) re-run discovery or rename/merge the entries by hand, then re-check — names become file paths and validation ids, target code is untrusted, and two capabilities with one name would overwrite each other's outputs. Checkunassigned_filesis empty; otherwise add them to a capability or ask the subagent to re-cluster. For a single-capability target you may write the manifest by hand. - Generate in parallel. One subagent per capability, all in a SINGLE
message, with
prompts/generator-rebuild.md. Each writes its unmerged spec (local{r1}refs) toPKG/_fragments/<cap>.spec.md(SPEC OUTPUT) and its fragment toPKG/_fragments/<cap>.json, nothing else. - Merge (this session — design D4; fall back to a consolidator subagent
only if the fragments exceed context):
Catalog boundary: a rule is anything that decides a caller-visible outcome
from domain data or failure class, including HTTP/WS/CLI error maps (which
failure class yields which status, code, reply or non-success exit) and
fallback handlers that hide or substitute details. Plumbing is a numbering or
formatting choice that encodes no decision (one non-success exit status for
every failure, output formatting, id formats, subscribe/unsubscribe
mechanics); plumbing belongs in the spec, not in the rule catalog.
Keep a rule that falls under this boundary in
rules.md; never drop an error map or fallback rule as plumbing. Keep rule statements verbatim: never rewrite config key names (the generator names the literal external key). 0. Citation check first, on every merge (initial and every re-merge from a revise, completeness or cross-cutting loop):G lint-cite PKG/_fragments/*.json PKG/_fragments/*.spec.md. Exit 1 lists everyconfirmedcite with more than one location and every unterminated cite. For each finding this session may only LOWER the confidence toinferred— the item in<cap>.jsonand the matching cite comment in<cap>.spec.mdtogether, mechanically (the one exception to step 5's rule that only generators write fragments). Narrowing a cite to one location is the generator's job: route it asFINDINGS. Re-run until exit 0; never merge while it fails.- Load
rules.md/quirks.md/gaps.mdfrom the frozenprevious-$RUN_ID/snapshot (step 3) when one exists — on every merge of the run, so ids the previous package retired stay retired even after this run rewritesPKG. - Walk fragments in manifest order. For each rule/quirk/gap, match it BY
MEANING against items already merged in this run (dedupe; add the
capability to the existing item), then against the frozen snapshot
(reuse its id), then against the catalogs of this run's previous merge
(reuse its id). Otherwise allocate with
G next-id PKG/_ids.json <BR|QUIRK|GAP>— never compute an id by hand. The mark only grows, so an id retired by the previous package or by an earlier revision of this run is never reused._ids.jsonships with the package so the next run inherits it. - Render EVERY capability's
PKG/capabilities/<cap>/spec.mdfrom its unmergedPKG/_fragments/<cap>.spec.md, replacing each{r1}/{q1}/{g1}with its global id — on every merge, for all capabilities, so a re-merge that shifts ids cannot leave a stale reference in an unrevised spec. No{...}local reference may remain. Never edit the rendered spec by hand. - A merged item's confidence is the LOWEST of its sources; never raise it.
A merged item's cite is the union of its sources' locations; a union of
more than one location caps its confidence at
inferred. When a fragment rule spans several catalog rules, map its local id to the closest one and list the others in the spec text, rather than narrowing the claim. - Merge entities by name into
model.md; renderrules.md,quirks.md,gaps.md, usingreferences/package-templates.md. Keep a JSON origin mapitem id -> capabilityfor the cross-cutting audit. - At the end of EVERY merge, before step 7:
G lint-cite PKG/rules.md PKG/model.md PKG/quirks.md PKG/gaps.md PKG/capabilities/*/spec.md. A finding only in merged output is a merge error: re-run the merge applying rule 4 (never hand-edit a catalog). No audit runs while it fails.
- Load
- Audit in parallel. One subagent per capability in a SINGLE message,
prompts/auditor-rebuild.md,MODE=capability. - Revise loop. For each
verdict: revise, re-run its generator with the audit JSON asFINDINGS, then go back to step 6 (every revision re-merges), and re-audit every capability that was regenerated, whose rendered spec changed, or that is listed under (or contributed) a catalog item — rule, quirk, gap or entity field — whose statement, class, citation, confidence or id changed in that merge. Diff the previous merge's catalog files against the new ones to find those items. Stop after 3 rounds for a capability that still fails: report it as not promotable. - Format gate. For every spec:
G lint-spec PKG/capabilities/<cap>/spec.md(exit 1 listsfile:line: reason). Additionally, only when the OpenSpec CLI is on PATH ANDopenspec/exists, validate each spec through a transient id that is deleted in the same iteration. Run this block once per capability (it is a subshell, safe to repeat in one shell) with shell variablesPKG(package dir),CAP,RUN_IDandGset; it refuses (exit 2) aCAPorRUN_IDthat is not a single safe path component before touching any path; its exit status is the validation result, and it records its own pid in.ownerso a concurrent sweep leaves it alone while it runs:
A failing spec is regenerated with the failures as( $G check-cap "$CAP" && $G check-run "$RUN_ID" || exit 2 id="_rsfr-val-$RUN_ID-$CAP"; d="openspec/specs/$id" trap 'rm -rf "$d"' EXIT mkdir -p "$d" && sh -c 'echo $PPID' > "$d/.owner" && cp "$PKG/capabilities/$CAP/spec.md" "$d/spec.md" && openspec validate "$id" --type spec )FINDINGS(back to step 5 for that capability, then 6-9). It is never promotable while failing. - Completeness gate. One subagent with
prompts/completeness.mdwritesPKG/completeness.md, thenG lint-cite PKG/completeness.mdbefore the cross-cutting audit (a finding re-runs completeness). Any unmapped entry point = FAIL: re-run the suggested capability's generator with the unmapped list as FINDINGS — it either specs the entry point or records it as a gap (and an entry point) in its fragment. Never editrules.md/quirks.md/gaps.mdor a rendered spec directly: every merge re-renders them from fragments, so a direct edit is lost. Then loop back through steps 6-10. A package that fails is not promotable. Allow at most 3 rounds of this loop; if entry points are still unmapped, report the package as not promotable, runG unlock "$SLUG" "$RUN_ID"and stop. - Cross-cutting audit. One subagent with
prompts/auditor-rebuild.md,MODE=cross-cutting,ORIGINS= the origin map. Route each failing item to the capability in itsorigin, regenerate it with the finding, and loop back through steps 6-11. Allow at most 3 rounds of this loop; if a cross-cutting finding persists, report the package as not promotable, runG unlock "$SLUG" "$RUN_ID"and stop. - Sweep again.
G sweep --run "$RUN_ID"thenG sweep; confirmgit status --porcelainshows nothing new outside.reverse-spec-scratch/(a change elsewhere means a subagent wrote outside its outputs — investigate before going on). - Gate summary. Write
PKG/README.md(template inreferences/package-templates.md, with the commit SHA) and report per capability: audit verdict, format gate (lint-spec, plusopenspec validatewhen it ran), citation check (lint-citeon fragments, catalogs andcompleteness.md), rule counts (explicit/implicit), quirks, gaps, and the completeness verdict. - Promote on confirm. Offer promotion only when every capability passed
audit and format gate, completeness is PASS and the citation check
(
G lint-cite) is clean.ask_userfor a destination; runG check-dest <dest>(add--protect <dir>per root when the user overrides the protected roots). Exit 1 = inside a protected root: say so and ask for another destination. On exit 0 MOVE (not copy)PKGto the destination. Never promote without explicit confirmation. FinallyG unlock "$SLUG" "$RUN_ID"(also when the user declines promotion).
What ships with it
60 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
- eval/answer-key.json 12 KB
- eval/answer-key.json.AGENTS.md 404 B
- eval/fixture/package.json 264 B
- eval/fixture/src/cli.ts 988 B runs code
- eval/fixture/src/config.ts 613 B runs code
- eval/fixture/src/errors.ts 569 B runs code
- eval/fixture/src/events.ts 560 B runs code
- eval/fixture/src/http.ts 1.4 KB runs code
- eval/fixture/src/index.ts 142 B runs code
- eval/fixture/src/model.ts 1.0 KB runs code
- eval/fixture/src/orders.ts 2.5 KB runs code
- eval/fixture/src/pricing.ts 1.2 KB runs code
- eval/fixture/src/tools.ts 446 B runs code
- eval/score.md 14 KB
- eval/score.md.AGENTS.md 533 B
- prompts/auditor-rebuild.md 5.8 KB
- prompts/completeness.md 3.2 KB
- prompts/crud-classifier.md 2.6 KB
- prompts/discovery.md 2.9 KB
- prompts/generator-rebuild.md 10 KB
- prompts/sequence-generator.md 3.1 KB
- prompts/state-machine-generator.md 2.8 KB
- prompts/uc-linker.md 2.5 KB
- prompts/ui-screen-generator.md 2.7 KB
- prompts/usage-mapper.md 2.6 KB
- prompts/variability-classifier.md 3.0 KB
- references/behavior-checklists.md 2.9 KB
- references/behavior-checklists.md.AGENTS.md 292 B
- references/package-templates.md 7.0 KB
- references/package-templates.md.AGENTS.md 422 B
- references/provenance.md 4.1 KB
- references/provenance.md.AGENTS.md 446 B
- references/ui-extraction.md 8.8 KB
- references/ui-extraction.md.AGENTS.md 686 B
- references/ui-model.md 3.8 KB
- references/ui-model.md.AGENTS.md 393 B
- scripts/guard.mjs 25 KB runs code
- scripts/guard.mjs.AGENTS.md 2.3 KB
- scripts/ui-extract/adapters/angularjs.mjs 4.5 KB runs code
- scripts/ui-extract/adapters/angularjs.mjs.AGENTS.md 479 B
- scripts/ui-extract/compare.mjs 1.0 KB runs code
- scripts/ui-extract/compare.mjs.AGENTS.md 206 B
- scripts/ui-extract/config-reads.mjs 2.6 KB runs code
- scripts/ui-extract/config-reads.mjs.AGENTS.md 340 B
- scripts/ui-extract/config.mjs 1.0 KB runs code
- scripts/ui-extract/config.mjs.AGENTS.md 527 B
- scripts/ui-extract/fill.mjs 774 B runs code
- scripts/ui-extract/fill.mjs.AGENTS.md 233 B
- scripts/ui-extract/flow.mjs 7.0 KB runs code
- scripts/ui-extract/flow.mjs.AGENTS.md 433 B
- scripts/ui-extract/forms.mjs 4.3 KB runs code
- scripts/ui-extract/forms.mjs.AGENTS.md 401 B
- scripts/ui-extract/gate.mjs 6.1 KB runs code
- scripts/ui-extract/gate.mjs.AGENTS.md 425 B
- scripts/ui-extract/inventory.mjs 2.0 KB runs code
- scripts/ui-extract/inventory.mjs.AGENTS.md 288 B
- scripts/ui-extract/js-literal.mjs 4.0 KB runs code
- scripts/ui-extract/js-literal.mjs.AGENTS.md 334 B
- scripts/ui-extract/lib-html.mjs 2.3 KB runs code
- scripts/ui-extract/lib-html.mjs.AGENTS.md 302 B
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 5d ago Changed · +79 lines 28270e60e063
- 9d ago Changed · +4 lines 934266d37f50
- 11d ago Changed · +33 lines b3fa82f7b27c
- 12d ago First seen · 272 lines · 91 tokens per session scan C b98a3fe55baa
reverse-spec-for-rebuild is a skill published in the GitHub repository BlackBeltTechnology/pi-agent-dashboard (319 stars, last pushed yesterday), licensed MIT. It adds 91 tokens to every session and 6,762 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-04.
Other skills, from other repositories
goga-cookbook
Principles for applying DSL specification in cell and CODEMANIFEST design.
goga-plan-by-design
Compile a design document into a ralphex execution plan.
goga-review-plan
Verify execution plan completeness and correctness.
goga-define-challenge
Challenge the complete product definition before the PRD is generated.
goga-define-project
Understand the current project before defining a product change that must fit into an existing product.
goga-define-requirements
Define the product requirements that describe what the product must do to deliver the established user experience and achieve the agreed product goals.