Contract
- Input: data access patterns, read/write ratio, latency requirements, consistency needs, traffic profile, and failure tolerance.
- Output: advanced caching design with store selection, key strategy, invalidation policy, stampede prevention, consistency model, and operational runbook.
- Scope: stay within the skill's declared boundaries; do not broaden without explicit direction.
- Rule: documented standards override defaults; explicit project rules take precedence.
- Rule: if blocked by missing context or dependencies, surface the blocker before proceeding.
Provenance
| Question |
Answer |
| What is the source of truth? |
The user's request, originating spec/issue, and the skill's declared outputs |
| What is in scope? |
Work covered by the skill's acceptance criteria and completion rules |
| What is explicitly out of scope? |
Files, behaviors, and decisions outside the skill's declared boundary |
| Who or what consumes this artifact afterward? |
The next skill in the workflow or the user |
| What evidence proves it is done? |
Completion criteria met, artifact saved, validation passed |
| What risk remains? |
Subjective judgment calls, missing context, or external dependency failures |
Artifact
Emit CachingAdvancedArtifact as both:
- JSON:
.agents/skills/platform/artifacts/caching-advanced/{identifier}.json
- Markdown view: same filename with
.md extension
Advanced Caching
Use this skill when designing, reviewing, or optimizing advanced caching systems — Redis, Memcached, CDN, cache invalidation patterns, stampede prevention, consistency models, and multi-tier cache hierarchies.
Process
1. Analyze access patterns and requirements
- Catalog data: size, shape, read/write ratio, hot keys, and churn rate.
- Classify data by consistency requirement: strong, eventual, or best-effort.
- Identify latency and throughput targets per data class.
Completion criterion: data catalog and consistency requirements documented.
2. Select cache stores and layers
- Choose store per data class: in-process (Caffeine, Go cache), Redis (cluster or sentinel), Memcached, or CDN.
- Design multi-tier hierarchy: L1 local, L2 shared, L3 CDN or edge.
- Plan eviction policy per tier: LRU, LFU, TTL, or size-based.
Completion criterion: store selection and tier hierarchy documented with eviction policy.
3. Design key strategy and data shape
- Define key format: stable identity, versioning, and response-affecting dimensions.
- Choose value serialization and compression: JSON, Protobuf, MessagePack, or binary.
- Plan key lifecycle, rotation, and bulk invalidation approach.
Completion criterion: key format, value shape, and serialization strategy documented.
4. Plan invalidation and consistency
- Choose invalidation strategy: TTL, write-through, write-behind, or explicit invalidation.
- Define consistency model: cache-aside, read-through, write-through, or refresh-ahead.
- Plan handling for stale data, thundering herds, and cache outages.
Completion criterion: invalidation strategy and consistency model documented with failure behavior.
5. Implement stampede prevention
- Design stampede prevention: probabilistic early expiration, request coalescing, or jittered TTLs.
- Plan request mutex or single-flight for expensive regenerations.
- Define fallback behavior when regeneration fails or times out.
Completion criterion: stampede prevention mechanism documented with regeneration and fallback behavior.
6. Configure observability and operations
- Define metrics: hit rate, latency, eviction count, memory usage, key count, and error rate.
- Configure alerts for cache outage, high eviction, or degradation.
- Document operational runbook for scaling, failover, and cache warming.
Completion criterion: observability and operational runbook documented.
Rules
- Rule: never cache data without understanding its mutation rate and consistency requirements.
- Rule: name the cache's job explicitly: latency reduction, load shedding, availability, or cost control.
- Rule: set explicit TTL bounds; avoid unbounded or infinite caching without review.
- Rule: test invalidation and stampede behavior under load before production deployment.
- Rule: encrypt sensitive cache data at rest and in transit.
- Rule: treat cache configuration as code; version control and review changes.
Completion
- the skill's completion criteria are explicitly checked
- the artifact is saved and validated
- any blockers or skipped validations are documented
- the next consumer is identified or the work is handed off
@include .agents/skills/platform/contract-base.xml
1---2name: "caching-advanced"3category: "backend"4maturity: "stable"5version: "1"6description: "Advanced caching strategies (Redis, Memcached, CDN, cache invalidation, stampede prevention)."7license: "MIT"8capabilities:9 - apply caching advanced methods within explicit backend boundaries10 - analyze advanced caching strategies (redis, memcached, cdn, cache invalidation, stampede prevention) with assumptions, constraints, and failure modes11 - produce and validate a backend artifact with evidence, decisions, and next steps12outputs: "advanced caching design with store selection, key strategy, invalidation policy, stampede prevention, consistency model, and operational runbook."13sideEffects: []14dependencies: []15stopCondition: "Cache architecture, invalidation strategy, stampede prevention, and consistency model are explicit."16risk: "medium"17trustTier: "3"18maxIterations: "6"19promptVersion: "2.0"20artifactType: "backend"21modelTier: "reasoning"22evaluators: ["behavioral", "regression"]23fixturesPath: .agents/skills/platform/fixtures/behavioral/caching-advanced.json24diataxis: "how-to"25tags: ["backend"]26compatibility: []27approvalRequired: "true"28approvalFor: []29metadata:30 source: https://skillmd.com/skills/quantumquirkxyz/caching-advanced31---3233## Contract3435- Input: data access patterns, read/write ratio, latency requirements, consistency needs, traffic profile, and failure tolerance.36- Output: advanced caching design with store selection, key strategy, invalidation policy, stampede prevention, consistency model, and operational runbook.37- Scope: stay within the skill's declared boundaries; do not broaden without explicit direction.38- Rule: documented standards override defaults; explicit project rules take precedence.39- Rule: if blocked by missing context or dependencies, surface the blocker before proceeding.4041## Provenance4243| Question | Answer |44|---|---|45| What is the source of truth? | The user's request, originating spec/issue, and the skill's declared outputs |46| What is in scope? | Work covered by the skill's acceptance criteria and completion rules |47| What is explicitly out of scope? | Files, behaviors, and decisions outside the skill's declared boundary |48| Who or what consumes this artifact afterward? | The next skill in the workflow or the user |49| What evidence proves it is done? | Completion criteria met, artifact saved, validation passed |50| What risk remains? | Subjective judgment calls, missing context, or external dependency failures515253## Artifact5455Emit `CachingAdvancedArtifact` as both:56- JSON: `.agents/skills/platform/artifacts/caching-advanced/{identifier}.json`57- Markdown view: same filename with `.md` extension585960# 61# 62# Advanced Caching6364Use this skill when designing, reviewing, or optimizing advanced caching systems — Redis, Memcached, CDN, cache invalidation patterns, stampede prevention, consistency models, and multi-tier cache hierarchies.656667## Process6869### 1. Analyze access patterns and requirements70- Catalog data: size, shape, read/write ratio, hot keys, and churn rate.71- Classify data by consistency requirement: strong, eventual, or best-effort.72- Identify latency and throughput targets per data class.7374**Completion criterion:** data catalog and consistency requirements documented.7576### 2. Select cache stores and layers77- Choose store per data class: in-process (Caffeine, Go cache), Redis (cluster or sentinel), Memcached, or CDN.78- Design multi-tier hierarchy: L1 local, L2 shared, L3 CDN or edge.79- Plan eviction policy per tier: LRU, LFU, TTL, or size-based.8081**Completion criterion:** store selection and tier hierarchy documented with eviction policy.8283### 3. Design key strategy and data shape84- Define key format: stable identity, versioning, and response-affecting dimensions.85- Choose value serialization and compression: JSON, Protobuf, MessagePack, or binary.86- Plan key lifecycle, rotation, and bulk invalidation approach.8788**Completion criterion:** key format, value shape, and serialization strategy documented.8990### 4. Plan invalidation and consistency91- Choose invalidation strategy: TTL, write-through, write-behind, or explicit invalidation.92- Define consistency model: cache-aside, read-through, write-through, or refresh-ahead.93- Plan handling for stale data, thundering herds, and cache outages.9495**Completion criterion:** invalidation strategy and consistency model documented with failure behavior.9697### 5. Implement stampede prevention98- Design stampede prevention: probabilistic early expiration, request coalescing, or jittered TTLs.99- Plan request mutex or single-flight for expensive regenerations.100- Define fallback behavior when regeneration fails or times out.101102**Completion criterion:** stampede prevention mechanism documented with regeneration and fallback behavior.103104### 6. Configure observability and operations105- Define metrics: hit rate, latency, eviction count, memory usage, key count, and error rate.106- Configure alerts for cache outage, high eviction, or degradation.107- Document operational runbook for scaling, failover, and cache warming.108109**Completion criterion:** observability and operational runbook documented.110111## Rules112113- Rule: never cache data without understanding its mutation rate and consistency requirements.114- Rule: name the cache's job explicitly: latency reduction, load shedding, availability, or cost control.115- Rule: set explicit TTL bounds; avoid unbounded or infinite caching without review.116- Rule: test invalidation and stampede behavior under load before production deployment.117- Rule: encrypt sensitive cache data at rest and in transit.118- Rule: treat cache configuration as code; version control and review changes.119120## Completion121122- the skill's completion criteria are explicitly checked123- the artifact is saved and validated124- any blockers or skipped validations are documented125- the next consumer is identified or the work is handed off126---127@include .agents/skills/platform/contract-base.xml