layer-new

Create a new layer under the project's docs/layers/ tree following the functional layer architecture (principle 28). A layer represents a bounded concern (e.g., security, data, UI, infrastructure, domain) and holds that concern's constraints, decisions, pitfalls, patterns, and feature narrative. Operation follows the kb-skeleton structure and is idempotent—existing layers are not overwritten. Intended uses: creating a new layer, adding a security layer, starting to track a concern separately, invoking /layer-new, or adding a bounded concern. Do not use this to author single feature narratives inside an existing layer; use /feature-new for that.

Last repository push
GitHub Stars
218
Forks
33
Issues / PRs
5

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "layer-new" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-0406238efbc3b32f10ee5212454ec6b90585e406f679cc006434a422fa5e5d8f. Verify the upstream source and version against https://github.com/AnastasiyaW/codex-claude-code-config before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Create a new layer under the project's docs/layers/ tree following the functional layer architecture (principle 28). A layer represents a bounded concern (e.g., security, data, UI, infrastructure, domain) and holds that concern's constraints, decisions, pitfalls, patterns, and feature narrative. Operation follows the kb-skeleton structure and is idempotent—existing layers are not overwritten. Intended uses: creating a new layer, adding a security layer, starting to track a concern separately, invoking /layer-new, or adding a bounded concern. Do not use this to author single feature narratives inside an existing layer; use /feature-new for that.

0 Downloads

Introduction source: third_party · AnastasiyaW · 0.0.1 Reference

SkillPi interpretation

Tasks
Creates `docs/layers/<layer-name>/` with the full template structure defined by principle 28.
Audience
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
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: layer-new
description: >
  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).
user-invocable: true
model: sonnet

/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 (src is not a layer)
  • The "layer" is actually one feature in disguise -- use /feature-new inside 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:

  1. Is it a git repository? Run git rev-parse --show-toplevel. If not, ask the user whether to initialize one (offer git init + private GitHub repo per global rule).
  2. Does docs/ exist? If not, create it.
  3. Does docs/layers/README.md exist? If not, copy from <claude-code-skills-checkout>/templates/kb-skeleton/docs/layers/README.md.
  4. 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-code-skills-checkout>/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.md

Step 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 --purpose argument value, or prompt the user
  • ## Governing principles list -> populate from --principles arg, 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 index table: | <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 place

Blueprints (files this skill writes from)

  • templates/kb-skeleton/docs/layers/_LAYER-TEMPLATE/ -- the source tree to copy
  • 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-name then realizes they wanted right-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 the docs/ root (not under docs/layers/), refuse and ask the user which they want -- there is no automatic merge.
  • Templates may have moved. If the template path <claude-code-skills-checkout>/templates/kb-skeleton/docs/layers/_LAYER-TEMPLATE/ does not exist (e.g. user is on a different machine), fall back to reading from https://github.com/AnastasiyaW/claude-code-config/tree/main/templates/kb-skeleton/docs/layers/_LAYER-TEMPLATE via gh api.
  • Encoding boundary. When writing files with Cyrillic content, follow the global rule from ~/.claude/rules/api-utf8-posting.md -- always specify encoding="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/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).

Version history

  1. v2026.10.24 GitHub ↗
    Original release notes

    Three ideas from this month's agent-harness news, adopted as checks rather than prompts. ## New - **Output legibility** — [`docs/output-legibility.md`](https://github.com/AnastasiyaW/codex-claude-code-config/blob/main/docs/output-legibility.md). Karpathy's readability ladder (STE-style text, diagram, HTML, video), plus the two ASD-STE100 rules that need no licensed dictionary: one concept keeps one term, and sentences stay short. - **`scripts/term_drift_check.py`** — checks agent output against a project glossary. It flags synonyms of your terms (`stem*` covers inflection, so it works in Russian too) and overlong sentences, and skips code, URLs and HTML comments. Exit `0` clean, `1` findings, `2` not checked. It ships with a self-test whose must-fail controls catch six deliberate breaks of the logic. - **Bounded harness-improvement pilot** — [`docs/harness-improvement-pilot.md`](https://github.com/AnastasiyaW/codex-claude-code-config/blob/main/docs/harness-improvement-pilot.md). The method behind Google Research's Harness², without the auto-patcher: a frozen suite with a held-out case, one change per candidate, strict improvement and no safety regression. - **Dead-code sweep** — a new reference in the `refactoring-safely` skill, after OpenAI's GPT-6 maintenance guide. It covers a read-only audit with production evidence and one small draft PR per removal, and keeps killswitches and safeguards out of scope. ## Changed - `rules/quality-code.md`: when you change code, update or delete the comment next to it in the same commit. Research suggests a wrong or stale comment misleads a model more than a missing one. - `CLAUDE.md`: new Harness² and Output Legibility sections. Full changelog: [`UPDATES.md`](https://github.com/AnastasiyaW/codex-claude-code-config/blob/main/UPDATES.md) · PRs #18, #19

Current listing version

0.0.1

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value85/100

Highlights

  • 针对项目架构中的功能层搭建,解决长期项目中的关注点分离与文档化需求
  • 受众明确(开发者与架构师),实用性强,属于通用工具场景
Trigger Precision95/100

Highlights

  • 触发词覆盖多种变体(如“创建新层”、“添加安全层”等),边界清晰
  • 明确区分 layer-new 与 feature-new 的使用场景,避免误用
Structure and Standards95/100

Highlights

  • Phase 步骤清晰(Step 1-7),有出口条件和端到端示例
  • frontmatter 完整,参数说明详细,单文件结构规范
Execution Reliability90/100

Highlights

  • 工具来源明确(kb-skeleton 模板),参数正确
  • 覆盖主要异常(模板路径不存在、层名冲突),幂等操作有确认机制
Evidence Verifiability (mean of the first four)91/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

Domains or addresses referenced in the document

These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.

  • github.com

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.