What problem does it solve?
This Skill addresses the inefficiency of repeatedly processing large files (like PDFs or images) by implementing a content-hashing cache, ensuring that expensive operations are only performed once per unique file content.
Core Features & Use Cases
- Path-Independent Caching: Uses SHA-256 hashes of file content as cache keys, making the cache resilient to file renames or moves.
- Automatic Invalidation: When file content changes, its hash changes, automatically invalidating the old cache entry.
- Service Layer Separation: Keeps the core file processing logic pure by wrapping it in a caching service layer.
- Use Case: When building a document analysis pipeline that involves parsing PDFs, extracting text, and analyzing images, this pattern ensures that if the same PDF is encountered multiple times (even if moved or renamed), the parsing and analysis are only done once, significantly speeding up batch processing.
Quick Start
Use the content-hash-cache-pattern skill to extract text from the file located at /path/to/your/document.pdf, utilizing the cache if available.