section-matching
Use when kivo-creator section specs in .creator/<run>/specs must be mapped to the project's existing blocks before anything is generated - building the match plan, applying the compatibility filter, j
SKILL.mdplugins/kivo-creator/skills/section-matching/SKILL.md
GitHubSection matching
Recognise first, generate last. Each section is matched to a block the project already has; a new block is generated only when nothing fits. The plan is written to disk and approved before anything is emitted.
When to use
- After
html-ingestorfigma-ingestproduced valid specs. - "Which of our blocks should this section use?", "map the design to our blocks".
- Not for writing block code (
block-scaffolding-from-design) or checking the rendered page (visual-fidelity).
Inputs required
- The run folder
.creator/<run>/with valid specs. - The project root with
.roots-stack.json, or the kivo-wise detector JSON passed with--stack=<file>. - The kivo-creator plugin root (two levels above this skill's folder).
Procedure
Read the catalog:
node <kivo-creator>/scripts/match.mjs --catalog --project=.(name,type, title, description,whenToUse, fields). It holds every existing block of both types (ACF Composer classes andblock.jsonfiles); a section may fill either. The project's block type only matters for new blocks (blockTypein the plan; see/creator).Build the plan:
node <kivo-creator>/scripts/match.mjs --run=.creator/<run> --project=.. It writesmatch-plan.jsonand prints the sections tojudge. Already decided by the script:- chrome sections:
skip; - a Code Connect mapping (
spec.codeConnect.block):fillwith confidence 1; - no block passes the compatibility filter:
scaffold(orgapwhen the target forbids generated blocks).
- chrome sections:
For each section in
judge, read its spec, its reference image and itscandidates(blocks whose fields can hold every slot, ranked by field coverage). Score each candidate with the rubric, then write the decision intomatch-plan.json:Criterion Question Weight Purpose Do the block's description and whenToUsedescribe this kind of section?Decisive: a block built for another purpose is never a match, even when its fields fit Structure Do the slots and the repeat count fit without dropping content? Unused optional fields are fine High Layout Can the block show the media position and column count (styles, variants)? Medium Cost of a new block Would a new block duplicate one that only needs a style variant or one field? Tie-breaker Always consider
none: when the only candidates serve another purpose (a testimonial fits a hero's fields but is not a hero), choosescaffoldwithblock: null.Decision shape:
{ "action": "fill", "block": "acf/faq", "confidence": 0.85, "reason": "Questions and answers; the questions repeater holds the three items" }Confidence: 0.9 or more when purpose and structure are clear; 0.6 to 0.9 with a caveat written in
reason; below the plan'sthreshold(0.6) set"action": "ask"and ask the person.Ask the person about every
askdecision, listing the candidates andnone. Record the answer as the decision with"approvedBy": "person".Check:
node <kivo-creator>/scripts/match.mjs --run=.creator/<run> --check --project=.. Fix every error it prints and run it again.Show
match-plan.mdand stop. Emitting happens only after the person approves the plan.
Verification
match.mjs --checkexits 0 and printsmatch plan ok.- Every
fillnames a block from the catalog that is among the section's candidates (or was approved by the person). - Every
scaffoldorgaphas a reason a person can accept without opening the files.
Failure modes
| Symptom | Cause | Fix |
|---|---|---|
Every section goes to scaffold |
Catalog empty: blocks live outside the adapter's folder (ACF Composer classes in app/Blocks, block.json files under the app) |
Run --catalog; if blocks are missing, check the profile in .roots-stack.json and the block folder |
A good block is missing from candidates |
A slot type its fields cannot hold (for example an image slot and no image field) | Decide whether the slot matters; dropping it is the person's call, never yours |
did not pass the compatibility filter |
A fill names a block that cannot hold all slots | Pick a candidate, or ask the person and record approvedBy |
confidence ... is below 0.6 |
A low-confidence fill without approval | Ask the person; record approvedBy: "person" |
| Same block chosen for two different purposes | Purpose criterion skipped | Re-score with the rubric; purpose is decisive |
Escalation
Ask the person whenever the decision is below the threshold, when two candidates are equally good, or when the right answer is a new style variant of an existing block instead of a new block.