selftest

selftest is a command for coding agents from Linfee/spec-kit-cn. It costs 10 tokens per session (573 once invoked), scanned A, original, MIT.

An end-to-end self-test for a named extension in the Spec Kit catalogue. It checks whether the extension can be found, added, and recorded as installed.

In plain words
What is it for?
Testing an extension’s catalogue entry, simulating both normal and download-based installation, checking its registry record, and producing a pass-or-fail terminal report.
Why use it?
It catches problems in an extension’s discovery, installation, or registration process before users encounter them.

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/selftest
Clone the repo
git clone --depth 1 https://github.com/Linfee/spec-kit-cn

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for selftest

README.md
[![agentmods](https://agentmods.dev/badge/commands/linfee/spec-kit-cn/selftest.svg)](https://agentmods.dev/commands/linfee/spec-kit-cn/selftest)
Your own site
<a href="https://agentmods.dev/commands/linfee/spec-kit-cn/selftest"><img src="https://agentmods.dev/badge/commands/linfee/spec-kit-cn/selftest.svg" alt="Measured on agentmods" height="20"></a>
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 573 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.00573
Opus 5 $0.00005 $0.00287
Sonnet 5 $0.00002 $0.00115
Haiku 4.5 $0.00001 $0.00057

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

Security

Grade A, and why

selftest 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 4d 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/selftest/commands/selftest.md · 70 lines

What it actually says

扩展自测:$ARGUMENTS

此命令用于执行一次自测,模拟开发者使用 $ARGUMENTS 扩展时的完整体验。

目标

验证扩展 $ARGUMENTS 的端到端生命周期(发现、安装、注册)。 如果 $ARGUMENTS 为空,你必须提示用户提供扩展名称,例如:/speckit.selftest.extension linear

步骤

步骤 1:验证目录发现

检查该扩展是否存在于 Spec Kit 目录中。 执行下面的命令,并验证它成功完成,且返回的扩展 ID 与 $ARGUMENTS 完全一致。如果命令失败,或 ID 与 $ARGUMENTS 不匹配,则测试失败。

specify-cn extension info "$ARGUMENTS"

步骤 2:模拟安装

首先,尝试直接将该扩展添加到当前工作区配置中。如果目录将该扩展标记为 install_allowed: false(仅发现,不允许直接安装),那么此步骤预期会失败。

specify-cn extension add "$ARGUMENTS"

随后,通过目录中的下载 URL 来模拟添加该扩展,这应当绕过限制。 从目录元数据中获取扩展的 download_url(例如通过目录信息命令或 UI),然后运行:

specify-cn extension add "$ARGUMENTS" --from "<download_url>"

步骤 3:验证注册结果

add 命令完成后,通过检查项目配置来验证安装结果。 使用终端工具(如 cat)检查下面的文件是否包含 $ARGUMENTS 的注册记录。

cat .specify/extensions/.registry/$ARGUMENTS.json

步骤 4:输出验证报告

分析前面三个步骤的标准输出。 生成一种终端风格的测试输出格式,说明发现、安装和注册的结果,并直接返回给用户。

示例输出格式:

============================= test session starts ==============================
collected 3 items

test_selftest_discovery.py::test_catalog_search [PASS/FAIL]
  Details: [Provide execution result of specify-cn extension search]

test_selftest_installation.py::test_extension_add [PASS/FAIL]
  Details: [Provide execution result of specify-cn extension add]

test_selftest_registration.py::test_config_verification [PASS/FAIL]
  Details: [Provide execution result of registry record verification]

============================== [X] passed in ... ==============================
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. 4d ago First seen · 70 lines · 10 tokens per session scan A 0e352b933e29

Subscribe to this mod's changes

selftest 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 573 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.