Document Ingestion Pipeline
Skill Profile
(Select at least one profile to enable specific modules)
Overview
Document ingestion pipeline covers the complete workflow of processing raw documents from various sources, extracting content, and preparing them for RAG systems. This skill includes source connectors, text extraction, preprocessing, and quality validation. The pipeline architecture follows a modular design with components for PDF processing, web crawling, database loading, text extraction, data cleaning, and quality validation.
Why This Matters
Document ingestion is the foundation of RAG systems. Poor ingestion leads to low-quality retrieval, missing content, and poor user experience. A well-designed pipeline ensures consistent quality, handles various sources, scales efficiently, and provides monitoring for debugging. This skill is essential for building production-grade RAG systems.
Core Concepts & Rules
1. Core Principles
- Follow established patterns and conventions
- Maintain consistency across codebase
- Document decisions and trade-offs
2. Implementation Guidelines
- Start with the simplest viable solution
- Iterate based on feedback and requirements
- Test thoroughly before deployment
Inputs / Outputs / Contracts
Skill Composition
- Depends on: None
- Compatible with: None
- Conflicts with: None
- Related Skills: None
Quick Start / Implementation Example
- Review requirements and constraints
- Set up development environment
- Implement core functionality following patterns
- Write tests for critical paths
- Run tests and fix issues
- Document any deviations or decisions
# Example implementation following best practices
def example_function():
# Your implementation here
pass
Assumptions
- Documents are accessible and readable
- Sufficient storage capacity for processed documents
- Network connectivity for web sources
- Database is accessible for database sources
- OCR service is available for scanned documents
Compatibility & Prerequisites
- Supported Versions:
- Python 3.8+
- Node.js 16+
- Modern browsers (Chrome, Firefox, Safari, Edge)
- Required AI Tools:
- Code editor (VS Code recommended)
- Testing framework appropriate for language
- Version control (Git)
- Dependencies:
- Language-specific package manager
- Build tools
- Testing libraries
- Environment Setup:
.env.example keys: API_KEY, DATABASE_URL (no values)
Test Scenario Matrix (QA Strategy)
| Type |
Focus Area |
Required Scenarios / Mocks |
| Unit |
Core Logic |
Must cover primary logic and at least 3 edge/error cases. Target minimum 80% coverage |
| Integration |
DB / API |
All external API calls or database connections must be mocked during unit tests |
| E2E |
User Journey |
Critical user flows to test |
| Performance |
Latency / Load |
Benchmark requirements |
| Security |
Vuln / Auth |
SAST/DAST or dependency audit |
| Frontend |
UX / A11y |
Accessibility checklist (WCAG), Performance Budget (Lighthouse score) |
Technical Guardrails & Security Threat Model
1. Security & Privacy (Threat Model)
- Top Threats: Injection attacks, authentication bypass, data exposure
2. Performance & Resources
3. Architecture & Scalability
4. Observability & Reliability
Agent Directives & Error Recovery
(ข้อกำหนดสำหรับ AI Agent ในการคิดและแก้ปัญหาเมื่อเกิดข้อผิดพลาด)
- Thinking Process: Analyze root cause before fixing. Do not brute-force.
- Fallback Strategy: Stop after 3 failed test attempts. Output root cause and ask for human intervention/clarification.
- Self-Review: Check against Guardrails & Anti-patterns before finalizing.
- Output Constraints: Output ONLY the modified code block. Do not explain unless asked.
Definition of Done (DoD) Checklist
Anti-patterns / Pitfalls
- ⛔ Don't: Log PII, catch-all exception, N+1 queries
- ⚠️ Watch out for: Common symptoms and quick fixes
- 💡 Instead: Use proper error handling, pagination, and logging
Reference Links & Examples
- Internal documentation and examples
- Official documentation and best practices
- Community resources and discussions
Versioning & Changelog
- Version: 1.0.0
- Changelog:
- 2026-02-22: Initial version with complete template structure
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: document-ingestion-pipeline3description: Document ingestion pipeline covers the complete workflow of processing Use when this capability is needed.4---56# Document Ingestion Pipeline78## Skill Profile9*(Select at least one profile to enable specific modules)*10- [ ] **DevOps**11- [x] **Backend**12- [ ] **Frontend**13- [ ] **AI-RAG**14- [ ] **Security Critical**1516## Overview17Document ingestion pipeline covers the complete workflow of processing raw documents from various sources, extracting content, and preparing them for RAG systems. This skill includes source connectors, text extraction, preprocessing, and quality validation. The pipeline architecture follows a modular design with components for PDF processing, web crawling, database loading, text extraction, data cleaning, and quality validation.1819## Why This Matters20Document ingestion is the foundation of RAG systems. Poor ingestion leads to low-quality retrieval, missing content, and poor user experience. A well-designed pipeline ensures consistent quality, handles various sources, scales efficiently, and provides monitoring for debugging. This skill is essential for building production-grade RAG systems.2122## Core Concepts & Rules2324### 1. Core Principles25- Follow established patterns and conventions26- Maintain consistency across codebase27- Document decisions and trade-offs2829### 2. Implementation Guidelines30- Start with the simplest viable solution31- Iterate based on feedback and requirements32- Test thoroughly before deployment333435## Inputs / Outputs / Contracts36#3738## Skill Composition39* **Depends on**: None40* **Compatible with**: None41* **Conflicts with**: None42* **Related Skills**: None4344## Quick Start / Implementation Example45461. Review requirements and constraints472. Set up development environment483. Implement core functionality following patterns494. Write tests for critical paths505. Run tests and fix issues516. Document any deviations or decisions5253```python54# Example implementation following best practices55def example_function():56 # Your implementation here57 pass58```596061## Assumptions62- Documents are accessible and readable63- Sufficient storage capacity for processed documents64- Network connectivity for web sources65- Database is accessible for database sources66- OCR service is available for scanned documents6768## Compatibility & Prerequisites6970* **Supported Versions**:71 - Python 3.8+72 - Node.js 16+73 - Modern browsers (Chrome, Firefox, Safari, Edge)74* **Required AI Tools**:75 - Code editor (VS Code recommended)76 - Testing framework appropriate for language77 - Version control (Git)78* **Dependencies**:79 - Language-specific package manager80 - Build tools81 - Testing libraries82* **Environment Setup**:83 - `.env.example` keys: `API_KEY`, `DATABASE_URL` (no values)848586## Test Scenario Matrix (QA Strategy)8788| Type | Focus Area | Required Scenarios / Mocks |89| :--- | :--- | :--- |90| **Unit** | Core Logic | Must cover primary logic and at least 3 edge/error cases. Target minimum 80% coverage |91| **Integration** | DB / API | All external API calls or database connections must be mocked during unit tests |92| **E2E** | User Journey | Critical user flows to test |93| **Performance** | Latency / Load | Benchmark requirements |94| **Security** | Vuln / Auth | SAST/DAST or dependency audit |95| **Frontend** | UX / A11y | Accessibility checklist (WCAG), Performance Budget (Lighthouse score) |969798## Technical Guardrails & Security Threat Model99100### 1. Security & Privacy (Threat Model)101* **Top Threats**: Injection attacks, authentication bypass, data exposure102- [ ] **Data Handling**: Sanitize all user inputs to prevent Injection attacks. Never log raw PII103- [ ] **Secrets Management**: No hardcoded API keys. Use Env Vars/Secrets Manager104- [ ] **Authorization**: Validate user permissions before state changes105106### 2. Performance & Resources107- [ ] **Execution Efficiency**: Consider time complexity for algorithms108- [ ] **Memory Management**: Use streams/pagination for large data109- [ ] **Resource Cleanup**: Close DB connections/file handlers in finally blocks110111### 3. Architecture & Scalability112- [ ] **Design Pattern**: Follow SOLID principles, use Dependency Injection113- [ ] **Modularity**: Decouple logic from UI/Frameworks114115### 4. Observability & Reliability116- [ ] **Logging Standards**: Structured JSON, include trace IDs `request_id`117- [ ] **Metrics**: Track `error_rate`, `latency`, `queue_depth`118- [ ] **Error Handling**: Standardized error codes, no bare except119- [ ] **Observability Artifacts**:120 - **Log Fields**: timestamp, level, message, request_id121 - **Metrics**: request_count, error_count, response_time122 - **Dashboards/Alerts**: High Error Rate > 5%123124125## Agent Directives & Error Recovery126*(ข้อกำหนดสำหรับ AI Agent ในการคิดและแก้ปัญหาเมื่อเกิดข้อผิดพลาด)*127128- **Thinking Process**: Analyze root cause before fixing. Do not brute-force.129- **Fallback Strategy**: Stop after 3 failed test attempts. Output root cause and ask for human intervention/clarification.130- **Self-Review**: Check against Guardrails & Anti-patterns before finalizing.131- **Output Constraints**: Output ONLY the modified code block. Do not explain unless asked.132133134## Definition of Done (DoD) Checklist135136- [ ] Tests passed + coverage met137- [ ] Lint/Typecheck passed138- [ ] Logging/Metrics/Trace implemented139- [ ] Security checks passed140- [ ] Documentation/Changelog updated141- [ ] Accessibility/Performance requirements met (if frontend)142143144## Anti-patterns / Pitfalls145146* ⛔ **Don't**: Log PII, catch-all exception, N+1 queries147* ⚠️ **Watch out for**: Common symptoms and quick fixes148* 💡 **Instead**: Use proper error handling, pagination, and logging149150151## Reference Links & Examples152153* Internal documentation and examples154* Official documentation and best practices155* Community resources and discussions156157158## Versioning & Changelog159160* **Version**: 1.0.0161* **Changelog**:162 - 2026-02-22: Initial version with complete template structure163164---165> Converted and distributed by [TomeVault](https://tomevault.io/claim/amnadtaowsoam) — claim your Tome and manage your conversions.166<!-- tomevault:4.0:skill_md:2026-04-13 -->