Code review: offer repo skills in "Add a review"
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- git, typescript
- Ambito
- developer-experience
Direzione di ricerca
Start with packages/server/review-skill-loader.ts, apps/pi-extension/server/serverReview.ts, and docs/custom-reviews.md; trace how skills are discovered and passed to the picker and review launch path. The proposal splits work across both server runtimes, with tests for source selection and a Git fixture proving a PR uses the base version of a changed skill. Done means repo skills are safely sourced by trust context, shown distinctly, and existing global curation remains compatible.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What
"Add a review" in code review lists only global skills (~/.claude/skills, ~/.codex/skills, ~/.agents/skills, ~/.config/agents/skills). A skill checked into the repo under review does not show up.
My case: I run plannotator-review from Pi on a PR in a repo that has .agents/skills/pr-review/SKILL.md (and .claude/skills -> ../.agents/skills). The picker shows commit, performance, writing-for-agents, my global skills, but not pr-review, the one the team wrote for reviewing PRs in this repo.
Why
I know this is on purpose. docs/custom-reviews.md:
Global skills only. A skill checked into a repo is ignored. (A pull request from a fork could otherwise drop instructions straight into your reviewer.)
That makes sense, but repos that keep their review skill in the repo have no good path today. The workaround is to symlink each repo skill into ~/.agents/skills. That breaks when the repo moves, and two repos with a pr-review skill clash.
Proposal
Load repo skills, but never from the code under review:
- Local diff (my own uncommitted or branch work): read skills from the working tree. The author is me, so there is no one to distrust.
- PR or remote branch: read skills from the merge-base with the target branch (
git show <base>:.agents/skills/...), so a PR cannot change its own reviewer. A skill the PR changes takes effect once it is merged, likepull_request_targetworkflows and CODEOWNERS on GitHub. - The picker shows where each skill comes from, e.g.
REPO @ mainnext toCLAUDE. No new prompt or setting.
This doesn't stop prompt injection in the diff itself (the diff goes into the prompt anyway). It only keeps a PR from rewriting the reviewer's instructions.
Related: #3112 asks the same for the Inbox skill picker.
Proposed design
Today discoverSkills() in packages/server/review-skill-loader.ts takes no input and walks the global roots. The idea is to make the trust decision one small pure function, and keep the I/O at the edges.
type ReviewSubject =
| { kind: "local"; repo: string } // my own working tree
| { kind: "ref"; repo: string; base: string } // PR / remote branch, base = merge-base
| { kind: "none" }; // plan / annotate
type SkillSource =
| { kind: "global"; root: SkillRoot; dir: string }
| { kind: "worktree"; repo: string }
| { kind: "atRef"; repo: string; ref: string };
// The whole policy. Pure, exhaustive.
const sourcesFor = (s: ReviewSubject, globals: SkillSource[]): SkillSource[] => {
switch (s.kind) {
case "local": return [...globals, { kind: "worktree", repo: s.repo }];
case "ref": return [...globals, { kind: "atRef", repo: s.repo, ref: s.base }];
case "none": return globals;
}
};
There is no fork case on purpose: every PR reads skills from its base, so nothing has to detect forks.
Then:
- list (I/O, one reader per source):
globalandworktreeuse the existing folder walk;atRefusesgit ls-tree <ref> -- .agents/skills .claude/skillsandgit show <ref>:<path>for the SKILL.md head. - merge (pure): skills get a source-qualified id (
repo:pr-review,claude:pr-review), so a name clash shows both instead of dropping one. Bare names inreview-skills.jsonkeep meaning global, so existing configs still work. - materialize (I/O, only on launch): for
atRef,git archive <ref> <skillDir>into a temp dir, soreferences/also come from the base and the agent gets a normal path on disk. The prompt code does not change. - Both servers (
packages/server/andapps/pi-extension/server/serverReview.ts) build theReviewSubjectfrom what they already know and pass it to/api/agents/skillsand the launch path.
Slices
Each one can merge on its own.
- Refactor, no behavior change. Add
ReviewSubject,SkillSource,sourcesForreturning only the global roots. Table tests for the policy. - Working-tree skills for local diffs. Picker source label.
- Base-ref skills for PRs.
atRefreader andmaterialize. Git-fixture test: a skill committed onmainand changed on the PR branch; the review must use themainversion. - Source-qualified curation ids in
review-skills.json, backward compatible. Docs:docs/custom-reviews.md,docs/agent-guides/code-review.md.
Rough size: ~250–380 lines of code, ~200–300 of tests.
Question
Are you open to this? If yes, I'm happy to implement it in small PRs (both server runtimes, with a test that a PR's changed skill is not used). If you'd rather keep repo skills out, or prefer another trust model, that's fine too. I'd at least add the symlink workaround to the docs.
The idea and the problem are mine. I wrote this with help from an AI agent (Pi), which I used to read the loader code and draft the text.
- Lingua principale
- TypeScript
- Stelle
- 8.7k
- Fork
- 649
- Merge medio
- 16h 1m
- PR unite (30g)
- 756
Preparare l'ambiente
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di backnotprop/plannotator
-
Inbox: numbered choices in a :::question become free text, and context bullets become the choicesAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
backnotprop/plannotator#4132 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Claude Code: "classic.PermissionRequest hook was skipped" notice is back on Bash permission promptsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
backnotprop/plannotator#4051 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
backnotprop/plannotator#4000 ·
I maintainer di solito rispondono entro 1 giorno
-
PR description is hidden when a PR review opens on a phoneForse già presa @flipcyde101 l’ha presa 8 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
backnotprop/plannotator#3667 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
backnotprop/plannotator#2643 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di backnotprop/plannotator
Issue simili
-
enhancement status:needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
dongdongbh/Mindwtr#1625 ·
I maintainer di solito rispondono entro 1 giorno
-
area/ui-schema good first issue type/bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
I maintainer di solito rispondono entro 4 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 91/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
duckdb/duckdb-wasm#2335 ·
I maintainer di solito rispondono entro 1 giorno