Agent Command Authoring

VerifiedSafe

Create slash commands for Claude Code and OpenCode that delegate to subagents. Use this skill to create or refactor commands following the delegation pattern.

Sby Skills Guide Bot
DevelopmentBeginner
3/8/2026
Claude Code
#slash-commands#subagents#command-authoring#claude-code#delegation

Recommended for

Automated summary

This skill explains how to write slash commands that are thin wrappers delegating to a subagent, for both Claude Code and OpenCode.

Strengths

  • Provides an explicit command → subagent → skill delegation pattern that is easy to replicate
  • Lists the required frontmatter fields for Claude Code (allowed-tools, argument-hint) and OpenCode (agent)
  • Enforces imperative command naming and a short 5-20 line command body
  • Explains the rationale: single source of truth, cross-platform consistency and token efficiency

Limitations

  • OpenCode is documented but is not one of the target platforms in this catalog's platform list
  • Assumes subagents and skills already exist; it does not show how to create them
  • The anti-pattern section is cut off in the source, so that guidance is incomplete
When to use it

Use it when creating a new slash command or refactoring an existing one so it delegates to a subagent.

When not to use it

Avoid it if you intend to put implementation steps directly in the command, or if no matching subagent exists yet.

Security analysis

Safe
Quality score88/100

The skill is instructional documentation for creating AI command files. It contains no executable payloads, destructive commands, network calls, or data exfiltration. Bash examples are limited to read-only 'ls' checks for file existence and are presented as guidance, not as commands for the agent to run.

No concerns found

How this analysis is made

Examples

New delegating command
Create a new slash command called `review` that delegates to the code-reviewer subagent, following the delegation pattern.
Refactor an existing command
Refactor my .claude/commands/commit.md so it becomes a thin wrapper around the git-committer subagent instead of containing the full commit instructions.
Add OpenCode equivalent
Create the OpenCode version of my `prp` command that uses the prp-generator agent, matching the Claude Code command.

name: agent-command-authoring description: Create Claude Code slash commands and OpenCode command files that delegate to subagents. Use when creating new commands or refactoring existing ones to follow the delegation pattern.

Agent Command Authoring

Create commands that delegate to subagents for Claude Code and OpenCode.

When to Use This Skill

Use this skill when:

  • Creating a new custom command
  • Refactoring an existing command to delegate to a subagent
  • Ensuring consistency between Claude Code and OpenCode command implementations

The Delegation Pattern

Commands should be thin wrappers that delegate to subagents (which in turn delegate to skills):

command → subagent → skill

Claude Code command (.claude/commands/<name>.md):

---
description: Brief description of what the command does
allowed-tools: Task(subagent-name)
---

Use the `<subagent-name>` subagent to accomplish this task.

OpenCode command (.config/opencode/command/<name>.md):

---
description: Brief description of what the command does
agent: <subagent-name>
---

Use the `<subagent-name>` subagent to accomplish this task.

Claude Code Command Structure

Frontmatter Fields

| Field | Required | Description | |-------|----------|-------------| | description | Yes | 1-2 sentence description of what the command does | | allowed-tools | Yes | Task(subagent-name) to invoke the subagent | | argument-hint | No | Hint for command arguments (e.g., [feature_name [subtask_number]]) |

allowed-tools Format

For commands that delegate to subagents:

  • Task(subagent-name) - Invoke a subagent

Example:

allowed-tools: Task(git-committer)

Naming Conventions

Command names should use the imperative form of verbs (telling the agent what to do):

  • ✅ commit, stage, lint, test, review, reflect
  • ❌ committing, git-committer, do-linting

The imperative form gives commands their characteristic feel:

  • "commit" = "perform a commit"
  • "stage" = "stage changes"
  • "test" = "run tests"

OpenCode Command Structure

Frontmatter Fields

| Field | Required | Description | |-------|----------|-------------| | description | Yes | 1-2 sentence description of what the command does | | agent | Yes | Name of the subagent to invoke |

Example:

---
description: Create well-formatted commits using conventional commits style
agent: git-committer
---

Command Body

The command body should be 5-20 lines maximum and contain only:

