Agent skill

RAG Code Review

by lyonzin in lyonzin/knowledge-rag

When performing code review on a PR, diff, snippet, or "look at this change" request, first consult the corpus for related ADRs, coding standards, prior patterns, and similar files.

MITAuto-check passedDevelopment

Install RAG Code Review

skills CLI
$ npx skills add lyonzin/knowledge-rag --skill rag-code-review -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install lyonzin/knowledge-rag rag-code-review --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/lyonzin/knowledge-rag.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/workflow/rag-code-review .claude/skills/rag-code-review && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
rag-code-review
GitHub stars
290
Token cost
~1.8k tokens
SKILL.md length
405 words
Files
1
Skills in repo
10
Repo updated
First seen
Licence
MIT

At a glance

When performing code review on a PR, diff, snippet, or "look at this change" request, first consult the corpus for related ADRs, coding standards, prior patterns, and similar files.

  • Works in 3 steps: ADRs governing the area (auth, retries,… → Existing patterns — similar files that… → Prior incidents touching the code being…
  • Any review-style request — review
  • SKILL.md covers When to use this skill, What this skill commits to, Steps and Examples, plus 2 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

RAG Code Review is an agent skill from lyonzin/knowledge-rag. When performing code review on a PR, diff, snippet, or "look at this change" request, first consult the corpus for related ADRs, coding standards, prior patterns, and similar files. Grounds review comments in the team's actual decisions instead of generic best practices. Trigger on any review-style request — "review", "look at", "any issues with", "does this make sense".

Its SKILL.md is about 1.8k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Retrieval-augmented generation, Architecture decision records and Code review. It works with Model Context Protocol. The repository describes itself as: Local RAG MCP server for Claude Code — hybrid search (semantic + BM25), cross-encoder reranking, 13 MCP tools, 20 format parsers. Zero external servers, zero API keys. The licence is MIT.

When your agent uses it

  • Any review-style request — review
  • Any issues with
  • Does this make sense

Example prompts

  • “look at this change”
  • “review”
  • “look at”
  • “/rag-code-review”

Requirements

  • Python 3

Workflow steps

3 steps, taken from the first numbered list in SKILL.md.

  1. ADRs governing the area (auth, retries, error handling, naming, dependencies…)
  2. Existing patterns — similar files that show the "how we do this" convention
  3. Prior incidents touching the code being changed

What it can do on your machine

Read from SKILL.md and the folder at commit df9cccb. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are markdown).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

RAG Code Review loads about 1.8k tokens when it runs. Until then it costs about 97 tokens; SKILL.md has 405 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~97
When it runs · the whole SKILL.md, loaded when a task matches
~1.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from lyonzin/knowledge-rag at commit df9cccb, republished under its MIT licence (© lyonzin). 405 words, ~1,765 tokens.

Download SKILL.mdSave it as .claude/skills/rag-code-review/SKILL.md (or your agent's skills folder).
name
rag-code-review
description
When performing code review on a PR, diff, snippet, or "look at this change" request, first consult the corpus for related ADRs, coding standards, prior patterns, and similar files. Grounds review comments in the team's actual decisions instead of generic best practices. Trigger on any review-style request — "review", "look at", "any issues with", "does this make sense".
metadata.type
rag-workflow
metadata.kind
workflow
metadata.target
any-mcp-client

rag-code-review — review against team standards, not the internet

When to use this skill

Trigger when the user asks:

  • "Review this PR / code / diff"
  • "Any issues with this?"
  • "Does this look right?"
  • "Is this idiomatic?"
  • "Should I merge this?"
  • Any critique-style prompt on a code artifact

What this skill commits to

Before offering ANY review comment, the agent consults the corpus for:

  1. ADRs governing the area (auth, retries, error handling, naming, dependencies…)
  2. Existing patterns — similar files that show the "how we do this" convention
  3. Prior incidents touching the code being changed

Review comments then read as "per ADR-XXXX we do Y here" rather than "generally you should Z".


Steps

  1. Identify the "area" of the change. From the diff / snippet, extract:

    • The file path or module name (e.g. services/payment/, mcp_server/security.py)
    • The concern touched (auth, retries, logging, config, ingestion, search, storage…)
    • Any new dependencies, endpoints, or public API changes
  2. Search for governing ADRs / standards:

    search_knowledge(query="<concern> ADR standard", max_results=5)

    Example: search_knowledge(query="retry policy ADR")

  3. Find similar existing files (patterns to follow):

    search_similar(filepath="<the file being changed>", max_results=5)

    If the file is new, use search_knowledge with the file's purpose instead.

  4. Look for prior incidents / postmortems on adjacent code:

    search_knowledge(query="<component> incident postmortem", max_results=3)
  5. Structure the review comments:

    markdown
    ### Findings
    
    1. **[required]** Per ADR-0031 [docs/adr/0031-retries.md] the retry policy is
       "3 attempts, exponential backoff". This PR uses 5 attempts — either match
       the ADR or open a follow-up ADR to document the exception.
    
    2. **[suggestion]** The error-handling shape here differs from what
       `services/payment/refund_service.py` does [search_similar hit].
       Consider aligning for consistency.
    
    3. **[nit]** Missing docstring on `_new_helper()`. Team standard is ≥80%
       docstring coverage (interrogate gate, per CONTRIBUTING.md).
    
    ### Not commented on
    
    Style / naming / whitespace — those are ruff's job. Reviewed only what
    ruff cannot catch.
  6. Every finding cites a source (ADR, similar file, incident, coding standard). If a finding is opinion-only, mark it [opinion] explicitly.


Show full SKILL.md (190 more words)Show less

Examples

Example 1 — Retry policy diff

User: "Review this. for attempt in range(5): try: ... except: sleep(2) — new call site added to payment service."

Agent:

search_knowledge(query="retry policy exponential backoff") → 2 hits
  → docs/adr/0031-retries.md (0.83), services/common/retry.py (0.71)

search_similar(filepath="services/payment/refund_service.py") → 5 hits
  → All use `services/common/retry.retry_with_backoff` decorator

Reply: "3 findings:

1. **[required]** ADR-0031 [docs/adr/0031-retries.md] says '3 attempts, exponential
   backoff, max 30s'. This code has 5 attempts + fixed 2s sleep — violates both.
   Fix: use `@retry_with_backoff` decorator from `services/common/retry.py:12`.

2. **[required]** Bare `except:` catches BaseException including SystemExit and
   KeyboardInterrupt. Team standard is to catch specific exceptions [PEP 8].
   Change to `except (ConnectionError, TimeoutError) as e:`.

3. **[suggestion]** Every other payment service call site uses the decorator
   pattern [services/payment/refund_service.py, capture_service.py]. This
   ad-hoc loop is the odd one out — align for consistency."

Example 2 — New auth middleware

User: "Look at this new middleware — it adds bearer auth to a new endpoint."

Agent:

search_knowledge(query="bearer auth middleware ADR") → 3 hits
  → docs/adr/0018-auth.md, mcp_server/security.py (existing BearerAuthMiddleware), CHANGELOG.md#v451

Reply: "The project already has `BearerAuthMiddleware` in `mcp_server/security.py:434`
with constant-time comparison, RFC 6750 challenge, exempt paths, etc. This new
middleware duplicates that logic — worse, uses `==` (timing side-channel).

Fix: import and reuse the existing `BearerAuthMiddleware` instead. If the new
endpoint has different auth needs (different token, different exempt paths),
compose the existing middleware or open an ADR before duplicating."

Example 3 — Nothing to cite, honest

User: "Review this small helper for parsing dates."

Agent:

search_knowledge(query="date parsing helper standard") → 0 hits
search_similar(filepath="<the new file>") → 2 weak hits (unrelated helpers)

Reply: "Nothing in the corpus about date-parsing conventions here (searched
'date parsing helper standard' and adjacent files, 0 strong hits). Reviewing
against general Python practice:

1. **[opinion]** `datetime.strptime` is slow — if this is a hot path, consider
   `dateutil.parser` or pre-compiling.
2. **[nit]** Missing timezone handling — will surprise on DST edges.

Flagging both as opinion/nit because there is no ADR to cite. If date parsing
becomes a repeated topic, worth opening an ADR."

Edge cases

  • Very small diff (1-2 lines) — still search once for the governing ADR of the area, then a light review. Skip similar-search.
  • Very large diff (whole feature) — do the ADR search for the top 2-3 concerns; do not try to search every file. Focus review energy on the ADR-governed parts.
  • Newly-created file — search_similar needs an existing file. Use search_knowledge with the file's purpose instead.
  • User pasted code without file context — ask "what area/service is this from?" so search queries can be targeted.

  • rag-check-first — the base pattern (this is check-first specialized for review).
  • rag-cite-sources — critical here; a review comment without a citation is just opinion.
  • rag-deep-dive — for very architectural reviews, chain into deep-dive to understand the full context.
  • rag-index-decisions — if the review surfaces a new pattern, index the decision.

© lyonzin, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/workflow/rag-code-review of lyonzin/knowledge-rag.

Open the folder on GitHubat commit df9cccb

Compare with similar skills

RAG Code Review next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

RAG Code Review compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
RAG Code Review this skilllyonzin/knowledge-rag290—~1.8kAutomated safety check: PassMIT
Codex Code ReviewerVCnoC/Claude-Code-Zen-mcp-Skill-Work116—~3.5kAutomated safety check: PassApache-2.0
WooCommerce Code Reviewwoocommerce/woocommerce11k3 repos~1.1kAutomated safety check: PassCustom licence
Skill Doli Code ReviewDolibarr/dolibarr7.7k1 repos~1.1kAutomated safety check: PassMIT
Dignified Python Standardsdocling-project/docling69k—~1.5kAutomated safety check: PassApache-2.0
Clean Code GuardamElnagdy/guard-skills1.3k2 repos~4.3kAutomated safety check: PassMIT

Similar skills

  • Codex Code Reviewer

    VCnoC/Claude-Code-Zen-mcp-Skill-Work

    Systematic code review workflow using zen mcp's codex tool. An agent skill from VCnoC/Claude-Code-Zen-mcp-Skill-Work.

    116 GitHub stars~3.5k tokensUpdated 9 mo ago
    DevelopmentAuto-check passed
  • WooCommerce Code Review

    woocommerce/woocommerce

    Reviews WooCommerce code changes against the project's standards, flagging backend PHP architecture, naming, documentation, data integrity and testing violations.

    11k GitHub starsUsed in 3 repos~1.1k tokens
    DevelopmentAuto-check passed
  • Skill Doli Code Review

    Dolibarr/dolibarr

    Reviews Dolibarr PHP code for compliance with coding standards and security best practices, and fixes identified issues.

    7.7k GitHub starsUsed in 1 repo~1.1k tokens
    DevelopmentAuto-check passed
  • Dignified Python Standards

    docling-project/docling

    Applies opinionated production Python conventions chosen by the project's Python version: modern type syntax, pathlib, explicit checks and interface guidance.

    69k GitHub stars~1.5k tokensUpdated today
    DevelopmentAuto-check passed
  • Clean Code Guard

    amElnagdy/guard-skills

    Reviews generated or changed production code against Clean Code, SOLID, DRY, KISS, YAGNI and LLM-specific failure modes before it ships, in any language.

    1.3k GitHub starsUsed in 2 repos~4.3k tokens
    DevelopmentAuto-check passed
  • Archify Review

    tt-a1i/archify

    Review Archify issues, PRs, or code through value, cost, and impact to support evidence-based maintenance decisions. Use for issue triage, change reviews, and…

    79k GitHub stars~415 tokensUpdated yesterday
    DevelopmentAuto-check passed

More from lyonzin/knowledge-rag

