Token导航 LogoToken导航

Agent Skill · 研究检索

agent-spec-tool-first(首先是 Agent 规范工具)

agent-spec-tool-first 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

agent-spec-tool-first 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为执行命令;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 57,063。

总安装 441周安装 18GitHub Stars 224下载 141核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:agent-spec-tool-first(首先是 Agent 规范工具)
来源仓库:https://github.com/zhanghandong/agent-spec
仓库路径:skills/agent-spec-tool-first
安装命令:
npx skills add https://github.com/zhanghandong/agent-spec --skill agent-spec-tool-first
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/zhanghandong/agent-spec --skill agent-spec-tool-first

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于基于 agent-spec CLI 工具驱动的合同式编码流程。适合计划、实现、验证和调试规格化任务时使用。通过 GitHub 安装,依赖 agent-spec CLI 工具链。遵循 Intent、Decisions、Boundaries 等合同要素执行。

支持生命周期检查和 git trailer 标注,便于审计追踪。

来源仓库内路径:skills/agent-spec-tool-first

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/zhanghandong/agent-spec --skill agent-spec-too…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要执行命令,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

agent-spec-tool-first 怎么安装?

在终端执行 npx skills add https://github.com/zhanghandong/agent-spec --skill agent-spec-tool-first。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

agent-spec-tool-first 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

agent-spec-tool-first 需要什么权限?

权限级别是执行命令。安装流程涉及命令执行,可能通过 npx skills add https://github.com/zhanghandong/agent-spec --skill agent-spec-tool-first 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

agent-spec-tool-first 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

agent-spec-tool-first 用的人多吗?

公开数据是累计安装 441 次,近一周安装 18 次,下载 141 次,GitHub 224 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

agent-spec-tool-first 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 需要执行命令,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 不能接受 Skill 在你机器上执行命令的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
agent-spec-tool-first

首先是 Agent 规范工具 · 本页

441224执行命令未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Agent Spec Tool-First Workflow

Version: 3.2.0 | Last Updated: 2026-03-19

You are an expert at using agent-spec as a CLI tool for contract-driven AI coding. Help users by:

  • Planning: Render task contracts with contract, generate plan context with plan
  • Implementing: Follow contract Intent, Decisions, Boundaries
  • Verifying: Run lifecycle / guard to check code against specs
  • Reviewing: Use explain for human-readable summaries, stamp for git trailers
  • Debugging: Interpret verification failures and fix code accordingly

IMPORTANT: CLI Prerequisite Check

Before running any agent-spec command, Claude MUST check:

command -v agent-spec || cargo install agent-spec

If agent-spec is not installed, inform the user:

agent-spec CLI not found. Install with: cargo install agent-spec

Core Mental Model

The key shift: Review point displacement. Human attention moves from "reading code diffs" to "writing contracts".

Traditional:  Write Issue (10%) → Agent codes (0%) → Read diff (80%) → Approve (10%)
agent-spec:   Write Contract (60%) → Agent codes (0%) → Read explain (30%) → Approve (10%)

Humans define "what is correct" (Contract). Machines verify "is the code correct" (lifecycle). Humans do final "Contract Acceptance" — not Code Review.

Quick Reference

CommandPurposeWhen to Use
agent-spec initScaffold new specStarting a new task
agent-spec contract <spec>Render Task ContractBefore coding - read the execution plan
agent-spec plan <spec> --code.Generate plan contextBefore coding - codebase scan + task sketch
agent-spec lint <files>Spec quality checkAfter writing spec, before giving to Agent
agent-spec lifecycle <spec> --code.Full lint + verify pipelineAfter edits - main quality gate
agent-spec guard --spec-dir specs --code.Repo-wide checkPre-commit / CI - all specs at once
agent-spec explain <spec> --format markdownPR-ready review summaryContract Acceptance - paste into PR
agent-spec explain <spec> --historyExecution historySee how many retries the Agent needed
agent-spec stamp <spec> --dry-runPreview git trailersBefore committing - traceability
agent-spec verify <spec> --code.Raw verification onlyWhen you want verify without lint gate
agent-spec checkpoint statusVCS-aware statusCheck uncommitted state

Documentation

Refer to the local files for detailed command patterns:

  • ./references/commands.md - Complete CLI command reference with all flags

IMPORTANT: Documentation Completeness Check

Before answering questions, Claude MUST:

  1. Read ./references/commands.md for exact command syntax
  2. If file read fails: Inform user "references/commands.md is missing, answering from SKILL.md patterns"
  3. Still answer based on SKILL.md patterns + built-in knowledge

The Seven-Step Workflow

Step 1: Human writes Task Contract (human attention: 60%)

Not a vague Issue — a structured Contract with Intent, Decisions, Boundaries, Completion Criteria.

agent-spec init --level task --lang zh --name "用户注册API"
# Then fill in the four elements in the generated .spec.md file

For rewrite, migration, or parity tasks, prefer the parity-aware scaffold:

agent-spec init --level task --template rewrite-parity --lang en --name "CLI Parity Contract"

Key principle: Exception scenarios >= happy path scenarios. 1 happy + 3 error paths forces you to think through edge cases before coding begins.

Step 2: Contract quality gate

Check Contract quality before handing to Agent. Like "code review" but for the Contract itself.

agent-spec parse specs/user-registration.spec
agent-spec lint specs/user-registration.spec --min-score 0.7

Catches: malformed structure, zero-scenario acceptance sections, vague verbs, unquantified constraints, non-deterministic wording, missing test selectors, sycophancy bias, uncovered constraints, uncovered decisions (decision-coverage), unbound observable behavior decisions (observable-decision-coverage), uncovered output modes (output-mode-coverage), unverified precedence/fallback chains (precedence-fallback-coverage), weak mock-only I/O error scenarios (external-io-error-strength), missing verification-strength metadata on I/O scenarios (verification-metadata-suggestion), missing error paths (error-path), universal claims with insufficient scenarios (universal-claim), boundary entry points without matching scenarios (boundary-entry-point), untested flag combinations (flag-combination-coverage), untagged platform-specific decisions (platform-decision-tag).

Required self-checks before coding:

  • agent-spec parse must show the expected section count and a non-zero scenario count for task specs.
  • If Acceptance Criteria: 0 scenarios appears, stop and rewrite the spec before running contract or lifecycle.
  • The parser accepts Markdown-heading forms like ### Scenario: and ### Test: for compatibility, but authoring should still emit bare Scenario: / 场景: and Test: / 测试: lines by default. Do not invent extra top-level sections like ## Milestones.

Unbound Observable Behavior review:

  • After parse + lint, ask which stdout, stderr, file, network, cache, and persisted-state behaviors are still unbound.
  • If the task is a rewrite, migration, or parity effort, also ask whether the contract covers:

- command x output mode - local x remote - warm cache x cold start - fallback / precedence order - partial failure vs hard failure

  • If any of these surfaces are still only described in prose, switch back to authoring mode and add scenarios before coding.

Optional: team "Contract Review" — review 50-80 lines of natural language instead of 500 lines of code diff.

Step 3: Agent reads Contract, generates plan, and codes

Agent consumes the structured contract and generates plan context:

# Read the contract
agent-spec contract specs/user-registration.spec

# Generate plan context with codebase scan
agent-spec plan specs/user-registration.spec --code . --format prompt

The plan command outputs three blocks:

  • Contract — the full task contract (same as contract command)
  • Codebase Context — files in Allowed Changes paths with summaries, pub signatures, and test function names
  • Task Sketch — scenarios grouped by dependency order for implementation sequencing

Use --format prompt to get a self-contained prompt for AI plan generation. Use --depth full to include pub API signatures.

Agent is triple-constrained:

  • Decisions tell it "how to do it" (no technology shopping)
  • Boundaries tell it "what to touch" (no unauthorized file changes)
  • Completion Criteria tell it "when it's done" (all bound tests must pass)

Step 4: Agent self-checks with lifecycle (automatic retry loop)

agent-spec lifecycle specs/user-registration.spec \
  --code . --change-scope worktree --format json --run-log-dir .agent-spec/runs

Four verification layers run in sequence:

  1. lint — re-check Contract quality (prevent spec tampering)
  2. StructuralVerifier — pattern match Must NOT constraints against code
  3. BoundariesVerifier — check changed files are within Allowed Changes
  4. TestVerifier — execute tests bound to each scenario
Agent retry loop (no human needed):
  Code → lifecycle → FAIL (2/5) → read failure_summary → fix → lifecycle → FAIL (4/5) → fix → lifecycle → PASS (5/5) ✓

Run logs record this history — "this Contract took 3 tries to pass".

The Iron Law
NO CODE IS "DONE" WITHOUT A PASSING LIFECYCLE

If lifecycle hasn't run in this session, you cannot claim completion. If lifecycle ran but had failures, code is not done. No exceptions.

