AGENT SKILL

review-report

Report template, finding card and diagram guide for the review-companion skill, which loads this when it writes its report. Not a review on its own.

License 许可
MIT
最近更新
2026-11-11
Stars
★ 0
Forks
0

01 前言 Front Matter

name
review-report
description
Report template, finding card and diagram guide for the review-companion skill, which loads this when it writes its report. Not a review on its own.

03 SKILL.md 正文

Review report

Used by review-companion. It fixes the shape of the report, the finding card and the diagrams, and what follows the report: the PR comment, the description by role and the chat summary.

Report template

The report is one Markdown file at .reviews/<YYYY-MM-DD>-<branch-or-PR>.md, written at the end of every review. The file name is flat: in the branch or PR part, replace / and every character other than letters, digits, ., _ and - with - (feature/archive-wish → .reviews/2026-09-30-feature-archive-wish.md). Never overwrite or edit an earlier report: when a file with that name already exists — an earlier review the same day, or a report_path already in use — add -2, -3, … before .md and use the first name that is free. Use these headings exactly and in this order; a section with nothing to say says so in one line ("No query changes.") rather than disappearing. Diagrams follow the diagram guide below.

Write for a reader who has not seen the code: plain words, no undefined jargon, present tense. Every finding card must make sense on its own, pasted into a PR comment.

Every SQL block in the report starts with a line that says what it is: -- engine: <engine> for a query someone may run (it follows the read-only rules in review-passes, pass 7), or -- migration for a recommended schema change, shown for review and never run by you.

# Review — <branch or PR title>

| | |
|---|---|
| Target | `<target>` compared with `<base>` at `<short SHA>` |
| Date | <YYYY-MM-DD> |
| Role of the person asked | author / reviewer / not asked: reviewer assumed |
| Stack and skills applied | <e.g. Elixir, Phoenix, Oban — engineering-principles, elixir-phoenix-conventions; Oban: no skill> |
| Commands run | <each command run and its result, or "none"> |
| Previous report | <`.reviews/<earlier report>.md`: n new, n still open, n fixed · or "none found" · or "comparison declined"> |
| Security layer | <n kept (F-NN, …), n dropped — `security-audit`, complete or partial · or "not run: <why>" · or "not applicable: no code files"> |

> This report supports a human review. It does not approve or reject anything; the decision to merge belongs to the reviewer.

## 1. Summary

<3–5 sentences: what the change does, how it fits, the overall picture of the findings.>

| Severity | Count |
|---|---|
| 🔴 | n |
| 🟠 | n |
| 🟡 | n |
| ❓ | n |

⚡ <n> side effects: <n> new, <n> changed, <n> removed, <n> irreversible, <n> leave the app.

**Look first:** <the three places a human should look at first, each linked to its finding.>

**Definition of done** — the findings against each of its parts; this is not a verdict.

| Criterion | Findings |
|---|---|
| Implemented | <F-NN, … or "none found"> |
| Tested | <…> |
| Properly designed | <…> |
| Follows the conventions | <…> |
| Deployable without hurting users | <…> |
| Consumers stated | <F-NN, … or "none found"> — <the frontends and apps that must change, or "none"> |

<Each finding goes under the one part it puts at risk: Implemented — a bug, or something the intent needs that is missing; Tested — pass 3; Properly designed — design, boundaries, concurrency and data access; Follows the conventions — conventions, stack skills and documentation; Deployable without hurting users — EP-I5, migration safety, flags and rollback; Consumers stated — EP-E5. A part that was not checked says why ("tests not run").>

## 2. ⚡ Side effects set in motion

<Effect graph (see "Diagram guide" below, "Side effects"), then one row per effect.>

| Effect | Kind | Fires when | Status | Irreversible | User-visible | Tested | Documented | Intended |
|---|---|---|---|---|---|---|---|---|

## 3. The change at a glance

**Intent** (<confirmed by the author | confirmed by the reviewer | inferred, not confirmed>): <one paragraph>.

<Change map; the main new flow as a sequence diagram; before/after where behaviour changed; ER or state diagrams where schemas or lifecycles changed.>

**Skills applied**

| Skill | Covers | Applied to | Findings |
|---|---|---|---|
| engineering-principles | every language | <all changed files> | <F-NN, …> |
| <skill> | <language, framework, library or frontend work> | <the files checked against it> | <F-NN, … or "none"> |

<One line for each part of the stack with no skill, and each skill that could not be loaded: "Oban — no skill available; engineering-principles only.">

## 4. Findings

<Cards grouped by pass, in pass order, then the security layer's; inside a group, most severe first. The format is below.>

## 5. Tests

<Behaviour → test matrix; tests that would still pass if the behaviour broke; test smells; what was run and its result.>

| Behaviour | Test | Would fail if broken? |
|---|---|---|

## 6. Documentation

<Docs impact map; missing pages; each stale passage quoted next to the new behaviour, with a suggested rewrite.>

**PR description** — <the table below; "no PR description yet" when there is no PR (no GitHub remote, a branch without a PR, a commit range) and nothing was pasted; or "not checked: <why>" when a PR exists but could not be read>

| Part | Status | Findings |
|---|---|---|
| Title | <present · missing · wrong place> | <F-NN, … or "none"> |
| What it does | <present · missing> | <…> |
| Before deploying | <present · missing items · not needed> | <…> |
| How it works | <present · missing · not needed> | <…> |
| Behind the scenes | <present · missing items> | <…> |
| Screenshots and videos | <present · missing · not needed> | <…> |
| Cadre line | <present · missing · not needed> | <…> |
| Not essential | <none · n to cut> | <…> |

## 7. Data access & performance

<Query → index table, production numbers with the date they were collected; or "No query or schema changes.">

| Query (where) | Table | Filters · joins · sort | Index that serves it | Rows (prod) | Calls/day | Status |
|---|---|---|---|---|---|---|

## 8. Locks and deadlocks

<One row per path the change adds or touches that holds a lock or waits while holding one, and per path elsewhere that takes the same locks; or the no-lock line.>

| Path | Locks and waits, in order | Same locks taken elsewhere | Verdict |
|---|---|---|---|
| <path> | <each lock and wait, in the order taken> | <path: the same locks, or "none"> | <Can't deadlock: <why> · F-NN> |

<A hot row (EP-H13) appears with its finding. A deadlock that existed before the change gets its finding too, marked `existed before this change`.>

A change that takes no lock says: The change takes no lock and waits on nothing while holding one.

## 9. Risk and attention map

<Criticality, change frequency (6 months) and blast radius per touched file; quadrant chart.>

The risk shown here comes from the code only. Weigh who wrote the change, and how familiar they are with this area, yourself.

## 10. Conversation

- **Worked out without asking:** <target and base, role, exclusions, where the intent came from: what a person would otherwise have been asked>
- **Answers given:** <answers given in advance, or "none">
- **Open questions for the author:** <each question with the findings that wait on it: the intent, necessity, context outside the repository, consumers, how the code runs, side effects, where docs live>
- **Not run:** <each command left out, exactly as it would be run, and what it would add, or "none": tests, the repository's checks, `EXPLAIN`, `git fetch`>
- **Memory:** <entries that applied, each with "Is this still true?", overdue ones flagged; entries proposed, stored only when a person asks; or "none">
- **Points to discuss:** <…>
- **Where the intent had to be guessed:** <file:line — why>

## 11. Recommended plan

- [ ] Before merge: <F-NN — one line>
- [ ] Can wait: <F-NN — one line>
- [ ] Needs a decision: <F-NN — one line>

## 12. Limits and decision

- **Not checked:** <tests not run, no production statistics, the security layer, when it did not run, the PR description (not read, or no PR yet), context the companion could not know, …>
- **Assumptions:** <each conditional finding and the fact it depends on>
- **Before you decide:** <a short checklist for the human: open ❓ items, conditional findings, places they could not explain>

The decision to merge is yours.

Finding card

Every finding uses this card — 🟡, ❓ and documentation findings too. It has these parts, always in this order: the Pass / Rules / Where / Status line, What., Why it matters., Evidence., Recommendation., Effort:. None may be dropped, even when another part seems to say it already:

  • Only findings get an ### F-NN heading. A note that is not a finding goes in the prose of its section or in the Conversation section.
  • The title states the consequence, not the rule: "Two requests can both spend the last invite", not "EP-H2 violation".
  • Why it matters. is concrete: who does what, with real values, and what happens. "A referrer with one invite left double-clicks; both requests read 1; two referrals exist." For a minor finding it is one short sentence ("A malformed request gets a 500 instead of a 400.").
  • Evidence. quotes the code or the doc passage involved. When there is nothing to quote, say what is absent in one line: "none — no test file touches archive_wish/2".
  • A finding about the PR's title or description: its Where: is PR title or PR description; Evidence. quotes the passage involved, or says what is absent; the Sketch is the rewritten passage; Test that proves the fix is "none — a description finding"; Doc to update is "the PR description".
### F-NN <🔴|🟠|🟡|❓>[ ⚡] <one sentence stating the consequence, not the rule>
**Pass:** <pass> · **Rules:** `<EP-XN>`[, `<language #N>`] · **Where:** `<file:line>` · **Status:** confirmed | conditional on <fact>[ · existed before this change]

**What.** <What the code does, in plain words.>

**Why it matters.** <A concrete failure scenario with real values: who does what, what happens, what it costs.>

**Evidence.**
```<language>
<at most 10 lines of the code involved>
```

<Diagram, when a picture explains it faster than a sentence — see the diagram guide.>

**Recommendation.**
1. <Step to fix it.>
2. <…>
- **Sketch:** a before/after in the repository's language.
- **Test that proves the fix:** <name and what it asserts>.
- **Doc to update:** <page and section, or "none">.

**Effort:** small | medium | large.

Severity, ⚡ and status mean what "Writing a finding" in review-passes says.

A ❓ card keeps every field too: Why it matters says what goes wrong if the answer is the unwelcome one; Recommendation says what to do for each possible answer; Effort is the effort of the likely fix.

Before you write

Check the whole report once more before writing it:

  • the file name is free: no earlier report is overwritten;
  • the header has all seven rows and the disclaimer line;
  • section 1 has the Definition of done table with its six rows;
  • section 6 has the PR description table, or says "no PR description yet" or "not checked" and why;
  • the Skills applied table lists every skill loaded, the files it was checked against and its findings;
  • section 8 has the lock table or the no-lock line;
  • section 10 has its Worked out without asking: and Not run: lines;
  • the twelve sections are there, in order, and section 12 ends with "The decision to merge is yours.";
  • every card has every part, in order;
  • every diagram follows the rules below;
  • every SQL block starts with -- engine: <engine> or -- migration;
  • no secret value appears anywhere, not even in part.

The PR comment

When the change has a pull request on GitHub, the report belongs on that PR as a comment, so the author and every reviewer read the same findings where the change is discussed. A post is public, so a person approves it: in advance, or by answering the one question at the end.

  • When. A remote is on github.com and the change has a PR. A commit range, a branch without a PR, or another host: nothing is posted, and the report says so.
  • Approval. writes.pr_comment: approve posts it. writes.pr_comment: decline does not, and drops the question. With neither, the last line of the final message is Post this report on PR #<n> as a comment?. The review has finished and the report is written, so nothing waits on the answer: with nobody there, the question goes unanswered and nothing is posted. Post only on a clear yes.
  • What and how. After writing the report, post that file unchanged as a plain comment: gh pr comment <n> --body-file <report path>. Never as a review: no gh pr review, nothing that approves or requests changes.
  • Size. GitHub refuses a comment longer than 65,536 characters. When the report is longer, cut it at its ## section headings into as few parts as fit, start each part with Review — part <i> of <n>, write each part to a temporary file outside the repository, and post the parts in order, one gh pr comment per part. The approval to post covers these temporary files.
  • When it fails. If gh is missing, not logged in, or the post fails, put the command and its error in the chat summary; the report stays where it was written. Never post another way (gh api, curl, a browser).

The description, by role

The description's EP-F5 findings are acted on by role. What would be posted or applied always appears in the report's section 6, and is posted or applied only when approved in advance.

  • When. Only when the title and description were read or pasted and the passes found a gap in them: an EP-F5 finding, or a description that leaves out the consumers line (EP-E5), the deploy order (EP-I5), the doc page checked (elixir #59) or a loosened check's reason (EP-I3) — except for the author with no PR yet, who always gets a draft. When the description has no such gap, nothing is offered: say so in one line.

  • Reviewer: a comment for the author. Section 6 holds the comment in full, and writes.description_comment: approve posts it as its own comment, separately from the report comment, with gh pr comment <n> --body-file <file outside the repository>. Its form:

    **PR description** — what would make this PR easier to review (EP-F5).
    
    **Required**
    - F-NN: <what to add or fix, in one line>
    
    **Suggested**
    - F-NN: <what to cut or clarify, in one line>
    

    Required holds the 🟠 ones of those gaps, Suggested the 🟡 ones; an empty list is left out. Title findings go in the lists too. It is a comment, never a review. With a pasted description and no PR, there is nothing to post to: the findings stay in the report.

  • Author: a redraft. Section 6 holds the new title and description in full, written as "Rewriting a description" in pr-description says, and writes.pr_update: approve applies them.

    • Applying reads the PR again first. When its title or body differs from what was read or pasted, or the read fails, edit nothing and say why in the chat summary. Line endings and trailing whitespace are not differences.
    • Applying runs gh pr view <n> --json title,body, then gh pr edit <n> --title '<title>' --body-file <file outside the repository>. The title goes in single quotes, each ' in it written as '\'', so the shell never reads it: a title can hold backticks and $, and it comes from the PR's own text.
    • When the description could not be read, no redraft is offered: replacing a description you have not seen would drop what it holds.
  • Author, no PR yet. Section 6 holds a draft title and description, written as "Rewriting a description" says from the code and the answers given — or rewriting the pasted description when there is one. writes.description_file: approve writes it next to the report: the report's file name with -pr-description before .md (.reviews/2026-10-21-feature-pr-description.md), under the report's file-name rules: flat, never overwritten (-2, -3, …). It is offered even with no description findings, since there is no description yet.

  • Files. The comment and the redraft are written to temporary files outside the repository; the approval covers them.

  • When it fails. As for the PR comment: the command and its error go in the chat summary. Never post another way (gh api, curl, a browser).

Chat summary

After writing the report, post a short summary in the chat. The report holds every finding, the summary only the three that matter most. In this order:

  1. counts by severity;
  2. the ⚡ line: the counts, then each effect by name and status ("⚡ 2 side effects: archived_at write (new), WishArchived event (new)");
  3. the definition of done in one line: each part with findings and their IDs, and the frontends and apps that must change;
  4. the locks and deadlocks line: the paths compared and the deadlock findings ("Locks and deadlocks: 3 paths compared — F-02 can deadlock; 2 can't"), or the no-lock line;
  5. the security layer line: Security layer: <n> kept (F-NN, …), <n> dropped, Security layer: not run — <why>, or Security layer: not applicable — no code files; then the tests line: what ran and its result, or why nothing ran;
  6. the three most important findings, one line each;
  7. the three most important open questions;
  8. the report path, and — when the change has a GitHub PR — the comment's link, the exact command to post it when it was not posted, or the gh error; then what happened to the description: the description comment's link, "PR title and description updated", the draft's path, or why not (no approval given in advance, nothing to change, the PR changed or could not be re-read, or the gh error); then the commands left under Not run, in one line;
  9. "The decision to merge is yours."
  10. when the change has a GitHub PR and writes.pr_comment was left out, the question Post this report on PR #<n> as a comment?.

Diagram guide

Diagrams are mermaid code blocks inside the report. They render on GitHub, in most editors and in the Claude app. Draw one when a picture explains something faster than a sentence; skip it when one sentence is enough.

Which diagram for which finding

Finding about Diagram
Race, lost update, duplicate processing, async or cancellation sequenceDiagram: two actors side by side, the failure, then the fixed version
Transaction boundaries, effects before or after commit sequenceDiagram with a rect around what is inside the transaction
Deadlock, or a wait the database cannot see sequenceDiagram: the two paths side by side, each holding one lock and waiting for the other's
Side effects set in motion flowchart LR effect graph with the styles below
Missing or untested branch, error path flowchart with each branch marked ✅ or ❌
Layering, boundary or Demeter violation, coupling Module flowchart, offending edge in red
Over-complex solution (EP-D12) Before/after flowchart: what was built, and the minimal version
Schema or data-model change erDiagram, before and after
Lifecycle or status field stateDiagram-v2, the missing or illegal transition highlighted
N+1, blocking migration sequenceDiagram: 1 + N round trips next to one batched query; writes waiting on an index build
Refactoring suggestion Before/after flowchart or classDiagram
Risk map quadrantChart
Docs impact flowchart from code to doc pages, each page updated, stale or missing

Rules

  • Only these diagram types: flowchart, sequenceDiagram, erDiagram, stateDiagram-v2, classDiagram, quadrantChart. Others may not render everywhere.
  • One idea per diagram, at most about 12 nodes.
  • Real names from the code (create_referral/2, listings), never placeholders.
  • Put a one-line caption under each diagram saying what to look at, and a legend whenever colours carry meaning.
  • Quote every node label that contains spaces, punctuation, parentheses, slashes or emoji: A["create_referral/2"].
  • Keep classDef names and colours below, so every report reads the same.
  • Node ids are single words without spaces (A, create); never use end as a node id.
  • sequenceDiagram messages and notes cannot contain ; or #; say it in words.
  • quadrantChart point names are quoted and their coordinates are between 0 and 1.
  • Keep a mermaid block free of HTML and of Markdown formatting (**, backticks).

Styles

flowchart LR
  A["added"]:::new --> B["changed"]:::changed --> C["removed"]:::removed
  D[/"external call"/]:::external --> E[/"message to a person"/]:::people --> F[/"leaves the app"/]:::boundary
  classDef new fill:#bbf7d0,stroke:#15803d
  classDef changed fill:#fde68a,stroke:#b45309
  classDef removed fill:#e5e7eb,stroke:#6b7280,stroke-dasharray:4 3
  classDef external fill:#fecaca,stroke:#b91c1c
  classDef people fill:#e9d5ff,stroke:#7e22ce
  classDef boundary fill:#ffffff,stroke:#b91c1c,stroke-dasharray:4 3

Legend: green added · amber changed · grey dashed removed · red external call · purple message to a person · red dashed leaves the app.

Patterns

Race (two actors, then the fix).

sequenceDiagram
  participant A as Request A
  participant B as Request B
  participant DB
  A->>DB: read invites_remaining → 1
  B->>DB: read invites_remaining → 1
  A->>DB: check ≥ 1 ✓ · write 0
  B->>DB: check ≥ 1 ✓ · write 0
  Note over DB: 2 referrals, 1 invite spent

Transaction boundary.

sequenceDiagram
  participant S as create_referral/2
  participant DB
  participant M as Mailer
  rect rgb(254, 243, 199)
    Note over S,DB: inside the transaction
    S->>DB: insert referral
    S->>M: send invite email
    S->>DB: update invites_remaining
  end
  Note over M: the email is gone even if the commit fails

Effect graph.

flowchart LR
  C["create_referral/2"]:::changed --> E(["event ReferralCreated"]):::removed
  E -.-> H["NotifyReferrer"]:::removed
  C --> M[/"✉ invite email · irreversible"/]:::people
  classDef changed fill:#fde68a,stroke:#b45309
  classDef removed fill:#e5e7eb,stroke:#6b7280,stroke-dasharray:4 3
  classDef people fill:#e9d5ff,stroke:#7e22ce

Untested branches.

flowchart TD
  S["archive_wish/2"] --> A{"wish found?"}
  A -- no --> NF["error not_found ❌ untested"]
  A -- yes --> B{"already archived?"}
  B -- yes --> AA["error already_archived ❌ untested"]
  B -- no --> OK["ok archived wish ✅ tested"]

Minimal solution (EP-D12).

flowchart LR
  subgraph built["What was built"]
    O1["charge/1"] --> F["PaymentProviderFactory"] --> R["ProviderRegistry"] --> P1["StripeProvider"]
  end
  subgraph minimal["Minimal version"]
    O2["charge/1"] --> P2["Stripe client"]
  end

Schema change.

erDiagram
  CITIES ||--o{ LISTINGS : has
  LISTINGS {
    uuid id PK
    uuid city_id FK "no index"
    datetime archived_at
    datetime inserted_at
  }

Lifecycle.

stateDiagram-v2
  [*] --> active
  active --> archived: archive_wish
  archived --> active: restore_wish (missing)

Risk map.

quadrantChart
  title Where to look closely
  x-axis Rarely changed --> Often changed
  y-axis Low criticality --> High criticality
  quadrant-1 Look closely
  quadrant-2 Critical but stable
  quadrant-3 Low risk
  quadrant-4 Busy but low stakes
  "payments/charge.py": [0.8, 0.9]
  "admin/routes.py": [0.3, 0.8]
  "docs/billing.md": [0.2, 0.1]

04 同仓库更多 Skills