All 10 skills in this repo
  • RAG Check First

    lyonzin/knowledge-rag

    Before answering any technical question, code request, architecture decision, or factual claim, call searchknowledge to check the local corpus.

    290 GitHub stars~1.4k tokensUpdated 4 days ago
    Auto-check passed
  • RAG Cite Sources

    lyonzin/knowledge-rag

    Every technical claim drawn from the local corpus must ship with a source citation formatted as path:line or path:section.

    290 GitHub stars~1.4k tokensUpdated 4 days ago
    Auto-check passed
  • RAG Deep Dive

    lyonzin/knowledge-rag

    Three-step multi-tool workflow — search the corpus, fetch the most relevant document in full, then find similar documents.

    290 GitHub stars~1.6k tokensUpdated 4 days ago
    Auto-check passed
  • RAG Troubleshoot

    lyonzin/knowledge-rag

    When the user reports a bug, error message, stack trace, unexpected behavior, or "why is this broken" question, search the corpus first for prior occurrences, known fixes, or related runbooks.

    290 GitHub stars~1.8k tokensUpdated 4 days ago
    Auto-check passed
  • RAG Evaluate Quality

    lyonzin/knowledge-rag

    Measure retrieval quality using evaluateretrieval (MRR@5 and Recall@5) and getindexstats.

    290 GitHub stars~1.4k tokensUpdated 4 days ago
    Auto-check passed
  • RAG Index Decisions

    lyonzin/knowledge-rag

    After making a non-obvious architectural decision, solving a novel bug, agreeing on a coding standard, or reaching a conclusion worth remembering, index it back into the knowledge base so the next…

    290 GitHub stars~2k tokensUpdated 4 days ago
    Auto-check passed

Questions about RAG Code Review

What does RAG Code Review do?

When performing code review on a PR, diff, snippet, or "look at this change" request, first consult the corpus for related ADRs, coding standards, prior patterns, and similar files. RAG Code Review is an agent skill from lyonzin/knowledge-rag. When performing code review on a PR, diff, snippet, or "look at this change" request, first consult the corpus for related ADRs, coding standards, prior patterns, and similar files.

When should I use RAG Code Review?

RAG Code Review fits situations like: any review-style request — review; any issues with; does this make sense.

How do I install RAG Code Review in Claude Code?

Run `npx skills add lyonzin/knowledge-rag --skill rag-code-review -a claude-code`. Or copy the skill folder (skills/workflow/rag-code-review in lyonzin/knowledge-rag) into .claude/skills/rag-code-review in your project. Claude Code loads it when a task matches its description.

How do I install RAG Code Review in Codex?

Run `npx skills add lyonzin/knowledge-rag --skill rag-code-review -a codex`. Or copy the skill folder (skills/workflow/rag-code-review in lyonzin/knowledge-rag) into .agents/skills/rag-code-review in your project. Codex loads it when a task matches its description.

Can I use RAG Code Review in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add lyonzin/knowledge-rag --skill rag-code-review -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/rag-code-review, .gemini/skills/rag-code-review, .github/skills/rag-code-review and .opencode/skills/rag-code-review in your project.

What does RAG Code Review need to run?

SKILL.md names no scripts, command-line tools or credentials: RAG Code Review is instructions for the agent only. Our summary lists: Python 3.

Does RAG Code Review access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is RAG Code Review safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does RAG Code Review use?

RAG Code Review is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does RAG Code Review use?

About 1.8k tokens (SKILL.md is roughly 7.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to RAG Code Review?

Skills that share tags, products or a category with RAG Code Review: Codex Code Reviewer (VCnoC/Claude-Code-Zen-mcp-Skill-Work, 116 stars), WooCommerce Code Review (woocommerce/woocommerce, 11k stars), Skill Doli Code Review (Dolibarr/dolibarr, 7.7k stars) and Dignified Python Standards (docling-project/docling, 69k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains RAG Code Review?

lyonzin (a GitHub user) maintains it in lyonzin/knowledge-rag, which has 290 GitHub stars. The repository holds 10 skills in this directory. The repository was last updated on October 4, 2026.

Source: lyonzin/knowledge-rag on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.