New skill

From pedrohcgs/claude-code-my-workflow · View interactive version

New skill is an AI agent skill from the GitHub repository pedrohcgs/claude-code-my-workflow. Scaffold a new skill that follows this repo's conventions — interviews for purpose, trigger phrases, and tool needs, then writes `.claude/skills/<name>/SKILL.md` from the skill template with frontmatter and body that pass the integrity gates on first try. Use when user says "write a skill", "scaffol

How to use this skill

Skill file

/new-skill — Author a Convention-Compliant Skill

Scaffold a new skill the way this template's gold-standard skills are written: a deep module behind a simple interface (Ousterhout, A Philosophy of Software Design — "deep modules": a small surface that hides substantial implementation). The user supplies a fuzzy intent; this skill interviews it into a tight spec, then writes .claude/skills/<name>/SKILL.md with frontmatter and body that are mutually consistent — so check-skill-integrity.py and check-surface-sync.sh pass without a second pass.

Adapted from the write-a-skill pattern in mattpocock/skills, reshaped to this repo's frontmatter, section, and gate conventions.

When to use

Use /learn instead when you just discovered something non-obvious this session and want it preserved — /learn captures a discovery; /new-skill deliberately designs an interface. With --from-learn, this skill upgrades a /learn-shaped stub into a full convention-compliant skill.

Phases

Phase 0 — Resolve the name and check for collisions

  1. Take the kebab-case name from $0 (or ask). Reject non-kebab-case, names that collide with an existing .claude/skills/<name>/, or names that shadow a built-in (commit, learn, …) — ls .claude/skills/ and stop if taken.
  2. Read CODE0 for the canonical structure and the frontmatter-field reference.
  3. Skim 2-3 sibling skills near the intended domain (e.g. Glob .claude/skills/*/SKILL.md, then Read the closest matches) so the new skill borrows real conventions, not invented ones.

Phase 1 — Interview (collect everything *before* writing)

A skill cannot stop to ask mid-write, so gather all interactivity up front (the orchestrator-protocol.md RUN_CONFIG discipline). Ask, in one batch:

  1. Purpose — one sentence: what does it accomplish and why does it exist?
  2. When it should fire — the 2-4 situations a user is in when they need it (e.g. "preparing a submission", "a number changed between runs"), plus one or two example phrasings. These become the description's "Use when…" clause. Name intent categories rather than enumerating near-synonyms: every model-invocable description is loaded into every session, and description + when_to_use are truncated in the skill listing (at 1,536 characters per the Claude Code skills docs, 2026-09) — put the key use first.
  3. Inputs / arguments — positional args and any flags (each must become a documented --token).
  4. Tools — does the body Read? Write? Grep/Glob? run Bash? fan out to a subagent (Agent)? hit the web via WebSearch/WebFetch? Only declare what it actually uses.
  5. Output — a written file (where?), a chat report, or an in-place edit? Should it be read-only?
  6. Scope boundary — the one or two things it explicitly does NOT do (and which sibling owns those).
  7. Side effects — which steps send, post or upload anything (email, GitHub, an external model, cloud sync) or cannot be undone by git? Each such step shows the user what it will do and waits for a yes before it runs; restricted data follows CODE0.
  8. Fresh eyes — does the skill critique something this session produced? That part runs in a fresh-context subagent, never a conversation fork (CODE0).

Echo a one-paragraph design brief back for confirmation before writing.

Phase 2 — Write the SKILL.md (deep module, simple interface)

Write .claude/skills/<name>/SKILL.md from the template, with these gold-standard sections:

Phase 3 — Enforce parity so the gates pass first try

check-skill-integrity.py enforces two parities this phase must satisfy (scripts/check-skill-integrity.py is the checker; ./scripts/backtest.sh runs every gate):

Run python3 scripts/check-skill-integrity.py --verbose and fix any P0/P1 before declaring done.

Phase 4 — Remind: register the surface (table-row and count gates)

The skill is NOT discoverable to a reader until it is listed, and the inventory counts must match what is on disk. check-surface-sync.sh runs two surface checks. The table-row gate requires the <!-- surface-sync-table: skills --> table in README.md to have exactly one data row per skill on disk. The count assertions require every inventory phrasing that states a skill count (e.g. "N agents, M skills, …") in README.md, CLAUDE.md, guide/workflow-guide.qmd, both rendered guide copies (guide/workflow-guide.html, docs/workflow-guide.html), docs/index.html, templates/skill-template.md and .claude/skills/commit/SKILL.md to equal the number of skill directories. A new skill fails the gate if it has no row or if the counts are not bumped.

REMIND the user to:

  1. Add a row to the README.md skills table: ` | /<name> | <what it does> | ` (the gated table).
  2. Add a row to the guide's ## All Skills appendix table in guide/workflow-guide.qmd. That table has no surface-sync marker, so no gate catches a missing row.
  3. Bump every skill count. Run python3 scripts/check-surface-sync.py: each asserts N skills (actual: M) line names a file:line to update. For the guide, edit guide/workflow-guide.qmd, then quarto render guide/workflow-guide.qmd, cp guide/workflow-guide.html docs/workflow-guide.html and ./scripts/stamp-render.sh, so both HTML copies carry the new count and the staleness gate stays green.
  4. Optionally add the skill to CLAUDE.md's "Skills Quick Reference" bullet list — only if it belongs among the most-used skills; no gate checks that list.
  5. Decide whether Codex and Antigravity should get it. If one agent can run it end to end (no fan-out to independent reviewers, nothing specific to Claude Code's own sessions), add its name to INCLUDE in scripts/sync-agent-skills.py and run python3 scripts/sync-agent-skills.py; otherwise add it to EXCLUDE with the reason. Left in neither list, it stays Claude-only and check-skill-integrity.py prints a P2 reminder.
  6. Run ./scripts/check-surface-sync.sh and python3 scripts/check-skill-integrity.py — both must exit 0.
  7. Check what the skill costs and whether it fires: /skill-doctor shows its context cost and usage; ./scripts/run-skill-eval.sh runs its eval cases once they exist.

Print the ready-to-paste README row so the user can drop it in.

Output / report format

Exit behavior

Flags

Cross-references

What this skill does NOT do

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.