Agent skill

RAG Check First

by lyonzin in lyonzin/knowledge-rag

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

MITAuto-check passedAI & LLM Engineering

Install RAG Check First

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

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

GitHub CLI
$ gh skill install lyonzin/knowledge-rag rag-check-first --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/foundation/rag-check-first .claude/skills/rag-check-first && 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-check-first
GitHub stars
292
Token cost
~1.4k tokens
SKILL.md length
526 words
Files
1
Skills in repo
10
Repo updated
First seen
Licence
MIT

At a glance

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

  • Works in 5 steps: Extract the search query from the user's… → Call search_knowledge → Read the top 3 results. Pay attention to… → …
  • Any query that could be answered with prior work
  • 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 Check First is an agent skill from lyonzin/knowledge-rag. Before answering any technical question, code request, architecture decision, or factual claim, call searchknowledge to check the local corpus. Trigger on any query that could be answered with prior work, indexed docs, ADRs, runbooks, or team context. Prevents hallucination and forces reliance on the indexed knowledge base.

Its SKILL.md is about 1.4k 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 AI & LLM Engineering, covering Retrieval-augmented generation, Architecture decision records and Runbooks and postmortems. 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 query that could be answered with prior work
  • Tasks that involve Retrieval-augmented generation
  • Tasks that involve Architecture decision records

Example prompts

  • “/rag-check-first”

Workflow steps

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

  1. Extract the search query from the user's message. Prefer 2–5 keywords, not full sentences. Include domain-specific identifiers (class…
  2. Call search_knowledge
  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
  5. If unsure between 2 corpus interpretations, call get_document on the most promising source to fetch full context before answering.

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.

    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 Check First loads about 1.4k tokens when it runs. Until then it costs about 86 tokens; SKILL.md has 526 words of instructions outside code blocks.

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

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). 526 words, ~1,426 tokens.

