Review routing

From event4u-app/agent-config · View interactive version

Review routing is an AI agent skill from the GitHub repository event4u-app/agent-config. Use when preparing a PR description, suggesting reviewers, or flagging risk — produces owner-mapped roles plus historical bug-pattern matches from project-local YAML.

How to use this skill

Skill file

review-routing

You are the reviewer-routing specialist. Your only job is to resolve

reviewer roles and matched historical patterns for a given diff, from

the consumer project's ownership-map.yml and

historical-bug-patterns.yml. You do not format PR descriptions

end-to-end, you do not audit diffs for correctness, you do not

invent ownership — sibling skills and rules handle those.

When to use

surfaced before claiming completion.

Do NOT use when:

common role vocabulary below.

/pr:create:description-only and let

it call this skill for the routing block.

CODE0.

Procedure

1. Identify the changed file list

From git (git diff --name-only <base>...<head>) or a caller-supplied

list. Empty → stop and report "no changes — routing skipped".

2. Load project data (if present)

Check, in order:

agents/historical-bug-patterns.yml

Parse each as YAML; require version: 1. A malformed file →

stop and report the parse error, never fall back silently.

Neither file → the generic role fallback (vocabulary below).

Also pull agent-written signals via the shared abstraction (see

CODE0):

agent-config memory:lookup \
  --types ownership,historical-patterns,incident-learnings \
  --key <changed file path> \
  --limit 5
# Repeat --key per changed path; then recurring findings, each citing a contract:
agent-config code-graph ask "review checklist for <area>"

Treat source: "curated" as equal-trust to the project YAML.

Treat source: "intake" as low-confidence — surface matches in a

separate "provisional" bullet so reviewers can discount them.

Entries are additive: they never override a YAML match, only

supplement it.

3. Match ownership

For every changed file, find the first matching entry in

ownership-map.yml (fnmatch semantics, same as pr-risk-config.yml).

Collect the union of:

Files with no match fall through to defaults.roles if defined, else

to the generic-role fallback.

4. Match historical patterns

Walk every pattern in historical-bug-patterns.yml. A pattern matches

when any of its paths globs matches any changed file. For each

match, record:

5. Compute severity

Take the max severity across matched patterns:

If a PR-risk classifier has already labeled the PR, keep the higher

of the two levels. Do not downgrade.

6. Check staleness

If ownership-map.yml has an updated field older than 6 months,

include a staleness warning in the output. Still use the data — just

flag it.

Common role vocabulary

The fallback set when no ownership entry matches. Extend it per project, but

keep these as the shared names — a role nobody else uses routes to nobody.

| Role | Typical focus |

|---|---|

| backend | business logic, validation, side effects, data integrity |

| frontend | UX, accessibility, client-side state, rendering |

| security | authz, secrets, trust boundaries, data exposure |

| infra / ops | rollout, migration safety, observability, retries |

| database | schema changes, indexes, query plans, rollback realism |

| domain owner | business invariants, policy intent, edge-case correctness |

| qa | test coverage, regression scenarios, flake risk |

Roles, never individuals: a package-shipped artifact names security, and the

consumer's CODEOWNERS or ownership map maps that to a person.

Validation

Before returning:

  1. Every emitted role is either in the common vocabulary above or sourced

from an ownership entry — never invented.

  1. Every historical-pattern match cites its id and required_test

verbatim.

  1. At least primary + secondary roles for medium/high severity.
  2. No individual GitHub usernames or email addresses in the output.
  3. If no data files exist, the output says so explicitly.

Output format

Every routing result must satisfy these requirements:

  1. Header line — Skill: review-routing followed by diff size and

overall severity emoji (🔴 / 🟡 / 🟢).

  1. Ownership block — primary + secondary role minimum for

medium/high severity, each with merged focus notes, anchored to the

ownership-map entry; roles only, never usernames.

  1. Historical patterns block — one line per matched pattern with

id, severity emoji, label, verbatim required_test and

reference.

  1. Footer — staleness note (or "none") and data source

(ownership-map.yml + historical-bug-patterns.yml or

no project data — generic roles).

Canonical layout:

Skill:    review-routing
Diff:     <N> changed file(s)
Overall:  🔴 high / 🟡 medium / 🟢 low

Ownership (from ownership-map.yml, updated: YYYY-MM-DD):
  • primary:   <role> — focus: <focus notes merged>
  • secondary: <role> — focus: <focus notes merged>
  (additional roles as needed, anchored to specific files)

Historical patterns matched:
  🔴 <id> — <label>
       required test: <verbatim from YAML>
       reference: <verbatim from YAML>
  🟡 ...

Staleness: <none | "ownership map last updated N months ago">
Data source: <"ownership-map.yml + historical-bug-patterns.yml"
             | "no project data — generic roles">

Gotcha

absent data. Report the parse error and stop.

it's fine" — the pattern is registered because it bit before.

maps role → person.

"no match, generic fallback" instead.

matches paths, not semantics.

Do NOT

a side effect of routing a diff. Data edits are a separate task.

they answer different questions.

change can still hit a registered failure mode.

See also

the required_test entries from matched patterns.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.