rag-code-review

A code-review workflow that searches the team’s stored knowledge before commenting on a pull request, diff, or code snippet. It checks relevant architecture decisions, coding standards, existing patterns, and past incidents.

In plain words
What is it for?
Use it when reviewing changes involving areas such as authentication, retries, logging, configuration, dependencies, ingestion, search, or storage.
Why use it?
It makes review comments fit the project’s actual rules and history instead of applying generic advice that may conflict with established practice.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/lyonzin/knowledge-rag/rag-code-review
Any agent
npx skills add lyonzin/knowledge-rag --skill rag-code-review
Clone the repo
git clone --depth 1 https://github.com/lyonzin/knowledge-rag

Made for: Claude Code, Codex.

Per session 83 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,766 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00083 $0.01766
Opus 5 $0.00042 $0.00883
Sonnet 5 $0.00017 $0.00353
Haiku 4.5 $0.00008 $0.00177

Measured 3d ago against content hash b1b43b276f31, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

rag-code-review scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/workflow/rag-code-review/SKILL.md · 172 lines

How it starts

The opening of the file, as written. The whole thing — 172 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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:

    ### 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.
    

Read the full file on GitHub · 172 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 172 lines · 83 tokens per session scan A b1b43b276f31

Subscribe to this mod's changes

rag-code-review is a skill published in the GitHub repository lyonzin/knowledge-rag (262 stars, last pushed 5d ago), licensed MIT. It adds 83 tokens to every session and 1,766 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories