Non-negotiable rules:
- Read
references/claude-skill-runtime.md before planning or rewriting.
- Default to
--mode plan unless the user explicitly asks to rewrite now.
- Treat frontmatter as the highest-leverage surface. Claude routes and budgets skills from metadata first.
- Keep
SKILL.md focused on workflow. Move bulky examples, framework variants, and edge-case catalogs into references/ or scripts/.
- Do not add
context: fork, paths:, or user-invocable: false without a concrete runtime reason.
- Never add agent-only frontmatter to a skill.
tools, disallowedTools, skills, initialPrompt, permissionMode, maxTurns, background, memory, isolation, color, and mcpServers belong to agents, not skills.
Normalize Skill For Claude
Inputs
$target: Skill directory or direct path to SKILL.md
$mode: Optional. plan or rewrite. Default: plan
Goal
Produce a Claude Code optimized skill that is easier to auto-invoke, cheaper to keep in prompt budget, and safer to execute. Always start by creating a per-skill DAG plan unless the user explicitly asks for direct rewrite.
Step 1: Resolve the target
- Accept either a skill directory or a direct
SKILL.md path.
- Normalize to the skill root and confirm
SKILL.md exists.
- Determine mode:
--mode rewrite means plan first, then rewrite in the same run
- missing mode means
plan
- Inventory the current skill:
- line count of
SKILL.md
- existing frontmatter fields
- whether
references/, scripts/, or assets/ already exist
- whether the skill appears internal-only or user-invocable
Success criteria: You know the exact skill root, target mode, current file shape, and likely scope of the rewrite.
Step 2: Load the Claude Code skill runtime anchors
Read references/claude-skill-runtime.md fully before making any recommendation.
Extract these constraints from the reference:
- Claude budgets skill discovery from frontmatter and short descriptions first.
- Full skill bodies are loaded on invocation, not for listing.
paths: activates conditional skills when matching files are touched.
context: fork runs the skill in a forked subagent and should be rare.
allowed-tools should be the minimum needed permission surface.
- Skill rewrites must use skill-native frontmatter only, not agent-native headers.
If this repository contains claude-code-source/, use the exact source files named in the reference to verify edge cases before rewriting unusual frontmatter.
Success criteria: Every planned change can be tied to a specific Claude runtime behavior.
Step 3: Audit the current skill against Claude's runtime
Evaluate the target skill using this checklist:
- Description and trigger quality
- Does
description say what the skill does, when to use it, and example trigger phrases?
- Is
when_to_use missing or weak?
- Frontmatter completeness
- Would
allowed-tools, arguments, argument-hint, user-invocable, paths, context, or agent improve runtime behavior?
- Are there any agent-only headers that must be removed or explicitly avoided?
- Body size and shape
- Is the body carrying reference material instead of core workflow?
- Are there giant examples, duplicated checklists, or framework-specific sections that belong in
references/?
- Structural content audit: Does the skill contain routing tables (task→reference mappings), personality/expertise definitions, numbered rule sets, or gate classifications? These are high-signal inline content, NOT bulk examples. Tag each as
PRESERVE-INLINE or EXTRACT-WITH-MANDATORY-LOAD.
- Invocation type
- Is this a public slash command, an internal router, or a conditional path-scoped helper?
- Execution model
- Would
context: fork help, or would it fragment work and require mid-flow user interaction?
- Determinism opportunities
- Are there repeated shell snippets or fragile transformations that belong in
scripts/?
Classify each issue:
ROUTING: metadata is too weak for auto-invocation
PROMPT: body is too large or redundant
SAFETY: tool scope or execution mode is too broad
STRUCTURE: references or scripts should be extracted
Success criteria: You have a concrete, source-backed audit of what must change and why.
Step 4: Write the per-skill DAG plan
Create both of these artifacts:
.ulpi/plans/skills/<skill-name>-normalize-for-claude.md
.ulpi/plans/skills/<skill-name>-normalize-for-claude.json
The plan must include:
- Current state
- line count
- existing frontmatter
- current folders
- largest bloat areas
- Claude runtime findings
- each finding mapped to source references from
references/claude-skill-runtime.md
- Target state
- final frontmatter shape
- files to keep, rewrite, create, or split
- DAG tasks
- frontmatter rewrite
- body trim
- reference extraction
- optional script extraction
- validation
- Guardrails
- what must not be changed
- what must not be over-automated
- Validation
- concrete commands or checks to confirm the skill is structurally sound
Each DAG task should include:
id
title
rationale
filesToModify
filesToCreate
dependencies
validation
Success criteria: The markdown and JSON plans describe the same work and can be executed safely.
Step 5: Rewrite only if requested
If mode is plan, stop after writing the DAG artifacts.
If mode is rewrite:
- Rewrite the frontmatter first.
- Keep the body focused on:
- inputs
- goal
- workflow steps
- guardrails
- output contract
- Move bulky material into
references/, but respect content classification:
- Bulk (move to references): giant examples, framework variants, edge-case catalogs, verbose checklists, before/after code samples
- Structural (keep inline OR extract with mandatory load directive): routing tables (task→reference mappings), numbered guardrail rules in EXTREMELY-IMPORTANT, gate classifications (BLOCK/CONCERN/OBSERVATION), personality/expertise sections
- Routing tables that map task types to reference files MUST stay inline — they are the skill's primary navigation surface.
- Concrete guardrail lists (numbered rules, always/never) MUST either stay in the EXTREMELY-IMPORTANT block or get a mandatory load directive in the step that needs them — not a soft "see references" suggestion.
- When extracting personality/expertise to a reference file, add a mandatory load directive at session start, not just a "When To Load References" entry.
- Create
scripts/ only when deterministic repeated logic is clearly justified.
- Keep the resulting
SKILL.md lean enough that future edits remain easy.
Preferred rewrite outcomes:
description and when_to_use become trigger-oriented
- internal router skills become
user-invocable: false
- domain skills gain
paths: only when file-touch activation clearly helps
context: fork appears only for self-contained analysis/research workflows
- no agent-only headers are introduced into the rewritten skill
Success criteria: The rewritten skill is structurally smaller, clearer to route, and justified by Claude runtime behavior.
Step 6: Validate the result
After planning or rewriting:
- Re-read the final
SKILL.md.
- Confirm the body does not duplicate reference files.
- Confirm frontmatter fields are intentionally chosen, not cargo-culted.
- Confirm no agent-only headers were introduced.
- Confirm every
references/ file is directly linked from SKILL.md.
- Confirm no routing tables, numbered guardrail rules, or gate classifications were stripped without replacement.
- Confirm the plan or rewrite summary names the Claude source anchors that drove the major decisions.
Success criteria: The output is usable immediately by a human or follow-on agent without guessing.
Output Contract
Always report:
Skill: target path and normalized root
Mode: plan or rewrite
Top runtime issues: the highest-value Claude mismatches
Artifacts: exact plan or rewritten file paths
Guardrails applied: 3 to 5 bullets tied to Claude runtime behavior
If rewrite mode was used, also report:
- which sections moved to
references/
- which frontmatter fields were added, removed, or intentionally omitted
1---2name: normalize-skill-for-claude3description: Convert a local skill into a Claude Code optimized shape — an AUDIT-then-rewrite that ties every change to real Claude skill-runtime behavior, treating FRONTMATTER as the highest-leverage routing surface. Inventories the skill, checks it against the runtime reference (Claude routes and budgets skills from metadata first), writes a per-skill DAG rewrite plan with source-backed guardrails, and — only when asked — rewrites frontmatter, body, and references for cheaper routing and safer execution. Defaults to PLAN mode, never a blind rewrite, uses skill-native frontmatter only, and preserves structural content (routing tables, guardrail rules) rather than stripping it as bulk. Use to migrate or restructure a SKILL.md for Claude's skill runtime.4---5
6<EXTREMELY-IMPORTANT>
7Every recommendation must be justified by Claude Code runtime behavior, not taste.
8
9Non-negotiable rules:
101. Read `references/claude-skill-runtime.md` before planning or rewriting.
112. Default to `--mode plan` unless the user explicitly asks to rewrite now.
123. Treat frontmatter as the highest-leverage surface. Claude routes and budgets skills from metadata first.
134. Keep `SKILL.md` focused on workflow. Move bulky examples, framework variants, and edge-case catalogs into `references/` or `scripts/`.
145. Do not add `context: fork`, `paths:`, or `user-invocable: false` without a concrete runtime reason.
156. Never add agent-only frontmatter to a skill. `tools`, `disallowedTools`, `skills`, `initialPrompt`, `permissionMode`, `maxTurns`, `background`, `memory`, `isolation`, `color`, and `mcpServers` belong to agents, not skills.
16</EXTREMELY-IMPORTANT>
17
18# Normalize Skill For Claude
19
20## Inputs
21
22- `$target`: Skill directory or direct path to `SKILL.md`
23- `$mode`: Optional. `plan` or `rewrite`. Default: `plan`
24
25## Goal
26
27Produce a Claude Code optimized skill that is easier to auto-invoke, cheaper to keep in prompt budget, and safer to execute. Always start by creating a per-skill DAG plan unless the user explicitly asks for direct rewrite.
28
29## Step 1: Resolve the target
30
311. Accept either a skill directory or a direct `SKILL.md` path.
322. Normalize to the skill root and confirm `SKILL.md` exists.
333. Determine mode:
34 - `--mode rewrite` means plan first, then rewrite in the same run
35 - missing mode means `plan`
364. Inventory the current skill:
37 - line count of `SKILL.md`
38 - existing frontmatter fields
39 - whether `references/`, `scripts/`, or `assets/` already exist
40 - whether the skill appears internal-only or user-invocable
41
42**Success criteria**: You know the exact skill root, target mode, current file shape, and likely scope of the rewrite.
43
44## Step 2: Load the Claude Code skill runtime anchors
45
46Read `references/claude-skill-runtime.md` fully before making any recommendation.
47
48Extract these constraints from the reference:
49- Claude budgets skill discovery from frontmatter and short descriptions first.
50- Full skill bodies are loaded on invocation, not for listing.
51- `paths:` activates conditional skills when matching files are touched.
52- `context: fork` runs the skill in a forked subagent and should be rare.
53- `allowed-tools` should be the minimum needed permission surface.
54- Skill rewrites must use skill-native frontmatter only, not agent-native headers.
55
56If this repository contains `claude-code-source/`, use the exact source files named in the reference to verify edge cases before rewriting unusual frontmatter.
57
58**Success criteria**: Every planned change can be tied to a specific Claude runtime behavior.
59
60## Step 3: Audit the current skill against Claude's runtime
61
62Evaluate the target skill using this checklist:
63
641. **Description and trigger quality**
65 - Does `description` say what the skill does, when to use it, and example trigger phrases?
66 - Is `when_to_use` missing or weak?
672. **Frontmatter completeness**
68 - Would `allowed-tools`, `arguments`, `argument-hint`, `user-invocable`, `paths`, `context`, or `agent` improve runtime behavior?
69 - Are there any agent-only headers that must be removed or explicitly avoided?
703. **Body size and shape**
71 - Is the body carrying reference material instead of core workflow?
72 - Are there giant examples, duplicated checklists, or framework-specific sections that belong in `references/`?
73 - **Structural content audit**: Does the skill contain routing tables (task→reference mappings), personality/expertise definitions, numbered rule sets, or gate classifications? These are high-signal inline content, NOT bulk examples. Tag each as `PRESERVE-INLINE` or `EXTRACT-WITH-MANDATORY-LOAD`.
744. **Invocation type**
75 - Is this a public slash command, an internal router, or a conditional path-scoped helper?
765. **Execution model**
77 - Would `context: fork` help, or would it fragment work and require mid-flow user interaction?
786. **Determinism opportunities**
79 - Are there repeated shell snippets or fragile transformations that belong in `scripts/`?
80
81Classify each issue:
82- `ROUTING`: metadata is too weak for auto-invocation
83- `PROMPT`: body is too large or redundant
84- `SAFETY`: tool scope or execution mode is too broad
85- `STRUCTURE`: references or scripts should be extracted
86
87**Success criteria**: You have a concrete, source-backed audit of what must change and why.
88
89## Step 4: Write the per-skill DAG plan
90
91Create both of these artifacts:
92
93- `.ulpi/plans/skills/<skill-name>-normalize-for-claude.md`
94- `.ulpi/plans/skills/<skill-name>-normalize-for-claude.json`
95
96The plan must include:
97
981. **Current state**
99 - line count
100 - existing frontmatter
101 - current folders
102 - largest bloat areas
1032. **Claude runtime findings**
104 - each finding mapped to source references from `references/claude-skill-runtime.md`
1053. **Target state**
106 - final frontmatter shape
107 - files to keep, rewrite, create, or split
1084. **DAG tasks**
109 - frontmatter rewrite
110 - body trim
111 - reference extraction
112 - optional script extraction
113 - validation
1145. **Guardrails**
115 - what must not be changed
116 - what must not be over-automated
1176. **Validation**
118 - concrete commands or checks to confirm the skill is structurally sound
119
120Each DAG task should include:
121- `id`
122- `title`
123- `rationale`
124- `filesToModify`
125- `filesToCreate`
126- `dependencies`
127- `validation`
128
129**Success criteria**: The markdown and JSON plans describe the same work and can be executed safely.
130
131## Step 5: Rewrite only if requested
132
133If mode is `plan`, stop after writing the DAG artifacts.
134
135If mode is `rewrite`:
136
1371. Rewrite the frontmatter first.
1382. Keep the body focused on:
139 - inputs
140 - goal
141 - workflow steps
142 - guardrails
143 - output contract
1443. Move bulky material into `references/`, but respect content classification:
145 - **Bulk** (move to references): giant examples, framework variants, edge-case catalogs, verbose checklists, before/after code samples
146 - **Structural** (keep inline OR extract with mandatory load directive): routing tables (task→reference mappings), numbered guardrail rules in EXTREMELY-IMPORTANT, gate classifications (BLOCK/CONCERN/OBSERVATION), personality/expertise sections
147 - Routing tables that map task types to reference files MUST stay inline — they are the skill's primary navigation surface.
148 - Concrete guardrail lists (numbered rules, always/never) MUST either stay in the EXTREMELY-IMPORTANT block or get a mandatory load directive in the step that needs them — not a soft "see references" suggestion.
149 - When extracting personality/expertise to a reference file, add a mandatory load directive at session start, not just a "When To Load References" entry.
1504. Create `scripts/` only when deterministic repeated logic is clearly justified.
1515. Keep the resulting `SKILL.md` lean enough that future edits remain easy.
152
153Preferred rewrite outcomes:
154- `description` and `when_to_use` become trigger-oriented
155- internal router skills become `user-invocable: false`
156- domain skills gain `paths:` only when file-touch activation clearly helps
157- `context: fork` appears only for self-contained analysis/research workflows
158- no agent-only headers are introduced into the rewritten skill
159
160**Success criteria**: The rewritten skill is structurally smaller, clearer to route, and justified by Claude runtime behavior.
161
162## Step 6: Validate the result
163
164After planning or rewriting:
165
1661. Re-read the final `SKILL.md`.
1672. Confirm the body does not duplicate reference files.
1683. Confirm frontmatter fields are intentionally chosen, not cargo-culted.
1694. Confirm no agent-only headers were introduced.
1705. Confirm every `references/` file is directly linked from `SKILL.md`.
1716. Confirm no routing tables, numbered guardrail rules, or gate classifications were stripped without replacement.
1727. Confirm the plan or rewrite summary names the Claude source anchors that drove the major decisions.
173
174**Success criteria**: The output is usable immediately by a human or follow-on agent without guessing.
175
176## Output Contract
177
178Always report:
179
1801. `Skill:` target path and normalized root
1812. `Mode:` `plan` or `rewrite`
1823. `Top runtime issues:` the highest-value Claude mismatches
1834. `Artifacts:` exact plan or rewritten file paths
1845. `Guardrails applied:` 3 to 5 bullets tied to Claude runtime behavior
185
186If rewrite mode was used, also report:
187- which sections moved to `references/`
188- which frontmatter fields were added, removed, or intentionally omitted