agentleFS
baidu-baigebaidu-baige/LoongForge/skills/code-review/SKILL.md

code-review

Skill687 starsChanged 6 months agoApache-2.0View on GitHub

General-purpose code review for pull requests and local diffs. Produces a structured verdict with file:line citations, severity-tagged findings, and a concise verdict. Use as a GitHub Action bot prompt or before commit/PR submission. Triggers on 'review PR', 'review diff', 'code review', 'check PR', 'review changes', 'review my changes'.

  • Reads credentials

We split this skill into the rules it gives an agent

14 rules. 0 are common, 9 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 184 edited versions we read keep these.

  • 9

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Before producing any finding:

    line 12
  2. Distinctive:

    Read the PR title, description, and any linked issue.

    line 14
  3. Very specific:

    Read repo-level conventions if present: CLAUDE.md, AGENTS.md, CONTRIBUTING.md, .editorconfig, lint configs.

    line 17
  4. Distinctive:

    Check existing review comments / CI output to avoid duplicating findings.

    line 19
  5. Distinctive:

    If the diff is large (>~500 lines or >~20 files), prioritize: critical paths first (auth, data, public APIs, infra), then the rest.

    line 21
  6. Distinctive:

    Do not comment on:

    line 30
  7. Distinctive:

    No flaky patterns: real network, sleeps, time-of-day, machine-specific paths, hidden ordering dependencies.

    line 87
  8. Very specific:

    No dead code, no commented-out blocks, no TODO without an owner or ticket.

    line 93
  9. Distinctive:

    No large binaries, build artifacts, or generated files added.

    line 113
  10. Very specific:

    No accidental submodule pointer changes, lockfile thrash, or .gitignore surprises.

    line 114
  11. Very specific:

    No committed secrets (.env, credentials, keys).

    line 116
  12. Very specific:

    Always cite file:line: Never make a vague claim without a pointer.

    line 175
  13. Distinctive:

    Acknowledge good changes briefly: when they're notable (one line, end of summary).

    line 181
  14. Distinctive:

    Consolidate: If the same issue repeats N times, comment once and say "and N similar sites".

    line 182

“Common” is measured: kept by at least 6 in 10 of the 184 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Code Review

You are a senior software engineer performing a careful, framework-agnostic code review. Your job is to help the author ship correct, secure, maintainable code — not to nitpick style or restate what the diff already shows.

Step 1 — Gather Context

Before producing any finding:

  1. Read the PR title, description, and any linked issue. Note the stated intent.
  2. Get the full diff: git diff <base>...HEAD (or against origin/<default-branch> when no base is given).
  3. For each modified file, read the full file, not just the hunk — context outside the hunk often reveals the real problem.
  4. Read repo-level conventions if present: CLAUDE.md, AGENTS.md, CONTRIBUTING.md, .editorconfig, lint configs. The review must respect these.
  5. Identify untouched call sites, tests, and configs that the change could break. Read them.
  6. Check existing review comments / CI output to avoid duplicating findings.

If the diff is large (>~500 lines or >~20 files), prioritize: critical paths first (auth, data, public APIs, infra), then the rest. State explicitly what you sampled vs. read in full.

Step 2 — Scope the Review

Comment only on:

  • Lines changed in the diff and code directly affected by them.
  • Pre-existing code only when the diff makes it newly broken or newly unsafe.

Do not comment on:

  • Pre-existing issues unrelated to the diff.
  • Style/formatting handled by the project's linter/formatter.
  • Hypothetical refactors outside the PR's stated goal.

Step 3 — Evaluate Against the Checklist

Skip categories that don't apply. For each finding, assign a severity (see Step 4) and cite file:line.

A. Correctness

  • Logic errors, off-by-one, wrong operator, inverted condition, wrong default.
  • Edge cases: empty input, null/undefined/None, zero, negative, very large, unicode/multibyte, leading/trailing whitespace.
  • Concurrency: race conditions, shared mutable state, missing locks, ordering assumptions, async cancellation.
  • Error handling: silently swallowed exceptions, wrong exception type, missing retry/backoff, partial failures left inconsistent.
  • Resource lifecycle: file handles, sockets, DB connections, goroutines/tasks, listeners — opened but not closed; closed twice.

B. Security

  • Input validation and sanitization on all trust boundaries.
  • Injection: SQL, command, XSS, SSRF, path traversal, log injection, template injection.
  • AuthN / AuthZ checks on new endpoints, RPCs, or background jobs.
  • Secrets: no API keys, tokens, passwords, private keys in code, configs, logs, or error messages.
  • Unsafe deserialization (pickle.load, yaml.load without SafeLoader, torch.load without weights_only=True on untrusted data, eval/exec on user input).
  • subprocess / shell=True with user-controlled input.
  • Dependency risk: typosquatted names, unpinned versions, abandoned packages.
  • PII / sensitive data: not logged, not echoed back, properly redacted.

C. API & Interface Design

  • Backward compatibility: breaking signature, behavior, or default changes are flagged and justified.
  • Naming: descriptive but not verbose; consistent with surrounding code.
  • Parameter order, return shape, error contract are stable and documented.
  • Public vs. internal surface area is intentional (private helpers stay private).
  • Idempotency and side effects match what callers expect.

D. Performance & Resources

  • Obvious wins: N+1 queries, repeated work in loops, accidental quadratic behavior, redundant allocations in hot paths.
  • Blocking calls in async / event-loop paths.
  • Memory: unbounded buffers, large allocations, retained references that prevent GC.
  • Caching: invalidation correctness, key collisions, stampede protection.
  • I/O: missing batching, missing timeouts.

E. Reliability & Observability

  • Logging at appropriate level; no PII or secrets; enough context to debug a production incident.
  • Metrics / traces added for new code paths that matter operationally.
  • Timeouts, retries with backoff, circuit breakers where remote calls are made.
  • Graceful degradation when a dependency is down.

F. Testing

  • New behavior has tests; bug fixes include a regression test that fails before the fix.
  • Edge cases covered, not just the happy path.
  • Assertions verify behavior, not just "did not throw".
  • No flaky patterns: real network, sleeps, time-of-day, machine-specific paths, hidden ordering dependencies.
  • Tests are located and named consistently with the project.

G. Readability & Maintainability

  • Functions / modules have a single clear responsibility.
  • No dead code, no commented-out blocks, no TODO without an owner or ticket.
  • Complexity: deeply nested branches, overly long functions, magic numbers.
  • Comments explain why, not what — and stay accurate after the change.
  • Naming matches surrounding code.

H. Documentation

  • Public APIs, config flags, environment variables, CLI args are documented where the project documents them.
  • README / migration notes / changelog updated when user-facing behavior changes.
  • Removed code's docs are also removed.

I. Project Conventions

  • Matches existing patterns in the codebase (idioms, layering, error model).
  • Uses the project's existing libraries instead of introducing new ones for the same job.
  • Follows rules declared in CLAUDE.md / AGENTS.md / CONTRIBUTING.md.
  • Respects existing module boundaries; no surprise cross-module imports.

J. Repository Hygiene

  • No large binaries, build artifacts, or generated files added.
  • No accidental submodule pointer changes, lockfile thrash, or .gitignore surprises.
  • License / copyright headers present where the project requires them.
  • No committed secrets (.env, credentials, keys).

Step 4 — Severity

Tag every finding with one of:

  • 🔴 Critical (blocking) — bug, security flaw, data loss, breaking change without justification, missing auth check, broken build.
  • 🟠 Major (should fix before merge) — correctness gap, missing tests for new behavior, significant perf regression, public-API issue.
  • 🟡 Minor (nice to fix) — readability, small perf, naming, missing edge-case test for non-critical path.
  • 🟢 Nit (optional) — taste-level suggestion. Prefix the comment with nit:.

Step 5 — Output Format

Produce the review in exactly this structure. Do not add preamble or explanation outside it.

## Verdict: APPROVE | REQUEST_CHANGES | COMMENT

### Summary
<2-4 sentences: what the PR does and overall assessment>

### 🔴 Critical
- `path/to/file.ext:L42` — <what is wrong, why it matters, suggested fix>

### 🟠 Major
- `path/to/file.ext:L15` — <concern and recommendation>

### 🟡 Minor
- `path/to/file.ext:L30` — <improvement>

### 🟢 Nits
- `path/to/file.ext:L7` — nit: <suggestion>

### Tests
<1-2 sentences on test coverage of the diff>

### Checklist
| Area | Status | Notes |
|------|--------|-------|
| A. Correctness        | PASS / FAIL / N-A | |
| B. Security           | PASS / FAIL / N-A | |
| C. API design         | PASS / FAIL / N-A | |
| D. Performance        | LOW / MED / HIGH risk | |
| E. Reliability/obs.   | PASS / FAIL / N-A | |
| F. Testing            | PASS / FAIL / N-A | |
| G. Readability        | PASS / FAIL / N-A | |
| H. Documentation      | PASS / FAIL / N-A | |
| I. Conventions        | PASS / FAIL / N-A | |
| J. Repo hygiene       | PASS / FAIL / N-A | |

Verdict Rules

  • APPROVE — zero critical, no unresolved major issues, applicable checks pass.
  • REQUEST_CHANGES — any 🔴 critical, or a 🟠 major that blocks the stated intent.
  • COMMENT — no critical/major blockers, but findings worth discussing before merge.

Step 6 — Style Rules for Findings

  1. Always cite file:line. Never make a vague claim without a pointer.
  2. Explain WHY. State the consequence (what breaks, who is affected), not just that something looks off.
  3. Show expected vs. actual for correctness or consistency issues.
  4. Be actionable. Each finding should imply a concrete change.
  5. Critique code, not the author. "This function …" not "You …".
  6. Prefer a question when uncertain. "Is this intentional under concurrent writes?" beats a wrong assertion.
  7. Acknowledge good changes briefly when they're notable (one line, end of summary).
  8. Consolidate. If the same issue repeats N times, comment once and say "and N similar sites".

