content-hash-cache-pattern

Cache file processing results using SHA-256 content hashes as keys.

3|2|Updated Mar 8, 2026
One-click install
npx skills add https://github.com/agentmatters/mullai-bot --skill content-hash-cache-pattern-agentmatters
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: content-hash-cache-pattern
Source: https://github.com/agentmatters/mullai-bot/tree/main/src/Mullai.Skills/Skills/claude-code-everything/content-hash-cache-pattern
Command: npx skills add https://github.com/agentmatters/mullai-bot --skill content-hash-cache-pattern-agentmatters

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Cache expensive file processing results using SHA-256 content hashes as cache keys to enable path-independence and automatic invalidation when content changes.

Core Features & Use Cases

  • Content-hash based caching for file processing tasks (PDF parsing, text extraction, image analysis).
  • Automatic invalidation on content changes and optional CLI control with --cache/--no-cache.
  • Separate service layer to keep processing functions pure and decoupled from caching concerns.

Quick Start

Use the content-hash cache pattern to wrap your file processing function so identical content returns cached results.

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 so they don't reprocess on path changes?

SHA-256 content-hash caching stores processing results keyed by file content rather than file path. When a file moves or is renamed, the hash remains identical, returning cached results instantly while automatically invalidating upon content modifications.

What is the best way to skip expensive OCR and PDF parsing on unchanged files?

Wrapping OCR and PDF parsing functions in a content-hash cache service layer skips redundant processing. It checks the SHA-256 hash against existing JSON cache entries, returning cached results immediately on matches and only reprocessing on misses.

How does content-hash caching handle corrupted cache entries?

Content-hash caching gracefully handles corrupted cache entries by treating them as cache misses. When a corrupted JSON cache file is encountered, the system automatically reprocesses the original file and overwrites the damaged cache entry with fresh results.

Can I control file processing caching with a CLI flag?

Yes, you can control file processing caching behavior using --cache and --no-cache CLI options. This allows you to force fresh reprocessing of files like PDFs or images during specific runs while keeping caching enabled by default for regular workflows.

How do I keep file processing functions pure while adding a caching layer?

Keep file processing functions pure by using a separate service layer wrapper for caching. This decoupled design ensures your core processing logic remains unaware of cache mechanics, while the service layer manages SHA-256 hashing and JSON cache storage.