Token导航 LogoToken导航

Agent Skill · 开发

agent-spec-authoring(Agent 规范编写)

用于辅助安全审计、权限检查、凭据风险、认证流程和常见漏洞排查。它适合让 Agent 梳理敏感配置、检查依赖风险、分析鉴权逻辑或生成安全复核清单。使用时不能把工具输出直接当最终结论,涉及密钥、令牌、用户数据或生产系统时,应先确认最小权限、脱敏方式和操作边界。

agent-spec-authoring 是开发类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为调用外部服务;许可证信息还不明确,第三方扫描已通过,按安装量在开发类的 21,746 个 Skill 里排第 17,537。

总安装 399周安装 16GitHub Stars 224下载 129核验 2026-05-01

安装说明

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

安装方式

通过对话安装

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

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

命令行安装

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

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

这个 Skill 是做什么的

开发类 Skill 面向写代码、改代码和排查问题,一般会读写仓库文件,部分还会执行构建或测试命令。

用于编写结构化任务契约(.spec.md)的专业助手。适合创建、编辑或调试 Agent 规格文档时使用。通过 GitHub 安装,依赖 agent-spec CLI 工具链。支持 BDD 风格场景编写和测试选择器定义。agent-spec-authoring 属于开发类 Skill,可作为该场景下的辅助能力补充。

提供质量评分与警告修复建议,提升规格可读性。

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

上手步骤

4 步
  1. 1

    确认自己的宿主工具

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

  2. 2

    拿到安装命令

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

  3. 3

    安装后重启宿主

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

  4. 4

    按最小权限试用

    它需要调用外部服务,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

agent-spec-authoring 怎么安装?

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

agent-spec-authoring 支持哪些 AI 工具?

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

agent-spec-authoring 需要什么权限?

权限级别是调用外部服务。该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

agent-spec-authoring 是免费的吗?

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

agent-spec-authoring 用的人多吗?

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

agent-spec-authoring 安全吗?

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

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

值得选的地方

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

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

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

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

开发类 Skill 对比

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

技能审查员 · OpenClaw

8,779,018986操作浏览器MIT-0通过
ontology

本体论 · OpenClaw

6,636,960576只读MIT-0通过
entra-app-registration

内部应用程序注册 · Codex、Claude

6,631,872764接触敏感数据未明确通过
entra-app-registration

内部应用程序注册 · Codex、Claude

3,757,680201接触敏感数据未明确通过
nano-banana-pro

纳米香蕉专业版 · OpenClaw

3,526,898364接触敏感数据MIT-0有提醒
agent-spec-authoring

Agent 规范编写 · 本页

399224调用外部服务未明确通过

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

SKILL.md 原文

Agent Spec Authoring

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

You are an expert at writing agent-spec Task Contracts. Help users by:

  • Creating specs: Scaffold new .spec.md files with correct structure (.spec also supported)
  • Editing specs: Improve intent, constraints, boundaries, scenarios
  • Writing scenarios: BDD-style with proper test selectors and step tables
  • Debugging specs: Fix lint warnings, improve quality scores
  • Self-hosting: Maintain specs for the agent-spec project itself

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 Philosophy

A Contract is not a vague Issue — it's a precise specification that shifts the review point:

Traditional:  Human reviews 500 lines of code diff (slow, error-prone)
agent-spec:   Human writes 50-80 lines of Contract (fast, high-value)
              Machine verifies code against Contract (deterministic)

Writing a Contract is the highest-value human activity in the agent-spec workflow. You're defining "what is correct" — the machine handles "is the code correct".

Quick Reference

SectionChinese HeaderEnglish HeaderPurpose
Intent## 意图## IntentWhat to do and why
Constraints## 约束## ConstraintsMust / Must NOT rules
Decisions## 已定决策 / ## 决策## DecisionsFixed technical choices
Boundaries## 边界## BoundariesAllowed / Forbidden / Out-of-scope
Acceptance Criteria## 验收标准 / ## 完成条件## Acceptance Criteria / ## Completion CriteriaBDD scenarios
Out of Scope## 排除范围## Out of ScopeExplicitly excluded items

