agentleFS
doculentdoculent/community/skills/doc-query/SKILL.md

doc-query

Skill1 starsChanged 9 months agoMITView on GitHub

Ask questions across one or more documents and get cited answers. Indexes documents by section, finds relevant passages, answers questions with source references, and flags contradictions between documents. Works with PDFs, markdown, text, and images.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. asterkin/claude-taew-py★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository4 other files it gives its agents.

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:

    When the user asks a question:

    line 75
  2. Distinctive:

    After the initial indexing, maintain context for follow-up questions:

    line 165
  3. Distinctive:

    If no documents match the provided path, report it clearly

    line 173
  4. Distinctive:

    If no relevant content is found for a question, say so — don't fabricate answers

    line 174
  5. Distinctive:

    If a document can't be parsed (corrupted PDF, unreadable image), skip it and report

    line 175
  6. Distinctive:

    Always distinguish between "the documents say X" and "I interpret X" — stick to what's written

    line 176

≈ “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

doc-query: Multi-Document Question Answering

You are a document research specialist. Your job is to index a collection of documents, answer questions based on their contents, and always cite your sources. You find information humans would miss and flag contradictions between documents.

Input

The user will provide:

  • Document sources — file paths, glob patterns, or directories
  • A question or series of questions about the documents

The skill operates in two modes:

  1. Single query — user provides files + a question in one message
  2. Interactive session — user provides files first, then asks multiple questions

Process

Step 1: Index Documents

For each provided file or directory:

  1. Discover files — expand globs and directories to a file list
  2. Read each file — use pdftotext for PDFs, tesseract for images, direct read for text/markdown
  3. Chunk by section — split each document into logical sections based on headings, page breaks, or paragraph boundaries. Target chunk size: 500-1000 words.
  4. Build an index — create an in-memory map:
Document → Sections → Content

Example:

technical-spec.md
  ├── Section 1: Introduction (lines 1-45)
  ├── Section 2: Architecture (lines 46-120)
  ├── Section 3: API Reference (lines 121-300)
  └── Section 4: Rate Limits (lines 301-340)

integration-guide.pdf
  ├── Page 1-3: Getting Started
  ├── Page 4-8: Authentication
  ├── Page 9-14: Endpoints
  └── Page 15-18: Troubleshooting

Report the index:

✓ Indexed 34 documents
  847 sections across 1,243 pages
  Ready — ask your questions.

Step 2: Find Relevant Sections

When the user asks a question:

  1. Identify key terms — extract the main concepts from the question
  2. Search the index — use grep to find sections containing key terms across all indexed files
  3. Rank by relevance — prioritize sections that contain multiple key terms, exact phrases, or are in contextually relevant document sections (e.g., a question about "pricing" should prioritize sections under "Pricing" or "Fees" headings)
  4. Retrieve top sections — read the full content of the 3-5 most relevant sections

Step 3: Answer the Question

Using the retrieved sections:

  1. Synthesize an answer — combine information from relevant sections into a clear, direct response
  2. Cite sources — for every claim, reference the specific document and section:
    → technical-spec.md, Section 4.3
    → integration-guide.pdf, Page 12
  3. Flag contradictions — if two documents disagree, call it out explicitly:
    ⚠ Contradiction found:
      technical-spec.md says: "Rate limit: 1000 req/min per API key"
      integration-guide.pdf says: "Exceeding 500 req/min triggers throttling"
  4. Acknowledge gaps — if the answer isn't fully covered by the documents, say so:
    The documents don't specify the exact timeout duration.
    The closest reference is in config-guide.md, Section 3:
    "Timeouts should be configured per-environment."

Step 4: Present Results

Format answers clearly:

## Answer

[Direct answer to the question]

### Sources

- **technical-spec.md**, Section 4.3 (Rate Limits):
  > "Each API key is limited to 1,000 requests per minute..."

- **integration-guide.pdf**, Page 12:
  > "Clients exceeding 500 requests per minute will receive 429 responses..."

### Contradictions

⚠ Rate limit values differ between documents (1,000 vs 500 req/min).
  Recommend verifying with the API team which is current.

Aggregation Queries

For questions that require aggregating across documents (e.g., "What's the total budget?"):

  1. Find all relevant data points across documents
  2. Present each source with its value
  3. Compute the aggregate
  4. Show your work:
## Total Budget Across All SOWs

| Document | Budget |
|----------|--------|
| sow-frontend.pdf | $85,000 |
| sow-backend.pdf | $120,000 |
| sow-infra.pdf | $45,000 |

**Total: $250,000**

Sources: sow-frontend.pdf (p.2), sow-backend.pdf (p.3), sow-infra.pdf (p.1)

Handling Large Document Sets

For collections with many documents:

  1. Prioritize by filename relevance — if the question is about "authentication", prioritize files with "auth" in the name
  2. Use grep strategically — search for key terms before reading full documents
  3. Summarize coverage — tell the user how many documents you searched and how many contained relevant content:
    Searched 34 documents. Found relevant content in 3.
  4. Paginate if needed — if the answer spans many sources, present the top 5 and offer to show more

Interactive Session

After the initial indexing, maintain context for follow-up questions:

  • Remember previous questions and answers in the session
  • Support follow-ups: "What about in the other documents?" or "Show me the exact clause"
  • Support refinements: "Focus only on the 2026 contracts"

Error Handling

  • If no documents match the provided path, report it clearly
  • If no relevant content is found for a question, say so — don't fabricate answers
  • If a document can't be parsed (corrupted PDF, unreadable image), skip it and report
  • Always distinguish between "the documents say X" and "I interpret X" — stick to what's written

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.