llm-structured-extraction
Skill1 starsChanged 33 days agoMITView on GitHub
Extract structured data from documents and text with LLMs reliably — JSON schemas, constrained decoding or tool calling, field-level validation, confidence and abstention, chunking for long documents, human review queues and accuracy measurement. Use when turning invoices, contracts, emails, tickets or forms into structured records with an LLM.
In this repository105 other files it gives its agents.
- AGENTS.mdAGENTS.md
- instructions/AGENTS.mdAGENTS.md
- accessibility-reviewSkill
- agent-evaluationSkill
- agent-guardrailsSkill
- agenthub-routerSkill
- ai-red-teamingSkill
- ansible-reviewSkill
- api-designSkill
- api-integrationSkill
- architecture-decisionSkill
- backup-restoreSkill
- caching-strategySkill
- chaos-engineeringSkill
- ci-cd-pipeline-designSkill
- cloud-cost-optimizationSkill
- cloud-iam-least-privilegeSkill
- code-reviewSkill
- container-image-optimizationSkill
- cyber-resilience-actSkill
- database-migrationsSkill
- data-pipeline-reviewSkill
- data-privacySkill
- data-quality-checksSkill
- debugging-root-causeSkill
- dependency-auditSkill
- dependency-upgradeSkill
- disaster-recovery-drillSkill
- docker-hardeningSkill
- documentationSkill
- dora-readinessSkill
- dpiaSkill
- email-deliverabilitySkill
- embedding-model-selectionSkill
- error-handling-reviewSkill
- eu-ai-act-readinessSkill
- eu-data-sovereigntySkill
- european-accessibility-actSkill
- event-driven-architectureSkill
- feature-flagsSkill
- frontend-reviewSkill
- gdpr-dsar-handlingSkill
- github-actionsSkill
- gitlab-ciSkill
- git-workflowSkill
- go-developmentSkill
- graphql-api-reviewSkill
- helm-chart-reviewSkill
- i18n-localizationSkill
- incident-responseSkill
- java-spring-reviewSkill
- kubernetes-reviewSkill
- linux-server-hardeningSkill
- llm-cost-analysisSkill
- llm-gateway-routingSkill
- llm-observabilitySkill
- llm-output-evaluationSkill
- load-testingSkill
- local-llm-servingSkill
- log-analysisSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
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
- Distinctive: line 13
Document types and samples (anonymised), target schema, downstream systems, accuracy requirements per field, volume and latency, data …
- Distinctive: line 19
Ground values: ask for the source quote or page/coordinates per critical field.
- Distinctive: line 21
Confidence and abstention: use validation results, agreement between two runs or models, and missing evidence as signals.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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.
Files
LLM Structured Extraction
Goal
Records that conform to the schema, are correct field by field at a measured rate, and route uncertain cases to people instead of guessing.
Inputs
- Document types and samples (anonymised), target schema, downstream systems, accuracy requirements per field, volume and latency, data sensitivity.
Procedure
- Design the schema for extraction: precise field descriptions, types and formats (ISO dates, currency codes), enums where possible, nullable fields for "not present" — never force the model to invent a value.
- Use structured output: JSON schema response formats, tool or function calling, or constrained decoding; reject anything that does not validate.
- Validate beyond the schema: business rules (totals equal sum of lines, VAT numbers checksum, dates plausible), cross-field consistency; failed validation triggers a retry with error feedback or human review.
- Ground values: ask for the source quote or page/coordinates per critical field; verify that quoted text exists in the document.
- Long documents: OCR or layout extraction first for scans; chunk by structure; merge per-chunk results with conflict rules.
- Confidence and abstention: use validation results, agreement between two runs or models, and missing evidence as signals; low-confidence records go to a review queue.
- Measure on a labelled set: per-field precision/recall or exact match, document-level accuracy, abstention rate; track by document type and language (see
llm-output-evaluation). - Privacy: minimise what is sent to the model, mask unneeded personal data, prefer EU or self-hosted models for sensitive documents.
Example fixture
{"type":"object","required":["invoice_number","issue_date","currency","total","lines"],
"properties":{"invoice_number":{"type":"string"},"issue_date":{"type":"string","format":"date"},
"currency":{"type":"string","enum":["EUR","USD","GBP"]},"total":{"type":"number"},
"vat_id":{"type":["string","null"]},"lines":{"type":"array","items":{"type":"object","required":["description","amount"]}}}}Validation rule: abs(total - sum(lines.amount + vat)) < 0.01, otherwise review.
Acceptance checks
- Field-level accuracy on a labelled test set meets the agreed targets, reported per document type.
- 100 % of stored records validate against the schema and business rules (invalid ones are in the review queue).
- Negative case: a document missing a VAT ID yields
null, not a fabricated value.
Output
Schema, prompts and validators, evaluation report, review-queue design.
Safety
Documents often contain personal and financial data: control where they are sent, mask what is not needed, and keep labelled datasets under access control.
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
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.