Hard Syntax Rules

  • Use exactly one supported section header per line. Good: ## Intent or ## 意图. Bad: ## Intent / 意图.
  • Write scenarios as bare DSL lines under the acceptance section. Good: Scenario: / 场景:. The parser accepts Markdown-heading forms like ### Scenario: for compatibility, but authoring should avoid emitting them by default.
  • Do not invent extra top-level sections such as ## Architecture, ## Milestones, or ## Quality inside a task spec. Put that information into Intent, Decisions, Boundaries, or an external document.
  • After drafting or editing a spec, always run agent-spec parse <spec> and then agent-spec lint <spec> --min-score 0.7.

Documentation

Refer to the local files for authoring patterns and examples:

  • ./references/patterns.md - Complete authoring patterns with examples

IMPORTANT: Documentation Completeness Check

Before answering questions, Claude MUST:

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

Required Self-Check

After writing or editing a spec:

agent-spec parse specs/task.spec.md
agent-spec lint specs/task.spec.md --min-score 0.7

Do not hand a spec to an agent if:

  • agent-spec parse shows Acceptance Criteria: 0 scenarios
  • lint reports missing explicit test selectors
  • lint score is below threshold

Behavior Surface Checklist

When authoring a contract for CLI tools, MCP servers, protocols, or parity rewrites, do not stop at the main happy path. Check these observable surfaces explicitly:

Observable Behavior

  • stdout vs stderr behavior
  • --json or machine-readable output
  • -o/--output and file side effects
  • local vs remote behavior
  • warm cache vs cold start
  • fallback / precedence order
  • partial failure vs hard failure
  • on-disk state changes and persisted files

Flag Combinations (lint: flag-combination-coverage)

  • Multi-value parameters (multi-ID, batch) combined with output flags
  • Single vs multiple entry behavior for -o, --full, --json
  • If your command has 2+ output-affecting flags, add at least one scenario that tests a combination

Platform-Specific Decisions (lint: platform-decision-tag)

  • When copying decisions from a reference implementation, tag platform-specific terms
  • Use markers like [JS-only], [platform-specific], or 不适用 to flag phantom requirements
  • The linter flags untagged references to npm, pip, cargo install, dist/, bundled dist, etc.

Architectural Invariants

  • If the reference implementation uses a specific processing pattern (e.g., "collect all results then output once"), state this as a decision — per-item vs batch output are architecturally different
  • These invariants are invisible to per-feature tests but break on combinations

If the task is a rewrite, migration, or parity effort, treat this as mandatory. Do not hand the contract to an agent until these observable behaviors are either:

  • covered by scenarios, or
  • explicitly declared out of scope

For these tasks, prefer starting from the parity-aware scaffold instead of the generic task template:

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

Before Writing a Contract

Not every task needs a Contract. Ask yourself:

QuestionIf No
Can I define what "done" looks like?Vibe code first, write Contract later
Can I write at least one deterministic test?Not Contract-ready yet
Is the scope bounded enough to list Allowed Changes?Split into smaller tasks
Do I know the key technical decisions?Do a spike/prototype first

If all "yes" — proceed with authoring. If not, doing exploratory work first is the right call.

The Four Elements of a Contract

1. Intent — What and Why

One focused paragraph. Not a feature list — a clear statement of purpose.

## Intent

为现有的认证模块添加用户注册 endpoint。新用户通过邮箱+密码注册,
注册成功后发送验证邮件。这是用户体系的第一步,后续会在此基础上
添加登录和密码重置。

Rules:

  • Focus on "what to do and why"
  • Mention context (what already exists, where this fits)
  • Keep it to 2-4 sentences
  • Do not combine bilingual section labels on the same header line

2. Decisions — Fixed Technical Choices

Already-decided choices. Not aspirational. Not options to explore.

## Decisions

- 路由: POST /api/v1/auth/register
- 密码哈希: bcrypt, cost factor = 12
- 验证 Token: crypto.randomUUID(), 存数据库, 24h 过期
- 邮件: 使用现有 EmailService,不新建

Rules:

  • Only choices that are already fixed — not "we should consider..."
  • Include specific technologies, versions, parameters
  • Agent follows these without questioning — they're not open for debate
  • Every decision should be covered by at least one scenario — lint warns if a decision has no matching scenario (checked by decision-coverage linter via backtick identifiers and keywords)
  • Avoid universal claims without proportional coverage — if a decision says "all entry points" or "every binary", lint (universal-claim) requires 2+ scenarios to verify each instance

3. Boundaries — What to Touch, What Not to Touch

Triple constraint: Allowed, Forbidden, Out-of-scope.

