reverse-spec-for-rebuild
БесплатноЗапускает вложенные скриптыНе проверенCharacterize existing code into a rebuild package a team can reimplement from without the source: behavior specs, domain model, BR-NNN rules…
от BlackBeltTechnology★ 357 звёзд на 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:- 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.
- Lock the target.
- 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 cap
Установить reverse-spec-for-rebuild в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл reverse-spec-for-rebuild?
Characterize existing code into a rebuild package a team can reimplement from without the source: behavior specs, domain model, BR-NNN rules (explicit/implicit), quirks, gaps, entry-point completeness, each claim cited file:line with confidence. Use on "reverse-engineer this for a rebuild", "extract the business rules", "reimplement X without the original code", "characterize code for a rewrite".
Как установить скилл reverse-spec-for-rebuild?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл reverse-spec-for-rebuild запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic