AGENT SKILL

acceptance-criteria

Reference for writing and evaluating acceptance criteria. Use when an AC is flagged as untestable, when the spec-review agent needs to judge testability, or when deriving ACs from a vague requirement. Trigger on: acceptance criteria, AC, testability, 验收标准, how to write AC, is this AC testable, untestable criterion.

License 许可
Apache-2.0
所属仓库
Lincyaw/workbuddy
最近更新
2026-06-08
Stars
★ 2
Forks
1

01 前言 Front Matter

name
acceptance-criteria
description
Reference for writing and evaluating acceptance criteria. Use when an AC is flagged as untestable, when the spec-review agent needs to judge testability, or when deriving ACs from a vague requirement. Trigger on: acceptance criteria, AC, testability, 验收标准, how to write AC, is this AC testable, untestable criterion.

03 SKILL.md 正文

Acceptance Criteria Reference

An acceptance criterion (AC) is a single, verifiable condition that must hold for the implementation to be considered correct. ACs are the bridge between human requirements and automated tests.

The testability test

An AC is testable if you can answer YES to all three:

  1. Can you write the test function signature right now? If you can write def test_ac3_window_expiry(): and know what it should call and assert, the AC is testable.

  2. Is the pass/fail deterministic? Running the test twice with the same input produces the same result. No randomness, no timing sensitivity (without clock injection), no dependency on external services (without mocking).

  3. Does it reference concrete values? Names from the Interface section, specific inputs, specific expected outputs or error types. Not "the function" but "parse_config". Not "an error" but "FileNotFoundError".

Patterns

Functional behavior

AC-N: <function>(<specific input>) returns <specific output>
AC-N: <function>(<invalid input>) raises <specific error type>

State transitions

AC-N: After calling <method A>, calling <method B> returns <value>
AC-N: <object> initialized with <params> has <property> = <value>

Performance (when in scope)

AC-N: <operation> on <N items> completes in < <threshold>
AC-N: Memory usage does not exceed <limit> for <workload>

Always specify the workload size and the threshold.

API contracts

AC-N: POST /path with <body> returns <status code> and <response shape>
AC-N: GET /path without auth returns 401

Data invariants

AC-N: After <operation>, <invariant> holds (e.g., balance >= 0)
AC-N: <collection> never contains duplicate <key field>

Common untestable patterns and fixes

Untestable AC Why Fix
"Should be fast" No threshold "Completes in < 200ms for N=1000"
"Handles errors gracefully" "Gracefully" is subjective "Raises ValueError with message containing the invalid field name"
"Works correctly" Tautological Split into specific input/output pairs
"Is well-documented" Subjective "Every public function has a docstring with parameter descriptions" (checkable by AST)
"Is secure" Too broad Split: "Escapes HTML in user input" + "Rejects SQL in query params" + "Rate-limits login attempts"
"Improves performance" No baseline or target "p99 latency drops from > 500ms (current) to < 200ms"
"Supports all edge cases" "All" is unbounded Enumerate: empty input, null, max int, Unicode, concurrent
"Is backward compatible" Unstated contract "Existing callers of old_function(a, b) continue to work without changes"

Deriving ACs from vague requirements

When the issue says "add caching to the API":

  1. Identify the interface: what function/endpoint gets cached? → "GET /api/users/:id responses are cached"

  2. Define the observable behavior: what changes for the caller? → "Second request for the same user_id returns in < 5ms" → "Response includes X-Cache: HIT header"

  3. Define the boundaries: when does the cache invalidate? → "PUT /api/users/:id invalidates the cached entry" → "Cache entries expire after 300 seconds"

  4. Define the error cases: what if cache is unavailable? → "If Redis is unreachable, requests fall through to the database (no error returned to caller)"

  5. State assumptions: "Assuming cache backend is Redis. If in-memory cache is preferred, AC-4 changes."

Result:

AC-1: GET /api/users/:id returns identical response on second call
AC-2: Second call completes in < 5ms (first call unconstrained)
AC-3: Response includes X-Cache header (HIT or MISS)
AC-4: PUT /api/users/:id causes next GET to return updated data
AC-5: Cache entries not accessed for 300s are evicted
AC-6: If Redis is unreachable, GET still returns correct data from DB

AC granularity

Too coarse: "AC-1: The rate limiter works correctly for all cases." This is untestable and will produce a test that either tests one case (incomplete) or a monster test that's hard to debug when it fails.

Too fine: "AC-1: The constructor stores max_requests. AC-2: The constructor stores window_seconds." This tests implementation details, not behavior. The implementation could store them differently and still be correct.

Right level: One observable behavior per AC. "AC-1: First N requests pass. AC-2: Request N+1 is rejected." These test what the caller sees, not how the internals work.

Numbering and traceability

  • Number sequentially: AC-1, AC-2, AC-3...
  • Don't renumber when removing an AC — skip the number. This preserves traceability to tests named test_ac3_....
  • When adding ACs during review feedback, continue from the last number.
  • The test-to-AC mapping (produced by test-gen agent) is the traceability record.

04 同仓库更多 Skills

Lincyaw
Lincyaw/workbuddy

workbuddy-guide

Explain and operate workbuddy: what it is, which command to reach for, and where to find deeper references. **Trigger whenever the user mentions 'workbuddy' in any context** — including operational requests (register/onboard a repo, add/bind a worker, 注册仓库, 加仓库, 接入新仓库, onboard repo, set up worker), explanatory questions (how to use workbuddy, workbuddy guide, teach me workbuddy, 怎么用workbuddy, 使用指南), deployment/running/operating/debugging workbuddy, and questions about how issues/tasks are scheduled or how dependencies between issues work (depends_on, blocked, dependency gate, 依赖, 调度, 排队, '为什么没派发'), and questions about parallel-development workflows (rollouts:N fan-out, synthesize/synthesis reduce step, cherry-pick, '并行开发', '多个方案', 'rollout'). Invoke this skill before running workbuddy CLI commands so the documented onboarding flow (coordinator register + worker repos add) and the dependency/scheduling model aren't re-derived from scratch.

★ 2
Lincyaw
Lincyaw/workbuddy

web-debug

Validate the workbuddy webui (SPA + auth + JSON API) end-to-end on the same machine workbuddy runs on, using browser-use's headless harness. Use when the user says 'verify the frontend', 'test the SPA', 'check dashboard loads', '前端验证', '验下 webui', or after merging changes that touch internal/webui, web/, or the auth/cookie path.

★ 2
Lincyaw
Lincyaw/workbuddy

setup-repo

Configure a GitHub repository for workbuddy orchestration — creates labels, the two canonical agent configs (dev + review), workflow definitions, issue templates, and config.yaml. Use when the user says 'set up repo', 'configure repo for workbuddy', 'initialize workbuddy', '配置仓库', '初始化workbuddy', or wants to onboard a new repo.

★ 2
Lincyaw
Lincyaw/workbuddy

pipeline-monitor

Monitor the workbuddy agent pipeline, detect stuck issues, zombie processes, and missed redispatches. Works for both the 3-unit bundle (supervisor + coordinator + worker) and single-process `serve`. Use when the user says 'monitor the pipeline', 'check workbuddy status', '监工', '看看跑完了没', or asks to watch issue progress.

★ 2
Lincyaw
Lincyaw/workbuddy

merge-flow

Merge a batch of approved workbuddy PRs into main: order them, resolve conflicts against design intent, validate post-merge health, and report. Use when the user asks to 'merge the batch', 'merge approved PRs', 'integrate finished issues', '批量合并', '处理冲突'; or when the merge-agent is invoked.

★ 2
Lincyaw
Lincyaw/workbuddy

deploy

Workbuddy deployment topology guide — explains the 3-unit bundle (supervisor + coordinator + worker), the rolling-restart property, and the cutover from the legacy single-process `serve` install. Use when the user says 'how should I deploy workbuddy', 'install workbuddy as a service', 'switch to bundle', 'rolling restart', '部署 workbuddy', '升级到 bundle'.

★ 2