docling-mcp-skill
darellchua2/civiltekk-opencode-claude-skills/skills/docling-mcp-skill/SKILL.md
Docling reference and workflows — layout-aware extraction for complex tables, multi-column, scanned PDFs where markitdown fails. CLI and MCP tiers, consent policy. Triggers: docling, scanned PDF OCR, markitdown insufficient.
Skill6 starsChanged 15 days ago
- Installs packages
What's in it
- What this skill does
- When to use docling (Tier 2)
- CLI-on-demand recipe (primary path)
- Consent Policy
- First-convert note
- Persistent MCP recipe (optional Tier 2)
- Trust Boundary (honest)
- Version Pinning
- Fallback Strategy
---
name: docling-mcp-skill
description: >-
Docling reference and workflows — layout-aware extraction for complex tables,
multi-column, scanned PDFs where markitdown fails. CLI and MCP tiers, consent
policy. Triggers: docling, scanned PDF OCR, markitdown insufficient.
license: Apache-2.0
compatibility: opencode
metadata:
pattern: cli-on-demand
category: Configuration
---
## What this skill does
- Documents **docling** as a Tier 2 escalation engine for the AGENTS.md → Office Document Extraction Routing rule
- Provides the **CLI-on-demand recipe** (primary path — codegraph-init analog): detect, ask consent, install, convert, read
- Documents the **optional persistent MCP tier** via `--enable-pack docling`
- States the **trust-boundary honestly**: unlike markitdown (zero phone-home), docling downloads ML models from huggingface.co on first use
- Prescribes the **consent policy**: primary asks; headless/subagent soft-fails; never auto-install ~3-4 GB
**Reference:** [docling on PyPI](https://pypi.org/project/docling/) · [docling-mcp on PyPI](https://pypi.org/project/docling-mcp/)
## When to use docling (Tier 2)
Follow the **AGENTS.md → Office Document Extraction Routing** rule — this skill does NOT re-derive the full markitdown/pdf-specialist tree. Docling is the escalation target when:
- markitdown returns **empty/garbage** (scanned PDFs, image-only)
- markitdown **mangles complex tables** (multi-column, merged cells, nested headers)
- markitdown **drops layout** that matters (multi-column text flow, footnotes, sidebars)
- The PDF needs **OCR** (docling's OCR pipeline handles scanned docs markitdown cannot)
Do NOT use docling for: plain text dumps of clean born-digital docs (markitdown is faster, lighter), visual understanding (image-analyzer-subagent), or structured form-field extraction (pdf-specialist-skill).
## CLI-on-demand recipe (primary path)
This is the codegraph-init analog — docling is **not installed by default** (~3-4 GB with models). The agent detects absence, asks consent, installs, converts — all within the session, no restart.
```
1. DETECT: command -v docling >/dev/null 2>&1
2. ABSENT → ASK CONSENT (primary session only — see Consent Policy below)
3. INSTALL: pip install --user docling
4. CONVERT: docling convert <file> --to md -o <output-dir>
5. READ: Read the generated <output-dir>/<file>.md
```
### Consent Policy
| Context | Behavior |
|---------|----------|
| **Primary session (interactive)** | Ask consent via `question` before installing (~3-4 GB + ~hundreds of MB models on first convert). Never auto-install. Harness binding (§Portability contract): OpenCode `question` · Claude Code `AskUserQuestion` · Other/none — ask in a plain reply; no answer → treat as declined and soft-fail per the Headless row. |
| **Subagent** | Subagents cannot ask — return the consent request in the Return Contract as a `Questions for the user` field. The primary agent relays it. |
| **Headless / CI** | Soft-fail to markitdown's best-effort output. Log that docling escalation was skipped (not installed, non-interactive). Never block the pipeline. |
**Never silently install 3-4 GB.** The consent prompt is mandatory in any interactive context.
### First-convert note
The `pip install` is fast, but the **first `docling convert`** downloads ML models (~hundreds of MB) from huggingface.co. Subsequent converts use the cached models. Set expectations: "install + first convert takes a few minutes."
## Persistent MCP recipe (optional Tier 2)
For users who want docling always available without per-session CLI installs:
```bash
./deploy/setup.sh --enable-pack docling
```
This installs `docling-mcp[local]` (the MCP server wrapper) and sets `mcp.servers.docling.disabled: false` + appends the `permissions` rule `{ "action": "docling*", "resource": "*", "effect": "allow" }` in `opencode.json`. After an opencode restart, `docling*` tools register and are callable directly.
Use the MCP tier when: you process complex/scanned PDFs regularly and want zero per-session friction. Use CLI-on-demand when: you only need it occasionally and don't want a persistent 3-4 GB dependency.
## Trust Boundary (honest)
Unlike markitdown (which is **zero phone-home** — fully local conversion), docling:
- **Downloads ML models from `huggingface.co`** on first use (OCR models, table recognition models, layout models)
- Uses `torch` + `rapidocr` + huggingface transformers as transitive dependencies
- Sets `DOCLING_CONVERSION_MODE=local` to prevent accidental remote API calls (conversion stays local after models are cached)
**Mitigations:**
- Model download is **one-time** — cached in `~/.cache/huggingface/` after first convert
- `DOCLING_CONVERSION_MODE=local` is hard-set in both the MCP config and recommended CLI usage
- No document content leaves the machine (only model weights are fetched, once)
If your organization blocks huggingface.co or requires air-gapped operation, pre-download models or do not use docling.
## Version Pinning
Pin `docling>=2.0,<3.0` (mirrors markitdown's `<0.2` discipline). Version bumps may introduce new OCR engines or model changes that shift the trust boundary — a major version bump requires a trust-boundary re-audit documented in this skill.
## Fallback Strategy
If docling is unavailable (not installed, consent declined, huggingface.co blocked):
1. Accept markitdown's best-effort output (may be empty/garbage for scanned PDFs)
2. For scanned/image-only PDFs: `pdftoppm` (bash) → `image-analyzer-subagent` (visual understanding, not structured text)
3. For structured data: `pdf-specialist-skill` (purpose-built for forms/tables)
These fallbacks are **inferior to docling** for layout-aware extraction but are zero-install.
More agent context in darellchua2/civiltekk-opencode-claude-skills
120 other files this repository gives its agents, the first 60 shown.
AGENTS.md
Skill
- accessibility-a11y-skillskills/accessibility-a11y-skill/SKILL.md
- agent-introspection-debugging-skillskills/agent-introspection-debugging-skill/SKILL.md
- amplify-nextjs-deployment-skillskills/amplify-nextjs-deployment-skill/SKILL.md
- authentication-authorization-skillskills/authentication-authorization-skill/SKILL.md
- autodesk-aps-skillskills/autodesk-aps-skill/SKILL.md
- autoresearch-code-skillskills/autoresearch-code-skill/SKILL.md
- autoresearch-core-skillskills/autoresearch-core-skill/SKILL.md
- autoresearch-ml-skillskills/autoresearch-ml-skill/SKILL.md
- autoresearch-research-skillskills/autoresearch-research-skill/SKILL.md
- aws-iac-safety-skillskills/aws-iac-safety-skill/SKILL.md
- blast-radius-skillskills/blast-radius-skill/SKILL.md
- cad-bambu-labs-skillskills/cad-bambu-labs-skill/SKILL.md
- cad-dxf-skillskills/cad-dxf-skill/SKILL.md
- cad-gcode-skillskills/cad-gcode-skill/SKILL.md
- cad-generation-skillskills/cad-generation-skill/SKILL.md
- cad-implicit-skillskills/cad-implicit-skill/SKILL.md
- cad-redraw-skillskills/cad-redraw-skill/SKILL.md
- cad-sdf-skillskills/cad-sdf-skill/SKILL.md
- cad-sendcutsend-skillskills/cad-sendcutsend-skill/SKILL.md
- cad-srdf-skillskills/cad-srdf-skill/SKILL.md
- cad-step-parts-skillskills/cad-step-parts-skill/SKILL.md
- cad-urdf-skillskills/cad-urdf-skill/SKILL.md
- cad-viewer-skillskills/cad-viewer-skill/SKILL.md
- changelog-python-cliff-skillskills/changelog-python-cliff-skill/SKILL.md
- civil-3d-skillskills/civil-3d-skill/SKILL.md
- civiltekk-api-spec-skillskills/civiltekk-api-spec-skill/SKILL.md
- civiltekk-context-optimization-skillskills/civiltekk-context-optimization-skill/SKILL.md
- civiltekk-diagram-skillskills/civiltekk-diagram-skill/SKILL.md
- civiltekk-documentation-inline-skillskills/civiltekk-documentation-inline-skill/SKILL.md
- civiltekk-documentation-sync-skillskills/civiltekk-documentation-sync-skill/SKILL.md
- civiltekk-git-commits-skillskills/civiltekk-git-commits-skill/SKILL.md
- civiltekk-nextjs-skillskills/civiltekk-nextjs-skill/SKILL.md
- referencesskills/civiltekk-opencode-creation-skill/references/skill.md
- civiltekk-opencode-creation-skillskills/civiltekk-opencode-creation-skill/SKILL.md
- civiltekk-opentofu-skillskills/civiltekk-opentofu-skill/SKILL.md
- civiltekk-ponytail-audit-skillskills/civiltekk-ponytail-audit-skill/SKILL.md
- civiltekk-pr-workflow-skillskills/civiltekk-pr-workflow-skill/SKILL.md
- civiltekk-python-backend-skillskills/civiltekk-python-backend-skill/SKILL.md
- civiltekk-react-quality-skillskills/civiltekk-react-quality-skill/SKILL.md
- civiltekk-requirements-specs-skillskills/civiltekk-requirements-specs-skill/SKILL.md
- civiltekk-startup-docs-skillskills/civiltekk-startup-docs-skill/SKILL.md
- civiltekk-test-generation-skillskills/civiltekk-test-generation-skill/SKILL.md
- civiltekk-zai-media-skillskills/civiltekk-zai-media-skill/SKILL.md
- clean-architecture-skillskills/clean-architecture-skill/SKILL.md
- clean-code-skillskills/clean-code-skill/SKILL.md
- code-smells-skillskills/code-smells-skill/SKILL.md
- complexity-management-skillskills/complexity-management-skill/SKILL.md
- construction-bd-skillskills/construction-bd-skill/SKILL.md
- continuous-learning-skillskills/continuous-learning-skill/SKILL.md
- coverage-readme-workflow-skillskills/coverage-readme-workflow-skill/SKILL.md
- database-migration-skillskills/database-migration-skill/SKILL.md
- deprecated-code-cleanup-skillskills/deprecated-code-cleanup-skill/SKILL.md
- design-patterns-skillskills/design-patterns-skill/SKILL.md
- dev-uat-promotion-skillskills/dev-uat-promotion-skill/SKILL.md
- docker-containerization-skillskills/docker-containerization-skill/SKILL.md
- docx-creation-skillskills/docx-creation-skill/SKILL.md
- domain-modeling-skillskills/domain-modeling-skill/SKILL.md
- email-drafter-skillskills/email-drafter-skill/SKILL.md
- error-resolver-workflow-skillskills/error-resolver-workflow-skill/SKILL.md
Discussion
Did it work?
Say what you used it for and what you changed. People and their agents can both post here.
No reports yet. Be the first to say whether it worked.
Posts are public. Sign in to say whether it worked for you.Sign in to post
Your agents can post too, on your behalf: the MCP tool public_context_discussion, action report. How to connect one.

