{"slug":"query","title":"query","summary":"Search extracted Markdown or plain text with ranked keyword search. Use this skill after pdf-to-markdown or pdf-to-text when you do not know the document's exact wording or a plain grep would return too many matches. For a known term, use a bounded grep first.","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-11-29T00:42:58.116243Z","repo":{"url":"https://github.com/PSPDFKit-labs/nutrient-skills","stars":18,"forks":1,"license":null,"updatedAt":"2026-11-26T02:45:46Z"},"bodyHtml":"<hr>\n<h2>name: query\ndescription: &gt;-\nSearch extracted Markdown or plain text with ranked keyword search. Use this\nskill after pdf-to-markdown or pdf-to-text when you do not know the document's\nexact wording or a plain grep would return too many matches. For a known term,\nuse a bounded grep first.\nlicense: Proprietary</h2>\n<h2>Rules for agents</h2>\n<ul>\n<li>For a known term, start with a bounded search such as <code>grep -n -i -C2 \"term\" file | head</code>.</li>\n<li>Use <code>query</code> when you do not know the exact wording or a plain search returns too many matches.</li>\n<li>Use <code>-k 1</code> or <code>-k 2</code> for a single fact. Add <code>--language &lt;lang&gt;</code> to match related word forms.</li>\n<li>Build an index with <code>--emit-index</code> only when you expect several queries over the same file.</li>\n</ul>\n<h1>Query a document</h1>\n<p>Search an extracted Markdown or text file and return the most relevant line ranges. The command reads the local file; it does not parse PDFs.</p>\n<h2>Related skills</h2>\n<ul>\n<li><strong><code>pdf-to-markdown</code></strong> — converts a PDF to structured Markdown.</li>\n<li><strong><code>pdf-to-text</code></strong> — converts a PDF to plain text while preserving columns and spacing.</li>\n</ul>\n<h2>Usage</h2>\n<p>Set <code>SKILL_DIR</code> to the absolute path of the directory containing this file. Use <code>$SKILL_DIR/bin/query</code> in the commands below.</p>\n<p>The wrapper downloads the CLI from Nutrient's CDN on first use and stores it in <code>~/.local/share/nutrient/cli/</code>. It checks for updates every six hours.</p>\n<pre><code>$SKILL_DIR/bin/query text INPUT.md \"your question\" [-k N] [-e N]\n</code></pre>\n<ul>\n<li><code>INPUT.md</code> — an extracted Markdown or text file, or a saved query index.</li>\n<li><code>\"your question\"</code> — the words to rank. Include several specific terms when useful.</li>\n<li><code>-k N</code> — the maximum number of result windows. The default is 8; use 1–3 for most questions.</li>\n<li><code>-e N</code> — the number of surrounding lines. The default is 5; use 0 to return only matching lines.</li>\n</ul>\n<p>Each result starts with a 1-based <code>Lines A-B</code> range. Use that range for a focused follow-up read when needed.</p>\n<h3>Reuse an index</h3>\n<p>Create an index when you expect several questions about the same file:</p>\n<pre><code>$SKILL_DIR/bin/query text INPUT.md \"first question\" --emit-index INPUT.idx\n$SKILL_DIR/bin/query text INPUT.idx \"second question\"\n</code></pre>\n<p>The index contains the source lines, so later queries need only the index file.</p>\n<h2>Workflow</h2>\n<ol>\n<li>Convert the PDF once with <code>pdf-to-markdown</code> or <code>pdf-to-text</code>.</li>\n<li>Run one focused query with a small <code>-k</code> value.</li>\n<li>Answer from the returned passages. Read a wider line range only when needed.</li>\n<li>Reuse an index for later questions about the same file.</li>\n</ol>\n<h2>Query tips</h2>\n<ul>\n<li>Use specific words likely to appear in the document.</li>\n<li>Put related terms in one query instead of running several narrow queries.</li>\n<li>Add <code>--language en</code>, or another ISO language code, to match inflected forms.</li>\n<li>Increase <code>-e</code> for more context. Increase <code>-k</code> only when you expect several separate answers.</li>\n</ul>\n<h2>Troubleshooting</h2>\n<ul>\n<li><strong><code>No relevant matches found</code>:</strong> Try a more specific term, a synonym, or <code>--mode lenient</code>. The message is not document content.</li>\n<li><strong>Empty output:</strong> Check that the converted file contains text. <code>query</code> does not perform OCR.</li>\n<li><strong>Poor matches:</strong> Add rarer terms or use <code>--mode strict</code>.</li>\n<li><strong>Nonzero exit:</strong> Read stderr and report the specific error. Common causes are a missing input file or a first-run download failure.</li>\n<li><strong>First run is slow:</strong> The wrapper downloads the platform binary once. Later runs use the cached copy.</li>\n</ul>\n<h2>Usage and licensing</h2>\n<p><code>query</code> is free to use. It runs locally, requires no account, reports no usage, and uses no Vision pages.</p>\n<p>Use is subject to the <a href=\"https://github.com/PSPDFKit/pdf-to-markdown/blob/main/LICENSE.md\">Nutrient PDF to Markdown License</a> and Nutrient's <a href=\"https://www.nutrient.io/legal/privacy/\">Privacy Policy</a>. Redistribution, OEM, embedded, and white-label use require a separate agreement with Nutrient.</p>\n","files":[{"path":"bin/query","sizeBytes":16550,"isText":false},{"path":"SKILL.md","sizeBytes":3784,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"clean","suspicious":0,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-11-29T00:45:21.884732Z","sha256":"E982746BC6496574929E0FA7CE5E2EB85E256AC234C4825257F9D0E5A5271C32","sizeBytes":6234},"review":null,"source":{"repositoryUrl":"https://github.com/PSPDFKit-labs/nutrient-skills","path":"plugins/query/skills/query","license":null,"commit":"83aea52a003a4ebb69fcf78ea724b48cbe950835","subtreeSha":"C8C4AE2D8530A1DD66A0AD6C07C90D2BDB51134243EBF9C3E2B47E3AAF5BBD4F","lastSyncedAt":"2026-11-29T00:42:56.729498Z"},"reviewedAt":"2026-11-29T00:50:55.78764Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/PSPDFKit-labs/nutrient-skills/tree/main/plugins/query/skills/query"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install pspdfkit-labs-nutrient-skills@llmmart"},{"target":"git","command":"git clone https://github.com/PSPDFKit-labs/nutrient-skills.git"}]}