Retry Protocol

When lifecycle fails, follow this exact sequence:

  1. Run: agent-spec lifecycle <spec> --code. --format json
  2. Parse JSON output, find each scenario's verdict and evidence
  3. For fail: the bound test ran and failed — read evidence to understand why, fix code
  4. For skip: the bound test was not found — check Test: selector matches a real test name
  5. For uncertain: AI verification pending — review manually or enable AI backend
  6. Fix code based on evidence. Do NOT modify the spec file — changing the Contract to make verification pass is sycophancy, not a fix
  7. Re-run lifecycle
  8. After 3 consecutive failures on the same scenario, stop and escalate to the human

Critical rule: The spec defines "what is correct". If the code doesn't match, fix the code. If the spec itself is wrong, switch to authoring mode and update the Contract explicitly — never silently weaken acceptance criteria.

Red Flags — Stop If You're Thinking This
ThoughtReality
"lifecycle is slow, skip it this once"Skipping verification = delivering unverified code
"I only changed one line, no need to re-run"One line can break every scenario
"skip means it's fine"skip ≠ pass. skip = not verified
"The spec is too strict, let me adjust it"Changing spec to pass isn't fixing — it's weakening the contract
"3 failures already, just submit what I have"3 failures → stop and escalate to human
"I ran lifecycle earlier, it should still pass""Should" is not evidence. Run it again.
"The test is flaky, not my code"Prove it: run 3 times. If 2+ pass, investigate flake. If 0-1 pass, it's your code.

Step 5: Guard gate (pre-commit / CI)

# Pre-commit hook
agent-spec guard --spec-dir specs --code . --change-scope staged

# CI (GitHub Actions)
agent-spec guard --spec-dir specs --code . --change-scope worktree

Runs lint + verify on ALL specs against current changes. Blocks commit/PR if any spec fails.

Step 6: Contract Acceptance replaces Code Review (human attention: 30%)

Human reviews a Contract-level summary, not a code diff:

agent-spec explain specs/user-registration.spec --code . --format markdown

Evidence gate: Before presenting results to the reviewer, run agent-spec explain <spec> --format markdown fresh. Read the output. Confirm all verdicts are pass. Do NOT report results from memory — run the command and read the output in this session.

Reviewer judges two questions:

  1. Is the Contract definition correct? (Intent, Decisions, Boundaries make sense?)
  2. Did all verifications pass? (4/4 pass including error paths?)

If both "yes" → approve. This is 10x faster than reading code diffs.

Check retry history if needed:

agent-spec explain specs/user-registration.spec --code . --history
Assisting Contract Acceptance

When helping a human review a completed task:

  1. Run agent-spec explain <spec> --code. --format markdown and present the output
  2. If human asks about retry history: run with --history flag
  3. If human asks about specific failures: run agent-spec lifecycle <spec> --code. --format json and extract the relevant scenario results
  4. If human approves: run agent-spec stamp <spec> --code. --dry-run and present the trailers

Step 7: Stamp and archive

agent-spec stamp specs/user-registration.spec --dry-run
# Output: Spec-Name: 用户注册API
#         Spec-Passing: true
#         Spec-Summary: 4/4 passed, 0 failed, 0 skipped, 0 uncertain

Establishes Contract → Commit traceability chain.

Verdict Interpretation

VerdictMeaningAction
passScenario verifiedNo action needed
failScenario failed verificationRead evidence, fix code
skipTest not found or not runAdd missing test or fix selector
uncertainAI stub / manual review neededReview manually or enable AI backend

Key rule: skip!= pass. All four verdicts are distinct.

VCS Awareness

agent-spec auto-detects the VCS from the project root. Behavior differs between git and jj:

ConditionBehavior
.jj/ exists (even with .git/)Use --change-scope jj instead of worktree
jj repoDo NOT run git add or git commit — jj auto-snapshots all changes
jj repostamp output includes Spec-Change: trailer with jj change ID
jj repoexplain --history shows file-level diffs between runs (via operation IDs)
Only .git/Use standard git commands (--change-scope staged or worktree)
NeitherChange scope detection unavailable; use --change <path> explicitly

Change Set Options

FlagBehaviorDefault
--change <path>Explicit file/dir for boundary checking(none)
--change-scope stagedGit staged filesguard default
--change-scope worktreeAll git working tree changes(none)
--change-scope jjJujutsu VCS changes(none)
--change-scope noneNo change detectionlifecycle/verify default

Advanced Features

Verification Layers

# Run only specific layers
agent-spec lifecycle specs/task.spec --code . --layers lint,boundary,test
# Available: lint, boundary, test, ai

Run Logging

agent-spec lifecycle specs/task.spec --code . --run-log-dir .agent-spec/runs
agent-spec explain specs/task.spec --history

AI Mode

agent-spec verify specs/task.spec --code . --ai-mode off      # default - no AI
agent-spec verify specs/task.spec --code . --ai-mode stub      # testing only
agent-spec lifecycle specs/task.spec --code . --ai-mode caller # agent-as-verifier

AI Verification: Caller Mode

When --ai-mode caller is used, the calling Agent acts as the AI verifier. This is a two-step protocol:

Step 1: Emit AI requests

agent-spec lifecycle specs/task.spec --code . --ai-mode caller --format json

If any scenarios are skipped (no mechanical verifier covered them), the output JSON includes:

  • "ai_pending": true
  • "ai_requests_file": ".agent-spec/pending-ai-requests.json"

The pending requests file contains AiRequest objects with scenario context, code paths, contract intent, and constraints.

Step 2: Resolve with external decisions

The Agent reads the pending requests, analyzes each scenario, then writes decisions:

[
  {
    "scenario_name": "场景名称",
    "model": "claude-agent",
    "confidence": 0.92,
    "verdict": "pass",
    "reasoning": "All steps verified by code analysis"
  }
]

Then merges them back:

agent-spec resolve-ai specs/task.spec --code . --decisions decisions.json

This produces a final merged report where Skip verdicts are replaced with the Agent's AI decisions.

When to use caller mode:

  • When the calling Agent (Claude, Codex, etc.) can read and reason about code
  • For scenarios that can't be verified by tests alone (design intent, code quality)
  • When you want the Agent to be both implementor and verifier

When to Use / When NOT to Use

ScenarioUse agent-spec?Why
Clear feature with defined inputs/outputsYesContract can express deterministic acceptance criteria
Bug fix with reproducible stepsYesGreat for "given bug X, when fixed, then Y"
Exploratory prototypingNoYou don't know "what is done" yet - vibe code first
Large architecture refactorNoBoundaries hard to define, "better architecture" isn't testable
Security/compliance rulesYes (org.spec)Encode rules once, enforce mechanically everywhere

Gradual Adoption

Week 1-2:  Pick 2-3 clear bug fixes, write Contracts for them
Week 3-4:  Expand to new feature development
Week 5-8:  Create project.spec with team coding standards
Month 3+:  Consider org.spec for cross-project governance

Common Errors

ErrorCauseSolution
Guard reports N specs failingSpecs have lint or verify issuesRun lifecycle on each failing spec individually
skip verdict on scenarioTest selector doesn't match any testCheck Test: / Package: / Filter: in spec
Quality score below thresholdToo many lint warningsFix vague verbs, add quantifiers, improve testability
Boundary violation detectedChanged file outside allowed pathsEither update Boundaries or revert the change
uncertain on all AI scenariosUsing --ai-mode stub or no backendExpected — review manually
Agent keeps failing lifecycleContract criteria too vague or too strictImprove Completion Criteria specificity

Command Priority

PreferenceUseInstead of
contractRender task contractbrief (legacy alias)
planContract + codebase + sketchManual code exploration
lifecycleFull pipelineverify alone (misses lint)
guardRepo-wideMultiple individual lifecycle calls
--changeExplicit paths known--change-scope when paths are known
CLI commandsTool-first approachspec-gateway library API

When to Switch to Authoring Mode

During implementation, if you discover:

  • A missing exception path that should be in Completion Criteria
  • A Boundary that's too restrictive (need to modify more files than allowed)
  • A Decision that needs to change (technology choice was wrong)

Switch to agent-spec-authoring skill, update the Contract FIRST, re-run agent-spec lint to validate the change, then resume implementation. Do NOT silently work outside the Contract's boundaries.

Escalation

Switch to library integration only when:

  • Embedding agent-spec into another Rust agent runtime
  • Testing spec-gateway internals
  • Injecting a host AiBackend via verify_with_backend(Arc<dyn AiBackend>)

平台分布

Codex

34.99%
按下载量换算49

Claude

27.15%
按下载量换算38

Cursor

19.47%
按下载量换算27

Gemini CLI

9.82%
按下载量换算14

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/zhanghandong/agent-spec --skill agent-spec-tool-first 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills