Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

reorganize-logic

БесплатноЗапускает вложенные скриптыНе проверен

Rebuild a project's DESIGN-CONTRACT layer when docs have rotted past sync: re-derive architecture + structure + interface contracts from code, gate-verified…

vincentjiang06от vincentjiang06826 установок в других каталогах

Об этом скилле

reorganize-logic

Rebuild the design-contract layer of an existing project from the ground up, with the code as the single source of truth. The old contracts are untrusted context — compacted, read, then discarded as a source: the new contracts are re-derived from the code, never copy-pasted from the legacy docs. Output is three fresh artifacts (architecture diagram · structure diagram · explicit interface definitions) plus a review-gated deletion manifest for the stale legacy.

The anchor (read first): a contract is only trustworthy once a runnable check ties it back to the code. So every documented interface is cross-checked against the code's public surface by scripts/verify_contracts.mjs, and the new contracts are written before anything legacy is deleted. A contract the gate can't tie to real code is a hallucination; the gate rejects it. The gate flags everything ambiguous for you to reconcile — it never rubber-stamps — and it never rules on design intent: whether an excluded symbol is really internal is judged by a fresh reader against the code, not by the gate.

When this fires (vs neat — the key boundary)

  • reorganize-logic = deliberate, heavyweight, ground-up REBUILD. Old contracts are untrusted; deleting legacy is a feature. Use when docs have drifted so far that syncing is not worth it.
  • neat = incremental sync at session end; keeps what's right, fixes drift, non-destructive. Route there for "tidy up / sync the docs / 同步一下".

If the docs are mostly right → neat. If you'd rather throw them out and re-derive from code → this skill.

Orchestration (the gate stays portable)

The gate is deterministic node (runs anywhere, CI included). The judged work — derivation, synthesis, faithfulness, exclusion verdicts — runs like this:

  • Fan out the derivation. An Explore subagent maps entry points, then one derivation subagent per module in parallel returns its surface + responsibilities.
  • Derivers and readers are non-fork. Spawn every derivation and fresh-reader subagent as a fresh subagent that starts from only the prompt you give it — not a fork of your context, which inherits the legacy docs and your draft. If the host only offers forking, use a separate claude -p session. The reply says how isolation was achieved (a self-report, not an enforcement).
  • Raise effort, don't pad. If a contract reads shallow, raise effort for the running model rather than padding the prompt; effort names are not equivalent across models.
  • Survive compaction from disk. After a compaction, re-read the on-disk artifacts (_legacy-context.md, the contracts written so far, _exclusion-review.md) AND this skill's Controls — a summary may have evicted a standing constraint.
  • Walk every entry point. The coverage gate and the readers enumerate the surface; they never sample it.

Protocol

Preflight: confirm REBUILD (not sync), resolve scope (whole project | a named module/dir). Then the 6 steps (detail in references/protocol.md):

  1. Compact old contracts → read-only, gitignored docs/contracts/_legacy-context.md headed "CONTEXT ONLY — DO NOT COPY".
  2. Re-derive from the code — read structure + public surface; build a fresh model. Code wins every disagreement. No copying from legacy.
  3. Author docs/contracts/architecture.md — Mermaid architecture diagram + components/responsibilities/data+control flow/boundaries.
  4. Author docs/contracts/structure.md (Mermaid + module map) and docs/contracts/interfaces.md in the strict gate-parseable format (references/contract-format.md).
  5. Gate — node scripts/verify_contracts.mjs <root> [--scope <dir>]. FAIL and FLAG block: fix every FAIL, reconcile every FLAG (open the cited code, fix the contract, re-run). REVIEW lines don't block, but every STRONG_EXPORT_EXCLUDED item goes through the fresh-reader exclusion card before you report. A line clearable only by an untrue statement or by editing code/the gate, one surviving two fix attempts, or a language with no matcher → escalate (protocol step 5).
  6. Emit docs/contracts/deletion-manifest.md — stale legacy to delete/overwrite, one reason each. Never delete anything; the human approves and applies.

Verify (eat the dogfood)

Run the gate on the produced interfaces.md before reporting:

node scripts/verify_contracts.mjs <project-root> [--scope <subdir>]

A PASS with exit 0 is PASS (structural): the gate proves doc-vs-code structure — not prose faithfulness, and not whether an excluded symbol is really internal. Any FAIL [tag] / FLAG [tag] line means the contract is not yet tied to the code — fix and re-run. The final word needs the fresh-reader pass and the exclusion card verdicts (references/protocol.md): non-fork readers check the diagrams, responsibilities and signatures against the code, and adjudicate every `STRONG

Полный SKILL.md на ClawHub

Установить reorganize-logic в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл reorganize-logic?

Rebuild a project's DESIGN-CONTRACT layer when docs have rotted past sync: re-derive architecture + structure + interface contracts from code, gate-verified. Use-when: "rebuild the contracts from scratch", "从代码重新推导契约", "$reorganize-logic". Do-NOT use for doc sync / cleanup (this REBUILDS and deletes legacy) → neat.

Как установить скилл reorganize-logic?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл reorganize-logic запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить reorganize-logic с