Best for
- Activation Triggers
- When NOT to Use
- Creating a new OpenCode slash command.
MichelKerkmeester/opencode--skilled-agent-loops-with-spec-kit-memory/.opencode/skills/sk-doc/sk-create-command/SKILL.md
Scaffold OpenCode slash commands with explicit argument hints, allowed tools, and router/presentation separation.
Decision brief
create-command is the command-authoring workflow packet of the sk-doc parent hub. It creates and improves OpenCode slash commands under .opencode/commands/ with executable workflows, precise frontmatter, required input gates, least-privilege tools, and router/presentation separa…
Compatibility matrix
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/MichelKerkmeester/opencode--skilled-agent-loops-with-spec-kit-memory --skill ".opencode/skills/sk-doc/sk-create-command"Inspect the Agent Skill "sk-create-command" from https://github.com/MichelKerkmeester/opencode--skilled-agent-loops-with-spec-kit-memory/blob/3d386ee21366523774d89c0aff3ebbbc8fa7ff10/.opencode/skills/sk-doc/sk-create-command/SKILL.md at commit 3d386ee21366523774d89c0aff3ebbbc8fa7ff10. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
Follow these steps in order.
Create a command only when the workflow is repeatable and has defined steps.
Determine the command invocation before writing:
Before editing an existing command or owned asset, read it completely enough to understand current behavior. Preserve behavior unless the user explicitly asks to change it.
Choose the smallest command type that fits:
Permission review
The documentation asks the agent to run terminal commands or scripts.
python3 ../shared/scripts/check_authored_name_kebab.py <command-file.md>The documentation asks the agent to run terminal commands or scripts.
python3 ../shared/scripts/validate_document.py <command-file.md> --type commandEvidence record
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 92/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 34 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
create-command is the command-authoring workflow packet of the sk-doc parent hub. It creates and improves OpenCode slash commands under .opencode/commands/ with executable workflows, precise frontmatter, required input gates, least-privilege tools, and router/presentation separation when needed.
This SKILL.md contains the core creation workflow. Use the references/ route map (references/README.md), assets/command-template.md, assets/command-router-template.md, assets/command-presentation-template.md, and ../shared/ only for exhaustive examples, edge cases, and validator implementation detail.
This packet is lean and self-contained. The advisor identity lives at the sk-doc hub root; do not add packet-local graph-metadata.json.
Use this packet when the request involves:
argument-hint and allowed-tools.$ARGUMENTS./namespace:action.Keyword triggers: create command, /create:command, slash command, OpenCode command, argument-hint, allowed-tools, command template, router presentation split, thin router, presentation contract, paired /create, $ARGUMENTS.
Use another sk-doc packet when:
create-skill.create-agent.create-readme, create-feature-catalog, create-manual-testing-playbook, create-benchmark, create-flowchart, or create-changelog.create-quality-control.These triggers route a request into this command-authoring packet. Execution-mode suffixes are command syntax, not packet-selection triggers. When the surface is a slash command, stay in this packet and continue to the creation workflow below.
This packet routes by command-authoring intent and the requested component surface. It does not use runtime keyed resource discovery through references/<key>/ because its references are flat.
references/README.md as the fallback route map when command intent or component surface is unclear.references/<key>/ or assets/<key>/ runtime-key router unless this packet gains real keyed resource subdirectories.The packet keeps its existing flat-resource routing while using the shared resilience call sequence:
def discover_markdown_resources():
return flat markdown resources under this packet's `references/` and `assets/` folders
def _guard_in_skill(relative_path):
# Keep packet-local markdown paths in scope; retain explicitly documented shared routes.
confirm the path is an allowed markdown resource for this packet
def load_if_available(relative_path, inventory, seen):
guarded = _guard_in_skill(relative_path)
if guarded in inventory and guarded not in seen:
load(guarded)
seen.add(guarded)
def route_create_command_request(request):
inventory = discover_markdown_resources()
intents = score_intents(request) # command-authoring intent and component surface
selected = select_intents(intents)
routing_key = get_routing_key(request, selected)
if not selected or the command purpose or component surface is unclear:
load_if_available("references/README.md", inventory, seen)
return UNKNOWN_FALLBACK
return route by the existing command-authoring intent and component-surface rules
UNKNOWN_FALLBACK asks for the command purpose, invocation shape, or component type. The sequence discovers the current flat resources at routing time, guards and loads only available resources without duplicates, then applies the activation triggers and command-type rules already defined below.
Follow these steps in order.
Create a command only when the workflow is repeatable and has defined steps.
Use a command when the workflow:
$ARGUMENTS parsing or mode routing.:auto or :confirm.Use a skill instead when the content is reusable reference knowledge, domain guidance, standards, or patterns shared by multiple workflows. Do not create a command for one-off work.
Determine the command invocation before writing:
.opencode/commands/<command>.md becomes /<command>..opencode/commands/<namespace>/<action>.md becomes /<namespace>:<action>.^[a-z0-9]+(?:-[a-z0-9]+)*$. Reject underscores, empty segments and ambiguous normalization; the emitted .md stem must equal the validated action name.For grouped related actions, prefer a namespace directory:
.opencode/commands/
└── <namespace>/
├── <action1>.md
├── <action2>.md
└── <action3>.md
Before editing an existing command or owned asset, read it completely enough to understand current behavior. Preserve behavior unless the user explicitly asks to change it.
For new commands, inspect nearby commands in the same namespace when available so structure and vocabulary match the command family.
Choose the smallest command type that fits:
| Type | Use When | Typical Shape |
|---|---|---|
| Simple | Single action, few arguments | One .md file, direct steps |
| Workflow | Multi-step process with checkpoints | One .md file with overview, instructions, recovery |
| Mode-based | Supports :auto / :confirm | Thin router plus owned assets when complex |
| Router | Thin dispatcher: verify agent, resolve mode/args, hand off to owned assets | Router .md plus owned presentation .txt and optional workflow YAML or scripts |
| Argument dispatch | Multiple action keywords or query forms | ASCII routing tree plus handlers |
| Destructive | Deletes data or irreversible changes | Explicit confirmation, affected-state display, recovery guidance |
| Namespace | Related commands grouped together | Directory under .opencode/commands/ |
If the command combines patterns, parse mode first, then dispatch remaining arguments.
For a simple or medium command, create or update:
.opencode/commands/<command>.md
For a namespace command, create or update:
.opencode/commands/<namespace>/<action>.md
For a split mode-based workflow command, create or update:
.opencode/commands/<namespace>/<action>.md
.opencode/commands/<namespace>/assets/<namespace>_<action>_presentation.txt
.opencode/commands/<namespace>/assets/<namespace>_<action>_auto.yaml
.opencode/commands/<namespace>/assets/<namespace>_<action>_confirm.yaml
Use _auto.yaml and _confirm.yaml only for workflow-backed families that route execution into workflow assets. Direct-router families dispatch directly to tools/scripts and do not need workflow YAML.
For a compiled-stub router, the .md is a generated thin stub carrying the render-command-contract marker; its section shape is rendered from a compiled source at invocation, not authored in the file. Do not hand-write section headings into a compiled stub, and keep its owned presentation/workflow assets alongside it:
.opencode/commands/<namespace>/<action>.md # compiled stub (render-command-contract marker)
.opencode/commands/<namespace>/assets/<namespace>_<action>_presentation.txt
Every command starts with YAML frontmatter.
Required:
---
description: Action-oriented single-line description
---
Recommended when applicable:
argument-hint: "<required> [optional] [--flag]"
allowed-tools: Read, Write, Edit, Bash
Rules:
description single-line, action-oriented, and concise.description.argument-hint whenever the command expects user input.<angle-brackets> only for required arguments.[square-brackets] for optional arguments.argument-hint at or under 140 characters: the hint summarizes the invocation shape while the router's EXECUTION TARGETS section enumerates the full flag surface. Over-budget hints warn (never block); move the exhaustive flag list into the router body.allowed-tools.allowed-tools, use fully qualified names such as mcp__<server>__<tool>.memory_context belong in prose only, not allowed-tools.If argument-hint contains any required <argument>, add the mandatory gate immediately after frontmatter, before all other content.
The gate must:
$ARGUMENTS is empty, undefined, or whitespace-only.$ARGUMENTS or the user's explicit answer as the input.For multi-input commands, use a blocking phase pattern:
Every workflow command with blocking phases must include violation self-detection: if a required phase was skipped, stop, state the violation, return to the phase, and complete it properly.
Use executable, instruction-oriented sections. Commands are workflows, not long reference manuals.
Common section order:
Use these conventions:
## N. SECTION-NAME, using full integers only.### Step N: Description.1.5 or 2.5.STATUS=OK, STATUS=FAIL ERROR="<message>", or STATUS=CANCELLED ACTION=cancelled.Approved common H2 section names include:
PURPOSECONTRACTWORKFLOW OVERVIEWINSTRUCTIONSARGUMENT ROUTINGREFERENCEEXAMPLESRELATED COMMANDSTOOL SIGNATURESUSER INPUTApproved canonical H2 section names for router commands (see Step 11):
ROUTER CONTRACTOWNED ASSETSMODE ROUTINGEXECUTION TARGETSPRESENTATION BOUNDARYWORKFLOW SUMMARYFor commands with multiple entry points, include an ASCII routing tree based on $ARGUMENTS.
Route by:
Then define one handler section per action. Show example routing in a table so future maintainers can verify behavior quickly.
Argument-echo deprecation. Do not end a command with a bare User request: $ARGUMENTS line. The command already receives $ARGUMENTS; echoing it verbatim adds no routing behavior and duplicates the argument surface the router resolves. Resolve arguments in the router body — the validator warns on the raw-echo idiom.
Loader gating. Frontmatter is the load gate: allowed-tools authorizes exactly the tools and MCP surfaces a command may use, and any agent the router dispatches must both be admitted by that gate and resolve to a real agent definition in the active runtime's agent directory. Do not dispatch a handle the frontmatter does not admit or that does not exist.
For commands supporting :auto and :confirm, document mode detection:
| Pattern | Mode | Behavior |
|---|---|---|
/command:auto | Autonomous | Execute without user approval gates |
/command:confirm | Interactive | Pause at each step for user approval |
/command | Prompt | Ask user to choose execution mode |
Autonomous mode self-validates at checkpoints, makes informed decisions, and records significant decisions.
Interactive mode pauses after each step for approval, presents options such as approve, review details, modify, skip, or abort, and records user decisions.
If the mode-based command is large or has visible dashboards/prompts/results, use the router/presentation split.
Mode completeness. Every mode a command advertises must be fully realized, not merely reachable. For each mode in the argument hint (:auto, :confirm), the command must have both its workflow asset (the _auto.yaml / _confirm.yaml) and an EXECUTION TARGETS row that resolves the mode to that asset. A hint that lists :auto with no _auto.yaml or no :auto execution row is incomplete — a reader cannot route the advertised mode — so declare only the modes you have wired end to end.
A router is a first-class command type, not a loose refactor. Its .md is a thin dispatcher: verify the orchestrating agent, resolve mode and arguments, then hand off to owned assets (a presentation .txt, optional _auto.yaml / _confirm.yaml, or scripts). It carries no inline dashboards, prompts, or result templates.
Detection signature. The validator treats a command as a router when any of:
render-command-contract marker is present (the compiled-stub variant, which has no authored section requirements); orPresentation Boundary section is present; or{Router Contract, Owned Assets, Mode Routing, Execution Targets} co-occur.Minimal core vs recommended. A router must include the blocking core only: Owned Assets and Presentation Boundary. The remaining canonical sections — Router Contract, Mode Routing, Execution Targets, Workflow Summary — are recommended and surface as non-blocking warnings when absent. Author the full shape for new routers; the minimal core lets incremental migrations land without failing.
Canonical vocabulary (numbered ## N., full integers). Use exactly these H2 names, in this order, for a fully-shaped router:
## 1. ROUTER CONTRACT
## 2. OWNED ASSETS
## 3. MODE ROUTING
## 4. EXECUTION TARGETS
## 5. PRESENTATION BOUNDARY
## 6. WORKFLOW SUMMARY
Do not invent divergent synonyms (Routing Assets, Workflow Routing, Execution Order); the validator alias-normalizes those as a safety net, but the authored end state is the canonical names above.
Ownership boundary. The router owns: the mandatory input gate or Phase 0, the owned-assets table, mode resolution, argument routing, execution-target selection, the presentation boundary, and a short workflow summary. The presentation asset owns: startup prompts and consolidated setup questions, auto fail-fast display text, dashboard and checkpoint layouts, success and failure result templates, and next-step suggestions. The router must not contain inline startup-question wording, dashboard templates, result templates, or next-step wording when a presentation asset exists. The split is behavior-preserving: move display content, do not change routing semantics.
Variants (one type, differing only by hand-off — not by required sections). Each maps to the contract's topology field:
topology: mode-pair) — routes execution into _auto.yaml / _confirm.yaml workflow assets; EXECUTION TARGETS is the | Mode | Target | table.topology: direct-dispatch) — dispatches directly to tools or scripts, no workflow YAML; the mode table is not required.topology: subaction-route-manifest) — a direct-dispatch router that resolves sub-actions through an owned _routes.yaml manifest.render-command-contract marker whose contract is rendered at invocation; exempt from authored section requirements (retained variant; no command currently uses it).Which family uses which topology is defined by the machine-readable command contract (assets/command-contract.json, validated by assets/command-contract.schema.json); consult it rather than a hand-maintained family list. Use assets/command-router-template.md for the canonical numbered router skeleton, and assets/command-presentation-template.md for the full presentation asset skeleton.
Template self-sufficiency. Each router variant must be authorable from its template alone — command-router-template.md plus the family's command-contract.json entry carry every section, vocabulary, and asset-path shape a new router needs. If a required shape is not derivable from the template and the contract, the template is incomplete: fix the template rather than copying a sibling command. This keeps the contract the single source and lets generate-command-routers.cjs --check detect drift instead of it hiding in hand-copied prose.
For commands that delete data or make irreversible changes, include:
--confirm only when explicitly designed to skip the prompt.STATUS=CANCELLED ACTION=cancelled when the user aborts.Do not ship destructive commands without confirmation and recovery design.
Before publishing or claiming the command is valid, verify:
description exists, is action-oriented, and is single-line.argument-hint exists when arguments are expected.allowed-tools lists only tools actually used.<arguments> have a mandatory gate immediately after frontmatter.## N. SECTION-NAME.OWNED ASSETS + PRESENTATION BOUNDARY) and use the canonical numbered vocabulary from Step 11; remaining router sections are present or intentionally left as warnings.Run shared validators when available:
python3 ../shared/scripts/check_authored_name_kebab.py <command-file.md>
python3 ../shared/scripts/validate_document.py <command-file.md> --type command
python3 ../shared/scripts/extract_structure.py <command-file.md>
Exit code 0 from the authored-name checker and validate_document.py is required before stating that the command document is structurally valid. If validation cannot be run, say that explicitly.
Always:
argument-hint for expected user input.description concise, single-line, and invocation-oriented.allowed-tools least-privilege and accurate.allowed-tools.graph-metadata.json.Never:
allowed-tools just in case.Escalate if:
A command produced through this packet is complete when:
description, an argument-hint whenever user input is expected, and a least-privilege allowed-tools list using fully qualified MCP tool IDs.<argument> has a mandatory input gate immediately after frontmatter that forbids inference and waits for explicit input.## N. SECTION-NAME headings, actionable steps, two or three example invocations, and structured status output.OWNED ASSETS plus PRESENTATION BOUNDARY), use the canonical numbered vocabulary, and hold no presentation templates when a presentation asset exists.validate_document.py exits 0, or its absence is stated explicitly rather than assumed.Use these only for overflow detail, long examples, and exact skeletons:
references/README.md - overflow route map for this packet; indexes the single-concern reference files below.references/worked-example.md - the canonical file contract plus a fully worked split command (router .md and presentation .txt).references/router-presentation-split.md - router/presentation ownership, the before/after split transformation, and the behavior-preserving rule.references/argument-hints-and-modes.md - argument-hint design patterns, :auto/:confirm mode design, and frontmatter/description budget tips.references/common-pitfalls.md - command-vs-skill-vs-agent selection and the common command-authoring mistakes table.assets/command-template.md - exhaustive command type templates, examples, vocabulary, and validation checklist.assets/command-router-template.md - canonical numbered router skeleton with variant call-outs.assets/command-presentation-template.md - full _presentation.txt skeleton for split command families.assets/command-contract.json / assets/command-contract.schema.json - machine-readable behavioral contract for the command families and its schema.../shared/references/core-standards.md - shared document quality standards.../shared/references/validation.md - shared validation expectations.../shared/scripts/validate_document.py - blocking structure validation.../shared/scripts/extract_structure.py - structure extraction for review.Frequently asked questions
create-command is the command-authoring workflow packet of the sk-doc parent hub. It creates and improves OpenCode slash commands under .opencode/commands/ with executable workflows, precise frontmatter, required input gates, least-privilege tools, and router/presentation separa…
The source record exposes this install command: npx skills add https://github.com/MichelKerkmeester/opencode--skilled-agent-loops-with-spec-kit-memory --skill ".opencode/skills/sk-doc/sk-create-command". Inspect the command and pinned source before running it.
Static rules flagged exec-script in the source; the page lists the matching lines and excerpts.
Alternatives
garrytan/gbrain
End-to-end discipline for turning any large data source (audio libraries, email takeouts, document corpora, chat exports, API dumps) into brain pages at scale. The lifecycle spine: SCHEMA → ACCESS → TRIAL → EVALUATE → IMPROVE → CODIFY → TEST → SKILLIFY → BULK → MONITOR. State is tracked in a durable JSON manifest (see MANIFEST-PATTERN.md) so any crash, session boundary, or subagent fan-out resumes from ground truth instead of memory.
alirezarezvani/claude-skills
App Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklist
wanshuiyin/Auto-claude-code-research-in-sleep
Use it for operations and research tasks; the detail page covers purpose, installation, and practical steps.
prowler-cloud/prowler
PostgreSQL indexing best practices for Prowler: index design, partial indexes, partitioned table indexing, EXPLAIN ANALYZE validation, concurrent operations, monitoring, and maintenance. Trigger: When creating or modifying PostgreSQL indexes, analyzing query performance with EXPLAIN, debugging slow queries, reviewing index usage statistics, reindexing, dropping indexes, or working with partitioned table indexes. Also trigger when discussing index strategies, partial indexes, or index maintenance