layer-new
Skill213 starsChanged 2 days agoMITView on GitHub
Scaffold a new layer in a project's docs/layers/ tree following the feature-layer architecture (principle 28). A layer is a bounded concern (security, data, ui, infrastructure, domain) with its own invariants, decisions, gotchas, patterns, and feature narratives. Use when: "create a new layer", "add security layer", "scaffold layer", "start tracking <concern> separately", "/layer-new", "add bounded concern". Operates on the kb-skeleton structure; idempotent -- will not overwrite existing layers. Do NOT use to scaffold an individual feature narrative inside an existing layer; use /feature-new for that (a layer is the container, not the per-feature doc).
We split this skill into the rules it gives an agent
14 rules. About 0 are common, 4 are distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 54
Check the current working directory:
- Very specific: line 62
Check if docs/layers/<layer-name>/ already exists.
- Very specific: line 68
Must be lowercase kebab-case ([a-z][a-z0-9-]*).
- Very specific: line 69
Must not start with _ (reserved for templates).
- Very specific: line 70
Must not be a generic file-system name (src, tests, docs, build).
- Distinctive: line 72
If invalid, refuse with a clear message and a suggested fix.
- Very specific: line 121
Add a row to the ## Layer index table: | <layer-name> | <purpose> | active |
- Distinctive: line 123
If a cross-layer Mermaid graph exists, add a node for the new layer with no edges (user will add edges as dependencies form).
- Very specific: line 128
If the project has feature_list.json at repo root, leave it alone -- features get added by /feature-new.
- Distinctive: line 132
If the project has AGENTS.md, suggest (but do not auto-edit) adding the new layer to the "Source-of-truth docs" table if multiple layers …
- Very specific: line 159
Renaming a layer is not idempotent: If the user runs /layer-new wrong-name then realizes they wanted right-name, manually rename the …
- Very specific: line 163
Layer name collision with existing directories: If docs/<layer-name>/ exists at the docs/ root (not under docs/layers/), refuse and ask the …
- Very specific: line 167
Templates may have moved: If the template path ${CLAUDE_PLUGIN_ROOT}/templates/kb-skeleton/docs/layers/_LAYER-TEMPLATE/ does not exist (e.g.
- Very specific: line 173
Encoding boundary: When writing files with Cyrillic content, follow the global rule from ~/.claude/rules/api-utf8-posting.md -- always …
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
/layer-new -- scaffold a project layer
Creates docs/layers/<layer-name>/ with the full template structure
defined by principle 28.
When to use
- Starting to track a new bounded concern in a long-running project
- Refactoring sprawling cross-cutting code into a documented layer
- Onboarding a new team member who needs the layer map
When NOT to use
- One-off scripts or pet projects with <5 features (overhead not justified)
- Layer name describes a directory (
srcis not a layer) - The "layer" is actually one feature in disguise -- use
/feature-newinside an existing layer instead
Arguments
/layer-new <layer-name> [--purpose "..."] [--principles P-NN,P-MM]<layer-name>-- kebab-case, single word preferred. Examples:security,data,image-processing,observability.--purpose-- one-sentence purpose. If omitted, prompt the user.--principles-- comma-separated Tier 1 principle IDs that govern this layer (e.g.P-02,P-21). If omitted, leave placeholder in README.
Direction (what to do, in order)
Step 1 -- Verify environment
Check the current working directory:
- Is it a git repository? Run
git rev-parse --show-toplevel. If not, ask the user whether to initialize one (offergit init+ private GitHub repo per global rule). - Does
docs/exist? If not, create it. - Does
docs/layers/README.mdexist? If not, copy from${CLAUDE_PLUGIN_ROOT}/templates/kb-skeleton/docs/layers/README.md. - Check if
docs/layers/<layer-name>/already exists. If yes, stop with a message -- do not overwrite. Suggest/feature-new <layer> <slug>instead.
Step 2 -- Validate layer name
- Must be lowercase kebab-case (
[a-z][a-z0-9-]*). - Must not start with
_(reserved for templates). - Must not be a generic file-system name (
src,tests,docs,build). - If invalid, refuse with a clear message and a suggested fix.
Step 3 -- Copy the template
Source: ${CLAUDE_PLUGIN_ROOT}/templates/kb-skeleton/docs/layers/_LAYER-TEMPLATE/
Destination: <repo>/docs/layers/<layer-name>/
Copy the entire directory tree. Preserve subdirectory structure (kb/
and features/). Result:
docs/layers/<layer-name>/
├── README.md
├── history.md
├── kb/
│ ├── invariants.md
│ ├── decisions.md
│ ├── gotchas.md
│ └── patterns.md
└── features/
└── _FEATURE-TEMPLATE.mdStep 4 -- Fill placeholders
In every file under the new layer, replace:
<layer-name>-> the actual layer name<Layer name>-> Title Case of the layer name (e.g. "Security", "Image Processing")
In README.md specifically:
**Purpose:** <one sentence...>-> the--purposeargument value, or prompt the user## Governing principleslist -> populate from--principlesarg, or leave the placeholder bullets in place for the user to fill
In history.md:
- Insert a "Layer created" entry at the top with today's date (YYYY-MM-DD) and the originating reason. Prompt the user for the reason if not provided.
Step 5 -- Register the layer
Update docs/layers/README.md:
- Add a row to the
## Layer indextable:| <layer-name> | <purpose> | active | - If a cross-layer Mermaid graph exists, add a node for the new layer with no edges (user will add edges as dependencies form).
Step 6 -- Wire to project state
If the project has feature_list.json at repo root, leave it alone --
features get added by /feature-new. Do not edit feature_list.json
from this skill.
If the project has AGENTS.md, suggest (but do not auto-edit) adding
the new layer to the "Source-of-truth docs" table if multiple layers
exist.
Step 7 -- Confirm and suggest next step
Print a summary:
Layer created: docs/layers/<layer-name>/
Files: 1 README, 1 history, 4 kb/, 1 feature template
Suggested next steps:
1. Fill governing principles in docs/layers/<layer-name>/README.md
2. Write the first feature: /feature-new <layer-name> <slug>
3. Add the first invariant when it earns its placeBlueprints (files this skill writes from)
${CLAUDE_PLUGIN_ROOT}/templates/kb-skeleton/docs/layers/_LAYER-TEMPLATE/-- the source tree to copy${CLAUDE_PLUGIN_ROOT}/templates/kb-skeleton/docs/layers/README.md-- the layers index template (used only if missing)
Gotchas
- Renaming a layer is not idempotent. If the user runs
/layer-new wrong-namethen realizes they wantedright-name, manually rename the directory and update references. This skill does NOT detect or fix duplicates. - Layer name collision with existing directories. If
docs/<layer-name>/exists at thedocs/root (not underdocs/layers/), refuse and ask the user which they want -- there is no automatic merge. - Templates may have moved. If the template path
${CLAUDE_PLUGIN_ROOT}/templates/kb-skeleton/docs/layers/_LAYER-TEMPLATE/does not exist (e.g. user is on a different machine), fall back to reading fromhttps://github.com/AnastasiyaW/codex-claude-code-config/tree/main/templates/kb-skeleton/docs/layers/_LAYER-TEMPLATEviagh api. - Encoding boundary. When writing files with Cyrillic content,
follow the global rule from
~/.claude/rules/api-utf8-posting.md-- always specifyencoding="utf-8"explicitly.
Troubleshooting
| Symptom | Cause | Fix |
| "Layer already exists" | Directory docs/layers/<name>/ present | Use /feature-new to add to it, or pick a different name |
| Template files missing | Path moved or different machine | Pull templates from public repo via gh api repos/AnastasiyaW/codex-claude-code-config/contents/templates/kb-skeleton/docs/layers/_LAYER-TEMPLATE |
| Layers README not updated | docs/layers/README.md had no ## Layer index table | Open file manually, add table per the kb-skeleton template |
| Validator warns about layer | validate_kb_links.py flagged broken link | Layer is fine; broken link is in a feature doc inside it. Run python scripts/build_kb_graph.py from the project root for the full health report. |
Implementation note
The bulk of the work is file copy + placeholder replacement. No dynamic logic is needed; the template files do all the structural heavy lifting. Keep this skill deterministic and idempotent -- it must be safe to invoke twice on the same layer (second call should be a no-op with a clear message).
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 1
- AnastasiyaW/claude-code-config★ 20997% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository60 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- agent-harness-designSkill
- agents-best-practicesSkill
- diffusion-engineeringSkill
- flux2-klein-promptingSkill
- flux2-lora-trainingSkill
- forensic-prompt-compilerSkill
- ml-research-labSkill
- notebooklm-grounded-researchSkill
- vlm-segmentationSkill
- feature-newSkill
- harness-designSkill
- plan-swarm-reviewSkill
- pixel-art-storyboardSkill
- pixel-art-studioSkill
- architecture-firstSkill
- architecture-qualitySkill
- bug-reproducerSkill
- code-complexitySkill
- control-cliSkill
- control-uiSkill
- deep-reviewSkill
- deslopSkill
- distill-feedbackSkill
- harness-feedbackSkill
- proof-verifySkill
- refactoring-safelySkill
- repo-mapSkill
- root-cause-deliverySkill
- system-and-data-designSkill
- testing-strategySkill
- thermo-nuclear-code-quality-reviewSkill
- verify-thisSkill
- workflow-orchestrationSkill
- frontend-designSkill
- motion-framerSkill
- ui-designSkill
- ui-ux-pro-maxSkill
- ios-developmentSkill
- lean-codeSkill
- cross-harness-continuationSkill
- deepseek-provider-contractSkill
- desktop-sessions-discoverySkill
- epistemic-challengeSkill
- gemini-delegateSkill
- harness-auditSkill
- observability-monitoringSkill
- remote-compute-opsSkill
- plan-to-ticketsSkill
- product-meaning-extractorSkill
- remotion-production-guideSkill
- script-evaluatorSkill
- video-narrative-arcSkill
- video-post-productionSkill
- article-structure-reviewSkill
- cavemanSkill
- humanize-englishSkill
- humanize-russianSkill
- owner-voiceSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

