clayers-onboard
Systematically onboard this project to clayers specifications. Analyzes the entire codebase, creates structured specs with prose/terminology/relations/LLM descriptions, maps all code with artifact tra
SKILL.md.claude/skills/clayers-onboard/SKILL.md
GitHubClayers Onboard
Systematically create a complete clayers specification for main.
The goal: every meaningful code construct is described in the spec, mapped via artifact traceability, and verified clean by the tooling.
Prerequisites
- clayers is installed: run
clayers --version - Project is adopted:
.clayers/schemas/exists andclayers/main/index.xmlexists. If not, runclayers adopt .
Mode Selection
- Fresh onboarding (default): start from the discovery phase
- Resume (
--resume): check which acceptance criteria already pass and continue from the first incomplete mode - Catch-up (
--catch-up): querylyr:mode[@name="catch-up"]instead of onboard modes to fill gaps in an existing spec
Phase 1: Codebase Discovery
Before executing layer modes, build a mental model:
- Scan the project tree: identify source directories, languages, build system
- Catalog modules: for each directory/package, note its purpose
- Extract domain concepts: identify domain terms from type names, function names, constants, comments (feeds into terminology layer)
- Map dependencies: what depends on what (feeds into relation layer)
This mental model guides the layer mode execution that follows.
Phase 2: Layer Mode Discovery
Query the project spec for layers with onboard modes:
clayers query '//lyr:layer' clayers/main/
clayers query '//lyr:mode[@name="onboard"]' clayers/main/
Each lyr:layer describes a layer. Each lyr:mode[@name="onboard"] inside
declares how to onboard that layer, including:
lyr:requires: prerequisite layerslyr:condition: when this mode applieslyr:acceptance: success criteriapr:sectionbody: step-by-step guidance
Phase 3: Topological Execution
Build a dependency graph from lyr:requires elements and execute modes
in topological order:
- For each mode in order:
- Check
lyr:conditionagainst the project state. Skip if it doesn't apply. - Read the mode body (the
pr:sectioninside contains the guidance). - Follow any
pr:xref ref="tpl-*"links to templates intemplates.xmlfor XML boilerplate. - Execute the guidance: create spec elements as instructed.
- Validate:
clayers validate clayers/main/ - Check
lyr:acceptancecriteria.
- Check
- If acceptance criteria fail: re-read the mode guidance and fix gaps before moving on.
Phase 4: Quality Iteration
After all modes execute, run the full quality suite:
clayers artifact --coverage clayers/main/
clayers connectivity clayers/main/
clayers artifact --drift clayers/main/
clayers validate clayers/main/
Targets:
- Coverage: zero unmapped nodes
- Connectivity: zero isolated nodes
- Drift: zero drifted mappings
- Validation: no structural errors
For any metric that fails, re-execute the relevant layer's catch-up or review mode. Iterate until all metrics are clean.
Reading Mode Guidance
To read a specific mode's guidance:
clayers query '//lyr:mode[@id="mode-trm-onboard"]' clayers/main/
The mode body contains a pr:section with detailed step-by-step guidance,
template references, and anti-patterns. Follow it precisely.
Catch-Up Mode
When invoked with --catch-up, query for catch-up modes instead:
clayers query '//lyr:mode[@name="catch-up"]' clayers/main/
Execute the same phases 2-4, using catch-up modes instead of onboard modes. Catch-up modes typically focus on gap analysis and targeted fixes rather than full layer construction.