document-granular-decompose

document-granular-decompose is a skill for Claude Code, Codex from tiangong-ai/skills. It costs 74 tokens per session (1,011 once invoked), scanned A, original, MIT.

A document-text extraction skill that sends local PDFs, Office files, or images to a TianGong Unstructure/MinerU service and returns plain text.

In plain words
What is it for?
Use it to extract full document text for search, chunking, or summarization, with connection details supplied through environment variables.
Why use it?
It removes the need to write and maintain custom parsing code when documents must be converted into text for later processing.

Skill for Claude CodeCodex

Written for Claude Code and Codex: shipped in a Claude Code plugin, but also agents/openai.yaml present.

Part of the knowledge-base-and-research-ops plugin — 19 skills shipped together

Good fit Use it to extract full document text for search, chunking, or summarization, with connection details supplied through environment variables.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tiangong-ai/skills/document-granular-decompose
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add tiangong-ai/skills --skill document-granular-decompose
Clone the repo
git clone --depth 1 https://github.com/tiangong-ai/skills

Made for: Claude Code, Codex.

Or install knowledge-base-and-research-ops, the plugin that ships this one along with the rest of its 19 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for document-granular-decompose

README.md
[![agentmods](https://agentmods.dev/badge/skills/tiangong-ai/skills/document-granular-decompose/github.svg)](https://agentmods.dev/skills/tiangong-ai/skills/document-granular-decompose)
Your own site
<a href="https://agentmods.dev/skills/tiangong-ai/skills/document-granular-decompose"><img src="https://agentmods.dev/badge/skills/tiangong-ai/skills/document-granular-decompose/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for document-granular-decompose

Your own site · 80×15
<a href="https://agentmods.dev/skills/tiangong-ai/skills/document-granular-decompose"><img src="https://agentmods.dev/badge/skills/tiangong-ai/skills/document-granular-decompose.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 74 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,011 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high System Prompt Leakage · line 71
    Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.
    Fix: Remove any instructions that reveal, print, or output system prompts or internal rules. System instructions should never be exposed to end users.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00074 $0.01011
Opus 5 $0.00037 $0.00505
Sonnet 5 $0.00015 $0.00202
Haiku 4.5 $0.00007 $0.00101

Measured 12d ago against content hash d43b9d64657e, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

document-granular-decompose scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/mineru_fulltext_extract.py, scripts/tests/test_mineru_fulltext_extract.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

document-granular-decompose/SKILL.md · 96 lines

How it starts

The opening of the file, as written. The whole thing — 96 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Document Granular Decompose

Core Goal

  • Parse a local document through POST /mineru_with_images.
  • Always force return_txt=true.
  • Read environment variables for endpoint, request identity, and model routing:
    • UNSTRUCTURED_API_BASE_URL (example: https://your-unstructured-host:7770)
    • UNSTRUCTURED_AUTH_TOKEN
    • UNSTRUCTURED_PROVIDER (optional)
    • UNSTRUCTURED_MODEL (optional)
  • Return only plain fulltext (prefer API txt; fallback to joined result[].text).

Triggering Conditions

  • Need robust document fulltext extraction for PDF/Office/image files.
  • Need image-aware MinerU parsing but only textual output for downstream chunking/search/summarization.
  • Need to standardize provider/model/token input via environment variables instead of ad-hoc command parameters.

Workflow

  1. Prepare environment variables.
export UNSTRUCTURED_AUTH_TOKEN="your-fastapi-bearer-token"
export UNSTRUCTURED_API_BASE_URL="https://your-unstructured-host:7770"
# Optional routing overrides. Omit them to let the server choose its defaults.
export UNSTRUCTURED_PROVIDER="vllm"
export UNSTRUCTURED_MODEL="Qwen/Qwen3.5-122B-A10B-FP8"
  1. Run extraction and print fulltext to stdout.
python3 scripts/mineru_fulltext_extract.py \
  --file "/absolute/path/to/document.pdf"
  1. Save fulltext to a local file when needed.
python3 scripts/mineru_fulltext_extract.py \
  --file "/absolute/path/to/document.pdf" \
  --output "/absolute/path/to/fulltext.txt"

Request Contract

  • Endpoint resolution:
    • --api-url if provided
    • else UNSTRUCTURED_API_BASE_URL + /mineru_with_images
    • else fail fast with missing environment variable error
  • Method: POST multipart form.
  • Query params:
    • Force return_txt=true (always set by script).
  • Form fields sent:
    • file (required)
    • provider (optional, from UNSTRUCTURED_PROVIDER when set)
    • model (optional, from UNSTRUCTURED_MODEL when set)
  • Header sent:
    • Authorization: Bearer $UNSTRUCTURED_AUTH_TOKEN

Read the full file on GitHub · 96 lines

Files

What ships with it

6 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 96 lines · 74 tokens per session scan A d43b9d64657e

Subscribe to this mod's changes

document-granular-decompose is a skill published in the GitHub repository tiangong-ai/skills (9 stars, last pushed yesterday), licensed MIT. It adds 74 tokens to every session and 1,011 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories