Skip to content

Custom commands in Claude Code are packaged as Agent Skills under .claude/skills/<name>/SKILL.md (with legacy .claude/commands/<name>.md files still supported). Each skill becomes a shared /<name> workflow with structured frontmatter, invocation controls, supporting scripts, and optional subagent isolation—turning ad-hoc personal prompts into versioned, verifiable team standards.

One engineer’s pre-PR checklist catches missing tests and unparameterised queries, while teammates run different prompts and catch those defects only during human review. This guide is for developers tired of pasting the same procedures into chat and tech leads standardising repeatable workflows across an entire repository.

Author every new workflow as a skill under .claude/skills/<name>/SKILL.md. Skills follow the open Agent Skills standard (also catalogued at skills.wondel.ai) so the core instruction body transfers across Claude Code, Codex, and Cursor while supporting Claude-specific extensions such as invocation guards, inline command injection, and forked subagent execution.

CapabilityLegacy .claude/commands/<name>.mdSkill .claude/skills/<name>/SKILL.md
Invocation/<name> (subfolders add : prefixes)/<name> or frontmatter name
Supporting files (scripts, templates, refs)NoYes, alongside SKILL.md
Name collision outcomeOverridden by skillTakes precedence
Cross-agent portabilityClaude Code onlyOpen SKILL.md standard (drop Claude-only fields when porting)

Skills conserve context budget: only each skill’s short description sits in context until invoked, at which point the full body enters the conversation. Write terse standing instructions rather than narrative prose, because every line stays in context across subsequent turns.

Commit team workflows to .claude/skills/ inside the repository; package cross-repository commands as a namespaced team plugin (plugins ecosystem).

ScopePathActive in
Managed (enterprise)Managed settings skills directoryEvery user on organization-managed machines
Personal~/.claude/skills/<name>/SKILL.mdLocal projects on your machine (not cloud or remote runs)
Project.claude/skills/<name>/SKILL.mdEveryone who clones this repository
Nested<subdir>/.claude/skills/<name>/SKILL.mdSessions started in or touching <subdir>
Plugin<plugin>/skills/<name>/SKILL.mdEnabled repos, namespaced as /<plugin>:<name>

Three precedence invariants prevent silent shadowing:

  • Enterprise beats personal, and personal beats project. A local ~/.claude/skills/deploy/ silently shadows the team’s .claude/skills/deploy/ on your machine alone.
  • Avoid built-in aliases such as /review. A project skill cannot hijack the built-in /review alias for /code-review; name team review workflows distinctly (for example /pre-pr or /team-review).
  • Plugin skills never collide because their plugin prefix namespaces them automatically.

A high-leverage team command runs real repository gates and outputs a fixed evidence structure rather than open-ended commentary.

  1. Create .claude/skills/pre-pr/SKILL.md and align the gate commands with your repository scripts:

    ---
    description: Run repository merge gates on the current branch and report a structured readiness verdict. Use before opening a pull request.
    disable-model-invocation: true
    allowed-tools: Bash(git diff *) Bash(npm run *)
    ---
    ## Changed files
    !`git diff --stat origin/main...HEAD`
    ## Standing instructions
    1. Run `npm run typecheck`, `npm run lint`, and `npm run test` in order. Record exact commands and exit codes.
    2. On failure, print the first failing file and line. Do not edit source code.
    3. For every modified file under `src/`, identify the covering test or flag the file as untested.
    4. Reply strictly in this format:
    VERDICT: READY | BLOCKED
    | Gate | Command | Exit code |
    Untested files: <list or "none">
    Review first: up to three file:line locations with one reason each
  2. Parameterise repeatable workflows with named arguments. Use $ARGUMENTS or explicit arguments with argument-hint (for example /fix-issue 482) so teammates see expected inputs in autocomplete.

  3. Commit the skill and protect .claude/ in CODEOWNERS. Because skills shape agent behaviour and can pre-approve tool rules across every developer machine, review skill edits with the same scrutiny as CI workflows.

Invocation boundaries, permissions, and forked execution

Section titled “Invocation boundaries, permissions, and forked execution”

Three frontmatter controls govern safety and context hygiene. Consult the official Claude Code documentation for the complete frontmatter schema and shell-injection settings.

Frontmatter settingUser invokesClaude auto-invokesBest fit
DefaultYesYesSafe, read-only checklists and reusable reference steps
disable-model-invocation: trueYesNoAnything with side effects: commits, pushes, deploys, messages, /pre-pr
user-invocable: falseNoYesBackground domain guidance loaded only when relevant

Understand two critical security and context mechanics before shipping skills to a team:

  • allowed-tools grants permissions rather than restricting them. Listing tools in allowed-tools pre-approves them for that invocation turn while leaving all other tools governed by normal policy—and project skill grants can apply even in non-interactive runs without a workspace trust prompt. Use disallowed-tools or permissions.deny to restrict capabilities, review .claude/skills/ before running Claude on untrusted repos, and enforce disableSkillShellExecution in managed settings when shell injection (!`command`) must be disabled org-wide.
  • Offload heavy inspection with context: fork. When a command sweeps dozens of files (such as finding every call site of a public API before refactoring), add context: fork and agent: Explore so the skill runs inside an isolated read-only subagent and returns only a concise summary instead of filling your main session (custom subagents).

Seeing a slash command print text proves only that the file loaded. Verify skills across four objective gates:

  1. Automated frontmatter validation in CI. Claude Code silently ignores misspelt frontmatter keys or malformed YAML—meaning a typo in disable-model-invocation quietly lets Claude auto-trigger a deploy skill. Run a zero-secret CI script on every PR touching .claude/ that checks opening --- on line 1, valid YAML parsing, required description, and known schema keys, and run npx @wondelai/harness-audit to audit skill hygiene alongside hooks and memory (Harness Audit). Protect both .claude/ and .github/ under CODEOWNERS.
  2. Fresh-session A/B evaluation. Test three realistic requests in clean sessions with the skill enabled versus disabled (or run automated trigger/output evals when shipping plugin skills). Writing and testing in the same session hides instruction gaps.
  3. Structured, re-runnable output. Require a fixed verdict and command/exit-code table so reviewers can verify claims in seconds rather than reading transcripts.
  4. Context-budget pruning. Audit skill token overhead and actual usage periodically (via Claude Code’s built-in skill diagnostics) and remove unused skills whose descriptions tax every turn.
SymptomLikely causeRecovery
/name missing from menuSkill lives in an unvisited nested directory or .claude/skills/ was created mid-sessionReload skills or restart the session; inspect loaded skills via /skills
Frontmatter guard has no effectOpening --- is not on line 1, YAML failed to parse, or a key is misspeltRun your CI frontmatter linter and launch with --debug to view parse errors
Teammate gets different behaviour for the same /nameA personal copy in ~/.claude/skills/ shadows the committed project skillDelete or rename the personal skill; personal scope outranks project scope
/review ignores a custom team command/review is reserved as an alias for built-in /code-reviewRename the team skill distinctly (for example /team-review or /pre-pr)
Shell injection aborts the commandAn inline !`command` exited non-zero or hit a permission ruleHandle expected non-zero exits explicitly or pre-approve the safe command in allowed-tools
Skill influence fades in long sessionsCompaction truncates re-attached skill bodiesKeep skill bodies concise, re-invoke when needed, and move hard invariants into hooks
Claude stops auto-selecting the right skillToo many installed skills exceed the description listing budgetPut the trigger condition first in description and disable unused skills

Refer to the official Claude Code documentation for exact frontmatter fields, plugin evaluation commands, and built-in skills, and browse the open standard at Agent Skills and skills.wondel.ai.

  • Custom subagents: define dedicated read-only or worktree-isolated specialists for context: fork skills.
  • Hooks automation: enforce non-negotiable rules deterministically instead of relying on skill instructions.
  • Memory system: decide what belongs in CLAUDE.md versus an on-demand skill.
  • Skills ecosystem: security, supply-chain review, and cross-tool portability across Claude Code, Codex, and Cursor.

Did this guide help you?

One tap, no sign-in.

not at all a lot