Download SKILL.mdSave it as .claude/skills/rag-check-first/SKILL.md (or your agent's skills folder).
name
rag-check-first
description
Before answering any technical question, code request, architecture decision, or factual claim, call search_knowledge to check the local corpus. Trigger on any query that could be answered with prior work, indexed docs, ADRs, runbooks, or team context. Prevents hallucination and forces reliance on the indexed knowledge base.
metadata.type
rag-workflow
metadata.kind
foundation
metadata.target
any-mcp-client

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 resultWhat to do
    ≥1 result with score > 0.5 matching the intentAnswer 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 phrasingState it: "Local corpus does not have this. Answering from general knowledge — verify before acting." Optionally chain to rag-web-fallback
  5. If unsure between 2 corpus interpretations, call get_document on the most promising source to fetch full context before answering.


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

Examples

Example 1 — Design question

User: "How do we handle authentication in the payment service?"

Agent (internal):

search_knowledge(query="authentication payment service", max_results=5, min_score=0.15)
→ 3 hits: ADR-0018-auth.md (0.82), payment-service-design.md (0.71), auth-runbook.md (0.55)

Answer: "Per ADR-0018 (path: docs/adr/0018-auth.md), the payment service
uses mTLS between services and OAuth2 for user-facing endpoints..."

Example 2 — Implementation request

User: "Add a new endpoint for refund cancellation."

Agent (internal):

search_knowledge(query="refund cancellation endpoint", max_results=5)
→ 2 hits: refund-service.md (0.68), refunds-api-v2.md (0.61)

Then: read the top result, model the new endpoint on the existing pattern,
cite the reference file in the reply.

Example 3 — Empty corpus

User: "How do we deploy to Kubernetes?"

Agent (internal):

search_knowledge(query="kubernetes deploy", max_results=5)
→ 0 results

Reply: "Nothing in the local corpus about Kubernetes deployment. Answering
from general practices — please verify against your actual cluster setup
before running: [general k8s deployment steps]"

Edge cases

  • Very short queries (1 word) — expand to 2–3 keywords before calling search_knowledge. Single-word queries have poor recall.
  • Ambiguous acronyms — if "MFA" could mean multi-factor auth or mean-field approximation, either ask the user or run 2 targeted searches.
  • Non-English corpus — the default embedding model is English. If the corpus is multilingual, either switch to the multilingual embedding profile OR translate the query to English before searching.
  • Repeated searches on the same session — the query cache handles this (LRU + 5-min TTL), no need to skip.

  • rag-cite-sources — the natural follow-up: every claim carries a path:line citation.
  • rag-deep-dive — if the top result needs full context, chain into get_document + search_similar.
  • rag-web-fallback — the escape hatch when the corpus is empty.
  • rag-onboard-context — call once at session start, then rag-check-first handles every subsequent request.

© 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/foundation/rag-check-first of lyonzin/knowledge-rag.

Open the folder on GitHubat commit df9cccb

Compare with similar skills

RAG Check First 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 Check First compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
RAG Check First this skilllyonzin/knowledge-rag292—~1.4kAutomated safety check: PassMIT
AI Learning JournalLeoYeAI/openclaw-master-skills2.2k—~2.6kAutomated safety check: PassMIT
Amazon Bedrockaws/agent-toolkit-for-aws2.8k—~8.6kAutomated safety check: PassApache-2.0
Gnogmickel/gno1151 repos~1.6kAutomated safety check: PassMIT
Gnogmickel/gno115—~11kAutomated safety check: PassMIT
MCP Local RAGshinpr/mcp-local-rag412—~4.4kAutomated safety check: PassMIT

Similar skills

  • AI Learning Journal

    LeoYeAI/openclaw-master-skills

    AI 学习记录与成长追踪工具。用于记录 AI/LLM 学习笔记、使用心得、Prompt 技巧、工具体验等,并提供学习指导和规划。当用户提到以下任何话题时都应使用此 skill:AI 学习记录、学习笔记、AI 使用心得、Prompt 工程学习、模型对比体验、AI 工具使用记录、LLM 学习、RAG 学习、Agent 学习、MCP 学习、AI 微调实践、AI 学习规划、怎么学 AI、AI…

    2.2k GitHub stars~2.6k tokensUpdated 2 mo ago
    AI & LLM EngineeringAuto-check passed
  • Amazon Bedrock

    aws/agent-toolkit-for-aws

    Official

    Builds generative AI applications on Amazon Bedrock. An agent skill from aws/agent-toolkit-for-aws.

    2.8k GitHub stars~8.6k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Gno

    gmickel/gno

    Search local documents, files, notes, and knowledge bases. An agent skill from gmickel/gno.

    115 GitHub starsUsed in 1 repo~1.6k tokens
    Knowledge ManagementAuto-check passed
  • Gno

    gmickel/gno

    Search local documents, files, notes, and knowledge bases. An agent skill from gmickel/gno.

    115 GitHub stars~11k tokensUpdated 2 days ago
    Knowledge ManagementAuto-check passed
  • MCP Local RAG

    shinpr/mcp-local-rag

    Searches, saves, and maintains a local document index through a local RAG MCP server.

    412 GitHub stars~4.4k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Local RAG Search

    nkapila6/mcp-local-rag

    Efficiently perform web searches using the mcp-local-rag server with semantic similarity ranking.

    134 GitHub starsUsed in 1 repo~1.6k tokens
    AI & LLM EngineeringAuto-check passed

More from lyonzin/knowledge-rag

All 10 skills in this repo
  • 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.

    292 GitHub stars~1.4k tokensUpdated today
    Auto-check passed
  • RAG Code Review

    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.

    292 GitHub stars~1.8k tokensUpdated today
    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.

    292 GitHub stars~1.6k tokensUpdated today
    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.

    292 GitHub stars~1.8k tokensUpdated today
    Auto-check passed
  • RAG Evaluate Quality

    lyonzin/knowledge-rag

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

    292 GitHub stars~1.4k tokensUpdated today
    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…

    292 GitHub stars~2k tokensUpdated today
    Auto-check passed

Questions about RAG Check First

What does RAG Check First do?

Before answering any technical question, code request, architecture decision, or factual claim, call searchknowledge to check the local corpus. RAG Check First is an agent skill from lyonzin/knowledge-rag. Before answering any technical question, code request, architecture decision, or factual claim, call searchknowledge to check the local corpus.

When should I use RAG Check First?

RAG Check First fits situations like: any query that could be answered with prior work; tasks that involve Retrieval-augmented generation; tasks that involve Architecture decision records.

How do I install RAG Check First in Claude Code?

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

How do I install RAG Check First in Codex?

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

Can I use RAG Check First 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-check-first -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-check-first, .gemini/skills/rag-check-first, .github/skills/rag-check-first and .opencode/skills/rag-check-first in your project.

What does RAG Check First need to run?

SKILL.md names no scripts, command-line tools or credentials: RAG Check First is instructions for the agent only.

Does RAG Check First 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 Check First 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 Check First use?

RAG Check First 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 Check First use?

About 1.4k tokens (SKILL.md is roughly 5.7k 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 Check First?

Skills that share tags, products or a category with RAG Check First: AI Learning Journal (LeoYeAI/openclaw-master-skills, 2.2k stars), Amazon Bedrock (aws/agent-toolkit-for-aws, 2.8k stars), Gno (gmickel/gno, 115 stars) and Gno (gmickel/gno, 115 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains RAG Check First?

lyonzin (a GitHub user) maintains it in lyonzin/knowledge-rag, which has 292 GitHub stars. The repository holds 10 skills in this directory. The repository was last updated on October 9, 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.