caching-strategy

Cache file reads, searches, network requests, and computed values across workflow phases with automatic invalidation by TTL and file modification.

91|10|Updated Oct 4, 2025
One-click install
npx skills add https://github.com/marcusgoll/Spec-Flow --skill caching-strategy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: caching-strategy
Source: https://github.com/marcusgoll/Spec-Flow/tree/main/.codex/skills/caching-strategy
Command: npx skills add https://github.com/marcusgoll/Spec-Flow --skill caching-strategy

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Cache expensive operations to avoid redundant work across workflow phases. Caches project docs (15min TTL), npm info (60min), grep results (30min), token counts (until file modified), web searches (15min). Auto-triggers when detecting repeated reads of same files or repeated API calls. Saves 20-40% execution time.

Core Features & Use Cases

  • File read cache: Cache file contents until the file is modified.
  • Search result cache: Cache grep/glob results for quick reuse.
  • Network request cache: Cache npm/web API calls for common packages.
  • Computed value cache: Cache expensive calculations until inputs change.
  • Automatic invalidation: TTL expiration and file-mod time checks.
  • Result: 20-40% faster workflow execution with zero behavioral changes.

Quick Start

  1. Identify cacheable operations: idempotent reads, repeated patterns, repeated API calls, and expensive computations.
  2. Generate a unique cache key per operation (e.g., file:, grep:, npm:, web:).
  3. Implement caching with TTLs and invalidation rules.
  4. Validate cache hits/misses and monitor performance improvements.

Frequently Asked Questions about caching-strategy

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

FAQPage Schema
How can I speed up workflows by caching repeated operations?

Caching repeated operations eliminates redundant work across workflow phases. Identify idempotent reads, API calls, and expensive computations, assign unique cache keys (file:, grep:, npm:, web:), and implement TTL-based invalidation. This typically saves 20-40% execution time with zero behavioral changes.

What operations can be cached in multi-phase workflows?

File reads cache until modification, grep/glob results cache for 30 minutes, npm queries cache for 60 minutes, token counts cache until file changes, and web searches cache for 15 minutes. Project documentation caches for 15 minutes. Automatic invalidation triggers on TTL expiration or file modification detection.

How does file modification detection work for cache invalidation?

File read caching uses mtime (modification time) checks to automatically invalidate cached content when source files change. Token counts and computed values stored against files automatically expire when those files are modified, ensuring cached data stays synchronized with current file state.

Can I cache network requests like npm package queries?

Yes, network request caching stores npm info queries and web search results with configurable TTLs. Common package lookups cache for 60 minutes and web searches for 15 minutes, reducing redundant API calls and improving performance across repeated workflow phases.

What happens when cache entries expire or files are modified?

Cache automatically invalidates on TTL expiration or when input files are detected as modified. The system re-executes the original operation, stores the fresh result, and resets the TTL timer. This ensures accuracy while preserving performance gains from cache hits on unchanged data.

Do I need to manually manage cache keys and invalidation?

No. The system generates cache keys automatically based on operation type (file:, grep:, npm:, web:) and automatically invalidates by TTL and file-modification detection. You identify cacheable operations and implement caching logic; invalidation is handled transparently.