Use the `<subagent-name>` subagent to accomplish this task.

Do NOT include:

  • Full implementation steps
  • Duplicated content between Claude and OpenCode
  • More than ~20 lines of content

Examples

Minimal Command (Claude Code)

---
description: Create well-formatted commits using conventional commits style
allowed-tools: Task(git-committer)
---

Use the `git-committer` subagent to create a well-formatted commit.

Minimal Command (OpenCode)

---
description: Create well-formatted commits using conventional commits style
agent: git-committer
---

Use the `git-committer` subagent to create a well-formatted commit.

Command with Arguments (Claude Code)

---
description: Generate a PRP
argument-hint: [feature_name]
allowed-tools: Task(prp-generator)
---

Use the `prp-generator` subagent to create a Product Requirements Prompt.

Why This Pattern?

  1. Single source of truth: Skills contain all implementation content
  2. Easier maintenance: Changes to skills automatically propagate
  3. Platform consistency: Commands are thin wrappers with platform-specific frontmatter
  4. Token efficiency: Subagents load skills progressively via progressive disclosure
  5. No duplication: Implementation lives in one place (the skill)
  6. Isolation: Subagents run in their own context with appropriate permissions

Anti-Pattern to Avoid

BAD - Command with full implementation:

---
description: Stage changes
allowed-tools: Bash(git add:*)
---

# Staging Changes

Stage relevant changes via `git add`...

1. Run `git status` to check for already staged changes
2. Verify no staged changes exist...
3. Run `git status` again...
4. Carefully review which files are relevant...
5. Stage only the relevant files...
6. Run `git status` again...

BAD - Command that delegates directly to skill (skipping subagent):

---
description: Stage changes via git add
allowed-tools: Skill(git-staging)
---

Use the `git-staging` skill to stage relevant changes.

GOOD - Command that delegates to subagent:

---
description: Stage changes via git add
allowed-tools: Task(git-stager)
---

Use the `git-stager` subagent to stage relevant changes.

Workflow

  1. Check for existing skill: Identify the skill the command should use
  2. Check for existing subagent: Look for a subagent that delegates to that skill
    • Claude Code: .claude/agents/<name>.md
    • OpenCode: .config/opencode/agent/<name>.md
  3. If no subagent exists: Ask the user if they want one created
    • If yes, use the subagent-authoring skill to create it first
    • If no, stop and explain the command cannot be created without a subagent
  4. Create/refactor Claude Code command with allowed-tools: Task(subagent-name)
  5. Create/refactor OpenCode command with agent: subagent-name
  6. Verify the full chain works: command → subagent → skill

Missing Subagent Handling

Before creating a command, always verify the target subagent exists:

# Check Claude Code subagent
ls ~/.claude/agents/<subagent-name>.md

# Check OpenCode subagent
ls ~/.config/opencode/agent/<subagent-name>.md

If either file is missing, ask the user:

"The subagent <subagent-name> doesn't exist yet. Would you like me to create it using the subagent-authoring skill before proceeding with the command?"

Do NOT create commands that reference non-existent subagents.

Related Skills

  • subagent-authoring - For creating subagent definitions that delegate to skills
  • skill-authoring - For creating skills themselves

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/agent-command-authoring-mmh8qqsn/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/agent-command-authoring-mmh8qqsn' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/agent-command-authoring-mmh8qqsn/download' --output '.skill-downloads/agent-command-authoring-mmh8qqsn/SKILL.md.part' && mv '.skill-downloads/agent-command-authoring-mmh8qqsn/SKILL.md.part' '.skill-downloads/agent-command-authoring-mmh8qqsn/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/agent-command-authoring-mmh8qqsn/SKILL.md' && test -s '.skill-downloads/agent-command-authoring-mmh8qqsn/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/agent-command-authoring' && cp -R '.skill-downloads/agent-command-authoring-mmh8qqsn' '.claude/skills/agent-command-authoring'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/agent-command-authoring-mmh8qqsn'

openskills read 'agent-command-authoring-mmh8qqsn'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/agent-command-authoring-mmh8qqsn/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills