normalize-skill-for-claude
Non-negotiable rules:
- Read
references/claude-skill-runtime.mdbefore planning or rewriting. - Default to
--mode planunless the user explicitly asks to rewrite now. - Treat frontmatter as the highest-leverage surface. Claude routes and budgets skills from metadata first.
- Keep
SKILL.mdfocused on workflow. Move bulky examples, framework variants, and edge-case catalogs intoreferences/orscripts/. - Do not add
context: fork,paths:, oruser-invocable: falsewithout a concrete runtime reason. - Never add agent-only frontmatter to a skill.
tools,disallowedTools,skills,initialPrompt,permissionMode,maxTurns,background,memory,isolation,color, andmcpServersbelong to agents, not skills.
Normalize Skill For Claude
Inputs
$target: Skill directory or direct path toSKILL.md$mode: Optional.planorrewrite. 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.mdpath. - Normalize to the skill root and confirm
SKILL.mdexists. - Determine mode:
--mode rewritemeans 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/, orassets/already exist - whether the skill appears internal-only or user-invocable
- line count of
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: forkruns the skill in a forked subagent and should be rare.allowed-toolsshould 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
descriptionsay what the skill does, when to use it, and example trigger phrases? - Is
when_to_usemissing or weak?
- Does
- Frontmatter completeness
- Would
allowed-tools,arguments,argument-hint,user-invocable,paths,context, oragentimprove runtime behavior? - Are there any agent-only headers that must be removed or explicitly avoided?
- Would
- 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-INLINEorEXTRACT-WITH-MANDATORY-LOAD.
- Invocation type
- Is this a public slash command, an internal router, or a conditional path-scoped helper?
- Execution model
- Would
context: forkhelp, or would it fragment work and require mid-flow user interaction?
- Would
- Determinism opportunities
- Are there repeated shell snippets or fragile transformations that belong in
scripts/?
- Are there repeated shell snippets or fragile transformations that belong in
Classify each issue:
ROUTING: metadata is too weak for auto-invocationPROMPT: body is too large or redundantSAFETY: tool scope or execution mode is too broadSTRUCTURE: 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
- each finding mapped to source references from
- 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:
idtitlerationalefilesToModifyfilesToCreatedependenciesvalidation
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.mdlean enough that future edits remain easy.
Preferred rewrite outcomes:
descriptionandwhen_to_usebecome trigger-oriented- internal router skills become
user-invocable: false - domain skills gain
paths:only when file-touch activation clearly helps context: forkappears 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 fromSKILL.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 rootMode:planorrewriteTop runtime issues:the highest-value Claude mismatchesArtifacts:exact plan or rewritten file pathsGuardrails 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