AGENT SKILL

code-review-standards

How to review code against a spec with structured per-AC verdicts. Use when reviewing a PR, verifying code fulfills acceptance criteria, or selecting between multiple parallel implementations. Trigger on: code review, review standards, PR review, 代码审查, 代码评审, review agent, per-AC verdict, structured review.

适用职业开发工程师
使用场景代码审查
License 许可
Apache-2.0
所属仓库
Lincyaw/workbuddy
最近更新
2026-06-08
Stars
★ 2
Forks
1

01 前言 Front Matter

name
code-review-standards
description
How to review code against a spec with structured per-AC verdicts. Use when reviewing a PR, verifying code fulfills acceptance criteria, or selecting between multiple parallel implementations. Trigger on: code review, review standards, PR review, 代码审查, 代码评审, review agent, per-AC verdict, structured review.

03 SKILL.md 正文

Code Review Standards

Review verifies two things: the code fulfills the spec, and the code is maintainable. In that order — correct but messy beats clean but wrong.

Review process

Step 1: Run the tests

Before reading any code, run the test suite (specifically the tests generated from the spec):

pytest tests/test_<feature>.py -v

Record per-test pass/fail. This is the ground truth — everything else in the review is judgment layered on top.

If tests don't exist (test-gen agent didn't run, or spec didn't have ACs), flag this immediately: review cannot verify correctness without tests. Send back to the developing state.

Step 2: Per-AC verdict

For each acceptance criterion, produce a structured verdict:

AC Test Result Code Inspection Verdict
AC-1 test_ac1 PASS Implementation matches spec interface PASS
AC-2 test_ac2 PASS Edge case handled correctly PASS
AC-3 test_ac3 FAIL Time handling uses time.time() not injected clock FAIL
AC-4 test_ac4 PASS Reset clears counter dict PASS
AC-5 (no test) Concurrent access not addressed CANNOT JUDGE

Three verdicts:

  • PASS: test passes AND code inspection confirms the AC is met (not just the test — the test might have gaps)
  • FAIL: test fails, OR test passes but code inspection reveals the implementation doesn't actually satisfy the AC (test gap)
  • CANNOT JUDGE: no test exists for this AC, or the AC requires manual verification (e.g., UI appearance)

Step 3: Code quality findings

After the per-AC verdict, note code quality issues. Categorize by severity:

Critical — must fix before merge:

  • Security vulnerabilities (injection, auth bypass, secret exposure)
  • Data corruption risks (race conditions on shared state, missing transactions)
  • Correctness bugs not caught by existing tests

Major — should fix, but doesn't block merge if ACs pass:

  • Missing error handling for documented error cases
  • Performance issues in hot paths (unbounded allocations, O(n²) where O(n) is straightforward)
  • Breaking changes to existing public interfaces without migration

Minor — nice to fix, never blocks merge:

  • Naming inconsistencies with project conventions
  • Missing docstrings on public functions
  • Unused imports or variables

Step 4: Verdict decision

  • All ACs PASS, no critical findings → approve, transition to done
  • Any AC FAIL → reject, transition to developing. The verdict comment must list every failing AC with:
    • What the AC requires
    • What the implementation does instead
    • The specific test failure message (if available)
    • A suggestion for how to fix (optional but helpful)
  • CANNOT JUDGE on any AC → flag but don't block if all testable ACs pass. Note what couldn't be verified and why.

Selecting between parallel implementations

When multiple dev sessions produce implementations that all pass tests, rank by:

  1. Correctness — any AC FAIL disqualifies
  2. Simplicity — fewer lines of code, fewer abstractions, fewer dependencies. The implementation that a new contributor would understand fastest.
  3. Idiomaticity — follows the project's existing patterns. If the codebase uses dataclasses, don't introduce attrs. If it uses fmt.Errorf, don't introduce a custom error package.
  4. Test coverage beyond spec — did the dev agent add extra tests for edge cases not in the ACs? Bonus, not required.
  5. Performance — only as a tiebreaker, and only if measured. "Looks faster" is not a valid criterion.

When selecting, name the winner and briefly explain why:

Selected: rollout-2
Reason: All 7 ACs pass. Rollout-2 implements the rate limiter as
a single function with a dict + timestamp, while rollout-1 uses a
class hierarchy with 3 abstract base classes. Rollout-2 is 40 lines
vs 120 lines with identical behavior. Rollout-3 fails AC-3.

Structured verdict format

The review comment MUST follow this format so the orchestrator can parse it and provide structured feedback to the dev agent:

<!-- workbuddy:review-verdict -->
## Review Verdict

### Test Results
- Total: 7 | Pass: 5 | Fail: 2
- Failing: test_ac3_window_expiry, test_ac6_zero_max_requests

### Per-AC Verdict
| AC | Verdict | Evidence |
|----|---------|----------|
| AC-1 | PASS | test_ac1 passes; implementation uses counter dict |
| AC-2 | PASS | test_ac2 passes; boundary check correct |
| AC-3 | FAIL | test_ac3 fails: time.time() not mockable, flaky |
| AC-4 | PASS | test_ac4 passes; reset clears entry |
| AC-5 | PASS | test_ac5 passes; separate dict entries per client |
| AC-6 | FAIL | test_ac6 fails: ValueError not raised for 0 |
| AC-7 | PASS | test_ac7 passes; ValueError raised for negative |

### Code Quality
- [critical] AC-6: constructor accepts max_requests=0 without
  raising ValueError (missing validation)
- [minor] rate_limiter.py: unused import `collections`

### Decision
REJECTED — 2 ACs fail. See failing ACs above for required fixes.

The <!-- workbuddy:review-verdict --> marker is required on the first line. The orchestrator uses it to locate the most recent verdict when assembling the next dev cycle's prompt.

Common review mistakes

Reviewing style when correctness is unclear. Don't bikeshed variable names while tests are failing. Fix correctness first.

Trusting tests blindly. Tests pass ≠ implementation is correct. Tests can have gaps. A test that checks assert result is not None passes even if the result is wrong. Read the code.

Rejecting for style alone. If all ACs pass and there are no critical findings, the implementation is acceptable. Style issues are minor findings, not rejection reasons.

Vague rejection. "Needs work" is not actionable. The dev agent needs: which AC fails, what error message, what's wrong with the implementation, what would fix it.

Reviewing without test results. If you haven't run the tests, you're guessing at correctness. Run them first. Always.

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.

Skill与智能体开发
★ 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