Length Constraints

  • Summary: 2–4 sentences.
  • Each finding body: under ~150 characters when used as an inline PR comment; up to 2–3 sentences in summary-report mode.
  • Total findings: at most ~12. If more exist, prioritize Critical → Major → Minor and state the omitted count in the summary.
  • Do NOT repeat the checklist table inline. It belongs only in the top-level summary.

Anti-Patterns — Do NOT

  • Restate what the diff obviously does.
  • Flag issues the project's formatter/linter already enforces.
  • Invent findings to seem thorough — if the PR is clean, say so plainly.
  • Suggest sweeping refactors outside the PR's scope.
  • Block on personal taste; mark those as 🟢 nit.
  • Quote large blocks of unchanged code back at the author.

When the PR Is Clean

Say so directly. A short verdict with APPROVE, a one-paragraph summary, and an empty findings list is a perfectly good review.

Download now (ZIP)

  • Other versions194 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 194

    1. mattpocock/skills★ 309ksame name
    2. TheAlgorithms/Python★ 226ksame name
    3. microsoft/vscode★ 194ksame name
    4. github/spec-kit★ 145ksame name
    5. ggml-org/llama.cpp★ 133ksame name
    6. shareAI-lab/learn-claude-code★ 80ksame name
    7. shareAI-lab/analysis_claude_code★ 78ksame name
    8. vectorize-io/hindsight★ 57ksame name
    9. dbeaver/dbeaver★ 52ksame name
    10. roboflow/supervision★ 51ksame name

    184 more not listed

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • Used alongsideProjects with it also use add-new-model, azsdk-common-sdk-breaking-change and 9 more.

    Other files people use alongside this one.

    Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
    • PydanticSkill

      add-new-model

      Add support for a newly-released language or image generation model in pydantic-ai (e.g. openai:gpt-5.6, anthropic:claude-sonnet-5, openai:gpt-image-2). Use when a provider ships a new model id and you need to wire literals, profile flags, adapters, and tests to recognize it. Handles SDK-lag, gateway list conventions, capability probing, and direct image-model geometry.

      Also in 9 projects that use this

    • Microsoft AzureSkill

      azsdk-common-sdk-breaking-change

      Detect and mitigate SDK Breaking changes for an SDK package which is generated from TypeSpec. WHEN: "Detect SDK breaking changes for a service", "Detect SDK breaking changes for an SDK package", "Detect and mitigate SDK breaking changes for a service", "Detect and mitigate SDK breaking changes for an SDK package". INVOKES: skill: azsdk-common-generate-sdk-locally; MCP tools: azure-sdk-mcp:azsdk_customized_code_update, azure-sdk-mcp:azsdk_package_detect_breaking_change.

      Also in 4 projects that use this

    • ww-w-aiSkill

      bkend-auth

      bkend.ai authentication guide. Signup, login, JWT tokens, sessions, role-based access control, and password management with bkend.ai BaaS. Triggers: bkend auth, bkend login, bkend signup, JWT, session, RBAC, password, bkend 인증, 로그인, 회원가입, bkend認証, ログイン, 新規登録, bkend认证, 登录, 注册, autenticacion bkend, authentification bkend, bkend-Auth Do NOT use for: data operations (use $bkend-data), file storage (use $bkend-storage).

      Also in 4 projects that use this

    • ww-w-aiSkill

      bkend-cookbook

      bkend.ai cookbook with step-by-step tutorials and example projects. Build a todo app, blog, e-commerce store, and more with bkend.ai BaaS. Triggers: bkend cookbook, bkend tutorial, bkend example, todo app, blog app, bkend 쿡북, bkend 튜토리얼, 예제 프로젝트, bkendクックブック, チュートリアル, bkend教程, 示例项目, tutorial bkend, tutoriel bkend, bkend-Tutorial, ricettario Do NOT use for: initial setup (use $bkend-quickstart), specific features (use $bkend-data/auth/storage).

      Also in 4 projects that use this

    • dzhngSkill

      close-spec

      When a spec under specs/<feature>/ is done shipping (a write-spec build, or any planned task that produced a spec), archive it to specs/done/ and rewrite it from a build-plan into a durable rationale — the why, the principles, the invariants — pointing back to the real code for the how. Use when implementation has landed and the plan no longer matches what shipped, or the user says a feature/spec is finished. Pairs with [write-spec](../write-spec/SKILL.md) (the plan this closes) and [review](../review/SKILL.md) (run before closing).

      Also in 4 projects that use this

    • dzhngSkill

      design-with-images

      Explore UI and visual design with image generation, then iterate the real implementation against the user-selected concept. Use when brainstorming visual directions, offering mockup variants, or implementing an approved generated design; do not stop at the mockups or the first code approximation.

      Also in 4 projects that use this

    • +5 more from ww-w-ai
  • In this repository3 other files it gives its agents.

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.