example

An example command showing how to create a Spec Kit extension command, including configuration checks, settings, an external tool call, and result output.

In plain words
What is it for?
Use it as a starting point when documenting or implementing a command that depends on configuration and an MCP server tool.
Why use it?
It gives developers a concrete pattern for loading extension configuration, validating required values, and reporting success or errors.

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/linfee/spec-kit-cn/example
Clone the repo
git clone --depth 1 https://github.com/Linfee/spec-kit-cn
Per session 10 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,124 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.00010 $0.01124
Opus 5 $0.00005 $0.00562
Sonnet 5 $0.00002 $0.00225
Haiku 4.5 $0.00001 $0.00112

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

Security

Grade A, and why

example 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 2d ago.

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.

extensions/template/commands/example.md · 202 lines

How it starts

The opening of the file, as written. The whole thing — 202 lines — stays where its author put it; the contents beside it link to each section on GitHub.

示例命令

这是一个示例命令,用于演示如何为 Spec Kit 扩展创建命令。

用途

描述此命令的作用以及适用场景。

先决条件

列出使用此命令前的要求:

  1. 先决条件 1(例如 “MCP server configured”)
  2. 先决条件 2(例如 “Configuration file exists”)
  3. 先决条件 3(例如 “Valid API credentials”)

用户输入

$ARGUMENTS

步骤

步骤 1:加载配置

从项目中加载扩展配置:

config_file=".specify/extensions/my-extension/my-extension-config.yml"

if [ ! -f "$config_file" ]; then
  echo "❌ Error: Configuration not found at $config_file"
  echo "Run 'specify-cn extension add my-extension' to install and configure"
  exit 1
fi

# Read configuration values
setting_value=$(yq eval '.settings.key' "$config_file")

# Apply environment variable overrides
setting_value="${SPECKIT_MY_EXTENSION_KEY:-$setting_value}"

# Validate configuration
if [ -z "$setting_value" ]; then
  echo "❌ Error: Configuration value not set"
  echo "Edit $config_file and set 'settings.key'"
  exit 1
fi

echo "📋 Configuration loaded: $setting_value"

步骤 2:执行主要操作

描述此步骤要做什么:

使用 MCP 工具执行主要操作:

  • Tool: example-mcp-server example_tool
  • Parameters: { "key": "$setting_value" }

这会调用 MCP server 工具来执行操作。

步骤 3:处理结果

处理结果并输出:

echo ""
echo "✅ Command completed successfully!"
echo ""
echo "Results:"
echo "  • Item 1: Value"
echo "  • Item 2: Value"
echo ""

步骤 4:保存输出(可选)

如果需要将结果保存到文件:

output_file=".specify/my-extension-output.json"

cat > "$output_file" <<EOF
{
  "timestamp": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")",
  "setting": "$setting_value",
  "results": []
}
EOF

echo "💾 Output saved to $output_file"

配置参考

此命令使用 my-extension-config.yml 中的以下配置:

  • settings.key: 此设置的用途说明

    • Type: string
    • Required: Yes
    • Example: "example-value"
  • settings.another_key: 另一个设置的说明

    • Type: boolean
    • Required: No
    • Default: false
    • Example: true

环境变量

可以使用环境变量覆盖配置:

  • SPECKIT_MY_EXTENSION_KEY - 覆盖 settings.key
  • SPECKIT_MY_EXTENSION_ANOTHER_KEY - 覆盖 settings.another_key

Read the full file on GitHub · 202 lines

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. 2d ago First seen · 202 lines · 10 tokens per session scan A 5adde9b023bc

Subscribe to this mod's changes

example is a command published in the GitHub repository Linfee/spec-kit-cn (695 stars, last pushed 1mo ago), licensed MIT. It adds 10 tokens to every session and 1,124 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-30.