[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M79RSSKKE3E3V19X2RXZ5HZJ":3,"skill-same:01M79RSSKKE3E3V19X2RXZ5HZJ":49},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":28,"repositoryHtmlUrl":29,"repositoryHomepageUrl":30,"ownerHtmlUrl":31,"ownerBlogUrl":32,"ownerDescription":33,"updatedAt":34,"install":35,"resources":48},"01M79RSSKKE3E3V19X2RXZ5HZJ","extraction-pipeline-patterns",null,"Document extraction pipeline architecture and patterns","jamon8888\u002Fhacienda-engine","jamon8888","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F145190?v=4","01M79RNFE7K7JZ1AZG8TACAV98","Jamin Rubio","01M79RNFEV6ZC1SZ4K04SHDY8Z",2,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fjamon8888\u002Fhacienda-engine\u002Fblob\u002Fmain\u002F.ai-rulez\u002Fskills\u002Fextraction-pipeline-patterns\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\ndescription: \"Document extraction pipeline architecture and patterns\"\nname: extraction-pipeline-patterns\npriority: critical\n---\n\n# Extraction Pipeline Patterns\n\n**Xberg's format detection -> extraction -> fallback orchestration for 75+ file formats**\n\n## Core Pipeline Architecture\n\nThe extraction pipeline (`crates\u002Fxberg\u002Fsrc\u002Fcore\u002Fpipeline.rs`, `crates\u002Fxberg\u002Fsrc\u002Fextraction\u002F`) orchestrates:\n\n1. **Format Detection** - MIME type inference + extension validation -> select appropriate extractor\n2. **Intelligent Extraction** - Route to format-specific extractors (PDF, DOCX, Excel, HTML, images, archives, etc.)\n3. **Fallback Strategies** - Password-protected PDFs, OCR for images, nested archive handling, corrupted file recovery\n4. **Post-Processing Pipeline** - Validators, quality processing, chunking, custom hooks (see `core\u002Fpipeline.rs`)\n\n## Format Detection Strategy\n\n**Location**: `crates\u002Fxberg\u002Fsrc\u002Fcore\u002Fmime.rs`, `crates\u002Fxberg\u002Fsrc\u002Fcore\u002Fformats.rs`\n\nPattern: detect via magic bytes, validate extension alignment (prevent spoofing), route to extractor. Multiple extractors for same format -> choose highest confidence\u002Fspecificity.\n\n```rust\n\u002F\u002F Pseudocode: core\u002Fmime.rs\nmatch (magic_bytes(content), extension) {\n    (Some(fmt), Some(ext)) if aligned -> Ok(fmt),\n    (Some(fmt), Some(ext)) if misaligned -> Err(FormatMismatch),\n    (Some(fmt), None) -> Ok(fmt),  \u002F\u002F magic bytes only\n    (None, Some(ext)) -> Ok(from_extension(ext)),\n    _ -> Err(UnknownFormat),\n}\n```\n\n## Extraction Modules (75 Formats)\n\n| Category     | Extractors                                       | Key Modules                                          |\n| ------------ | ------------------------------------------------ | ---------------------------------------------------- |\n| **Office**   | DOCX, XLSX, XLSM, XLSB, XLS, PPTX, ODP, ODS      | `extraction\u002F{docx,excel,pptx}.rs`                    |\n| **PDF**      | Standard + encrypted, password attempts          | `pdf\u002F` subdirectory (13 files)                       |\n| **Images**   | PNG, JPG, TIFF, WebP, JP2, SVG (OCR-enabled)     | `extraction\u002Fimage.rs` + `ocr\u002F`                       |\n| **Web**      | HTML, XHTML, XML, SVG (DOM parsing)              | `extraction\u002Fhtml.rs` (67KB - complex table handling) |\n| **Email**    | EML, MSG (headers, body, attachments, threading) | `extraction\u002Femail.rs`                                |\n| **Archives** | ZIP, TAR, GZ, 7Z (recursive extraction)          | `extraction\u002Farchive.rs` (31KB)                       |\n| **Markdown** | MD, TXT, RST, Org Mode, RTF                      | `extraction\u002Fmarkdown.rs`                             |\n| **Academic** | LaTeX, BibTeX, JATS, Jupyter, DocBook            | `extraction\u002F{structured,xml}.rs`                     |\n\n## Extraction Dispatcher\n\n```rust\n\u002F\u002F Pseudocode: extraction\u002Fmod.rs\nlet format = detect_format(source.bytes, source.extension);\nlet result = match format {\n    Pdf -> extract_pdf(source, config),\n    Docx -> extract_docx(source, config),\n    Image -> extract_image_with_ocr_fallback(source, config),\n    Archive -> extract_archive_recursive(source, config),\n    _ -> extract_with_plugin(format, source, config),\n};\nrun_pipeline(result, config)  \u002F\u002F post-processing always runs\n```\n\n## Fallback Strategies\n\n- **Password-Protected PDFs**: Try primary password -> secondary password list -> return `is_encrypted=true` in metadata on failure\n- **OCR Fallback**: If image text extraction confidence \u003C threshold, trigger OCR backend; return both results with scores\n- **Nested Archives**: Recursive extraction with configurable depth limit; flatten or preserve hierarchy\n- **Corrupted File Recovery**: Stream-based parsing, emit content up to error point, include error location in metadata\n\n## Configuration Integration\n\n**Location**: `crates\u002Fxberg\u002Fsrc\u002Fcore\u002Fconfig.rs`, `crates\u002Fxberg\u002Fsrc\u002Fcore\u002Fconfig_validation.rs`\n\n`ExtractionConfig` holds format-specific configs (`pdf`, `image`, `html`, `office`), fallback orchestration (`fallback`), and post-processing (`postprocessor`, `chunking`, `keywords`). See struct definition in `config.rs`.\n\n## Plugin System Integration\n\n**Location**: `crates\u002Fxberg\u002Fsrc\u002Fplugins\u002F`\n\n- **CustomExtractor**: Override built-in format extractors\n- **PostProcessor**: Modify results after extraction (Early\u002FMiddle\u002FLate stages)\n- **Validator**: Fail-fast validation (e.g., minimum text length)\n- **OCRBackend**: Swap OCR engine\n\nPlugin registry loaded at startup, cached for zero-cost lookup.\n\n## Feature Flag Strategy\n\n**Location**: `Cargo.toml` (workspace), `crates\u002Fxberg\u002FCargo.toml`, `FEATURE_MATRIX.md`\n\n20+ features across 9 language bindings. Key feature groups:\n\n| Group    | Features                                                                             | Notes                             |\n| -------- | ------------------------------------------------------------------------------------ | --------------------------------- |\n| OCR      | `tesseract` (default), `tesseract-static`, `ocr-minimal`                             | Mutually exclusive recommendation |\n| Formats  | `pdf`, `pdf-minimal`, `office`, `office-minimal`                                     |                                   |\n| AI\u002FML    | `embeddings` (requires ONNX), `keywords-yake`, `keywords-rake`, `language-detection` |                                   |\n| Server   | `api` (Axum), `mcp`, `tokio-runtime`, `lite-runtime`                                 |                                   |\n| Bindings | `python-bindings`, `ruby-bindings`, `php-bindings`, `node-bindings`, `wasm`          |                                   |\n\nConditional compilation: modules gated with `#[cfg(feature = \"...\")]`. Runtime `validate_config()` warns if requested feature not compiled in.\n\n### Feature Flag Critical Rules\n\n1. **Never mix conflicting features** - e.g., `ocr-minimal` + `tesseract` should error at compile time\n2. **Always provide feature diagnostics** - Config validation must warn if feature unavailable\n3. **Default to maximum feature set** - Unless embedded\u002Fminimal specifically requested\n4. **Test all feature combinations** - Matrix testing in CI catches regressions\n5. **WASM incompatible** with embeddings, keywords, OCR\n\n## Critical Rules\n\n1. **Always use format detection** before routing to extractors (prevent confusion attacks)\n2. **Stream-based parsing** for PDFs\u002Farchives to handle multi-GB files\n3. **Post-pipeline is mandatory**: All extraction results flow through `run_pipeline()` for validators\u002Fhooks\n4. **Plugin overrides are order-dependent**: Plugins registered first take priority\n5. **Fallback timeouts**: Set reasonable OCR\u002Farchive extraction timeouts (config-driven)\n6. **Metadata preservation**: Include format detection confidence, extraction method used, any fallbacks applied\n\n## Related Skills\n\n- **ocr-backend-management** - OCR engine selection and image preprocessing\n- **chunking-embeddings** - Post-extraction text splitting with FastEmbed\n- **api-server-mcp** - Axum endpoint for extraction pipeline exposure and MCP server\n","# Extraction Pipeline Patterns\n\n**Xberg's format detection -> extraction -> fallback orchestration for 75+ file formats**\n\n## Core Pipeline Architecture\n\nThe extraction pipeline (`crates\u002Fxberg\u002Fsrc\u002Fcore\u002Fpipeline.rs`, `crates\u002Fxberg\u002Fsrc\u002Fextraction\u002F`) orchestrates:\n\n1. **Format Detection** - MIME type inference + extension validation -> select appropriate extractor\n2. **Intelligent Extraction** - Route to format-specific extractors (PDF, DOCX, Excel, HTML, images, archives, etc.)\n3. **Fallback Strategies** - Password-protected PDFs, OCR for images, nested archive handling, corrupted file recovery\n4. **Post-Processing Pipeline** - Validators, quality processing, chunking, custom hooks (see `core\u002Fpipeline.rs`)\n\n## Format Detection Strategy\n\n**Location**: `crates\u002Fxberg\u002Fsrc\u002Fcore\u002Fmime.rs`, `crates\u002Fxberg\u002Fsrc\u002Fcore\u002Fformats.rs`\n\nPattern: detect via magic bytes, validate extension alignment (prevent spoofing), route to extractor. Multiple extractors for same format -> choose highest confidence\u002Fspecificity.\n\n```rust\n\u002F\u002F Pseudocode: core\u002Fmime.rs\nmatch (magic_bytes(content), extension) {\n    (Some(fmt), Some(ext)) if aligned -> Ok(fmt),\n    (Some(fmt), Some(ext)) if misaligned -> Err(FormatMismatch),\n    (Some(fmt), None) -> Ok(fmt),  \u002F\u002F magic bytes only\n    (None, Some(ext)) -> Ok(from_extension(ext)),\n    _ -> Err(UnknownFormat),\n}\n```\n\n## Extraction Modules (75 Formats)\n\n| Category     | Extractors                                       | Key Modules                                          |\n| ------------ | ------------------------------------------------ | ---------------------------------------------------- |\n| **Office**   | DOCX, XLSX, XLSM, XLSB, XLS, PPTX, ODP, ODS      | `extraction\u002F{docx,excel,pptx}.rs`                    |\n| **PDF**      | Standard + encrypted, password attempts          | `pdf\u002F` subdirectory (13 files)                       |\n| **Images**   | PNG, JPG, TIFF, WebP, JP2, SVG (OCR-enabled)     | `extraction\u002Fimage.rs` + `ocr\u002F`                       |\n| **Web**      | HTML, XHTML, XML, SVG (DOM parsing)              | `extraction\u002Fhtml.rs` (67KB - complex table handling) |\n| **Email**    | EML, MSG (headers, body, attachments, threading) | `extraction\u002Femail.rs`                                |\n| **Archives** | ZIP, TAR, GZ, 7Z (recursive extraction)          | `extraction\u002Farchive.rs` (31KB)                       |\n| **Markdown** | MD, TXT, RST, Org Mode, RTF                      | `extraction\u002Fmarkdown.rs`                             |\n| **Academic** | LaTeX, BibTeX, JATS, Jupyter, DocBook            | `extraction\u002F{structured,xml}.rs`                     |\n\n## Extraction Dispatcher\n\n```rust\n\u002F\u002F Pseudocode: extraction\u002Fmod.rs\nlet format = detect_format(source.bytes, source.extension);\nlet result = match format {\n    Pdf -> extract_pdf(source, config),\n    Docx -> extract_docx(source, config),\n    Image -> extract_image_with_ocr_fallback(source, config),\n    Archive -> extract_archive_recursive(source, config),\n    _ -> extract_with_plugin(format, source, config),\n};\nrun_pipeline(result, config)  \u002F\u002F post-processing always runs\n```\n\n## Fallback Strategies\n\n- **Password-Protected PDFs**: Try primary password -> secondary password list -> return `is_encrypted=true` in metadata on failure\n- **OCR Fallback**: If image text extraction confidence \u003C threshold, trigger OCR backend; return both results with scores\n- **Nested Archives**: Recursive extraction with configurable depth limit; flatten or preserve hierarchy\n- **Corrupted File Recovery**: Stream-based parsing, emit content up to error point, include error location in metadata\n\n## Configuration Integration\n\n**Location**: `crates\u002Fxberg\u002Fsrc\u002Fcore\u002Fconfig.rs`, `crates\u002Fxberg\u002Fsrc\u002Fcore\u002Fconfig_validation.rs`\n\n`ExtractionConfig` holds format-specific configs (`pdf`, `image`, `html`, `office`), fallback orchestration (`fallback`), and post-processing (`postprocessor`, `chunking`, `keywords`). See struct definition in `config.rs`.\n\n## Plugin System Integration\n\n**Location**: `crates\u002Fxberg\u002Fsrc\u002Fplugins\u002F`\n\n- **CustomExtractor**: Override built-in format extractors\n- **PostProcessor**: Modify results after extraction (Early\u002FMiddle\u002FLate stages)\n- **Validator**: Fail-fast validation (e.g., minimum text length)\n- **OCRBackend**: Swap OCR engine\n\nPlugin registry loaded at startup, cached for zero-cost lookup.\n\n## Feature Flag Strategy\n\n**Location**: `Cargo.toml` (workspace), `crates\u002Fxberg\u002FCargo.toml`, `FEATURE_MATRIX.md`\n\n20+ features across 9 language bindings. Key feature groups:\n\n| Group    | Features                                                                             | Notes                             |\n| -------- | ------------------------------------------------------------------------------------ | --------------------------------- |\n| OCR      | `tesseract` (default), `tesseract-static`, `ocr-minimal`                             | Mutually exclusive recommendation |\n| Formats  | `pdf`, `pdf-minimal`, `office`, `office-minimal`                                     |                                   |\n| AI\u002FML    | `embeddings` (requires ONNX), `keywords-yake`, `keywords-rake`, `language-detection` |                                   |\n| Server   | `api` (Axum), `mcp`, `tokio-runtime`, `lite-runtime`                                 |                                   |\n| Bindings | `python-bindings`, `ruby-bindings`, `php-bindings`, `node-bindings`, `wasm`          |                                   |\n\nConditional compilation: modules gated with `#[cfg(feature = \"...\")]`. Runtime `validate_config()` warns if requested feature not compiled in.\n\n### Feature Flag Critical Rules\n\n1. **Never mix conflicting features** - e.g., `ocr-minimal` + `tesseract` should error at compile time\n2. **Always provide feature diagnostics** - Config validation must warn if feature unavailable\n3. **Default to maximum feature set** - Unless embedded\u002Fminimal specifically requested\n4. **Test all feature combinations** - Matrix testing in CI catches regressions\n5. **WASM incompatible** with embeddings, keywords, OCR\n\n## Critical Rules\n\n1. **Always use format detection** before routing to extractors (prevent confusion attacks)\n2. **Stream-based parsing** for PDFs\u002Farchives to handle multi-GB files\n3. **Post-pipeline is mandatory**: All extraction results flow through `run_pipeline()` for validators\u002Fhooks\n4. **Plugin overrides are order-dependent**: Plugins registered first take priority\n5. **Fallback timeouts**: Set reasonable OCR\u002Farchive extraction timeouts (config-driven)\n6. **Metadata preservation**: Include format detection confidence, extraction method used, any fallbacks applied\n\n## Related Skills\n\n- **ocr-backend-management** - OCR engine selection and image preprocessing\n- **chunking-embeddings** - Post-extraction text splitting with FastEmbed\n- **api-server-mcp** - Axum endpoint for extraction pipeline exposure and MCP server\n",{"name":5,"priority":24,"description":7},"critical","main","613e6deee7a2f31f95bac8beec31dd5171193c8d",".ai-rulez\u002Fskills\u002Fextraction-pipeline-patterns",0,"https:\u002F\u002Fgithub.com\u002Fjamon8888\u002Fhacienda-engine","https:\u002F\u002Fhacienda-engine-hacienda-studio.vercel.app","https:\u002F\u002Fgithub.com\u002Fjamon8888","hacienda.diy","Maker","2026-11-15 05:01:55",{"source":8,"skillName":5,"commands":36,"prompt":46,"zipAvailable":47},[37,40,43],{"tool":38,"command":39},"npx","npx skills add jamon8888\u002Fhacienda-engine --skill extraction-pipeline-patterns",{"tool":41,"command":42},"bunx","bunx skills add jamon8888\u002Fhacienda-engine --skill extraction-pipeline-patterns",{"tool":44,"command":45},"pnpm","pnpm dlx skills add jamon8888\u002Fhacienda-engine --skill extraction-pipeline-patterns","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjamon8888\u002Fhacienda-engine\u002Fblob\u002Fmain\u002F.ai-rulez\u002Fskills\u002Fextraction-pipeline-patterns\u002FSKILL.md",true,[],[50,57,64,71,78,85],{"skillNo":51,"name":52,"nameZh":6,"description":53,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":54,"categories":55,"keywords":56,"publishedAt":19},"01M79RTKG5HB5PQ251W7J9C4S6","impeccable","Use when the user wants to design, redesign, shape, critique, audit, polish, clarify, distill, harden, optimize, adapt, animate, colorize, extract, or otherwise improve a frontend interface. Covers websites, landing pages, dashboards, product UI, app shells, components, forms, settings, onboarding, and empty states. Handles UX review, visual hierarchy, information architecture, cognitive load, accessibility, performance, responsive behavior, theming, anti-patterns, typography, fonts, spacing, layout, alignment, color, motion, micro-interactions, UX copy, error states, edge cases, i18n, and reusable design systems or tokens. Also use for bland designs that need to become bolder or more delightful, loud designs that should become quieter, live browser iteration on UI elements, or ambitious visual effects that should feel technically extraordinary. Not for backend-only or non-UI tasks.","https:\u002F\u002Fgithub.com\u002Fjamon8888\u002Fhacienda-engine\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fimpeccable\u002FSKILL.md",[],[],{"skillNo":58,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":19},"01M79RTFDA4MAD9PPF3N15B68Y","wasm-constraints","WASM build constraints for the crates\u002Fxberg-wasm crate — the wasm-target feature set, no-tokio sync-only internal APIs, the mandatory SyncExtractor trait for WASM-compatible extractors, the 2 MB HTML size limit, size-optimized build config (opt-level=\"z\"), and the async-wrapper\u002Fsync-internal API pattern. Load when building for wasm32, adding or modifying a WASM-compatible extractor, or debugging WASM build\u002Fruntime failures.","https:\u002F\u002Fgithub.com\u002Fjamon8888\u002Fhacienda-engine\u002Fblob\u002Fmain\u002F.ai-rulez\u002Fskills\u002Fwasm-constraints\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":19},"01M79RTC4SV7NENKJXK2PSHK7H","release-versioning","How xberg versions are synced and released — Cargo.toml is the single source of truth, `task version:sync` propagates it to alef-managed binding manifests AND the integrations under integrations\u002F, which are versioned and published in lockstep with core (including -rc.N). Load before bumping a version, editing the version-sync task, or touching an integration's version\u002Fxberg dependency.","https:\u002F\u002Fgithub.com\u002Fjamon8888\u002Fhacienda-engine\u002Fblob\u002Fmain\u002F.ai-rulez\u002Fskills\u002Frelease-versioning\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":19},"01M79RT94KWTS5R5T61S71H1AD","plugin-architecture-patterns","Plugin architecture, registration, and trait patterns","https:\u002F\u002Fgithub.com\u002Fjamon8888\u002Fhacienda-engine\u002Fblob\u002Fmain\u002F.ai-rulez\u002Fskills\u002Fplugin-architecture-patterns\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M79RT3X076QPZYK10QF6Q22X","mime-detection-routing","MIME type detection and extractor routing in core\u002Fmime.rs and core\u002Fextractor\u002Fbytes.rs — the extension→EXT_TO_MIME→validate→registry→extractor flow, key detection functions, the 118+ case-insensitive extension map, priority-based registry selection, wildcard MIME families, and how to add a new MIME type. Load when adding a format, wiring an extractor to a MIME type, or debugging why a file routes to the wrong (or no) extractor.","https:\u002F\u002Fgithub.com\u002Fjamon8888\u002Fhacienda-engine\u002Fblob\u002Fmain\u002F.ai-rulez\u002Fskills\u002Fmime-detection-routing\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M79RSZYWZ6RSAM31N2Y0TXMN","format-specific-extraction","Format-specific document extraction workflows","https:\u002F\u002Fgithub.com\u002Fjamon8888\u002Fhacienda-engine\u002Fblob\u002Fmain\u002F.ai-rulez\u002Fskills\u002Fformat-specific-extraction\u002FSKILL.md",[],[]]