spec

A shortcut that creates a technical specification for a proposed feature without creating the full implementation plan.

In plain words
What is it for?
Use it for a small feature or a single-file change when you need an agreed design first. The workflow researches documentation, writes the specification, and waits for confirmation before coding.
Why use it?
It lets you settle the design before coding, including interfaces, data structures, dependencies, validation commands, and known limitations.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/zhmxiaowo/opencode-simple/spec
Clone the repo
git clone --depth 1 https://github.com/zhmxiaowo/opencode-simple
Per session 23 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 421 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00023 $0.00421
Opus 5 $0.00012 $0.00211
Sonnet 5 $0.00005 $0.00084
Haiku 4.5 $0.00002 $0.00042

Measured yesterday against content hash 2e518d3a52a5, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

spec scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.opencode/commands/spec.md · 43 lines

What it actually says

/spec — Spec-First 快捷方式

/plan 的轻量版本 — 只输出 SPEC 部分,跳过实施步骤分解。

说明

/spec/plan 共享同一个 planner agent 和同一套 Spec-First 流程(MCP 文档研究 → SPEC 输出 → 等待确认),区别仅在于:

命令 输出内容
/plan SPEC + 实施步骤 + 风险评估(完整)
/spec 仅 SPEC(API 设计、数据模型、依赖、编译计划)

工作流程

  1. 需求确认 — 提取功能名称、技术栈、核心需求
  2. MCP 文档研究 — 并行调用 context7(官方文档)+ exa-web-search(社区实践)
  3. 输出 SPEC — 生成包含以下章节的规范文档:
    • API / 接口设计(精确到可直接复制到代码)
    • 数据模型
    • 依赖项及版本
    • 编译验证计划(具体命令)
    • 已知限制 & 兼容性
    • 参考文档链接
  4. 等待确认 — 必须等用户明确确认后方可编码

参数

  • /spec Unity PlayerController
  • /spec Cocos 2D骨骼动画
  • /spec UE5 Gameplay Ability System
  • /spec React Dashboard

何时用 /spec,何时用 /plan

  • 小功能 / 单文件改动/spec 足够
  • 多文件 / 跨模块 / 需要分阶段实施 → 用 /plan(包含 SPEC + 完整步骤)
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 43 lines · 23 tokens per session scan A 2e518d3a52a5

Subscribe to this mod's changes

spec is a command published in the GitHub repository zhmxiaowo/opencode-simple (2 stars, last pushed 5mo ago), licensed MIT. It adds 23 tokens to every session and 421 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.