What problem does it solve?
When adding a new file format or debugging why a file routes to the wrong extractor, developers need to understand how MIME detection, validation, and extractor selection actually work in the codebase instead of guessing which map or function to edit.
Core Features & Use Cases
- Detection Flow Reference: Documents the path-based detection (
detect_mime_type), bytes-based magic-number detection (detect_mime_type_from_bytes via the infer crate), and validate_mime_type behavior.
- FORMATS Registry Guidance: Explains that
EXT_TO_MIME and SUPPORTED_MIME_TYPES are derived from the single FORMATS registry and must never be hand-edited.
- Extractor Routing Rules: Covers priority-based registry selection, wildcard MIME families like
image/*, and the Err-on-no-match behavior of DocumentExtractorRegistry::get.
- Use Case: When adding support for a new document format, follow the documented four-step procedure: add a
FormatEntry, sync published counts, implement InternalDocumentExtractor, and register it in register_default_extractors().
Quick Start
Load this skill and ask how to add a new file format or why a specific file is being routed to the wrong extractor.