skills/content-hash-cache/SKILL.md
Pattern for caching expensive file operations using SHA-256 content hashes instead of file paths. Use when building data pipelines that process files (PDF parsing, OCR, image analysis, signal computation) and need caching. File rename = cache hit. Content change = auto-invalidation.
npx skillsauth add kitfunso/omniskill content-hash-cacheInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Cache by content (SHA-256), not by path. Rename = cache hit. Content change = auto-invalidation. No index file needed.
import hashlib
import json
from dataclasses import dataclass
from pathlib import Path
from typing import Any
def compute_file_hash(path: Path) -> str:
"""SHA-256 of file contents, chunked for large files."""
sha256 = hashlib.sha256()
with open(path, "rb") as f:
while chunk := f.read(65536): # 64KB chunks
sha256.update(chunk)
return sha256.hexdigest()
@dataclass(frozen=True)
class CacheEntry:
file_hash: str
source_path: str
result: Any # The cached computation result
def extract_with_cache(
file_path: Path,
process_fn,
*,
cache_enabled: bool = True,
cache_dir: Path = Path(".cache"),
) -> Any:
"""Wrapper that caches process_fn results by file content hash."""
if not cache_enabled:
return process_fn(file_path)
file_hash = compute_file_hash(file_path)
cache_file = cache_dir / f"{file_hash}.json"
# Cache hit
if cache_file.exists():
try:
data = json.loads(cache_file.read_text())
return data["result"]
except (json.JSONDecodeError, KeyError):
pass # Corrupted cache, recompute
# Cache miss — compute and store
result = process_fn(file_path)
cache_dir.mkdir(parents=True, exist_ok=True)
entry = {"file_hash": file_hash, "source_path": str(file_path), "result": result}
cache_file.write_text(json.dumps(entry, default=str))
return result
{hash}.json — no index file to maintain or corruptNone on bad cache, recomputes silentlyprocess_fn stays pure; caching is a separate concerndevelopment
Weekly engineering retrospective. Analyzes commit history, work patterns, and code quality metrics with persistent history and trend tracking. Team-aware: breaks down per-person contributions with praise and growth areas. Use when asked to "weekly retro", "what did we ship", or "engineering retrospective". Proactively suggest at the end of a work week or sprint.
development
Systematically QA test a web application and fix bugs found. Runs QA testing, then iteratively fixes bugs in source code, committing each fix atomically and re-verifying. Use when asked to "qa", "QA", "test this site", "find bugs", "test and fix", or "fix what's broken". Proactively suggest when the user says a feature is ready for testing or asks "does this work?". Three tiers: Quick (critical/high only), Standard (+ medium), Exhaustive (+ cosmetic). Produces before/after health scores, fix evidence, and a ship-readiness summary. For report-only mode, use /qa-only.
development
Report-only QA testing. Systematically tests a web application and produces a structured report with health score, screenshots, and repro steps — but never fixes anything. Use when asked to "just report bugs", "qa report only", or "test but don't fix". For the full test-fix-verify loop, use /qa instead. Proactively suggest when the user wants a bug report without any code changes.
testing
Eng manager-mode plan review. Lock in the execution plan — architecture, data flow, diagrams, edge cases, test coverage, performance. Walks through issues interactively with opinionated recommendations. Use when asked to "review the architecture", "engineering review", or "lock in the plan". Proactively suggest when the user has a plan or design doc and is about to start coding — to catch architecture issues before implementation.