claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[FEATURE] Support `skills:` frontmatter in slash commands to load skills into command context

Open mavam opened this issue 1 month ago • 2 comments

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

The 2.1.0 release added excellent support for running slash commands in forked contexts via context: fork in frontmatter, and specifying agent types via the agent: field. However, there's currently no way to load specific skills into a slash command's context.

This is different from #14886 which requests skill injection into spawned agents. This request is about loading skills directly into the slash command's own context (whether inline or forked).

Current state (2.1.0):

---
description: My command
context: fork
model: haiku
agent: general-purpose
hooks: ...
---

Desired addition:

---
description: My command  
context: fork
model: haiku
skills: my-skill  # or skills: [skill-a, skill-b]
---

Proposed Solution

Add a skills: frontmatter field to slash commands that loads the specified skill(s) into the command's context before execution.

Syntax options:

# Single skill
skills: my-skill

# Multiple skills (array)
skills:
  - skill-a
  - skill-b

Behavior:

  • When the slash command is invoked, the specified skill SKILL.md content is loaded into the context
  • Works with both inline commands and context: fork commands
  • Skills are loaded before the command prompt is processed
  • Skill resolution follows standard skill lookup (project .claude/skills/, user ~/.claude/skills/, plugins)

Alternative Solutions

Current workaround: Include instructions in the command prompt to read skill files:

---
description: My command
context: fork
---

First read and follow the instructions in .claude/skills/my-skill/SKILL.md

Then do: $ARGUMENTS

Problems with workaround:

  • Not guaranteed (Claude may skip or summarize)
  • Extra tool call overhead
  • No validation that skill exists
  • Poor developer experience

Priority

Medium - Would be very helpful

Feature Category

CLI commands and flags

Use Case Example

Scenario: Specialized code review command

  1. I have a code-standards skill that defines my team's coding conventions

  2. I want a /review command that reviews code using those standards

  3. Currently I must either:

    • Duplicate the skill content in the command (maintenance burden)
    • Hope Claude reads the skill file when instructed (unreliable)
    • Create a full agent just for this (overkill)
  4. With this feature:

# .claude/commands/review.md
---
description: Review code using team standards
context: fork
model: haiku
skills: code-standards
---

Review the following code for adherence to our coding standards:

$ARGUMENTS

The code-standards skill is automatically loaded, ensuring consistent reviews without duplication or extra tool calls.

Additional Context

Relationship to 2.1.0 features:

The 2.1.0 changelog added several frontmatter fields for skills and slash commands:

  • context: fork - run in forked sub-agent context
  • agent - specify agent type for execution
  • hooks - define lifecycle hooks

Adding skills: would complete this pattern, allowing commands to compose with skills the same way agents can compose with skills.

Related issues:

  • #14886 - Command-triggered agent spawning with skill injection (different: injects into agents, not commands)
  • #16410 - forwards-to for command aliasing (different: replaces command, not augments)

🤖 Generated with Claude Code

mavam avatar Jan 08 '26 19:01 mavam