agentleFS
mmccallammccalla/coding-agent-skill-library/skills/krag-retrieval-answering/SKILL.md

krag-retrieval-answering

Skill4 starsChanged 5 months agoApache-2.0View on GitHub

Implement KRAG retrieval, graph traversal, query planning, hybrid search, answer synthesis, citations, and abstention. Use when building or debugging graph/vector/keyword retrieval and enterprise question answering.

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 6 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use when building or debugging the query planner, graph traversal, hybrid ranking, answer synthesis, citation formatting or abstention …

    line 14
  2. Distinctive:

    Relationship traversal: follow typed paths between entities, controls, obligations, systems, teams, outcomes, risks, or processes.

    line 34
  3. Distinctive:

    Use the smallest sufficient strategy:

    line 40
  4. Distinctive:

    Hybrid: when recall matters or when the user asks a broad enterprise question.

    line 45
  5. Distinctive:

    Iterative retrieval: when first-pass evidence is incomplete, contradictory, or too generic.

    line 46
  6. Distinctive:

    Never invent relationships to close a reasoning gap.

    line 68

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “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

KRAG Retrieval and Answering

When to use

Use when building or debugging the query planner, graph traversal, hybrid ranking, answer synthesis, citation formatting or abstention logic of a KRAG system.

Objective

Answer questions using graph structure plus grounded evidence, not unverified model memory.

Procedure

  1. Classify the question (lookup, semantic discovery, traversal, impact analysis, synthesis).
  2. Select the smallest sufficient retrieval strategy (graph, vector, keyword, hybrid, iterative).
  3. Plan and execute bounded, read-only graph queries where applicable.
  4. Rank candidates using semantic, graph proximity, authority, recency, and confidence signals.
  5. Synthesise an answer with citations, uncertainty, and abstention when evidence is weak.

Retrieval planner

Classify the question before querying:

  • Entity lookup: find canonical entity and known attributes.
  • Semantic discovery: retrieve relevant evidence by embedding and keyword search.
  • Relationship traversal: follow typed paths between entities, controls, obligations, systems, teams, outcomes, risks, or processes.
  • Impact analysis: expand from a changed entity across dependency, ownership, control, obligation, data-flow, and outcome relationships.
  • Global synthesis: summarise communities, themes, or cross-document patterns.

Strategy selection

Use the smallest sufficient strategy:

  1. Graph-first for known entities, dependency paths, ownership, lineage, obligations, controls, and impact questions.
  2. Vector-first for vague, natural-language, or exploratory questions.
  3. Keyword-first for exact IDs, policy clauses, regulation names, control IDs, and error codes.
  4. Hybrid when recall matters or when the user asks a broad enterprise question.
  5. Iterative retrieval when first-pass evidence is incomplete, contradictory, or too generic.

Ranking signals

Combine:

  • semantic similarity
  • exact match strength
  • graph distance and path type
  • source authority
  • evidence confidence
  • recency/version
  • entity resolution confidence
  • policy or ontology priority

Answer synthesis rules

  • Separate facts, inferences, and recommendations.
  • Cite source evidence for every material claim.
  • Explain graph paths used for impact or traceability questions.
  • State uncertainty where evidence is incomplete, weak, stale, or conflicting.
  • Abstain or ask for missing source data when the graph cannot support the answer.
  • Never invent relationships to close a reasoning gap.

Enterprise impact template

For questions such as “What customer outcomes, controls, teams and regulatory obligations are affected if we retire this platform?” retrieve:

  1. target platform and aliases
  2. upstream/downstream systems and data flows
  3. supported products, journeys, services, and customer outcomes
  4. owning, operating, support, risk, and compliance teams
  5. linked controls, risks, policies, regulations, and obligations
  6. current evidence, confidence, gaps, and unresolved dependencies

Output format

Return retrieval plan, queries/pseudocode, evidence set, answer, citations, uncertainty, and follow-up data gaps.

Related skills

  • knowledge-graph-rag — Neo4j-native graph retrieval implementation
  • knowledge-retrieval-rag — generic document-grounded retrieval discipline
  • krag-system-design — architecture and retrieval role design
  • krag-evaluation-governance — retrieval and answer quality gates

References

Verification

  • Retrieval strategy selection is explicit and bounded.
  • Answers separate facts, inferences and recommendations.
  • Every material claim is grounded in cited evidence or abstained.

Download now (ZIP)

Does it work?

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

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

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.