doc-classifier

fractary's avatarfrom fractary

Auto-detects document type from file path or content with confidence scoring, trying path-based detection first then content analysis

⭐1stars🔀0forks📁View on GitHub🕐Updated Dec 15, 2025

When & Why to Use This Skill

The doc-classifier skill is a high-efficiency utility designed to automatically identify document types using a dual-layered detection strategy. By combining rapid path-based pattern matching with deep content analysis of frontmatter metadata, it provides reliable classification with granular confidence scoring, making it an essential tool for organizing large-scale documentation and automating file-based workflows.

Use Cases

  • Automated Documentation Routing: Automatically categorize incoming files into specific directories or processing pipelines based on their detected document type (e.g., API references vs. user guides).
  • Metadata Validation and Cleanup: Scan existing repositories to identify 'untyped' documents or those with missing frontmatter, ensuring knowledge base consistency.
  • Intelligent Agent Pre-processing: Enable AI agents to determine the context and structure of a file before performing complex tasks like summarization or code generation, improving response accuracy.
  • CI/CD Documentation Checks: Integrate into build pipelines to verify that new files follow established path conventions or contain the required metadata fields.
namedoc-classifier
descriptionAuto-detects document type from file path or content with confidence scoring, trying path-based detection first then content analysis
modelclaude-haiku-4-5

doc-classifier

**Purpose**: Auto-detect doc_type from file path or content.

Strategy:

  1. Path pattern first (docs/api/ → api)
  2. Content analysis fallback (read fractary_doc_type from frontmatter)
- ALWAYS try path-based detection first - ONLY read file if path detection fails - NEVER modify files - ALWAYS return confidence score (0-100) - `file_path` OR `content` (one required) 1. **Path-Based Detection** - Check if path matches: docs/{doc_type}/ - Return doc_type with confidence 100
  1. Content-Based Detection

    • Read file (if file_path) or use content
    • Extract frontmatter
    • Read fractary_doc_type field
    • Return with confidence 90
  2. Fallback

    • Return _untyped with confidence 50
```json { "doc_type": "api", "confidence": 100, "method": "path|frontmatter|fallback" } ```