rag-citations

Generate JSON answers with page, start, end, and quote citations from provided context.

1|Updated Dec 9, 2025
One-click install
npx skills add https://github.com/BinkyTwin/DeepRead --skill rag-citations
Or copy as Structured Prompt for Agentโ–ผ
Please help me install this Agent Skill.
Skill: rag-citations
Source: https://github.com/BinkyTwin/DeepRead/tree/main/.claude/skills/rag-citations
Command: npx skills add https://github.com/BinkyTwin/DeepRead --skill rag-citations

SYSTEM DOCUMENTATION & REQUIREMENTS

๐Ÿ’ก This Skill includes scripts (resource) components.

What problem does it solve?

LLMs can hallucinate or rely on memory. This Skill ensures responses are grounded solely in the provided context and paired with verifiable citations.

Core Features & Use Cases

  • JSON-based answer with citations: Returns an answer plus a list of citations containing page, start, end, and quote.
  • Exact quotes with offsets: Each citation includes precise location data for reliable verification.
  • Use Case: Chat with documents, questions about papers, or any scenario requiring precise quotes.

Quick Start

Provide your question along with the relevant document context. For example: "What is the main finding on page 2?" The model should respond with a JSON object containing the answer and citations.

Frequently Asked Questions about rag-citations

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate citations with exact page numbers and text offsets from documents?โ–ผ

Citations with page numbers, start/end offsets, and exact quotes are generated by pairing LLM responses with validated text extraction from source documents. This Skill enforces JSON output containing answer text linked to precise location data, enabling readers to verify claims directly against the original content.

Can I use citations to prevent LLM hallucinations when answering questions about papers or documents?โ–ผ

Yes. By grounding answers exclusively in provided context and attaching verifiable citations, this approach eliminates hallucination risk. Each citation includes the quote, page, and character offsets, making it impossible for the model to claim information it didn't extract from your source material.

What format do citations need to be in for reliable verification?โ–ผ

Citations must follow a strict JSON structure containing page number, start offset, end offset, and the exact quote from the source. This standardized format allows automated verification and makes citations machine-readable for downstream tools or databases.

How do I set up chat-with-documents with verifiable citations?โ–ผ

Provide your question and document context together. The Skill processes both and returns a JSON object with your answer and a citations array. Each citation entry contains the page, character offsets, and verbatim text, ready for end-users to validate.

Does this work for multi-page documents or research papers?โ–ผ

Yes. The Skill handles multi-page contexts by tracking page numbers and character positions within each page. This enables precise citation across lengthy documents like research papers, regulatory filings, or any text where location accuracy matters.

What happens if the model's answer goes beyond the provided document context?โ–ผ

The Skill enforces strict adherence to provided context. If the model attempts to reference information not in the source material, citations cannot be validated, preventing unsupported claims from reaching users.