content-hash-cache-patterns

Installation
SKILL.md

Content-Hash File Cache Pattern

Cache expensive file processing results (PDF parsing, text extraction, image analysis) using SHA-256 content hashes as cache keys. Unlike path-based caching, this approach survives file moves/renames and auto-invalidates when content changes.

When to Activate

  • Building file processing pipelines (PDF, images, text extraction)
  • Processing cost is high and same files are processed repeatedly
  • Need a --cache/--no-cache CLI option
  • Want to add caching to existing pure functions without modifying them
  • Adding caching to a batch LLM pipeline that processes the same uploaded documents across multiple runs or user sessions
  • Designing a cache layer that must survive file renames and directory reorganizations without invalidating existing entries
  • Implementing cache invalidation that is automatic and correct without requiring a manual cache-clear step when file content changes
  • Separating caching concerns from a pure extraction or analysis function using a service layer wrapper that respects the single-responsibility principle

Core Pattern

1. Content-Hash Based Cache Key

Installs
3
GitHub Stars
14
First Seen
Apr 7, 2026
content-hash-cache-patterns — marvinrichter/clarc