## Boundaries

### Allowed Changes
- crates/api/src/auth/**
- crates/api/tests/auth/**
- migrations/

### Forbidden
- 不要添加新的 npm/cargo 依赖
- 不要修改现有的登录 endpoint
- 不要在注册流程中创建 session

## Out of Scope

- 登录功能
- 密码重置
- OAuth 第三方登录

Rules:

  • Path globs (crates/auth/**) are mechanically enforced by BoundariesVerifier
  • Natural language prohibitions are checked by lint but not file-path enforced
  • Out of Scope prevents scope creep — Agent knows what NOT to attempt
  • If Boundaries list 2+ entry points (e.g. bin/cli.rs, bin/server.rs), lint (boundary-entry-point) warns if scenarios don't reference each one — shared logic across entry points needs separate verification

4. Completion Criteria — Deterministic Pass/Fail

BDD scenarios with explicit test bindings.

Critical principle: Exception scenarios >= happy path scenarios. Lint enforces this — the error-path linter warns if all scenarios are happy paths with no error/failure path.

## Completion Criteria

场景: 注册成功                                    ← 1 happy path
  测试: test_register_returns_201
  假设 不存在邮箱为 "alice@example.com" 的用户
  当 客户端提交注册请求:
    | 字段     | 值                |
    | email    | alice@example.com |
    | password | Str0ng!Pass#2026  |
  那么 响应状态码为 201
  并且 响应体包含 "user_id"

场景: 重复邮箱被拒绝                              ← exception path 1
  测试: test_register_rejects_duplicate_email
  假设 已存在邮箱为 "alice@example.com" 的用户
  当 客户端提交相同邮箱的注册请求
  那么 响应状态码为 409

场景: 弱密码被拒绝                                ← exception path 2
  测试: test_register_rejects_weak_password
  假设 不存在邮箱为 "bob@example.com" 的用户
  当 客户端提交密码为 "123" 的注册请求
  那么 响应状态码为 400

场景: 缺少必填字段                                ← exception path 3
  测试: test_register_rejects_missing_fields
  当 客户端提交缺少 email 字段的注册请求
  那么 响应状态码为 400

This forces you to think through edge cases before coding begins. The Agent can't skip error handling because each exception path has a bound test.

Rewrite / Parity Contracts

For rewrite, migration, and parity tasks, write a behavior matrix before writing scenarios. At minimum, ask whether the contract covers:

  • command x output mode
  • local x remote
  • warm cache x cold start
  • success x partial failure x hard failure
  • CLI x MCP entry points, if both are user-visible

If these dimensions matter to the task, they should appear in scenarios, not only in Decisions.

Spec File Structure

Frontmatter (YAML)

spec: task           # Level: org, project, task
name: "Task Name"   # Human-readable name
inherits: project    # Parent spec (optional)
tags: [feature, api] # Tags for filtering
---

Three-Layer Inheritance

org.spec(.md) → project.spec(.md) → task.spec(.md)
LayerScopeExample Content
org.spec.mdOrganization-wideCoding standards, security rules, forbidden patterns
project.spec.mdProject-levelTech stack decisions, API conventions, test requirements
task.spec.mdSingle taskIntent, boundaries, specific acceptance criteria

Both .spec and .spec.md extensions are recognized. .spec.md is preferred for new files (enables Markdown preview in editors and GitHub).

Constraints and decisions are inherited downward. Task specs inherit from project, which inherits from org.

BDD Step Keywords

EnglishChineseUsage
Given假设Precondition
When当Action
Then那么Expected result
And并且Additional step (same type as previous)
But但是Negative additional step

Test Selector Patterns

Simple selector

Scenario: Happy path
  Test: test_happy_path
  Given precondition
  When action
  Then result

Structured selector (cross-crate)

Scenario: Cross-crate verification
  Test:
    Package: spec-gateway
    Filter: test_contract_prompt_format
  Given a task spec
  When verified
  Then passes

Chinese equivalents

场景: 正常路径
  测试: test_happy_path

场景: 跨包验证
  测试:
    包: spec-gateway
    过滤: test_contract_prompt_format

Step Tables

For structured inputs, use tables instead of inventing custom prose:

Scenario: Batch validation
  Test: test_batch_validation
  Given the following input records:
    | name  | email           | valid |
    | Alice | alice@test.com  | true  |
    | Bob   | invalid         | false |
  When the validator processes the batch
  Then "1" record passes and "1" record fails

Boundary Patterns

Machine-enforced (path globs)

### Allowed Changes
- crates/spec-parser/**
- tests/parser_contract.rs

BoundariesVerifier checks actual changed files against these globs.

Natural language prohibitions

### Forbidden
- Do not break the existing JSON shape
- Do not introduce .unwrap()

Checked by lint, not mechanically enforced against file paths.

Use both when needed. Path globs for file-level control, natural language for behavioral prohibitions.

Common Errors

Lint WarningCauseFix
vague-verb"handle", "manage", "process", "处理"Be specific: "validate email format" not "handle email"
unquantified"fast", "efficient", "应该快速"Add metrics: "respond within 200ms" not "respond quickly"
testabilitySteps that can't be mechanically verifiedUse observable assertions: "returns error code X"
coverageConstraint with no covering scenarioAdd a scenario that exercises the constraint
determinismNon-deterministic step wordingRemove "should", "might"; use definitive assertions
implicit-depMissing Test: selector on scenarioAdd Test: test_name or structured Test: block
sycophancyBug-finding bias languageRemove "find all bugs", "must find issues"

Authoring Checklist

Before handing a Contract to an Agent, verify:

#CheckWhy
1Intent is 2-4 focused sentencesAgent needs clear direction, not a novel
2Decisions are specific (tech, version, params)Agent shouldn't be choosing technology
3Boundaries have path globs for Allowed ChangesEnables mechanical enforcement
4Exception scenarios >= happy path scenariosForces edge-case thinking upfront
5Every scenario has a Test: selectorRequired for TestVerifier to run
6Steps use deterministic wording"returns 201" not "should return 201"
7agent-spec lint score >= 0.7Quality gate before Agent starts

Common Rationalizations When Writing Specs

ExcuseReality
"This is too simple to need a spec"Simple tasks take 5 min to spec. Un-specced simple tasks scope-creep into complex ones.
"I'll write code first, then add the spec"Specs written after code conform to what was built, not what's correct.
"Exception paths don't matter much"Bugs live in exception paths. Lint enforces exception >= happy path count.
"I'll add Test selectors later"Scenarios without Test: get skip verdicts — they verify nothing.
"Boundaries are too restrictive"Boundaries are a safety net for the agent, not a limitation on you.
"One happy path scenario is enough"One scenario = one test = zero confidence in edge cases.
"The intent is obvious, no need to write it"Obvious to you ≠ obvious to the agent. Write it.

If you catch yourself using any of these, stop and write the spec properly.

Deprecated Patterns (Don't Use)

DeprecatedUse InsteadReason
Scenarios without Test:Always add Test: selectorRequired for mechanical verification
Vague boundaries like "be careful"Specific path globs or prohibitionsMust be mechanically checkable
"should" / "might" in stepsDefinitive "returns" / "is" / "becomes"Non-deterministic wording fails lint
brief command to previewcontract commandbrief is a legacy alias
Only happy path scenariosInclude exception paths (>= happy)Edge cases are where bugs live

Self-Hosting Rules

When authoring specs for the agent-spec project itself:

  • Put task specs under specs/
  • Roadmap specs go in specs/roadmap/, promote to specs/ when active
  • Update tests when DSL or verification behavior changes
  • Preserve the four verdicts: pass, fail, skip, uncertain
  • Do not let a task spec rely on implicit test-name matching

Escalation

Authoring → Planning: After the Contract passes agent-spec lint with score >= 0.7, generate plan context with agent-spec plan <spec> --code. --format prompt to give the AI Agent codebase awareness before coding.

Authoring → Implementation: Switch to agent-spec-tool-first after the Contract is drafted and passes agent-spec lint with score >= 0.7.

Implementation → Authoring: Switch back here if the Agent discovers during implementation that:

  • A missing exception path needs to be added to Completion Criteria
  • A Boundary is too restrictive and needs expanding
  • A Decision was wrong and needs changing

Update the Contract first, re-lint, then resume implementation. The Contract is a living document until the task is stamped.

平台分布

Codex

34.58%
按下载量换算45

Claude

32.86%
按下载量换算42

Cursor

21.56%
按下载量换算28

Gemini CLI

8.73%
按下载量换算11

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

调用外部服务

该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

安装前确认

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

继续浏览同类 Skills