Skip to main content

Substitutions and Invocation

A skill body can hold placeholders that Claude Code fills in when the skill runs. It can also run shell commands and paste in their output. This page lists the placeholders, the shell syntax, and the rules for who can start a skill. For example, $ARGUMENTS in a SKILL.md file becomes the text that you type after the command.

disableSkillShellExecution turns off shell injection. disable-model-invocation and user-invocable control who can run a skill.

Example​

.claude/skills/fix-issue/SKILL.md
---
description: Fix a GitHub issue by number.
arguments: issue
allowed-tools: Bash(gh issue view *)
---

Issue details:
!`gh issue view $issue --json title,body`

Fix issue $issue. Session: ${CLAUDE_SESSION_ID}.

Type /fix-issue 42. Claude Code runs gh issue view 42, pastes the output, and sends the whole text to Claude.

String Substitutions​

PlaceholderStatusWhat it becomesNotes
$ARGUMENTSDocumentedAll arguments as typed.With no placeholder in the skill, Claude Code appends ARGUMENTS: <value>.
$ARGUMENTS[N], $NDocumentedOne argument by index, counting from 0.Shell-style quotes group words. A missing index stays as text.
$nameDocumentedA named argument from the arguments key.A missing value gives an empty string.
\$1DocumentedThe literal text $1.One backslash before a token escapes it. \\$1 still expands.
${CLAUDE_SESSION_ID}DocumentedThe session ID.Not replaced in synced skills.
${CLAUDE_EFFORT}DocumentedThe current effort level.low to max.
${CLAUDE_SKILL_DIR}DocumentedThe folder of the SKILL.md.Also replaced in allowed-tools Bash rules. In a plugin it is the skill subfolder.
${CLAUDE_PROJECT_DIR}DocumentedThe project root.Replaced in the body and in allowed-tools.
${CLAUDE_PLUGIN_ROOT}, ${CLAUDE_PLUGIN_DATA}DocumentedPlugin paths.Plugin skills only.
${user_config.KEY}DocumentedA saved plugin option.In skill and agent content only non-sensitive values are filled.
Total size capUndocumentedStops huge fills.The error says "This skill, command or hook and the arguments filled into it add up to more than N characters". Argument values are marked so a $ inside them is not expanded.

Shell Injection​

Syntax or settingStatusWhat it doesNotes
!`command`DocumentedRuns a command and inserts its output.Only at the start of a line or after whitespace. The output is not scanned again. User, project, and plugin skills.
A fenced block with ! after the opening backticksDocumentedA multi-line command.The same rules.
A failing commandDocumentedAborts the whole invocation.The error is Shell command failed for pattern "...". Exit code 1 from search commands is a normal result. A permission failure says Shell command permission check failed.
disableSkillShellExecutionDocumentedReplaces each command with [shell command execution disabled by policy].Bundled and managed skills are not affected.
Synced skillsDocumentedNever run ! commands.@ files and two placeholders are not expanded either.

Invocation Control​

RuleStatusWhat it doesNotes
DefaultDocumentedYou and Claude can both run the skill.The description is always in context.
disable-model-invocation: trueDocumentedOnly you can run it.The description is not in context.
user-invocable: falseDocumentedOnly Claude can run it.The skill is hidden from the / menu.
A name at the start of a messageDocumentedRuns the skill.After plain text it only grants permission. You can stack up to five more skills in a terminal prompt.
Skill(name) and Skill(name *) rulesDocumentedPermission rules for the Skill tool.A deny on an alias blocks the bundled skill. Allow rules match the skill name only.
LifecycleDocumentedThe skill text stays in the conversation.An identical second run adds a short note. Compaction keeps 5,000 tokens for each skill and 25,000 in total. See Context and Compaction.
context: forkDocumentedRuns the skill in a subagent.Background by default. It waits in -p, with CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1, and for scheduled tasks.
Commit-time skillsUndocumentedThe names verify, pr, commit, code-review, simplify, and go.The program uses this set when it builds commit text. The docs name verify and simplify (2.1.286).

Source: Extend Claude with Skills, Settings Reference, and the program (the strings quoted in the tables).