document-structure-analyzer — Claude Code subagent for document analysis
This subagent maps document regions, content hierarchy, and reading order. Use it before OCR when the relationships between headings, tables, and other elements matter.
npx claude-code-templates@latest --agent ocr-extraction-team/document-structure-analyzerWhat document-structure-analyzer does
The subagent examines page layout and content hierarchy. It identifies headings and body text, recognizes tables, lists, and forms, and works out reading order in multi-column pages. It can also assign semantic roles to visual elements and spot recurring document patterns.
Its output can include labeled region maps, hierarchy schemas, reading sequences, and suggestions for OCR preparation. The available tools are Read and Write, and structural decisions include confidence scores. This is a pre-OCR analysis step, not text recognition itself; OCR requires a separate process.
What it helps with
- label regions by document content type
- set reading order for multi-column pages
- map headings and body text into a hierarchy
- identify table, list, and form structure
- prepare layout recommendations before OCR
Example prompts for the agent
- Map the regions in this document and label their roles.
- Work out the reading sequence for this multi-column file.
- Identify headings, tables, and forms before OCR.
How to install document-structure-analyzer
1claude-code-templates
npx claude-code-templates@latest --agent ocr-extraction-team/document-structure-analyzer2Manually: put the files in place
.claude/agents/document-structure-analyzer.mdFor all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention
Manually: put the files in place
.codex/agents/document-structure-analyzer.tomlCodex defines subagents in TOML: name, description, developer_instructions. Move the Markdown text into developer_instructions by hand. For all projects use ~/.codex/agents/
Manually: put the files in place
.cursor/agents/document-structure-analyzer.mdCursor also reads .claude/agents/
Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean
Questions about document-structure-analyzer
How do I install document-structure-analyzer in Claude Code?
Run npx claude-code-templates@latest --agent ocr-extraction-team/document-structure-analyzer, then use .claude/agents/document-structure-analyzer.md.
What does document-structure-analyzer do?
It maps document layout and content hierarchy, labels visual elements by their semantic role, and determines reading order. Its analysis can guide preparation for OCR.
Does the subagent perform OCR?
It analyzes structure and can recommend preprocessing before OCR. Text recognition itself is not among its listed tasks.