command-creator

Create custom OpenCode slash commands. Use when user asks to "create a command", "add a slash command", "make a /command", "set up custom commands", or wants to automate repetitive prompts.

$ Installer

git clone https://github.com/IgorWarzocha/Opencode-Workflows /tmp/Opencode-Workflows && cp -r /tmp/Opencode-Workflows/opencode-configurator/skill/command-creator ~/.claude/skills/Opencode-Workflows

// tip: Run this command in your terminal to install the skill


name: command-creator description: Create custom OpenCode slash commands. Use when user asks to "create a command", "add a slash command", "make a /command", "set up custom commands", or wants to automate repetitive prompts.

Command Creator

Create custom slash commands for repetitive tasks in OpenCode.

<core_approach>

Command creation is conversational, not transactional.

  • MUST NOT assume what the user wants—ask
  • SHOULD start simple, add complexity only if needed
  • MUST show drafts and iterate based on feedback

</core_approach>

Command Locations

ScopePath
Project.opencode/command/<name>.md
Global~/.config/opencode/command/<name>.md

Command File Format

---
description: What this command does (shown in /help)
agent: build              # Optional: build, plan, or custom agent
model: provider/model-id  # Optional: override model
subtask: true             # Optional: run as subagent
---

Template body goes here.

Frontmatter Options

FieldPurposeRequired
descriptionShown in command listRECOMMENDED
agentRoute to specific agentNo
modelOverride modelNo
subtaskForce subagent invocationNo

Template Placeholders

PlaceholderDescriptionExample
$ARGUMENTSAll arguments passed/cmd foo bar → "foo bar"
$1, $2, $3Positional arguments/cmd foo bar → $1="foo", $2="bar"
`!command`Shell output (runs bash)`!git status`
@filenameInclude file content@src/index.ts

Shell Commands in Templates

Use backticks with ! to run shell commands and include output:

Review the current changes:

`!git diff --staged`

Suggest improvements.

File References

Use @ to include file content:

Given the schema in @prisma/schema.prisma, generate a migration for $ARGUMENTS.

Built-in Commands

CommandDescriptionSubtask
/initCreate/update AGENTS.mdNo
/reviewReview git changes (defaults to uncommitted)Yes

Phase 1: Understand the Task

  1. "What task do you want to automate?"

    • Get the repetitive prompt/workflow
    • Examples: "run tests", "review this file", "create a component"
  2. "Can you show me how you'd normally ask for this?"

    • Get the actual prompt they'd type
    • This becomes the template body

Phase 2: Inputs & Routing

  1. "Does it need arguments?"

    • If they mention "this file", "a name", "the function" → yes
    • Explain: /command foo bar$ARGUMENTS = "foo bar", $1 = "foo", $2 = "bar"
  2. "Should it make changes or just analyze?"

    • Changes → default agent (build)
    • Analysis only → set agent: plan
  3. "Should it run as a background subtask?"

    • Long-running or parallel work → set subtask: true
    • Interactive or quick → leave unset
  4. "Project-specific or use everywhere?"

    • Project → .opencode/command/
    • Global → ~/.config/opencode/command/

Phase 3: Review & Refine

  1. Show the draft command, ask for feedback
    • "Here's what I've created. Want to adjust anything?"
    • Iterate until user is satisfied

Be flexible: If user provides lots of info upfront, adapt—MUST NOT rigidly ask every question.

/test - Run and Fix Tests

---
description: Run tests and fix failures
---

Run the full test suite. For any failures:
1. Show the failing test
2. Identify the root cause  
3. Fix the issue
4. Re-run to verify

/review - Code Review (Read-Only)

---
description: Review code for issues
agent: plan
---

Review $ARGUMENTS for:
- Bugs and edge cases
- Security issues
- Performance problems

Provide actionable feedback without making changes.

/commit - Smart Commit with Prefixes

---
description: Stage and commit with conventional prefix
---

1. Run `git status` and `git diff`
2. Analyze all changes
3. Choose appropriate prefix: docs:, feat:, fix:, refactor:, test:, ci:
4. Write concise commit message (imperative mood)
5. Stage relevant files and commit

/spellcheck - Check Spelling

---
description: Check spelling in markdown files
subtask: true
---

Check spelling in all unstaged markdown files:

`!git diff --name-only | grep -E '\.md$'`

Report any spelling errors found.

/issues - Search GitHub Issues

---
description: Search GitHub issues
model: anthropic/claude-3-5-haiku-20241022
subtask: true
---

Search GitHub issues matching: $ARGUMENTS

`!gh issue list --search "$ARGUMENTS" --limit 10`

Summarize the relevant issues.

/component - Create Component

---
description: Create a new React component
---

Create a React component named $1 in $2 with:
- TypeScript props interface
- Basic styling
- Unit test file

Usage: /component UserProfile src/components

/migrate - Database Migration

---
description: Generate database migration
---

Given the schema in @prisma/schema.prisma:

Generate a migration for: $ARGUMENTS

<quality_checklist>

Before delivering:

  • Asked what task to automate
  • Got example of how they'd normally prompt it
  • Determined if arguments needed ($ARGUMENTS vs $1, $2)
  • Set appropriate agent (plan for read-only)
  • Considered subtask for long-running work
  • Chose project vs global scope
  • Showed draft and got feedback

</quality_checklist>

<best_practices>

DoDon't
Keep templates focusedCram multiple tasks in one
Use $1, $2 for structured argsRely only on $ARGUMENTS for multi-arg
Use `!cmd` to gather contextHardcode dynamic values
Use @file for config/schema refsCopy-paste file contents
Set agent: plan for read-onlyForget agent for reviews
Set subtask: true for parallel workBlock main session unnecessarily

</best_practices>