review
Use when asked to review a pull request, examine code changes, find bugs, or audit a branch, in standard or depth mode. Not for an iterative review-and-fix loop: use audit-project.
Install
npx skills add https://github.com/OutlineDriven/odin-claude-plugin/tree/main/plugins/odin-review/skills/review
claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install outlinedriven-odin-claude-plugin@llmmart
git clone https://github.com/OutlineDriven/odin-claude-plugin.git
The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole outlinedriven/odin-claude-plugin collection as a plugin from our marketplace. Git is the plain clone.
Skill manifest
Severity-graded review
Two modes share one authority (read-only) and one evidence bar: every finding cites concrete code evidence, no invented issues, no style-only findings. Standard mode is a single-pass severity-graded review of a supplied diff, snippet, or branch. Depth mode fans out two parallel reviewers, bug/security and code quality, and synthesizes a deduplicated unified verdict.
Contract
| Field | Bound contract |
|---|---|
| Trigger | User asks to review a pull request, examine code changes, find bugs, run a security review, audit code on the current branch, or run combined bug/security and code-quality branch audits. |
| Authority | Read-only. No file, VCS, credential, paid, published, deployed, or remote mutation. |
| Side effect | Chat output: a review report with findings (standard) or a unified audit report (depth). |
| Done | Standard: validated findings with severity, evidence, and concrete fixes; no style-only or invented findings. Depth: a single deduplicated prioritized synthesis as a unified verdict ordered by severity. |
Inputs
Required: a PR URL, diff content, code snippet, or branch to review (standard); the diff range, PR number, or commit range to audit (depth).
Optional: a stated focus area (e.g., security, performance, correctness); specific files, directories, or a focus area to narrow scope.
The skill operates entirely within the current session context. No file system, repository, credential, or remote access is required or authorized.
Mode selection
| User says | Mode | Output |
|---|---|---|
| review this PR, examine these changes, find bugs, security review, audit this branch | standard | Severity-graded findings report |
| deep review, combined bug/security and quality audit, full branch audit | depth | Unified deduplicated verdict from parallel reviewers |
When the user names a single PR or diff, use standard mode. When the user asks for a combined bug/security and quality audit or a full branch audit, use depth mode.
Shared evidence bar
Every finding, in either mode, must cite specific code locations, line ranges, or diff hunk markers as evidence. Do not assert a finding without quoting the supporting code. Discard any candidate without evidence. Never report an invented issue. Exclude style-only findings (formatting, naming conventions, cosmetic preferences) unless they cause a correctness or security issue.
Standard mode
- Acquire diff. Receive the PR URL, diff text, or code snippet from the user; or determine the change set from the current branch diff against its base when the user does not name one. If no code change is supplied, ask for it. Done when: the change set is determined and scoped.
- Fetch changes. Use the available tools to retrieve diff or file content for the target revision range. If the user named files, directories, or a focus area, restrict scope to those. Do not assume write access. Done when: the diff or file content is retrieved and scope is restricted.
- Bound scope. Limit analysis to the supplied diff or code range. Do not widen scope to surrounding code or unrelated files. Done when: scope is bounded.
- Read changed regions with context. Read each changed region and the immediate callers and surrounding state needed to reason about its behavior. Do not read unrelated code. Done when: every changed region is read with its callers and surrounding state.
- Categorize findings. Assign each finding to one of: Correctness, Security, Performance, Maintainability, Robustness, Logic, or API Usage. Done when: every finding is categorized.
- Grade severity. Assign one severity level to each finding:
- Critical: exploitable bug, data loss, or security vulnerability with no workaround
- High: significant bug, regression risk, or breach of contract without mitigation
- Medium: correctness concern, degraded performance, or maintainability debt
- Low: minor issue, cosmetic concern, or opportunity for improvement Done when: every finding is graded.
- Validate findings. Apply the shared evidence bar: each finding cites specific code locations as evidence; evidence-less candidates are discarded; no invented issues. Done when: every surviving finding has concrete evidence.
- Reject style-only findings. Do not report formatting, naming conventions, or cosmetic preferences unless they cause a correctness or security issue. Done when: no style-only finding remains.
- Prescribe concrete fixes. For each finding, write a specific, actionable recommendation that addresses the root cause, not a surface-level patch. Done when: every finding has a concrete fix.
- Assemble report. Structure findings as: Severity → Category → Finding → Evidence → Recommended Fix. Sort by severity descending. Done when: the report is assembled and sorted.
Depth mode
- Confirm scope. Confirm the diff range, PR number, or commit range to audit. Stop if scope cannot be determined. Done when: the audit scope is confirmed or the run stops with scope-unresolvable.
- Fan out two simultaneous reviewers.
- Reviewer A, bug and security audit: reads the scope, identifies defect, security, and regression findings, produces a severity-ordered list.
- Reviewer B, code quality audit: reads the scope, identifies maintainability, style, and structural quality findings, produces a severity-ordered list. Both reviewers operate under the same read-only authority and the shared evidence bar. Neither reviewer makes changes. Done when: both reviewers are spawned with their audit assignments and read-only authority.
- Wait for both reviewers. Done when: both reviewers have returned their findings lists.
- Handle partial failure. If either reviewer fails or returns empty after retry, report the partial result from the surviving reviewer with the failure identified. Done when: both reviewers returned, or the surviving reviewer's partial result is reported with the failure identified.
- Synthesize.
- Merge findings from both reviewers.
- Deduplicate and consolidate overlapping findings.
- Rank merged findings by severity (critical > high > medium > low > informational). Map reviewer-reported severities onto this scale: P0 = critical, P1 = high, P2 = medium, P3 = low; informational is for advisory notes with no behavioral impact.
- Group findings by file or component.
- Omit findings already resolved or not applicable.
- Record which reviewer produced each finding for attribution. Done when: findings are merged, deduplicated, severity-ranked, grouped, resolved findings omitted, and reviewer attribution recorded.
- Return a unified audit report. Findings in severity order, each labeled with severity, category, affected file(s) and line(s), description, rationale, and reviewer source. Done when: the unified report is returned with all findings labeled and severity-ordered.
Failure and recovery
| Failure class | Condition | Result |
|---|---|---|
empty-diff |
No diff or code supplied | Ask the user for the PR or code to review; do not produce a report |
review-blocked |
Cannot access the target PR or revision | Report the access failure explicitly; do not fabricate content |
partial-result |
Some files or hunks are inaccessible | List accessible findings; state which parts were skipped and why |
scope-widening |
Analysis extends beyond supplied diff | Discard widened findings; report only bounded results |
style-only-report |
All findings are style-only | State that no actionable findings were found; describe what was evaluated |
scope-unresolvable (depth) |
Diff, PR, or commit range cannot be determined | Stop. Report that the scope could not be determined |
reviewer-failure (depth) |
A reviewer fails after retry | Return the surviving reviewer's findings with the failure stated. Do not synthesize from a missing reviewer |
synthesis-empty (depth) |
No synthesis was possible | Return the exact partial result each reviewer produced; state that no synthesis was possible |
Partial-result rule: always return what was produced. Never claim the done predicate holds when it does not. Non-mutation: never edits files, commits, or remote state. Any failure leaves the working tree unchanged.
Output
Standard mode. A structured review report returned as chat output. One section per severity level (Critical, High, Medium, Low), each containing:
- Severity and Category
- Finding: the specific issue with code location and evidence
- Recommended Fix: concrete, actionable correction
Unsuitable scope is reported as a named failure. An empty diff or inaccessible PR is reported as a named failure. The report must not contain findings without cited evidence.
Depth mode. A unified audit report with deduplicated findings prioritized by severity, grouped by file or component, each labeled with severity, category, affected location, description, rationale, and reviewer source. Or a partial-result report if synthesis was not possible.
Files (odin-claude-plugin)
-
agents
-
openai.yaml 179 B
interface: display_name: "Review" short_description: "Use when asked to review a pull request, examine code changes, find bugs, or audit a branch, in standard or depth mode."
-
-
references
-
action-class-rubric.md 1.2 KB
# Action-class rubric Action class describes the **intrinsic shape** of follow-up work; it is routing advice, not a fix. This skill is read-only; the class tells the caller what to do next. | Action class | Meaning | Route | |--------------|---------|-------| | **safe** | Mechanical, behavior-preserving, single-site; the fix is unambiguous. | Apply directly (unattended). | | **gated** | The fix is clear but touches a contract or multiple sites; needs verified batches and a resolve gate. | `audit-project`. | | **manual** | Needs a human design decision; no single correct fix. | Surface as a question; no auto-route. | | **advisory** | Opinion or nit; recording it is the whole action. | None. | ## Persona guidance - Prefer **safe** when you can write a defensible `suggested-route` for a localized, behavior-preserving change. - Use **gated** when the fix touches an API contract, spans multiple files, or needs verified batches. - Use **manual** when the right fix depends on product intent, architecture, or cross-cutting refactors. - Use **advisory** when nothing breaks if left unfixed but the observation has value. - Do not reclassify a safe fix as gated to appear more thorough. The class is signal, not a severity proxy. -
diff-scope.md 1.7 KB
# Diff scope rules These rules apply to every reviewer. They define what is "your code to review" versus pre-existing context. ## Scope discovery Determine the diff to review using this priority order: 1. **User-specified scope.** If the caller passed `BASE:`, `FILES:`, or `DIFF:` markers, use that scope exactly. 2. **Working copy changes.** If there are unstaged or staged changes (`git diff HEAD` is non-empty), review those. 3. **Unpushed commits vs base branch.** If the working copy is clean, review `git diff $(git merge-base HEAD <base>)..HEAD` where `<base>` is the default branch (main or master). The scope step in the SKILL.md handles discovery and passes you the resolved diff. ## Finding classification tiers Every finding you report falls into one of three tiers based on its relationship to the diff: ### Primary (directly changed code) Lines added or modified in the diff. This is your main focus. Report findings against these lines at full confidence. ### Secondary (immediately surrounding code) Unchanged code within the same function, method, or block as a changed line. If a change introduces a bug that's only visible by reading the surrounding context, report it, but note that the issue exists in the interaction between new and existing code. ### Pre-existing (unrelated to this diff) Issues in unchanged code that the diff didn't touch and doesn't interact with. Mark these with `pre_existing: true` in your output. They're reported separately and don't count toward the review verdict. **The rule:** If you'd flag the same issue on an identical diff that didn't include the surrounding file, it's pre-existing. If the diff makes the issue *newly relevant* (e.g., a new caller hits an existing buggy function), it's secondary. -
findings-schema.json 4 KB
{ "$schema": "http://json-schema.org/draft-07/schema#", "title": "Code Review Findings", "description": "Structured output schema for review deep-mode personas", "type": "object", "required": ["findings"], "properties": { "findings": { "type": "array", "description": "List of code review findings. Empty array if no issues found.", "items": { "type": "object", "required": [ "file", "line", "persona", "title", "severity", "behavioral-impact", "confidence", "action-class", "suggested-route", "evidence" ], "properties": { "file": { "type": "string", "description": "Relative file path from repository root" }, "line": { "type": "integer", "description": "Primary line number of the issue", "minimum": 1 }, "persona": { "type": "string", "description": "Persona name that produced this finding" }, "title": { "type": "string", "description": "Short, specific issue title. 10 words or fewer.", "maxLength": 100 }, "severity": { "type": "string", "enum": ["P0", "P1", "P2", "P3"], "description": "Issue severity by observable behavioral impact" }, "behavioral-impact": { "type": "string", "description": "The observable failure this causes, or 'none -- advisory'" }, "confidence": { "type": "string", "enum": ["high", "med", "low"], "description": "Confidence level. high = can cite the failing input or path. med = strong structural evidence, no repro. low = suspicion only." }, "action-class": { "type": "string", "enum": ["safe", "gated", "manual", "advisory"], "description": "Routing hint: safe = apply directly unattended; gated = route to audit-project; manual = needs design decision; advisory = report-only." }, "suggested-route": { "type": "string", "enum": ["apply", "audit-project", "none"], "description": "Where the fix belongs" }, "evidence": { "type": "string", "description": "path:line citation or a one-line repro" }, "pre_existing": { "type": "boolean", "description": "true if the issue exists in unchanged code unrelated to this diff. Reported separately; does not count toward the review verdict.", "default": false } } } } }, "_meta": { "confidence_levels": { "high": "Can cite the failing input or path. Report.", "med": "Strong structural evidence, no repro. Report unless below the confidence gate threshold.", "low": "Suspicion only. Drop unless corroborated by another persona." }, "severity_definitions": { "P0": "Reachable now by ordinary or untrusted input: data loss, security breach, crash on a normal path, regression in a shipped contract. Ship-blocker.", "P1": "Wrong output or failure on a plausible input; resource exhaustion under expected load; a contract break behind a flag or edge. Fix before merge.", "P2": "Degraded behavior on an uncommon path; a changed branch with no test that can break silently; maintainability debt with a named future-defect path. Fix or file.", "P3": "No behavioral impact: style, naming, micro-optimization with no measured win. Advisory." }, "action_classes": { "safe": "Mechanical, behavior-preserving, single-site, unambiguous fix. Apply directly (unattended).", "gated": "Clear fix but touches a contract or multiple sites. Route to audit-project.", "manual": "Needs a human design decision. Surface as a question.", "advisory": "Opinion or nit. Recording it is the action." } } } -
personas-adversarial.md 994 B
# Persona: adversarial ROLE: adversarial-lens review agent for `review` deep mode. Always-on. LENS: assume the change is wrong and the inputs are hostile: find the break the happy-path lenses miss. PRIMARY FAILURE CLASS: the failure the other personas' happy-path framing overlooks. HUNT (cite `path:line` or a one-line repro for each): 1. Hostile/malformed input: empty, huge, negative, Unicode, injection-shaped, wrong type. 2. Race conditions, reentrancy, TOCTOU, ordering assumptions between concurrent callers. 3. Partial failure: what state remains if the operation dies mid-way? Idempotency and retry safety. 4. Implicit assumptions stated as invariants but never enforced; cite the unguarded assumption. 5. Resource exhaustion and pathological inputs that turn O(n) into a denial of service. SEVERITY ANCHORS: a reachable hostile-input crash or corruption is P0; an assumption that holds today but is unenforced is P2 with a named future-defect path. Apply `personas-_contract.md`. -
personas-api-contract.md 942 B
# Persona: API contract ROLE: api-contract-lens review agent for `review` deep mode. Gated: run only when the diff changes an exported/public surface. LENS: does the change break a consumer that relied on the old contract? PRIMARY FAILURE CLASS: silent back-compat break. HUNT (use `ast-grep` for signatures, `git grep` for call sites; cite `path:line`): 1. Changed or removed exported signatures, return types, or error types without a migration. 2. Narrowed inputs or widened outputs that break existing callers. 3. Default/enum/serialization changes that alter wire or on-disk format. 4. Semantics changed under an unchanged signature: the most dangerous, because the type checker will not catch it. 5. Versioning or deprecation missing on a breaking change. SEVERITY ANCHORS: a reachable break in a shipped public contract is P0/P1; an internal-only surface with every caller in-repo and updated is P2. Apply `personas-_contract.md`. -
personas-correctness.md 974 B
# Persona: correctness ROLE: correctness-lens review agent for `review` deep mode. Always-on. LENS: does the changed code compute the right result on every path it claims to handle? PRIMARY FAILURE CLASS: wrong behavior (logic errors, broken control flow, mishandled state, swallowed or misrouted errors). HUNT (cite `path:line` for each): 1. Off-by-one, inverted conditions, wrong operator, sign/precedence mistakes. 2. Unhandled error/exception paths; results ignored; `Result`/`Option`/null not checked. 3. State mutated under the wrong condition, or read before it is initialized. 4. Boundary returns: empty collection, zero, max, overflow/underflow, integer truncation. 5. Concurrency only when obvious from the diff (shared mutable state without a guard); deep race-hunting belongs to the adversarial persona. SEVERITY ANCHORS: a wrong result on an ordinary input is P0/P1 by the rubric; a wrong result only on an exotic path is P2. Apply `personas-_contract.md`. -
personas-data-migration-reviewer.md 1.5 KB
# Persona: data-migration-reviewer ROLE: data-migration-reviewer-lens review agent for `review` deep mode. Gated: dispatch when the diff touches migrations, schema dumps, or data transforms. LENS: does the migration preserve data integrity across the deploy window: old code on new schema, new code on old data? PRIMARY FAILURE CLASS: data loss or corruption (swapped mappings, missing backfills, deploy-window breaks, irreversible changes without rollback). HUNT (cite `path:line` for each): 1. Schema drift: changes in `schema.rb` / `structure.sql` not explained by migrations in this diff. 2. Swapped or inverted ID/enum mappings: verify each CASE/IF branch and constant hash entry. 3. Irreversible migrations without a rollback plan: column drops, precision-losing type changes, data deletes. 4. Missing backfill for new non-nullable columns: `NOT NULL` without default or backfill fails on existing rows. 5. Deploy-window breaks: rename/drop before all code paths stop reading; constraints that existing rows violate. 6. Orphaned references: stale columns or associations after drop/rename in serializers, jobs, admin, rake tasks. 7. Silent data loss: `text` to `varchar(n)` truncation, float to integer precision loss. 8. Missing verification queries or rollback plan for non-trivial data transforms. SEVERITY ANCHORS: a dropped column without backup is P0; a missing backfill on a non-nullable column is P1; missing post-deploy verification queries on a risky transform is P2; a nullable column addition is P3 at most. Apply `personas-_contract.md`. -
personas-deployment-verification.md 1.3 KB
# Persona: deployment-verification ROLE: deployment-verification-lens review agent for `review` deep mode. Gated: dispatch when the diff touches data migrations, backfills, or data processing logic. LENS: does this change have a concrete, executable go/no-go checklist: pre-deploy audits, verification queries, rollback plan, post-deploy monitoring? PRIMARY FAILURE CLASS: missing operational readiness (no verification queries, no rollback plan, no monitoring for a risky data deployment). HUNT (cite `path:line` for each): 1. Data invariants that must remain true before/after deploy are not stated or verifiable. 2. Missing read-only SQL queries to prove correctness post-deploy (mapping counts, NULL checks, dual-write verification). 3. Destructive steps (backfills, batching, lock requirements) without estimated runtime or batching strategy. 4. No rollback plan for irreversible changes, or a rollback plan that is untested. 5. Missing post-deploy monitoring: no alert conditions, no dashboard references, no spot-check queries. SEVERITY ANCHORS: a data migration with no rollback plan and no verification queries is P1; missing monitoring for a risky transform is P2; a trivial additive migration with no data interaction needs no checklist. Apply `personas-_contract.md`. -
personas-learnings-researcher.md 1.3 KB
# Persona: learnings-researcher ROLE: learnings-researcher-lens review agent for `review` deep mode. Gated: dispatch when `docs/solutions/` exists in the repo. LENS: does the changed code repeat a pattern the team already learned from: a past defect, a resolved architecture decision, a regression trap? PRIMARY FAILURE CLASS: reinvented failure (repeating a known defect, ignoring a documented lesson, or violating a settled convention). HUNT (cite `path:line` for each): 1. Changed files touch modules or patterns documented in `docs/solutions/`; read the relevant entries and flag collisions. 2. A previously diagnosed bug class (logic error, performance regression, security hole) is reintroduced by the same structural pattern. 3. A past design decision (architecture pattern, tooling choice) is contradicted by the diff without explicit justification. 4. Missing test coverage for a failure mode that was previously captured in a solutions entry. 5. Convention violations against team-agreed standards documented in `docs/solutions/conventions/` or similar. SEVERITY ANCHORS: repeating a known P0-class defect is P0/P1; contradicting a settled design decision without justification is P2; missing a convention that has no behavioral impact is P3. Apply `personas-_contract.md`. -
personas-maintainability.md 882 B
# Persona: maintainability ROLE: maintainability-lens review agent for `review` deep mode. Gated by diff size. LENS: will the next engineer understand and safely change this? PRIMARY FAILURE CLASS: future-defect surface (coupling, opacity, or duplication that invites a later bug). HUNT (cite `path:line` for each): 1. Naming that lies or hides intent; magic values without a name. 2. Functions doing several things; deep nesting; control flow that needs a diagram. 3. Duplicated logic the diff introduces; name the existing site (`git grep`/`ast-grep`). 4. Tight coupling to volatile detail; an abstraction leaking across a module seam. 5. Comments explaining *what* instead of *why*; stale comments contradicting the code. SEVERITY ANCHORS: maintainability is P2 at most unless it names a concrete future-defect path; pure style is P3 advisory. Apply `personas-_contract.md`. -
personas-performance.md 848 B
# Persona: performance ROLE: performance-lens review agent for `review` deep mode. Gated: skip on docs/config-only diffs. LENS: does the change cost more than it should on expected load? PRIMARY FAILURE CLASS: avoidable cost on a path that runs often. HUNT (cite `path:line` for each): 1. Nested loops / O(n^2)+ over data that grows with load; N+1 queries. 2. Allocation in a hot loop; needless copies; unbounded buffering of input. 3. Repeated work that could be hoisted or cached; cite the call site. 4. Blocking I/O on a latency-sensitive path; sync work in an async context. 5. Unbounded growth: caches/maps/queues with no eviction. SEVERITY ANCHORS: resource exhaustion under expected load is P1; a micro-optimization with no measured win is P3 advisory. State the input-size assumption with any cost claim. Apply `personas-_contract.md`. -
personas-previous-comments-reviewer.md 1.2 KB
# Persona: previous-comments-reviewer ROLE: previous-comments-reviewer-lens review agent for `review` deep mode. Gated: dispatch only when PR context with prior review comments is available. LENS: has every prior review comment on this PR been addressed, or did a requested change get dropped? PRIMARY FAILURE CLASS: dropped thread (a reviewer requested a change: fix a bug, add a test, rename, handle an edge case) and the current diff does not reflect it. HUNT (cite `path:line` for each): 1. A prior reviewer asked for a specific change and the original code is still there, unchanged. 2. The reviewer asked for X and Y; the author did X but not Y (partially addressed feedback). 3. A change made to address a previous comment has been reverted or overwritten by subsequent commits. 4. A regression of a prior fix: code that was corrected in earlier review rounds is broken again. SEVERITY ANCHORS: an unaddressed P0-class prior comment is P0; a dropped test request or edge-case fix is P1; a nit the author chose not to take is not flagged. Apply `personas-_contract.md`. NOTE: return an empty findings array immediately if no PR context or prior review comments are available. Do not invent findings. -
personas-project-standards.md 1.4 KB
# Persona: project-standards ROLE: project-standards-lens review agent for `review` deep mode. Gated: dispatch when `CLAUDE.md` or `AGENTS.md` files exist in the repo. LENS: does the changed code violate a rule the project has explicitly written down in its standards files? PRIMARY FAILURE CLASS: standards violation (a quotable rule from `CLAUDE.md`, `AGENTS.md`, or directory-scoped equivalents is broken by the diff). HUNT (cite `path:line` for each): 1. YAML frontmatter violations in skill/agent files: missing required fields, description format mismatches. 2. Reference file inclusion mistakes: markdown links where backtick paths are required, or vice versa. 3. Tool selection violations: shell commands used where native tools are required by standards. 4. Naming and structure violations: files in wrong directories, component naming mismatches. 5. Writing style violations: second person where imperative is required, hedge words in instructions. 6. Protected artifact violations: changes to paths the standards designate as protected. SEVERITY ANCHORS: a mechanical standards violation with a quotable rule is P1; a judgment-call application of a rule is P2; a style preference not codified in standards is not flagged. Apply `personas-_contract.md`. NOTE: every finding must cite the exact rule from the standards file and the specific line in the diff. Generic best practices not in any standards file are not findings. -
personas-reliability-reviewer.md 1.3 KB
# Persona: reliability-reviewer ROLE: reliability-reviewer-lens review agent for `review` deep mode. Gated: dispatch when the diff touches I/O boundaries, external calls, retry logic, or error handling. LENS: what happens when this dependency is down, slow, or returns garbage: does the system degrade gracefully or fall over? PRIMARY FAILURE CLASS: unhandled failure (missing error handling, retry storms, cascading timeouts, swallowed errors, silent data corruption from ignored failures). HUNT (cite `path:line` for each): 1. Missing error handling on I/O boundaries: HTTP calls, database queries, file operations, message queue interactions without try/catch or error callbacks. 2. Retry loops without backoff or limits: immediate infinite retry turns a blip into a retry storm. 3. Missing timeouts on external calls: HTTP clients, database connections, RPC calls that hang indefinitely. 4. Error swallowing: `catch (e) {}`, `.catch(() => {})`, error handlers that log but don't propagate. 5. Cascading failure paths: failure in A causes aggressive retry of B, which overloads C. SEVERITY ANCHORS: a missing timeout on a critical-path external call is P0/P1; an infinite retry loop without backoff is P1; a swallowed error that masks data corruption is P1; error message formatting choices are P3. Apply `personas-_contract.md`. -
personas-security.md 1.2 KB
# Persona: security ROLE: security-lens review agent for `review` deep mode. Always-on when a security-touching path is in the diff. LENS: can untrusted input reach something dangerous? PRIMARY FAILURE CLASS: exploitable boundary (injection, secret exposure, broken authz). FORCING PATH GLOBS (presence in the diff forces this persona on; this is the authoritative set, and the auto-escalation threshold in `SKILL.md` lists only a representative subset and defers here): `auth`, `crypto`, `secret`/`token`/`password`/`session`, `sql`/`query`, `exec`/`eval`/`deserialize`/`pickle`, `.env`, `migrations/`, `middleware/`, request handlers. HUNT (cite `path:line` for each): 1. Untrusted input into SQL, shell, eval, deserialization, a path, or a template without validation/parameterization. 2. Secrets, tokens, or keys hardcoded or logged. 3. Missing or wrong authz/authn check on a changed endpoint; IDOR. 4. Sensitive data leaked in errors, logs, or responses. 5. Weak crypto, missing TLS verification, or predictable randomness used for security. SEVERITY ANCHORS: a boundary reachable by untrusted input is P0; a defense-in-depth gap behind another control is P1/P2. Apply `personas-_contract.md`. -
personas-testing.md 985 B
# Persona: testing ROLE: testing-lens review agent for `review` deep mode. Gated: skip when the diff adds no executable logic. LENS: do tests exercise the branches this diff changed, and would they actually catch a regression? PRIMARY FAILURE CLASS: silent breakage (a changed branch with no asserting test). HUNT (cite `path:line` for each): 1. New or changed branches with no covering test; discover test files with `fd -e <test-ext>`, map test names to changed symbols. 2. Tests that call the code but assert nothing, or assert on a mock instead of behavior. 3. Missing edge-case tests for the boundaries the correctness persona flags. 4. Deleted assertions, or `skip`/`xfail`/`only` left in the diff. 5. Tests coupled to implementation detail that break on any refactor (a maintainability cost; class it accordingly). SEVERITY ANCHORS: an untested changed branch that can break silently is P2; an untested security or money path is P1 or higher. Apply `personas-_contract.md`. -
personas-_contract.md 2.9 KB
# Review deep mode: shared persona contract Every persona dispatch is `<this file> + "\n\n---\n\n" + <persona prompt> + "\n\n---\n\nDIFF:\n" + <diff>`. The orchestrator prepends this file to all personas. You are a read-only review agent: you emit findings, you edit nothing. ## Severity: P0-P3 by observable behavioral impact Assign by the impact that is observed or *reachable*, not by how subtle the bug is. - P0: reachable now by ordinary or untrusted input: data loss/corruption, security breach, crash on a normal path, regression in a shipped contract. Ship-blocker. - P1: wrong output or failure on a plausible (non-adversarial) input; resource exhaustion under expected load; a contract break behind a flag/edge. Fix before merge. - P2: degraded behavior on an uncommon path; a changed branch with no test that can break silently; maintainability debt with a named future-defect path. Fix or file. - P3: no behavioral impact: style, naming, micro-optimization with no measured win. Advisory. A finding with no nameable reachable impact is P3. "Looks wrong" is not P0. ## Action class: routing advice (no fix is applied here) - safe: mechanical, behavior-preserving, single-site, unambiguous fix → apply directly (unattended). - gated: clear fix but touches a contract or multiple sites → route `audit-project`. - manual: needs a human design decision; no single correct fix → surface as a question, route `none`. - advisory: opinion/nit; recording it is the action → route `none`. ## Confidence `high`: you can cite the failing input or path. `med`: strong structural evidence, no repro. `low`: suspicion only. Do not pad with low-confidence findings; an empty list is valid output. ## Tool order (ODIN fd-First) 1. `fd -e <ext> -E <noise>` to discover candidate files (keep the set under ~50; narrow with `-E node_modules -E vendor -E dist`). 2. `ast-grep run -p '<pattern>' -l <lang> -C 3` for structural matches: signatures, call sites. 3. `git --no-pager grep -n -F 'literal'` or `rg -nF 'literal'` for literal text. 4. `bat -P -p -n <file>` to read a span with line numbers. Cite the exact `path:line`. Never use `ls`, `find`, `grep`, `cat`, `sed`, or `head`/`tail` as a pager. ## Output: JSON-style, one finding per object, nothing else ``` findings: - file: <path> line: <number> persona: <your persona name> title: <short> severity: P0 | P1 | P2 | P3 behavioral-impact: <the observable failure this causes, or "none — advisory"> confidence: high | med | low action-class: safe | gated | manual | advisory suggested-route: apply | audit-project | none evidence: <path:line citation or a one-line repro> ``` ## Hard limits - You do not edit files. Findings only. - Cite `path:line` for every claim; no claim without a citation. - Stay in your lens; defer an out-of-lens finding to the owning persona. - Empty findings is a valid, correct result. -
review-output-template.md 5 KB
# Review output template Use this **canonical skeleton** for deep-mode review output. Copy the section structure; the example shows one good rendering, not the only permitted layout. Shape each finding for the reader's next action. Group findings by severity, not by persona. **Hard constraints (non-negotiable):** ASCII-safe only -- no box-drawing or per-item horizontal-rule separators, no Unicode arrows, middot, or em dashes; use `->` for arrows, `--` for dashes. Don't paste file contents or re-print the diff -- cite `file:line`. Stable `#` numbering, reused wherever a finding reappears. The Verdict blockquote is always last and self-sufficient. The Actionable Findings section is conditional (include when the queue is non-empty) and always precedes Pre-existing and Coverage. **If you use a markdown table, escape literal pipe characters in cells.** Any `|` inside a finding title, issue description, code snippet, or example must be written as `\|` so column boundaries are determined only by unescaped pipes. ## Example ```markdown ## Code Review Results **Scope:** merge-base with the review base branch -> working tree (14 files, 342 lines) **Intent:** Add order export endpoint with CSV and JSON format support **Mode:** deep **Personas:** correctness, testing, maintainability, security, api-contract - security -- new public endpoint accepts user-provided format parameter - api-contract -- new /api/orders/export route with response schema ### P0 -- Critical | # | File | Issue | Persona | Confidence | |---|------|-------|---------|------------| | 1 | `orders_controller.rb:42` | User-supplied ID in lookup, no ownership check | security | high | - **#1** -- `find(params[:id])` on the export path has no `where(account: current_account)` scope, so any authenticated user can export another account's orders. Scope the lookup to the current account. ### P1 -- High | # | File | Issue | Persona | Confidence | |---|------|-------|---------|------------| | 2 | `export_service.rb:87` | Loads all orders into memory -- unbounded | performance | high | - **#2** -- `Order.where(...).to_a` materializes the full result set; a large account OOMs the worker. Stream with `find_each` or paginate. ### P2 -- Moderate | # | File | Issue | Persona | Confidence | |---|------|-------|---------|------------| | 3 | `export_service.rb:45` | No error handling for CSV serialization failure | correctness | med | ### P3 -- Low | # | File | Issue | Persona | Confidence | |---|------|-------|---------|------------| | 4 | `export_helper.rb:12` | Format detection could use an early return | maintainability | med | ### Actionable Findings | # | File | Issue | Route | Notes | |---|------|-------|-------|-------| | 1 | `orders_controller.rb:42` | Ownership check missing on export lookup | `gated -> audit-project` | `suggested-route` present -- caller decides whether to apply | | 2 | `export_service.rb:87` | Unbounded memory on export | `safe -> apply` | Mechanical: add `find_each` | ### Pre-existing Issues | # | File | Issue | Persona | |---|------|-------|---------| | 1 | `orders_controller.rb:12` | Broad rescue masking failed permission check | correctness | ### Coverage - Suppressed: 2 findings below the confidence gate - Residual risks: No rate limiting on export endpoint - Testing gaps: No test for concurrent export requests --- > **Verdict:** Ready with fixes > > **Reasoning:** 1 critical auth bypass must be fixed. The memory issue (P1) should be addressed for production safety. > > **Fix order:** P0 auth bypass -> P1 memory -> P2 error handling if straightforward ``` ## Formatting rules - ASCII-safe only -- never box-drawing characters or per-item horizontal-rule separators between entries, no Unicode arrows or middot; use `->`. - Escape literal `|` in table cells -- any `|` inside a finding title, issue description, code snippet, or example must be written as `\|`. - Severity-grouped sections -- `### P0 -- Critical`, `### P1 -- High`, `### P2 -- Moderate`, `### P3 -- Low`. Omit empty severity levels. - Stable sequential finding numbers -- assign finding numbers once after sorting, continue them across severity sections, and reuse those same numbers when findings are repeated in Actionable Findings. - Always include file:line location for code review issues. - Persona column shows which persona(s) flagged the issue. Multiple personas = cross-persona agreement. - Confidence column shows `high`, `med`, or `low`. - No Route column in per-severity tables -- the route appears only in the Actionable Findings table. - Detail line (per finding, as needed) -- keep the scannable line short; put the why-it-matters + fix in a per-finding detail line keyed by stable `#`: `- **#N** -- <why it matters + what response it needs>`. - Actionable Findings section -- include when the actionable queue is non-empty. - Pre-existing section -- separate table, no confidence column. - Coverage section -- suppressed count, residual risks, testing gaps. - Summary uses blockquotes for verdict, reasoning, and fix order. - Horizontal rule (`---`) separates findings from verdict. - `###` headers for each section. -
smell-baseline.md 2.2 KB
# Fowler code smell baseline The Standards axis adds this baseline to the repository's documented rules: a fixed set of twelve Fowler code smells (*Refactoring*, ch. 3) that applies even when a repository documents nothing. ## Binding rules - **The repo overrides.** A documented repo standard always wins; where it endorses something the baseline would flag, suppress the smell. - **Always a judgement call.** Each smell is a labelled heuristic ("possible Feature Envy"), never a hard violation, and skip anything tooling already enforces. ## Smell baseline (12 Fowler smells) - Mysterious Name: a function, variable, or type whose name doesn't reveal what it does or holds. → Rename it; if no honest name comes, the design's murky. - Duplicated Code: the same logic shape appears in more than one hunk or file in the change. → Extract the shared shape, call it from both. - Feature Envy: a method that reaches into another object's data more than its own. → Move the method onto the data it envies. - Data Clumps: the same few fields or params keep travelling together (a type wanting to be born). → Bundle them into one type, pass that. - Primitive Obsession: a primitive or string standing in for a domain concept that deserves its own type. → Give the concept its own small type. - Repeated Switches: the same `switch`/`if`-cascade on the same type recurs across the change. → Replace with polymorphism, or one map both sites share. - Shotgun Surgery: one logical change forces scattered edits across many files in the diff. → Gather what changes together into one module. - Divergent Change: one file or module is edited for several unrelated reasons. → Split so each module changes for one reason. - Speculative Generality: abstraction, parameters, or hooks added for needs the spec doesn't have. → Delete it; inline back until a real need shows. - Message Chains: long `a.b().c().d()` navigation the caller shouldn't depend on. → Hide the walk behind one method on the first object. - Middle Man: a class or function that mostly just delegates onward. → Cut it, call the real target direct. - Refused Bequest: a subclass or implementer that ignores or overrides most of what it inherits. → Drop the inheritance, use composition. -
subagent-template.md 3.4 KB
# Sub-agent prompt template The orchestrator uses this template to spawn each reviewer sub-agent. It fills the variable substitution slots at spawn time. --- ## Template ``` You are a specialist code reviewer. <persona> {persona_file} </persona> <scope-rules> {diff_scope_rules} </scope-rules> <output-contract> You produce a compact return to the parent with findings matching the schema: {schema} **Schema conformance — hard constraints (use these exact values):** - `severity`: one of `P0`, `P1`, `P2`, `P3` — the parent report reads these as critical, high, medium, and low respectively. - `confidence`: one of `high`, `med`, `low`. - `action-class`: one of `safe`, `gated`, `manual`, `advisory`. - `suggested-route`: one of `apply`, `audit-project`, `none`. - `evidence`: a `path:line` citation or a one-line repro. **Confidence rubric — use these behavioral anchors:** - **`high`** — you can cite the failing input or path. The bug, vulnerability, or contract violation is clearly present and actionable. - **`med`** — strong structural evidence, no repro. You verified this is a real issue but it may be a nitpick, narrow edge case, or have minimal practical impact. - **`low`** — suspicion only. Could not verify from the diff and surrounding code alone. **Suppress** — do not emit. A finding with no nameable reachable impact is P3. "Looks wrong" is not P0. **False-positive suppression.** Do not emit a finding when any of these apply: - Pre-existing issues unrelated to this diff (mark `pre_existing: true` only for unchanged code the diff does not interact with). - Pedantic style nitpicks a linter or formatter would catch. - Code that looks wrong but is intentional (check comments, commit messages, surrounding code for evidence of intent). - Issues already handled elsewhere (callers, guards, middleware, framework defaults). - Suggestions that restate what the code already does in different words. - Generic "consider adding" advice without a concrete failure mode. - Issues with a relevant lint-ignore comment — the author already chose to suppress. - General code-quality concerns not codified in the project's standards files. - Speculative future-work concerns with no current signal. **Propose a `suggested-route` whenever any defensible code change is reachable from the diff and surrounding code.** Imperfect information is not grounds for omission — propose the most defensible default and name the assumption. Omit only when there is genuinely no code-level change to propose. If you find no issues, return an empty findings array. Still report residual risks and testing gaps as prose lines after the JSON block -- the orchestrator compiles them into the final Coverage section. </output-contract> <review-context> Intent: {intent_summary} Changed files: {file_list} Diff: {diff} </review-context> ``` ## Variable reference | Variable | Source | Description | |----------|--------|-------------| | `{persona_file}` | Persona markdown file content | The full persona definition | | `{diff_scope_rules}` | `references/diff-scope.md` content | Primary/secondary/pre-existing tier rules | | `{schema}` | `references/findings-schema.json` content | The JSON schema reviewers must conform to | | `{intent_summary}` | Orchestrator output | 2-3 line description of what the change is trying to accomplish | | `{file_list}` | Orchestrator output | Changed-file list | | `{diff}` | Orchestrator output | The diff to review |
-
-
SKILL.md 9.1 KB
--- name: review description: 'Use when asked to review a pull request, examine code changes, find bugs, or audit a branch, in standard or depth mode. Not for an iterative review-and-fix loop: use audit-project.' --- # Severity-graded review Two modes share one authority (read-only) and one evidence bar: every finding cites concrete code evidence, no invented issues, no style-only findings. Standard mode is a single-pass severity-graded review of a supplied diff, snippet, or branch. Depth mode fans out two parallel reviewers, bug/security and code quality, and synthesizes a deduplicated unified verdict. ## Contract | Field | Bound contract | |---|---| | Trigger | User asks to review a pull request, examine code changes, find bugs, run a security review, audit code on the current branch, or run combined bug/security and code-quality branch audits. | | Authority | Read-only. No file, VCS, credential, paid, published, deployed, or remote mutation. | | Side effect | Chat output: a review report with findings (standard) or a unified audit report (depth). | | Done | Standard: validated findings with severity, evidence, and concrete fixes; no style-only or invented findings. Depth: a single deduplicated prioritized synthesis as a unified verdict ordered by severity. | ## Inputs Required: a PR URL, diff content, code snippet, or branch to review (standard); the diff range, PR number, or commit range to audit (depth). Optional: a stated focus area (e.g., security, performance, correctness); specific files, directories, or a focus area to narrow scope. The skill operates entirely within the current session context. No file system, repository, credential, or remote access is required or authorized. ## Mode selection | User says | Mode | Output | |---|---|---| | review this PR, examine these changes, find bugs, security review, audit this branch | standard | Severity-graded findings report | | deep review, combined bug/security and quality audit, full branch audit | depth | Unified deduplicated verdict from parallel reviewers | When the user names a single PR or diff, use standard mode. When the user asks for a combined bug/security and quality audit or a full branch audit, use depth mode. ## Shared evidence bar Every finding, in either mode, must cite specific code locations, line ranges, or diff hunk markers as evidence. Do not assert a finding without quoting the supporting code. Discard any candidate without evidence. Never report an invented issue. Exclude style-only findings (formatting, naming conventions, cosmetic preferences) unless they cause a correctness or security issue. ## Standard mode 1. **Acquire diff.** Receive the PR URL, diff text, or code snippet from the user; or determine the change set from the current branch diff against its base when the user does not name one. If no code change is supplied, ask for it. Done when: the change set is determined and scoped. 2. **Fetch changes.** Use the available tools to retrieve diff or file content for the target revision range. If the user named files, directories, or a focus area, restrict scope to those. Do not assume write access. Done when: the diff or file content is retrieved and scope is restricted. 3. **Bound scope.** Limit analysis to the supplied diff or code range. Do not widen scope to surrounding code or unrelated files. Done when: scope is bounded. 4. **Read changed regions with context.** Read each changed region and the immediate callers and surrounding state needed to reason about its behavior. Do not read unrelated code. Done when: every changed region is read with its callers and surrounding state. 5. **Categorize findings.** Assign each finding to one of: Correctness, Security, Performance, Maintainability, Robustness, Logic, or API Usage. Done when: every finding is categorized. 6. **Grade severity.** Assign one severity level to each finding: - Critical: exploitable bug, data loss, or security vulnerability with no workaround - High: significant bug, regression risk, or breach of contract without mitigation - Medium: correctness concern, degraded performance, or maintainability debt - Low: minor issue, cosmetic concern, or opportunity for improvement Done when: every finding is graded. 7. **Validate findings.** Apply the shared evidence bar: each finding cites specific code locations as evidence; evidence-less candidates are discarded; no invented issues. Done when: every surviving finding has concrete evidence. 8. **Reject style-only findings.** Do not report formatting, naming conventions, or cosmetic preferences unless they cause a correctness or security issue. Done when: no style-only finding remains. 9. **Prescribe concrete fixes.** For each finding, write a specific, actionable recommendation that addresses the root cause, not a surface-level patch. Done when: every finding has a concrete fix. 10. **Assemble report.** Structure findings as: Severity → Category → Finding → Evidence → Recommended Fix. Sort by severity descending. Done when: the report is assembled and sorted. ## Depth mode 1. **Confirm scope.** Confirm the diff range, PR number, or commit range to audit. Stop if scope cannot be determined. Done when: the audit scope is confirmed or the run stops with scope-unresolvable. 2. **Fan out two simultaneous reviewers.** - Reviewer A, bug and security audit: reads the scope, identifies defect, security, and regression findings, produces a severity-ordered list. - Reviewer B, code quality audit: reads the scope, identifies maintainability, style, and structural quality findings, produces a severity-ordered list. Both reviewers operate under the same read-only authority and the shared evidence bar. Neither reviewer makes changes. Done when: both reviewers are spawned with their audit assignments and read-only authority. 3. **Wait for both reviewers.** Done when: both reviewers have returned their findings lists. 4. **Handle partial failure.** If either reviewer fails or returns empty after retry, report the partial result from the surviving reviewer with the failure identified. Done when: both reviewers returned, or the surviving reviewer's partial result is reported with the failure identified. 5. **Synthesize.** - Merge findings from both reviewers. - Deduplicate and consolidate overlapping findings. - Rank merged findings by severity (critical > high > medium > low > informational). Map reviewer-reported severities onto this scale: P0 = critical, P1 = high, P2 = medium, P3 = low; informational is for advisory notes with no behavioral impact. - Group findings by file or component. - Omit findings already resolved or not applicable. - Record which reviewer produced each finding for attribution. Done when: findings are merged, deduplicated, severity-ranked, grouped, resolved findings omitted, and reviewer attribution recorded. 6. **Return a unified audit report.** Findings in severity order, each labeled with severity, category, affected file(s) and line(s), description, rationale, and reviewer source. Done when: the unified report is returned with all findings labeled and severity-ordered. ## Failure and recovery | Failure class | Condition | Result | |---|---|---| | `empty-diff` | No diff or code supplied | Ask the user for the PR or code to review; do not produce a report | | `review-blocked` | Cannot access the target PR or revision | Report the access failure explicitly; do not fabricate content | | `partial-result` | Some files or hunks are inaccessible | List accessible findings; state which parts were skipped and why | | `scope-widening` | Analysis extends beyond supplied diff | Discard widened findings; report only bounded results | | `style-only-report` | All findings are style-only | State that no actionable findings were found; describe what was evaluated | | `scope-unresolvable` (depth) | Diff, PR, or commit range cannot be determined | Stop. Report that the scope could not be determined | | `reviewer-failure` (depth) | A reviewer fails after retry | Return the surviving reviewer's findings with the failure stated. Do not synthesize from a missing reviewer | | `synthesis-empty` (depth) | No synthesis was possible | Return the exact partial result each reviewer produced; state that no synthesis was possible | Partial-result rule: always return what was produced. Never claim the done predicate holds when it does not. Non-mutation: never edits files, commits, or remote state. Any failure leaves the working tree unchanged. ## Output **Standard mode.** A structured review report returned as chat output. One section per severity level (Critical, High, Medium, Low), each containing: - **Severity** and **Category** - Finding: the specific issue with code location and evidence - Recommended Fix: concrete, actionable correction Unsuitable scope is reported as a named failure. An empty diff or inaccessible PR is reported as a named failure. The report must not contain findings without cited evidence. **Depth mode.** A unified audit report with deduplicated findings prioritized by severity, grouped by file or component, each labeled with severity, category, affected location, description, rationale, and reviewer source. Or a partial-result report if synthesis was not possible.
Comments (0)
Sign in to join the conversation.
Reviews (0)
No reviews yet.
No comments yet.