content-hash-cache-pattern

Cache file processing results using SHA-256 content hashes.

2|Updated Mar 21, 2026
One-click install
npx skills add https://github.com/Throokie/claude-code-skills --skill content-hash-cache-pattern-throokie
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: content-hash-cache-pattern
Source: https://github.com/Throokie/claude-code-skills/tree/main/skills/content-hash-cache-pattern
Command: npx skills add https://github.com/Throokie/claude-code-skills --skill content-hash-cache-pattern-throokie

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Cache expensive file processing results using SHA-256 content hashes as cache keys. Unlike path-based caching, this approach survives file moves/renames and auto-invalidates when content changes.

Core Features & Use Cases

  • Content-hash based cache keys to ensure cache validity across file moves or renames
  • File-based cache storage using {hash}.json for O(1) lookups
  • Service layer wrapper separates processing logic from caching concerns, enabling easy integration

Quick Start

Run a cache-enabled file processing task on a sample file to observe a cache miss on first run and a cache hit on subsequent runs.

Frequently Asked Questions about content-hash-cache-pattern

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I cache file processing results in Python so they survive renames and moves?

Content-hash caching uses SHA-256 file hashes as cache keys instead of file paths. This ensures cached results remain valid across file moves or renames, auto-invalidating only when the actual file content changes.

What is the best way to cache expensive OCR and PDF parsing results in Python?

The best way to cache expensive OCR and PDF parsing results is using content-hash caching. It stores computed outputs in JSON files named by the hash, enabling O(1) lookups and automatic invalidation when file content changes.

How does content-hash caching work for repeated file-processing pipelines?

Content-hash caching works by computing a SHA-256 hash for each file, using it as a JSON cache store key. A thin service wrapper separates core processing logic from caching, keeping processing pure and enabling easy integration.

Do I need extra dependencies to use content-hash caching for image analysis?

No extra dependencies are required. The content-hash caching pattern implements SHA-256 hashing and a JSON cache store natively, wrapping your image analysis pipeline without external libraries.

When should I not use content-hash caching for file processing?

You should not use content-hash caching when files are processed only once or when hashing large files outweighs the processing cost. It benefits pipelines where identical content is processed repeatedly across moves and renames.