rag-check-first

rag-check-first is a skill for Claude Code, Codex from lyonzin/knowledge-rag. It costs 68 tokens per session (1,404 once invoked), scanned A, original, MIT.

A check that searches the team's stored knowledge before answering technical questions, changing code, or making factual claims. The knowledge may include design records, runbooks, READMEs, and specifications.

In plain words
What is it for?
Use it before implementation, debugging, refactoring, architecture discussions, or questions about a named project component.
Why use it?
It grounds answers in the team's existing decisions and context instead of relying only on general knowledge or guesses.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

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-check-first
Any agent
npx skills add lyonzin/knowledge-rag --skill rag-check-first
Clone the repo
git clone --depth 1 https://github.com/lyonzin/knowledge-rag

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for rag-check-first

README.md
[![agentmods](https://agentmods.dev/badge/skills/lyonzin/knowledge-rag/rag-check-first.svg)](https://agentmods.dev/skills/lyonzin/knowledge-rag/rag-check-first)
Your own site
<a href="https://agentmods.dev/skills/lyonzin/knowledge-rag/rag-check-first"><img src="https://agentmods.dev/badge/skills/lyonzin/knowledge-rag/rag-check-first.svg" alt="Measured on agentmods" height="20"></a>
Per session 68 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,404 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.1 $0.00068 $0.01404
Opus 5 $0.00034 $0.00702
Sonnet 5 $0.00014 $0.00281
Haiku 4.5 $0.00007 $0.00140

Measured 6d ago against content hash 6d331313fcc3, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

rag-check-first 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 6d 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/foundation/rag-check-first/SKILL.md · 126 lines

How it starts

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

rag-check-first — search before you speak

When to use this skill

Trigger this skill before answering whenever the user asks:

  • A technical "how" or "why" question (design, implementation, security, ops)
  • Something about "our" / "the project" / "the team" / a named component
  • A request to write, refactor, review, or debug code
  • A question that could plausibly be answered by an ADR, runbook, README, or spec

Trigger keywords / patterns (non-exhaustive):

  • "how does X work", "why did we", "what is the pattern for"
  • "add a", "implement", "refactor", "fix", "debug"
  • Any mention of a file, module, function, feature, or component by name
  • Any question about historical decisions ("we used to", "the old way")

Do NOT trigger for:

  • Pure conversation / meta requests ("hi", "thanks", "what's your name")
  • Requests that are explicitly about the AI itself
  • Well-known facts already in training data with no team-specific angle

What this skill commits to

Before drafting a single line of the answer, the agent will call search_knowledge at least once with a query derived from the user's message. The results shape the answer — training-data knowledge is only a fallback when RAG returns nothing relevant.


Steps

  1. Extract the search query from the user's message. Prefer 2–5 keywords, not full sentences. Include domain-specific identifiers (class names, error codes, feature names, ADR IDs).

  2. Call search_knowledge:

    search_knowledge(query="<extracted keywords>", max_results=5, snippet_mode=true, min_score=0.15)
    
    • snippet_mode=true keeps token consumption sane
    • min_score=0.15 cuts obvious noise (adjust higher for terse corpora)
  3. Read the top 3 results. Pay attention to search_method (hybrid > semantic / keyword alone), score, and reranker_score.

  4. Decide the answer strategy based on what came back:

    RAG result What to do
    ≥1 result with score > 0.5 matching the intent Answer primarily from the RAG content, quote relevant snippets, cite the source (path:line)
    1–3 results with lower scores (0.2–0.5) Use as partial context, be explicit that the corpus does not cover this in depth, mix with training-data knowledge
    0 results after 2 attempts with varied phrasing State it: "Local corpus does not have this. Answering from general knowledge — verify before acting." Optionally chain to rag-web-fallback

Read the full file on GitHub · 126 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. 6d ago First seen · 126 lines · 68 tokens per session scan A 6d331313fcc3

Subscribe to this mod's changes

rag-check-first is a skill published in the GitHub repository lyonzin/knowledge-rag (269 stars, last pushed yesterday), licensed MIT. It adds 68 tokens to every session and 1,404 once invoked, about $0.0003 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

rag-perf

Performance benchmarking for a deployed NVIDIA RAG Blueprint server: profiling pass + aiperf load test driven by a single YAML config. Not for accuracy / RAGAS scoring (use rag-eval) or for deploying / repairing services (use rag-blueprint).

NVIDIA-AI-Blueprints/rag · 56 tokens

rag-blueprint

NVIDIA RAG Blueprint — deploy, configure, troubleshoot, and manage. Handles any RAG action: deploy, install, start, enable, disable, toggle, change, configure, troubleshoot, debug, fix, shutdown, stop, or tear down any RAG feature or service (Agentic RAG, VLM, guardrails, query rewriting, models, search, ingestion…

NVIDIA-AI-Blueprints/rag · 92 tokens

rag-eval

Filesystem RAG benchmarks: corpus/, train.json, evaluaterag.py (RAGAS quality). Not for prod monitoring, latency/throughput benchmarking (use rag-perf), or evals outside this repo layout.

NVIDIA-AI-Blueprints/rag · 48 tokens

pinecone:full-text-search

Create, ingest into, and query a Pinecone full-text-search (FTS) document index using the graduated document-schema API (Python SDK 10.0.0, API version 2026-07). Use when the user or agent asks to build a text search index on Pinecone, add dense or sparse vector fields, ingest documents, construct scoreby clauses…

pinecone-io/pinecone-claude-code-plugin · 163 tokens

pinecone:n8n

Build n8n workflows using the Pinecone Assistant node or Pinecone Vector Store node. Use when building RAG pipelines, chat-with-docs workflows, configuring Pinecone nodes in n8n, troubleshooting Pinecone n8n nodes, or asking about best practices for Pinecone in n8n.

pinecone-io/pinecone-claude-code-plugin · 67 tokens

pinecone:quickstart

Interactive Pinecone quickstart for new developers. Choose between two paths - Database (create an integrated index, upsert data, and query using Pinecone MCP + Python) or Assistant (create a Pinecone Assistant for document Q&A). Use when a user wants to get started with Pinecone for the first time or wants a guided…

pinecone-io/pinecone-claude-code-plugin · 79 tokens