What problem does it solve?
This Skill solves the inefficiency of path-based file caching, which breaks when files are moved or renamed, and requires manual cache invalidation when file content changes. It eliminates redundant compute from repeatedly processing expensive file operations like PDF parsing, text extraction, or image analysis on unchanged files.
Core Features & Use Cases
- Content-Hash Cache Keys: Uses SHA-256 hashes of file content as cache keys, so cache hits work even if files are moved to new directories, and cache entries are automatically invalidated when file content changes.
- Pure Function Separation: Keeps file processing functions free of cache logic, adhering to the single responsibility principle, so existing processing code can be wrapped with caching without modification.
- Use Case: For a batch workflow that processes 500 scanned PDF invoices weekly, this pattern caches extraction results keyed to file content, so reprocessing only occurs for new or modified invoices, cutting runtime by 90% for repeat runs.
Quick Start
Use the content-hash-cache-pattern skill to add content-hash based caching to your existing PDF text extraction function to avoid reprocessing the same files across multiple runs.