lehre-decompose
Use on a blank page, after lehre-preflight reports greenfield, to turn a stated project intent into build units, the seams between them, and an enforced build order. Trigger on 'start this project properly', 'initialize this repo', 'break this down into pieces and connect them', 'what should I build first', or 'lehre decompose'. Produces units whose order is denied at the tool-call layer, not a plan anyone can skip.
- License 许可
- MIT
- 最近更新
- 2026-11-02
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- lehre-decompose
- description
- Use on a blank page, after lehre-preflight reports greenfield, to turn a stated project intent into build units, the seams between them, and an enforced build order. Trigger on 'start this project properly', 'initialize this repo', 'break this down into pieces and connect them', 'what should I build first', or 'lehre decompose'. Produces units whose order is denied at the tool-call layer, not a plan anyone can skip.
03 SKILL.md 正文
Turn "I want to build X" into units, seams, and an order that is enforced. A dependency-ordered plan nobody is held to is the looseness this plugin exists to remove.
Steps
-
Refuse to guess the intent. If the user has not said what the project is for, ask once — what it does, who calls it, what it must not do. Do not invent a domain from the repository name. Record their answer verbatim; it becomes the
intent-derivedprovenance for every rulelehre-codifywrites next. -
Dispatch
spec-decomposer, one concern per dispatch, in parallel. Give each dispatch exactly one concern from the stated intent. Each returns candidate units with the paths they own and what they must not know about. Dispatching one agent over the whole intent produces a flat list with invented seams; the parallelism is what keeps the concerns independent. -
Derive the seams, not just the pieces. For every pair of units that must interact, name the seam: what crosses it, in which direction, and which side owns the type. A unit list with no seams is a folder layout, not an architecture — and it is the seams that become
python-importrules. -
Order by seam direction, then declare it. A unit depends on every unit whose seam it consumes. Contracts before the things written against them; transport last, so it cannot shape the domain. Reject any ordering that needs a cycle —
lehre_corerefuses a cyclic graph at validation time anyway, and catching it here is cheaper than catching it at the first denial. If no acyclic ordering exists, return to step 3 and re-derive the seams — a cycle usually means a seam was drawn in the wrong direction or two units were split along the wrong boundary; if re-deriving still cannot break the cycle, surface the conflicting units and their seams to the user instead of forcing an order. -
Dispatch
decomposition-criticover the whole candidate unit set, with the user's intent quoted verbatim. It hunts fordepends_onedges no seam supports,ownsandmust_not_knowclaims the intent does not back, invented technologies,utils-style buckets, and overlappingpaths. Revise or drop what it refutes, and re-dispatch it over the revised set; do not argue with it on the strength of your own derivation. These units are about to gate real writes, and nothing after this step checks them. If the dispatch errors or is unreachable, stop and report — do not write the units unreviewed. -
Write the units into
.lehre/ruleset.json. If the file does not exist, create it with"rules": []—lehre-codifyfills those in. Record the user's intent verbatim in the top-levelintentfield, and each unit'sownsandmust_not_knowalongside itspathsanddepends_on. These are persisted rather than remembered becauselehre-validatedispatchesspec-fidelity-auditoragainst them in a later session, and a recollection of what the user asked for is not evidence. Then:python3 -B "${CLAUDE_PLUGIN_ROOT}/scripts/lehre_cli.py" validateIf validation fails, fix the units; never leave an invalid ruleset on disk, because the hook fails closed and will deny every write until it parses.
-
Show the user what is now enforced, and say plainly that writing into a later unit will be refused until the earlier one passes
lehre-validate. This is the moment to surface it, not the moment of the first denial.
Output format
intent (verbatim, becomes rule provenance)
"A CLI that ingests CSV exports from three vendors, normalises them to one
schema, and writes Parquet. Must never mutate the input files."
reviewed by decomposition-critic: 5 units, 1 edge dropped (writer -> adapters: no seam
carries anything between them), 1 bucket unit (helpers) refused
units and seams
1 contracts src/contracts/* depends on: —
owns the normalised row schema and the VendorAdapter protocol
seam -> adapters, domain (types flow out; nothing flows in)
2 adapters src/adapters/* depends on: contracts
owns one module per vendor, each implementing VendorAdapter
seam <- contracts (protocol) -> domain (normalised rows only)
must not know the output format, or that Parquet exists
3 domain src/domain/* depends on: contracts
owns normalisation, validation, the never-mutate-input invariant
must not know which vendor a row came from
4 writer src/writer/* depends on: contracts
owns Parquet emission
5 cli src/cli/* depends on: adapters, domain, writer
owns argument parsing, exit codes
built last, so transport concerns cannot leak inward
enforced build order
contracts -> (adapters | domain | writer) -> cli
adapters, domain and writer are independent — they may be built in parallel.
now in force
A write into src/cli/* is DENIED until adapters, domain and writer each pass
lehre-validate. Escape hatch: LEHRE_DISABLE_GUARD=1.
next: lehre-codify — the units exist; the rules that govern them do not yet.
Rules
- Name what each unit must not know. That sentence is what becomes an
enforceable
python-importrule. A unit description with no negative space produces no enforceable rule. - Independent units must be reported as independent. Serialising units that have no seam between them invents a dependency and slows every later build for no reason.
- Never mark a unit done here. Only
lehre-validatewrites a done-marker. - Units may be revised later, but revising a unit whose dependents are already validated invalidates them — say so before doing it.
Resources
references/ruleset-schema.md— the unit fields this skill writes (id,paths,depends_on,owns,must_not_know,reason) and the top-levelintentfield, plus why the done-marker belongs tolehre-validatealone. Read it before writing units.
04 同仓库更多 Skills
toy-check
A skill that checks things in the repository and reports what it finds.
demo-check
Reports which generated files changed since the last generation run. Use when the user asks what drifted. Read-only; never edits a file.
demo-check
Reports which generated files changed since the last generation run. Use when the user asks what drifted. Read-only; never edits a file.
demo-check
Reports which generated files changed since the last generation run. Use when the user asks what drifted. Read-only; never edits a file.
demo-check
Reports which generated files changed since the last generation run. Use when the user asks what drifted. Read-only; never edits a file.
zirkel-verify-assumptions
Checks exactly ONE named assumption against real evidence in at most 3 steps and reports one outcome: confidence raised (>=90), reading changed, or still unresolved. Use to resolve a single load-bearing uncertainty — typically a blocking entry surfaced by zirkel-clarify-scope: "verify this one assumption", "is it actually true that X", "check this before we rely on it". For multiple uncertainties, invoke once per uncertainty — the step budget is never shared.