Back to list
ian-pascoe

writing-commands

by ian-pascoe

My dotfiles

1🍴 0📅 Jan 24, 2026

SKILL.md


name: writing-commands description: Use when creating, editing, or reviewing custom OpenCode commands. Covers frontmatter options, prompt templating with arguments and shell output, file references, and agent/model configuration.

Writing Commands

Overview

Commands are custom prompts triggered via /command-name in the TUI. They automate repetitive tasks with configurable agents, models, and dynamic prompt templating.

When to Use

  • Creating a new custom command for repetitive workflows
  • Adding argument handling or shell output injection to commands
  • Configuring which agent or model handles a command
  • Converting inline prompts to reusable commands

Don't use for: one-off prompts, complex multi-step workflows (use agents), or logic that needs code execution.

File Locations

.opencode/command/<name>.md         # Project-local
~/.config/opencode/command/<name>.md  # Global/personal

File name becomes the command name (e.g., test.md -> /test).

Frontmatter Options

---
description: Brief description shown in TUI
agent: build # Optional: agent to execute (default: current)
model: anthropic/... # Optional: override default model
subtask: true # Optional: force subagent invocation
---
OptionRequiredDescription
descriptionNoShown in TUI command list
agentNoAgent to execute (defaults to current)
modelNoOverride model for this command
subtaskNoForce subagent invocation (isolates context)
templateYes*Prompt text (JSON config only, body in markdown)

*In markdown files, the body after frontmatter IS the template.

Prompt Templating

Arguments

PlaceholderDescription
$ARGUMENTSAll arguments as single string
$1, $2...Positional arguments
Create a React component named $1 in $2 directory.

Usage: /component Button src/components

Shell Output

Inject command output with backtick syntax:

Here are the current test results:
!`npm test`

Based on these results, suggest improvements.

Commands run from project root.

File References

Include file contents with @path:

Review the component in @src/components/Button.tsx.
Check for performance issues.

Quick Reference

PatternExample
Simple command/test -> runs test suite
With args/component Button -> $1 = Button
Shell injection!git log -5`` -> injects git output
File inclusion@src/index.ts -> includes file content
Subagent isolatedsubtask: true -> runs in isolated context

JSON Config Alternative

Commands can also be defined in opencode.jsonc:

{
  "command": {
    "test": {
      "template": "Run tests with coverage...",
      "description": "Run tests with coverage",
      "agent": "build",
      "model": "anthropic/claude-3-5-sonnet-20241022",
    },
  },
}

Common Mistakes

MistakeFix
Missing descriptionAlways add for TUI discoverability
Using $ARGUMENTS with positionalPick one style: $ARGUMENTS OR $1, $2
Shell commands with side effectsOnly use read-only commands in prompts
Overriding built-in without intentBuilt-ins: /init, /undo, /redo, /share, /help
Forgetting quotes for JSON args/cmd "{ \"key\": \"value\" }"

Validation Checklist

  • File name is lowercase, hyphen-separated
  • Description is concise and descriptive
  • Template uses correct placeholder syntax
  • Shell commands are read-only (no mutations)
  • File references use correct @path syntax
  • Agent exists if specified

Score

Total Score

50/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon