Skip to content

SOP 005: Pass Arguments to Skills

Fresh
FieldValue
SOP ID005
Version1.0
StatusActive
Last Updated2026-02-14

Purpose

Pass dynamic data into skills using argument placeholders, including single arguments, positional access, and the session ID.

Argument Flow

Substitution Reference

VariableDescriptionExample InputResult
$ARGUMENTSAll arguments/skill foo barfoo bar
$ARGUMENTS[0]First argument/skill foo barfoo
$ARGUMENTS[1]Second argument/skill foo barbar
$0Shorthand for $ARGUMENTS[0]/skill foo barfoo
$1Shorthand for $ARGUMENTS[1]/skill foo barbar
${CLAUDE_SESSION_ID}Session IDN/Asess_abc123

Procedure

Step 1: Single Argument

Use $ARGUMENTS for the entire argument string:

yaml
---
name: fix-issue
description: Fix a GitHub issue
disable-model-invocation: true
---

Fix GitHub issue $ARGUMENTS following our coding standards.

1. Read the issue description
2. Understand the requirements
3. Implement the fix
4. Write tests
5. Create a commit

Usage: /fix-issue 123 becomes "Fix GitHub issue 123..."

Step 2: Positional Arguments

Use $ARGUMENTS[N] or $N for specific positions:

yaml
---
name: migrate-component
description: Migrate a component from one framework to another
---

Migrate the $0 component from $1 to $2.
Preserve all existing behavior and tests.

Usage: /migrate-component SearchBar React Vue

  • $0 = SearchBar
  • $1 = React
  • $2 = Vue

Step 3: Session-Scoped Logging

Use ${CLAUDE_SESSION_ID} for unique file/log naming:

yaml
---
name: session-logger
description: Log activity for this session
---

Log the following to logs/${CLAUDE_SESSION_ID}.log:

$ARGUMENTS

Step 4: Handle Missing $ARGUMENTS

Auto-Append Behavior

If you invoke a skill with arguments but the skill doesn't include $ARGUMENTS, Claude Code appends ARGUMENTS: <your input> to the end of the skill content.

Verification Checklist

  • [ ] $ARGUMENTS placeholder present in skill content
  • [ ] Positional arguments use correct 0-based indexing
  • [ ] Tested with expected argument patterns
  • [ ] Handled edge case of no arguments provided
  • [ ] argument-hint frontmatter set for autocomplete guidance

See Also

Built with VitePress + Claude Code Skills RAG Chat