[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7A4QEFX1M1B77KZSC12XBNR":3,"skill-same:01M7A4QEFX1M1B77KZSC12XBNR":144},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":44,"commitSha":45,"skillDirectory":46,"forksCount":47,"repositoryHtmlUrl":48,"repositoryHomepageUrl":6,"ownerHtmlUrl":49,"ownerBlogUrl":6,"ownerDescription":50,"updatedAt":51,"install":52,"resources":65},"01M7A4QEFX1M1B77KZSC12XBNR","cloudfront-cache-troubleshooter",null,"Diagnoses CloudFront caching issues via a symptom-to-cause decision tree covering cache misses on every request, stale content served, unexpected cache key variation, 403\u002F404 errors from cache, and low cache hit ratio. Walks Cache-Control headers from origin, cache policy configuration (managed vs custom), TTL settings, query string\u002Fheader\u002Fcookie inclusion in cache key, x-edge-result-type and x-cache headers in access logs, Lambda@Edge response modifications, and WAF blocks. Emits a deterministic verdict (ROOT_CAUSE_FOUND | NEED_MORE_INFO | ESCALATE) with the specific cache issue and evidence from CloudFront access logs, cache policy inspection, and curl response headers. Use when content is not cached, stale content is served, hit ratio is low, or CloudFront returns 403\u002F404 unexpectedly.","jhkchan\u002Faws-agent-skills","jhkchan","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1083902?v=4","01M7A2SVQYP9GQTPTDXP5JKYQ4","Jacky Chan","01M7A2SVS117YWCTZABB75HZR1",4,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudfront-cache-troubleshooter\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: cloudfront-cache-troubleshooter\ndescription: Diagnoses CloudFront caching issues via a symptom-to-cause decision tree covering cache misses on every request, stale content served, unexpected cache key variation, 403\u002F404 errors from cache, and low cache hit ratio. Walks Cache-Control headers from origin, cache policy configuration (managed vs custom), TTL settings, query string\u002Fheader\u002Fcookie inclusion in cache key, x-edge-result-type and x-cache headers in access logs, Lambda@Edge response modifications, and WAF blocks. Emits a deterministic verdict (ROOT_CAUSE_FOUND | NEED_MORE_INFO | ESCALATE) with the specific cache issue and evidence from CloudFront access logs, cache policy inspection, and curl response headers. Use when content is not cached, stale content is served, hit ratio is low, or CloudFront returns 403\u002F404 unexpectedly.\nlicense: Apache-2.0\ncompatibility: Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). Offline diagnosis works from pasted response headers, access log excerpts, and cache policy JSON. Live-account diagnosis uses aws cloudfront get-distribution-config, get-cache-policy, aws cloudfront get-monitoring-sample, curl -I against the distribution and origin, and CloudFront access logs via aws logs get-log-events (AWS CLI v2, SSO or key-based credentials).\nmetadata:\n  domain: aws-cloudops\n  complexity: high\n  requires_llm: 'true'\n  phase: '2'\n  supports_pipeline: 'true'\n  entry_point: 'false'\n  family: Networking\n  task_type: troubleshoot\n  skill_class: capability\n  verdict_shape: ROOT_CAUSE_FOUND | NEED_MORE_INFO | ESCALATE\n  lifecycle_status: active\n  when_to_use: Diagnosing CloudFront cache misses on every request, stale content being served, unexpected cache key variation (different content per user), 403\u002F404 errors from the cache edge, low cache hit ratio with elevated origin load, or Lambda@Edge \u002F WAF interference with caching; validating whether the root cause is origin headers, cache policy misconfiguration, TTL settings, invalidation gaps, or cache key bloat.\n  when_not_to_use: CloudFront distribution configuration posture audits (use cloudfront-distribution-auditor), origin failover \u002F multi-origin setup (use cloudfront-distribution-deployer), TLS certificate issues on the distribution (use acm-certificate-expiry-auditor), or WAF rule authoring (use wafv2-web-acl-auditor). This skill diagnoses caching root cause; it does not audit distribution security posture.\n  activation_triggers: CloudFront cache miss every request, CloudFront not caching, CloudFront stale content, CloudFront content not updating, CloudFront cache hit ratio low, CloudFront origin load high, CloudFront 403 from cache, CloudFront 404 from edge, CloudFront different content per user, CloudFront cache key variation, CloudFront cache policy misconfigured, x-cache Miss from cloudfront, x-edge-result-type Miss, troubleshoot CloudFront caching\n  invocation_schema: 'Input: either (a) a symptom description (cache miss pattern, stale content report, hit-ratio drop), optionally paired with cache policy JSON and response headers, OR (b) a distribution ID plus caller context (origin URL, observed x-cache header, access log excerpt) for live-account diagnosis. Output: a deterministic DISTRIBUTION \u002F VERDICT \u002F ROOT_CAUSE \u002F CACHE_ISSUE \u002F EVIDENCE \u002F REMEDIATION block where VERDICT ∈ {ROOT_CAUSE_FOUND, NEED_MORE_INFO, ESCALATE} and CACHE_ISSUE ∈ {ORIGIN_NO_CACHE, ORIGIN_NO_STORE, CACHE_POLICY_TOO_NARROW, CACHE_KEY_BLOAT, TTL_TOO_SHORT, STALE_NO_INVALIDATION, ORIGIN_HEADER_OVERRIDE, LAMBDA_EDGE_MUTATION, WAF_BLOCK, COMPRESSION_CACHE_KEY, ORIGIN_ERROR, UNKNOWN}.'\n  version: 0.1.0\n  author: Jacky Chan — AWS Community Builder\n  keywords: CloudFront, caching, cache miss, cache hit ratio, stale content, cache key, cache policy, Cache-Control, max-age, no-cache, no-store, TTL, x-edge-result-type, x-cache, Lambda@Edge, origin shield, managed policy, AllViewerExceptReservedHeader, invalidation, troubleshooting\n  tags: cloudfront, networking, troubleshoot, caching, cdn, cache-policy, ttl, lambda-at-edge\n---\n\n# CloudFront Cache Troubleshooter\n\n## Activation\n\nActivate this skill when the user reports a CloudFront caching issue.\nTrigger phrases: \"CloudFront cache miss every request\", \"CloudFront not\ncaching\", \"CloudFront stale content\", \"CloudFront content not updating\",\n\"CloudFront cache hit ratio low\", \"CloudFront origin load high\",\n\"CloudFront 403 from cache\", \"CloudFront 404 from edge\", \"CloudFront\ndifferent content per user\", \"CloudFront cache key variation\", \"CloudFront\ncache policy misconfigured\", \"x-cache Miss from cloudfront\",\n\"x-edge-result-type Miss\", \"troubleshoot CloudFront caching\".\n\n## Mindset\n\n**One-line takeaway:** every CloudFront caching problem is a mismatch\nbetween what the cache key captures, what the origin allows to be cached,\nand what the cache policy TTL instructs. The diagnostic walk identifies\nwhich of these three is broken.\n\nThree facts make CloudFront cache diagnosis different:\n\n- **CloudFront caches by cache key, not by URL alone.** The cache key =\n  URL path + query strings + headers + cookies (per the cache policy).\n  Including `User-Agent` fragments the cache so badly that hit ratio\n  drops to near zero.\n- **Origin `Cache-Control` headers dominate unless the cache policy\n  overrides them.** If the origin sends `Cache-Control: no-store`,\n  CloudFront will not cache regardless of the policy TTL.\n- **`x-edge-result-type` in access logs is the ground truth.** Values:\n  `Hit`, `Miss`, `RefreshHit`, `RefreshMiss`, `Error`, `LimitExceeded`,\n  `CapacityExceeded`, `Denied`. `Miss` every time means cache key or\n  origin headers prevent caching.\n\n## Expert heuristic\n\nFive senior-CDN-engineer heuristics (edge-only hit ratio, Lambda@Edge header rewrites, Origin Shield break-even, compression size limits, Functions vs Lambda@Edge cache timing) moved verbatim to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md).\nLoad on demand when the symptom contradicts the cache policy analysis.\n\n## Quick reference — symptom to cache issue\n\n| Observed signal | Cache issue | First probe |\n|---|---|---|\n| `x-edge-result-type: Miss` on every request | ORIGIN_NO_CACHE \u002F ORIGIN_NO_STORE \u002F CACHE_POLICY_TOO_NARROW | `curl -I` to origin for `Cache-Control`; cache policy TTL |\n| Content hours\u002Fdays old; origin updated | STALE_NO_INVALIDATION \u002F TTL_TOO_LONG | Origin `max-age` vs behavior TTL; invalidation history |\n| Same URL, different content per user | CACHE_KEY_BLOAT | Cache policy headers\u002Fcookies\u002Fquery strings |\n| 403 \u002F 404 from CloudFront; origin returns 200 | WAF_BLOCK \u002F LAMBDA_EDGE_MUTATION | WAF web ACL; Lambda@Edge logs |\n| Hit ratio dropping; origin load rising | CACHE_KEY_BLOAT \u002F TTL_TOO_SHORT | Cache policy `DefaultTTL`; cache key values |\n| `RefreshHit` frequent; origin gets `If-Modified-Since` | TTL_EXPIRED \u002F STALE-REVALIDATE | Origin `max-age` vs behavior `MinTTL` |\n\n## Process — Diagnostic decision tree (apply in order)\n\n### Step 0: Capture the cache signal\n\n| Signal | Source | Why required |\n|---|---|---|\n| **Distribution ID or domain** | User-provided or `list-distributions` | All get-distribution-config calls need this |\n| **Symptom (miss vs stale vs variation)** | User report + `curl -I` | Drives the symptom category |\n| **x-edge-result-type \u002F x-cache** | Access logs (S3) or `curl -I` | Ground truth for edge behavior |\n\nIf distribution\u002Fdomain unknown:\n\nlist-distributions \u002F get-distribution-config discovery commands moved verbatim to [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\nRun them when the distribution ID or domain is unknown.\n\n### Step 1: Identify the symptom category\n\n| Category | Signature | Diagnostic step |\n|---|---|---|\n| **A. CACHE_MISS_ALWAYS** | `Miss` on every request; `x-cache: Miss from cloudfront` | Step 2 |\n| **B. STALE_CONTENT** | Content old; origin updated; no invalidation sent | Step 3 |\n| **C. CACHE_KEY_VARIATION** | Same URL, different content per user; hit ratio near zero | Step 4 |\n| **D. ERROR_FROM_CACHE** | 403\u002F404 from CloudFront; origin returns 200; `x-edge-result-type: Error` | Step 5 |\n| **E. LOW_HIT_RATIO** | Hit ratio dropping; origin load rising; mix of Hit and Miss | Step 6 |\n\nPriority if multiple match: CACHE_MISS_ALWAYS > ERROR_FROM_CACHE >\nCACHE_KEY_VARIATION > STALE_CONTENT > LOW_HIT_RATIO.\n\n### Step 2: CACHE_MISS_ALWAYS diagnostic\n\nEvery request is a `Miss`. Cause: origin sends `no-cache`\u002F`no-store`, cache\npolicy TTL is 0, `CachingDisabled` attached, or response not cacheable.\n\n**Diagnostic walk:**\n\n1. **Check origin `Cache-Control`** (#1 cause). `curl -I` directly to origin:\n\n```bash\n# Direct to origin (bypass CloudFront):\ncurl -sI https:\u002F\u002Forigin.example.com\u002Fpath\u002Fto\u002Fcontent | grep -iE 'cache-control|expires|pragma|set-cookie'\n\n# Via CloudFront:\ncurl -sI https:\u002F\u002Fd123.cloudfront.net\u002Fpath\u002Fto\u002Fcontent | grep -iE 'x-cache|age|cache-control'\n```\n\n| Origin header | Effect | Fix |\n|---|---|---|\n| `Cache-Control: no-store` | Never caches | Change to `public, max-age=3600` |\n| `Cache-Control: no-cache` | Revalidates every request (RefreshMiss) | Change to `public, max-age=3600` |\n| `Cache-Control: max-age=0` | Same as no-cache | Raise to desired TTL |\n| `Cache-Control: private` | Not cached (browser-only) | Change to `public` |\n| `Pragma: no-cache` | Legacy HTTP\u002F1.0 no-cache | Remove |\n| `Set-Cookie` in response | May skip caching if cookie not in policy | Add cookie to policy or remove Set-Cookie |\n\n2. **Check cache policy TTL:** `MinTTL: 0, DefaultTTL: 0, MaxTTL: 0` disables\n   caching. Managed `CachingDisabled` (ID `4135ea2d-6df8-44a3-9df3-4b5a84be39ad`)\n   explicitly sets all TTLs to 0.\n\n```bash\naws cloudfront get-cache-policy --id \u003Ccache-policy-id> \\\n  --query 'CachePolicy.CachePolicyConfig.{minTTL:MinTTL,defaultTTL:DefaultTTL,maxTTL:MaxTTL,headers:ParametersInCacheKeyAndForwardedToOrigin.HeadersConfig.HeaderBehavior}' \\\n  --output json\n```\n\n3. **Check if origin returns cacheable status codes.** CloudFront caches\n   200, 206, 301, 302, 304, 404 (optionally).\n\n**Common fixes:**\n- Origin sends `no-store`: update origin to `Cache-Control: public, max-age=3600`.\n  For S3: `aws s3api put-object` with `--cache-control`.\n- Cache policy TTL is 0: set `DefaultTTL: 3600` or use managed\n  `CachingOptimized` (`658327ea-f89d-4fab-a63d-7e88639e58f6`).\n- `Set-Cookie` preventing caching: add cookie to policy or remove from response.\n\n### Step 3: STALE_CONTENT diagnostic\n\nContent served from cache but old — origin updated but CloudFront serves\ncached version. Cause: TTL not expired (expected without invalidation), no\ninvalidation sent, or cache behavior overrides origin with longer TTL.\n\n**Diagnostic walk:**\n\n1. **Determine if invalidation is needed.** CloudFront serves cached content\n   until TTL expires OR invalidation clears it. No invalidation after origin\n   update = stale until TTL expires. This is expected, not a bug.\n2. **Compare origin `max-age` vs cache behavior TTL.** If origin sends\n   `max-age=86400` but operator expects minutes, TTL is too long.\n3. **Check `OriginCacheControlHeaders` handling.** If set to respect,\n   CloudFront uses origin's `max-age`. If override, uses policy `DefaultTTL`.\n4. **Check invalidation history.** If invalidation sent but stale persists,\n   it may be for wrong paths or still in progress.\n\n```bash\n# List recent invalidations.\naws cloudfront list-invalidations --distribution-id \u003Cid> \\\n  --query 'InvalidationList.Items[*].{id:Id,status:Status,paths:InvalidationBatch.Paths.Items,created:CreateTime}' \\\n  --output json\n\n# Check the Age header (how long object has been cached):\ncurl -sI https:\u002F\u002Fd123.cloudfront.net\u002Fpath | grep -iE 'x-cache|age|cache-control'\n```\n\n| Sub-symptom | Root cause | Fix |\n|---|---|---|\n| No invalidation sent, TTL not expired | Expected behaviour | Send invalidation OR wait for TTL |\n| Invalidation sent but still stale | Wrong paths or in progress | Verify `get-invalidation` status; paths match |\n| Origin `max-age=86400` but expects 5-min | TTL too long | Lower origin `max-age` or policy `MaxTTL` |\n| Stale after deployment | No invalidation in CI\u002FCD | Add invalidation step to deploy pipeline |\n\n**Common fixes:**\n- Send invalidation: `aws cloudfront create-invalidation --distribution-id \u003Cid> --paths \"\u002Fupdated\u002F*\"`.\n  Prefer specific paths over `\u002F*` to avoid spiking origin load.\n- Add invalidation to CI\u002FCD pipeline.\n- For frequently-updated content, set shorter TTL (`max-age=300`).\n\n### Step 4: CACHE_KEY_VARIATION diagnostic\n\nSame URL but different content per user; hit ratio near zero. Cause: cache\nkey bloat — too many headers, cookies, or query strings creating unique\nentries.\n\n**Cache key formula:** `cache key = URL path + query strings (per policy) +\nheaders (per policy) + cookies (per policy)`. Any value included creates a\ndistinct entry per unique combination.\n\n**Diagnostic walk:**\n\n1. **Read cache policy `ParametersInCacheKeyAndForwardedToOrigin`:**\n\n```bash\naws cloudfront get-cache-policy --id \u003Ccache-policy-id> \\\n  --query 'CachePolicy.CachePolicyConfig.ParametersInCacheKeyAndForwardedToOrigin' \\\n  --output json\n```\n\n| Cache policy setting | Effect | Recommendation |\n|---|---|---|\n| `HeadersConfig.HeaderBehavior: none` | No headers in key | Default; use unless response varies |\n| `QueryStringsConfig.QueryStringBehavior: all` | ALL query strings in key | Only if every param affects response |\n| `CookiesConfig.CookieBehavior: all` | ALL cookies in key | Almost never correct — fragments cache |\n| `CookiesConfig.CookieBehavior: whitelist` + specific | Listed cookies only | Only cookies that affect response |\n\n2. **Check for fragmenting headers:** `User-Agent` (thousands of values),\n   `Authorization` (unique per user), `X-Forwarded-For` (unique per client).\n   Do NOT include these in the cache key.\n3. **Check `Accept-Encoding`** — required in cache key for compressed content.\n   Managed `AllViewerExceptReservedHeader` includes it by default.\n4. **Check access logs:** if every request is `Miss` for same URL, cache key\n   varies per request. Compare `cs-cookie` and `cs-accept-encoding` fields.\n\nSee `references\u002Fworked-examples.md` for the managed policy reference table\nand cache key normalization details.\n\n**Common fixes:**\n- Remove `User-Agent` from headers whitelist. Use `none` or only headers\n  that affect the response.\n- Switch `CookiesConfig.CookieBehavior` from `all` to `whitelist` with\n  only necessary cookies.\n- For static assets, use managed `CachingOptimized`.\n- For dynamic APIs, use `CachingDisabled`.\n\n### Step 5: ERROR_FROM_CACHE diagnostic\n\nCloudFront returns 403 or 404; origin returns 200. Cause: WAF blocking,\nLambda@Edge modifying response, cached transient error, or wrong origin.\n\n**Diagnostic walk:**\n\n1. **Check for WAF:** `aws cloudfront get-distribution-config --id \u003Cid>\n   --query 'DistributionConfig.WebACLId'`. Blocked requests return 403\n   with `x-amzn-waf-action: BLOCK`.\n2. **Check Lambda@Edge on behavior:** a function on `viewer-response` or\n   `origin-response` can modify status code\u002Fheaders\u002Fbody.\n3. **Check origin directly:** `curl -I` bypassing CloudFront. If origin\n   returns 200 but CloudFront returns 403\u002F404, issue is in CloudFront layer.\n4. **Check for cached 404:** CloudFront caches 404 if policy allows it\n   (`errorResponseCachingBehavior`). A transient 404 can persist after\n   origin recovers.\n5. **Check cache behavior target origin:** if pointing to deleted\u002Fwrong\n   origin, origin returns 404.\n\n```bash\n# Check WAF rules if attached:\naws wafv2 get-web-acl --scope CLOUDFRONT --id \u003Cweb-acl-id> \\\n  --query 'WebACL.Rules[*].{name:Name,action:Action,priority:Priority}' --output json\n\n# Check Lambda@Edge functions:\naws cloudfront get-distribution-config --id \u003Cid> \\\n  --query 'DistributionConfig.DefaultCacheBehavior.LambdaFunctionAssociations.Items[*].{type:EventType,arn:LambdaFunctionARN}' \\\n  --output json\n```\n\n| Sub-symptom | Root cause | Fix |\n|---|---|---|\n| 403 with `x-amzn-waf-action: BLOCK` | WAF blocking | Adjust WAF rules; add allowlist |\n| 403 without WAF header | Lambda@Edge returning 403 | Check function logs; curl origin directly |\n| 404 persists after origin recovers | Cached transient 404 | Invalidate; lower 404 cache TTL |\n| 404 on specific path | Wrong TargetOriginId | Update behavior's TargetOriginId |\n\nSee `references\u002Fworked-examples.md` for Lambda@Edge response modification\nedge cases.\n\n### Step 6: LOW_HIT_RATIO diagnostic\n\nHit ratio dropping; origin load rising; mix of Hit and Miss. Cause: cache\nkey bloat, TTL too short, origin sending `no-cache` on some responses, or\nlong-tail content (more unique URLs).\n\n**Diagnostic walk:**\n\n1. **Check `CacheHitRate` metric:**\n\n```bash\naws cloudwatch get-metric-statistics --namespace AWS\u002FCloudFront \\\n  --metric-name CacheHitRate \\\n  --dimensions Name=DistributionId,Value=\u003Cid> \\\n  --start-time $(date -u -d '24 hours ago' +%Y-%m-%dT%H:%M:%SZ) \\\n  --end-time $(date -u +%Y-%m-%dT%H:%M:%SZ) \\\n  --period 3600 --statistics Average --output json\n```\n\n2. **Analyze access logs** for the Miss pattern — group by path, query\n   string, headers.\n3. **Check long tail:** if content catalog grew, each URL is a miss on\n   first request (expected). Fix: pre-warming or accept lower ratio.\n4. **Check inconsistent origin headers:** some responses with `no-cache`,\n   others with `max-age=3600` = inconsistent ratio.\n\n| Sub-symptom | Root cause | Fix |\n|---|---|---|\n| Drop after traffic increase | Long-tail content | Pre-warm; accept lower ratio |\n| Low for specific path | Cache key bloat on that behavior | Narrow the cache policy |\n| Low with frequent `RefreshHit` | TTL expired; frequent revalidation | Raise TTL |\n| Low after deploy | Invalidation cleared cache | Expected; ratio recovers |\n\n**Common fixes:**\n- Separate static and dynamic content into different cache behaviors.\n- Raise TTL for content that changes infrequently. S3 immutable objects:\n  `max-age=31536000` (1 year).\n- Use Origin Shield as second-tier cache.\n- Pre-warm cache after deploys.\n\n### Step 7: Map to root-cause catalog\n\n| # | Root cause | Category | Fix pattern |\n|---|---|---|---|\n| 1 | Origin sends `Cache-Control: no-store` or `no-cache` | CACHE_MISS_ALWAYS (ORIGIN_NO_CACHE) | Update origin to `public, max-age=\u003CTTL>` |\n| 2 | Cache policy TTL is 0 or `CachingDisabled` | CACHE_MISS_ALWAYS (CACHE_POLICY_TOO_NARROW) | Switch to `CachingOptimized` or set `DefaultTTL > 0` |\n| 3 | No invalidation after origin update | STALE_CONTENT (STALE_NO_INVALIDATION) | Send invalidation; add to CI\u002FCD |\n| 4 | TTL too long for frequently-updated content | STALE_CONTENT (TTL_TOO_LONG) | Lower `max-age` or policy `MaxTTL` |\n| 5 | `User-Agent` or `Authorization` in cache key | CACHE_KEY_VARIATION (CACHE_KEY_BLOAT) | Remove from cache policy headers |\n| 6 | All cookies in cache key | CACHE_KEY_VARIATION (CACHE_KEY_BLOAT) | Switch to `whitelist` with necessary cookies |\n| 7 | WAF blocking requests | ERROR_FROM_CACHE (WAF_BLOCK) | Adjust WAF rules; add allowlist |\n| 8 | Lambda@Edge modifying response | ERROR_FROM_CACHE (LAMBDA_EDGE_MUTATION) | Fix function; remove from behavior |\n| 9 | Cached transient 404 | ERROR_FROM_CACHE (ORIGIN_ERROR) | Invalidate; lower 404 cache TTL |\n| 10 | `Accept-Encoding` not in cache key for compressed content | CACHE_KEY_VARIATION (COMPRESSION_CACHE_KEY) | Add `Accept-Encoding` to policy |\n\n### Step 8: Verify the fix\n\n- **Origin header changes:** verify with `curl -I`, request via CloudFront\n  twice — second should show `x-cache: Hit from cloudfront`.\n- **Cache policy changes:** wait for Deployed status, test with `curl -I` twice.\n- **Invalidation:** wait for Completed status, request path — first Miss,\n  second Hit.\n- **WAF changes:** verify blocked requests now succeed.\n- **Lambda@Edge changes:** deploy new version, wait for propagation (minutes).\n\n### Step 9: Decide — ROOT_CAUSE_FOUND vs NEED_MORE_INFO vs ESCALATE\n\n- **ROOT_CAUSE_FOUND.** Walk identified a specific cache issue and config\n  element. Output REMEDIATION with exact change.\n- **NEED_MORE_INFO.** Operator cannot supply evidence (logs not enabled,\n  policy ID unknown). Output the list of missing inputs.\n- **ESCALATE.** Cause outside operator's scope (AWS-side event, Lambda@Edge\n  owned by another team, WAF managed centrally). Output escalation target.\n\n## Output format\n\n```text\nDISTRIBUTION: \u003Cdistribution ID or domain>\nVERDICT: ROOT_CAUSE_FOUND | NEED_MORE_INFO | ESCALATE\nROOT_CAUSE: \u003Ccache issue name> — \u003Cspecific root cause>\nCACHE_ISSUE: \u003CORIGIN_NO_CACHE | ORIGIN_NO_STORE | CACHE_POLICY_TOO_NARROW |\n              CACHE_KEY_BLOAT | TTL_TOO_SHORT | STALE_NO_INVALIDATION |\n              ORIGIN_HEADER_OVERRIDE | LAMBDA_EDGE_MUTATION | WAF_BLOCK |\n              COMPRESSION_CACHE_KEY | ORIGIN_ERROR | UNKNOWN>\nEVIDENCE:\n  - \u003Corigin response header>: \u003Cvalue>\n  - \u003Ccache policy field>: \u003Cvalue>\n  - \u003Cx-edge-result-type from access logs>: \u003Cvalue>\nROOT_CAUSE_CATALOG: #\u003CN>\nREMEDIATION:\n  1. \u003Cspecific config change with CLI command>\n  2. \u003Cverification command>\n  3. \u003Cpost-apply monitoring>\n```\n\nSee `references\u002Fworked-examples.md` for full worked examples (origin\nno-store, User-Agent cache key bloat).\n\n## STRICT output contract\n\nThis section codifies the exact output shape the eval harness asserts\nagainst. Every invocation MUST produce output that matches this contract.\n\n### Required output structure\n\nEvery response MUST be a single block with these literal labels, in this\norder:\n\n```text\nDISTRIBUTION: \u003Cdistribution ID or domain>\nVERDICT: ROOT_CAUSE_FOUND | NEED_MORE_INFO | ESCALATE\nROOT_CAUSE: \u003Ccache issue name> — \u003Cspecific root cause>\nCACHE_ISSUE: \u003CORIGIN_NO_CACHE | ORIGIN_NO_STORE | CACHE_POLICY_TOO_NARROW |\n              CACHE_KEY_BLOAT | TTL_TOO_SHORT | STALE_NO_INVALIDATION |\n              ORIGIN_HEADER_OVERRIDE | LAMBDA_EDGE_MUTATION | WAF_BLOCK |\n              COMPRESSION_CACHE_KEY | ORIGIN_ERROR | UNKNOWN>\nEVIDENCE:\n  - \u003Csignal source>: \u003Cobserved value>\n  - \u003Csignal source>: \u003Cobserved value>\n  - \u003Csignal source>: \u003Cobserved value>\nROOT_CAUSE_CATALOG: #\u003CN>\nREMEDIATION:\n  1. \u003Cspecific config change with CLI command>\n  2. \u003Cverification command>\n  3. \u003Cpost-apply monitoring>\n```\n\n### FORBIDDEN output patterns\n\n1. **NEVER diagnose without checking the x-cache header first.** A\n   ROOT_CAUSE_FOUND without an EVIDENCE row citing the observed `x-cache`\n   value is rejected.\n2. **NEVER blame the cache policy without checking origin Cache-Control\n   headers — the origin header overrides the policy.** A ROOT_CAUSE_FOUND\n   citing `CACHE_POLICY_TOO_NARROW` or `TTL_TOO_SHORT` without EVIDENCE\n   showing the origin's actual `Cache-Control` is rejected.\n3. **NEVER suggest `\u002F*` invalidation without confirming content is stale.**\n   `\u002F*` invalidations are expensive and spike origin load. Always prefer\n   path-specific invalidations; reserve `\u002F*` for full-site updates only.\n4. **NEVER confuse `no-cache` with `no-store`.** `no-cache` allows caching\n   but requires revalidation (RefreshHit\u002FRefreshMiss); `no-store` prohibits\n   caching entirely. Mislabeling is rejected.\n5. **NEVER substitute lowercase or markdown-styled labels for the literal\n   all-caps `DISTRIBUTION:`, `VERDICT:`, `ROOT_CAUSE:`, `CACHE_ISSUE:`,\n   `EVIDENCE:`, `ROOT_CAUSE_CATALOG:`, `REMEDIATION:`.** The eval harness\n   pattern-matches on exact labels.\n\n### Perfect example output\n\n```text\nDISTRIBUTION: E1A2B3C4D5 (d123.cloudfront.net)\nVERDICT: ROOT_CAUSE_FOUND\nROOT_CAUSE: ORIGIN_NO_STORE — the origin returns \"Cache-Control: no-store\"\n  on all responses, which instructs CloudFront never to cache.\nCACHE_ISSUE: ORIGIN_NO_STORE\nEVIDENCE:\n  - curl -I https:\u002F\u002Forigin.example.com\u002Fapi\u002Fdata: response includes\n    \"Cache-Control: no-store\"\n  - curl -I https:\u002F\u002Fd123.cloudfront.net\u002Fapi\u002Fdata: \"x-cache: Miss from\n    cloudfront\" on every request; \"Age: 0\"\n  - get-cache-policy: CachePolicyId is CachingOptimized\n    (658327ea-f89d-4fab-a63d-7e88639e58f6), MinTTL=1, DefaultTTL=86400\n    — the policy is correct; the origin header overrides it\n  - CloudFront access logs: x-edge-result-type \"Miss\" on 100% of requests\n    to \u002Fapi\u002Fdata\u002F*\nROOT_CAUSE_CATALOG: #1 (origin sends no-store)\nREMEDIATION:\n  1. Update the origin to send Cache-Control: public, max-age=3600 for\n     cacheable API responses. For an S3 origin:\n     aws s3api copy-object --bucket my-bucket --key api\u002Fdata.json \\\n       --copy-source my-bucket\u002Fapi\u002Fdata.json \\\n       --cache-control \"public, max-age=3600\" \\\n       --metadata-directive REPLACE\n  2. Verify the origin header:\n     curl -sI https:\u002F\u002Forigin.example.com\u002Fapi\u002Fdata | grep -i cache-control\n     Expect: \"Cache-Control: public, max-age=3600\"\n  3. Request via CloudFront twice; the second request should show\n     \"x-cache: Hit from cloudfront\":\n     curl -sI https:\u002F\u002Fd123.cloudfront.net\u002Fapi\u002Fdata | grep -i x-cache\n```\n\n## Anti-Patterns — NEVER (top 5)\n\n1. NEVER assume the cache policy TTL controls caching when the origin sends\n   `Cache-Control: no-store`. The origin header overrides the policy unless\n   explicitly overridden. Always check the origin's `Cache-Control` first.\n2. NEVER include `User-Agent` in the cache key — thousands of distinct\n   values fragment the cache. If response truly varies by client, normalize\n   the header before including it.\n3. NEVER use `CookiesConfig.CookieBehavior: all` unless the response truly\n   varies by every cookie. Use `whitelist` with only cookies that affect\n   the response.\n4. NEVER invalidate `\u002F*` when path-specific invalidation suffices — `\u002F*`\n   clears the entire cache, spiking origin load. Use specific paths.\n5. NEVER set `MaxTTL` lower than `MinTTL` on a cache policy. Always ensure\n   `MinTTL \u003C= DefaultTTL \u003C= MaxTTL`.\n\nSee `references\u002Fworked-examples.md` for additional anti-patterns (no-cache\nvs no-store confusion, x-cache Hit meaning, Accept-Encoding for compressed\ncontent, static vs dynamic mixing).\n\n## Diagnostic command quick reference\n\nDiagnostic command quick-reference listing (config, cache policy, invalidations, CacheHitRate, x-cache probes, origin bypass, Lambda@Edge) moved verbatim to [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\nLoad on demand for live-account probing.\n\nSee `references\u002Fdiagnostic-commands.md` for the full command script per\ncache issue category.\n\n## Recent AWS features (2024-2026)\n\nRecent AWS features (2024-2026) moved verbatim to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md).\nLoad on demand when Functions vs Lambda@Edge timing, KeyValueStore, Origin Shield metrics, or Logs-to-CloudWatch are in play.\n\n## References\n\n- `references\u002Fcache-key-model.md` — full cache key model with worked examples\n- `references\u002Fdiagnostic-commands.md` — canonical command script per cache issue\n- `references\u002Fworked-examples.md` — worked examples, managed policy reference,\n  cache key normalization, and Lambda@Edge edge cases\n- [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md) — senior-engineer heuristics and recent AWS features (2024-2026) moved from SKILL.md\n\n## Domain\n\nAWS CloudOps \u002F CloudFront CDN Caching, Cache Policy, and Edge Performance.\n\n## AWS documentation\n\n- **Amazon CloudFront Developer Guide** — https:\u002F\u002Fdocs.aws.amazon.com\u002FAmazonCloudFront\u002Flatest\u002FDeveloperGuide\u002FIntroduction.html\n- **CloudFront caching** — https:\u002F\u002Fdocs.aws.amazon.com\u002FAmazonCloudFront\u002Flatest\u002FDeveloperGuide\u002FConfiguringCaching.html\n- **Cache policies** — https:\u002F\u002Fdocs.aws.amazon.com\u002FAmazonCloudFront\u002Flatest\u002FDeveloperGuide\u002Fcontrolling-the-cache-key.html\n- **CloudFront access logs** — https:\u002F\u002Fdocs.aws.amazon.com\u002FAmazonCloudFront\u002Flatest\u002FDeveloperGuide\u002FAccessLogs.html\n- **Lambda@Edge** — https:\u002F\u002Fdocs.aws.amazon.com\u002FAmazonCloudFront\u002Flatest\u002FDeveloperGuide\u002Flambda-at-the-edge.html\n- **CloudFront metrics** — https:\u002F\u002Fdocs.aws.amazon.com\u002FAmazonCloudFront\u002Flatest\u002FDeveloperGuide\u002Fcloudwatch-monitoring.html\n- **CloudFront CLI Reference** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fcli\u002Flatest\u002Freference\u002Fcloudfront\u002F\n","# CloudFront Cache Troubleshooter\n\n## Activation\n\nActivate this skill when the user reports a CloudFront caching issue.\nTrigger phrases: \"CloudFront cache miss every request\", \"CloudFront not\ncaching\", \"CloudFront stale content\", \"CloudFront content not updating\",\n\"CloudFront cache hit ratio low\", \"CloudFront origin load high\",\n\"CloudFront 403 from cache\", \"CloudFront 404 from edge\", \"CloudFront\ndifferent content per user\", \"CloudFront cache key variation\", \"CloudFront\ncache policy misconfigured\", \"x-cache Miss from cloudfront\",\n\"x-edge-result-type Miss\", \"troubleshoot CloudFront caching\".\n\n## Mindset\n\n**One-line takeaway:** every CloudFront caching problem is a mismatch\nbetween what the cache key captures, what the origin allows to be cached,\nand what the cache policy TTL instructs. The diagnostic walk identifies\nwhich of these three is broken.\n\nThree facts make CloudFront cache diagnosis different:\n\n- **CloudFront caches by cache key, not by URL alone.** The cache key =\n  URL path + query strings + headers + cookies (per the cache policy).\n  Including `User-Agent` fragments the cache so badly that hit ratio\n  drops to near zero.\n- **Origin `Cache-Control` headers dominate unless the cache policy\n  overrides them.** If the origin sends `Cache-Control: no-store`,\n  CloudFront will not cache regardless of the policy TTL.\n- **`x-edge-result-type` in access logs is the ground truth.** Values:\n  `Hit`, `Miss`, `RefreshHit`, `RefreshMiss`, `Error`, `LimitExceeded`,\n  `CapacityExceeded`, `Denied`. `Miss` every time means cache key or\n  origin headers prevent caching.\n\n## Expert heuristic\n\nFive senior-CDN-engineer heuristics (edge-only hit ratio, Lambda@Edge header rewrites, Origin Shield break-even, compression size limits, Functions vs Lambda@Edge cache timing) moved verbatim to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md).\nLoad on demand when the symptom contradicts the cache policy analysis.\n\n## Quick reference — symptom to cache issue\n\n| Observed signal | Cache issue | First probe |\n|---|---|---|\n| `x-edge-result-type: Miss` on every request | ORIGIN_NO_CACHE \u002F ORIGIN_NO_STORE \u002F CACHE_POLICY_TOO_NARROW | `curl -I` to origin for `Cache-Control`; cache policy TTL |\n| Content hours\u002Fdays old; origin updated | STALE_NO_INVALIDATION \u002F TTL_TOO_LONG | Origin `max-age` vs behavior TTL; invalidation history |\n| Same URL, different content per user | CACHE_KEY_BLOAT | Cache policy headers\u002Fcookies\u002Fquery strings |\n| 403 \u002F 404 from CloudFront; origin returns 200 | WAF_BLOCK \u002F LAMBDA_EDGE_MUTATION | WAF web ACL; Lambda@Edge logs |\n| Hit ratio dropping; origin load rising | CACHE_KEY_BLOAT \u002F TTL_TOO_SHORT | Cache policy `DefaultTTL`; cache key values |\n| `RefreshHit` frequent; origin gets `If-Modified-Since` | TTL_EXPIRED \u002F STALE-REVALIDATE | Origin `max-age` vs behavior `MinTTL` |\n\n## Process — Diagnostic decision tree (apply in order)\n\n### Step 0: Capture the cache signal\n\n| Signal | Source | Why required |\n|---|---|---|\n| **Distribution ID or domain** | User-provided or `list-distributions` | All get-distribution-config calls need this |\n| **Symptom (miss vs stale vs variation)** | User report + `curl -I` | Drives the symptom category |\n| **x-edge-result-type \u002F x-cache** | Access logs (S3) or `curl -I` | Ground truth for edge behavior |\n\nIf distribution\u002Fdomain unknown:\n\nlist-distributions \u002F get-distribution-config discovery commands moved verbatim to [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\nRun them when the distribution ID or domain is unknown.\n\n### Step 1: Identify the symptom category\n\n| Category | Signature | Diagnostic step |\n|---|---|---|\n| **A. CACHE_MISS_ALWAYS** | `Miss` on every request; `x-cache: Miss from cloudfront` | Step 2 |\n| **B. STALE_CONTENT** | Content old; origin updated; no invalidation sent | Step 3 |\n| **C. CACHE_KEY_VARIATION** | Same URL, different content per user; hit ratio near zero | Step 4 |\n| **D. ERROR_FROM_CACHE** | 403\u002F404 from CloudFront; origin returns 200; `x-edge-result-type: Error` | Step 5 |\n| **E. LOW_HIT_RATIO** | Hit ratio dropping; origin load rising; mix of Hit and Miss | Step 6 |\n\nPriority if multiple match: CACHE_MISS_ALWAYS > ERROR_FROM_CACHE >\nCACHE_KEY_VARIATION > STALE_CONTENT > LOW_HIT_RATIO.\n\n### Step 2: CACHE_MISS_ALWAYS diagnostic\n\nEvery request is a `Miss`. Cause: origin sends `no-cache`\u002F`no-store`, cache\npolicy TTL is 0, `CachingDisabled` attached, or response not cacheable.\n\n**Diagnostic walk:**\n\n1. **Check origin `Cache-Control`** (#1 cause). `curl -I` directly to origin:\n\n```bash\n# Direct to origin (bypass CloudFront):\ncurl -sI https:\u002F\u002Forigin.example.com\u002Fpath\u002Fto\u002Fcontent | grep -iE 'cache-control|expires|pragma|set-cookie'\n\n# Via CloudFront:\ncurl -sI https:\u002F\u002Fd123.cloudfront.net\u002Fpath\u002Fto\u002Fcontent | grep -iE 'x-cache|age|cache-control'\n```\n\n| Origin header | Effect | Fix |\n|---|---|---|\n| `Cache-Control: no-store` | Never caches | Change to `public, max-age=3600` |\n| `Cache-Control: no-cache` | Revalidates every request (RefreshMiss) | Change to `public, max-age=3600` |\n| `Cache-Control: max-age=0` | Same as no-cache | Raise to desired TTL |\n| `Cache-Control: private` | Not cached (browser-only) | Change to `public` |\n| `Pragma: no-cache` | Legacy HTTP\u002F1.0 no-cache | Remove |\n| `Set-Cookie` in response | May skip caching if cookie not in policy | Add cookie to policy or remove Set-Cookie |\n\n2. **Check cache policy TTL:** `MinTTL: 0, DefaultTTL: 0, MaxTTL: 0` disables\n   caching. Managed `CachingDisabled` (ID `4135ea2d-6df8-44a3-9df3-4b5a84be39ad`)\n   explicitly sets all TTLs to 0.\n\n```bash\naws cloudfront get-cache-policy --id \u003Ccache-policy-id> \\\n  --query 'CachePolicy.CachePolicyConfig.{minTTL:MinTTL,defaultTTL:DefaultTTL,maxTTL:MaxTTL,headers:ParametersInCacheKeyAndForwardedToOrigin.HeadersConfig.HeaderBehavior}' \\\n  --output json\n```\n\n3. **Check if origin returns cacheable status codes.** CloudFront caches\n   200, 206, 301, 302, 304, 404 (optionally).\n\n**Common fixes:**\n- Origin sends `no-store`: update origin to `Cache-Control: public, max-age=3600`.\n  For S3: `aws s3api put-object` with `--cache-control`.\n- Cache policy TTL is 0: set `DefaultTTL: 3600` or use managed\n  `CachingOptimized` (`658327ea-f89d-4fab-a63d-7e88639e58f6`).\n- `Set-Cookie` preventing caching: add cookie to policy or remove from response.\n\n### Step 3: STALE_CONTENT diagnostic\n\nContent served from cache but old — origin updated but CloudFront serves\ncached version. Cause: TTL not expired (expected without invalidation), no\ninvalidation sent, or cache behavior overrides origin with longer TTL.\n\n**Diagnostic walk:**\n\n1. **Determine if invalidation is needed.** CloudFront serves cached content\n   until TTL expires OR invalidation clears it. No invalidation after origin\n   update = stale until TTL expires. This is expected, not a bug.\n2. **Compare origin `max-age` vs cache behavior TTL.** If origin sends\n   `max-age=86400` but operator expects minutes, TTL is too long.\n3. **Check `OriginCacheControlHeaders` handling.** If set to respect,\n   CloudFront uses origin's `max-age`. If override, uses policy `DefaultTTL`.\n4. **Check invalidation history.** If invalidation sent but stale persists,\n   it may be for wrong paths or still in progress.\n\n```bash\n# List recent invalidations.\naws cloudfront list-invalidations --distribution-id \u003Cid> \\\n  --query 'InvalidationList.Items[*].{id:Id,status:Status,paths:InvalidationBatch.Paths.Items,created:CreateTime}' \\\n  --output json\n\n# Check the Age header (how long object has been cached):\ncurl -sI https:\u002F\u002Fd123.cloudfront.net\u002Fpath | grep -iE 'x-cache|age|cache-control'\n```\n\n| Sub-symptom | Root cause | Fix |\n|---|---|---|\n| No invalidation sent, TTL not expired | Expected behaviour | Send invalidation OR wait for TTL |\n| Invalidation sent but still stale | Wrong paths or in progress | Verify `get-invalidation` status; paths match |\n| Origin `max-age=86400` but expects 5-min | TTL too long | Lower origin `max-age` or policy `MaxTTL` |\n| Stale after deployment | No invalidation in CI\u002FCD | Add invalidation step to deploy pipeline |\n\n**Common fixes:**\n- Send invalidation: `aws cloudfront create-invalidation --distribution-id \u003Cid> --paths \"\u002Fupdated\u002F*\"`.\n  Prefer specific paths over `\u002F*` to avoid spiking origin load.\n- Add invalidation to CI\u002FCD pipeline.\n- For frequently-updated content, set shorter TTL (`max-age=300`).\n\n### Step 4: CACHE_KEY_VARIATION diagnostic\n\nSame URL but different content per user; hit ratio near zero. Cause: cache\nkey bloat — too many headers, cookies, or query strings creating unique\nentries.\n\n**Cache key formula:** `cache key = URL path + query strings (per policy) +\nheaders (per policy) + cookies (per policy)`. Any value included creates a\ndistinct entry per unique combination.\n\n**Diagnostic walk:**\n\n1. **Read cache policy `ParametersInCacheKeyAndForwardedToOrigin`:**\n\n```bash\naws cloudfront get-cache-policy --id \u003Ccache-policy-id> \\\n  --query 'CachePolicy.CachePolicyConfig.ParametersInCacheKeyAndForwardedToOrigin' \\\n  --output json\n```\n\n| Cache policy setting | Effect | Recommendation |\n|---|---|---|\n| `HeadersConfig.HeaderBehavior: none` | No headers in key | Default; use unless response varies |\n| `QueryStringsConfig.QueryStringBehavior: all` | ALL query strings in key | Only if every param affects response |\n| `CookiesConfig.CookieBehavior: all` | ALL cookies in key | Almost never correct — fragments cache |\n| `CookiesConfig.CookieBehavior: whitelist` + specific | Listed cookies only | Only cookies that affect response |\n\n2. **Check for fragmenting headers:** `User-Agent` (thousands of values),\n   `Authorization` (unique per user), `X-Forwarded-For` (unique per client).\n   Do NOT include these in the cache key.\n3. **Check `Accept-Encoding`** — required in cache key for compressed content.\n   Managed `AllViewerExceptReservedHeader` includes it by default.\n4. **Check access logs:** if every request is `Miss` for same URL, cache key\n   varies per request. Compare `cs-cookie` and `cs-accept-encoding` fields.\n\nSee `references\u002Fworked-examples.md` for the managed policy reference table\nand cache key normalization details.\n\n**Common fixes:**\n- Remove `User-Agent` from headers whitelist. Use `none` or only headers\n  that affect the response.\n- Switch `CookiesConfig.CookieBehavior` from `all` to `whitelist` with\n  only necessary cookies.\n- For static assets, use managed `CachingOptimized`.\n- For dynamic APIs, use `CachingDisabled`.\n\n### Step 5: ERROR_FROM_CACHE diagnostic\n\nCloudFront returns 403 or 404; origin returns 200. Cause: WAF blocking,\nLambda@Edge modifying response, cached transient error, or wrong origin.\n\n**Diagnostic walk:**\n\n1. **Check for WAF:** `aws cloudfront get-distribution-config --id \u003Cid>\n   --query 'DistributionConfig.WebACLId'`. Blocked requests return 403\n   with `x-amzn-waf-action: BLOCK`.\n2. **Check Lambda@Edge on behavior:** a function on `viewer-response` or\n   `origin-response` can modify status code\u002Fheaders\u002Fbody.\n3. **Check origin directly:** `curl -I` bypassing CloudFront. If origin\n   returns 200 but CloudFront returns 403\u002F404, issue is in CloudFront layer.\n4. **Check for cached 404:** CloudFront caches 404 if policy allows it\n   (`errorResponseCachingBehavior`). A transient 404 can persist after\n   origin recovers.\n5. **Check cache behavior target origin:** if pointing to deleted\u002Fwrong\n   origin, origin returns 404.\n\n```bash\n# Check WAF rules if attached:\naws wafv2 get-web-acl --scope CLOUDFRONT --id \u003Cweb-acl-id> \\\n  --query 'WebACL.Rules[*].{name:Name,action:Action,priority:Priority}' --output json\n\n# Check Lambda@Edge functions:\naws cloudfront get-distribution-config --id \u003Cid> \\\n  --query 'DistributionConfig.DefaultCacheBehavior.LambdaFunctionAssociations.Items[*].{type:EventType,arn:LambdaFunctionARN}' \\\n  --output json\n```\n\n| Sub-symptom | Root cause | Fix |\n|---|---|---|\n| 403 with `x-amzn-waf-action: BLOCK` | WAF blocking | Adjust WAF rules; add allowlist |\n| 403 without WAF header | Lambda@Edge returning 403 | Check function logs; curl origin directly |\n| 404 persists after origin recovers | Cached transient 404 | Invalidate; lower 404 cache TTL |\n| 404 on specific path | Wrong TargetOriginId | Update behavior's TargetOriginId |\n\nSee `references\u002Fworked-examples.md` for Lambda@Edge response modification\nedge cases.\n\n### Step 6: LOW_HIT_RATIO diagnostic\n\nHit ratio dropping; origin load rising; mix of Hit and Miss. Cause: cache\nkey bloat, TTL too short, origin sending `no-cache` on some responses, or\nlong-tail content (more unique URLs).\n\n**Diagnostic walk:**\n\n1. **Check `CacheHitRate` metric:**\n\n```bash\naws cloudwatch get-metric-statistics --namespace AWS\u002FCloudFront \\\n  --metric-name CacheHitRate \\\n  --dimensions Name=DistributionId,Value=\u003Cid> \\\n  --start-time $(date -u -d '24 hours ago' +%Y-%m-%dT%H:%M:%SZ) \\\n  --end-time $(date -u +%Y-%m-%dT%H:%M:%SZ) \\\n  --period 3600 --statistics Average --output json\n```\n\n2. **Analyze access logs** for the Miss pattern — group by path, query\n   string, headers.\n3. **Check long tail:** if content catalog grew, each URL is a miss on\n   first request (expected). Fix: pre-warming or accept lower ratio.\n4. **Check inconsistent origin headers:** some responses with `no-cache`,\n   others with `max-age=3600` = inconsistent ratio.\n\n| Sub-symptom | Root cause | Fix |\n|---|---|---|\n| Drop after traffic increase | Long-tail content | Pre-warm; accept lower ratio |\n| Low for specific path | Cache key bloat on that behavior | Narrow the cache policy |\n| Low with frequent `RefreshHit` | TTL expired; frequent revalidation | Raise TTL |\n| Low after deploy | Invalidation cleared cache | Expected; ratio recovers |\n\n**Common fixes:**\n- Separate static and dynamic content into different cache behaviors.\n- Raise TTL for content that changes infrequently. S3 immutable objects:\n  `max-age=31536000` (1 year).\n- Use Origin Shield as second-tier cache.\n- Pre-warm cache after deploys.\n\n### Step 7: Map to root-cause catalog\n\n| # | Root cause | Category | Fix pattern |\n|---|---|---|---|\n| 1 | Origin sends `Cache-Control: no-store` or `no-cache` | CACHE_MISS_ALWAYS (ORIGIN_NO_CACHE) | Update origin to `public, max-age=\u003CTTL>` |\n| 2 | Cache policy TTL is 0 or `CachingDisabled` | CACHE_MISS_ALWAYS (CACHE_POLICY_TOO_NARROW) | Switch to `CachingOptimized` or set `DefaultTTL > 0` |\n| 3 | No invalidation after origin update | STALE_CONTENT (STALE_NO_INVALIDATION) | Send invalidation; add to CI\u002FCD |\n| 4 | TTL too long for frequently-updated content | STALE_CONTENT (TTL_TOO_LONG) | Lower `max-age` or policy `MaxTTL` |\n| 5 | `User-Agent` or `Authorization` in cache key | CACHE_KEY_VARIATION (CACHE_KEY_BLOAT) | Remove from cache policy headers |\n| 6 | All cookies in cache key | CACHE_KEY_VARIATION (CACHE_KEY_BLOAT) | Switch to `whitelist` with necessary cookies |\n| 7 | WAF blocking requests | ERROR_FROM_CACHE (WAF_BLOCK) | Adjust WAF rules; add allowlist |\n| 8 | Lambda@Edge modifying response | ERROR_FROM_CACHE (LAMBDA_EDGE_MUTATION) | Fix function; remove from behavior |\n| 9 | Cached transient 404 | ERROR_FROM_CACHE (ORIGIN_ERROR) | Invalidate; lower 404 cache TTL |\n| 10 | `Accept-Encoding` not in cache key for compressed content | CACHE_KEY_VARIATION (COMPRESSION_CACHE_KEY) | Add `Accept-Encoding` to policy |\n\n### Step 8: Verify the fix\n\n- **Origin header changes:** verify with `curl -I`, request via CloudFront\n  twice — second should show `x-cache: Hit from cloudfront`.\n- **Cache policy changes:** wait for Deployed status, test with `curl -I` twice.\n- **Invalidation:** wait for Completed status, request path — first Miss,\n  second Hit.\n- **WAF changes:** verify blocked requests now succeed.\n- **Lambda@Edge changes:** deploy new version, wait for propagation (minutes).\n\n### Step 9: Decide — ROOT_CAUSE_FOUND vs NEED_MORE_INFO vs ESCALATE\n\n- **ROOT_CAUSE_FOUND.** Walk identified a specific cache issue and config\n  element. Output REMEDIATION with exact change.\n- **NEED_MORE_INFO.** Operator cannot supply evidence (logs not enabled,\n  policy ID unknown). Output the list of missing inputs.\n- **ESCALATE.** Cause outside operator's scope (AWS-side event, Lambda@Edge\n  owned by another team, WAF managed centrally). Output escalation target.\n\n## Output format\n\n```text\nDISTRIBUTION: \u003Cdistribution ID or domain>\nVERDICT: ROOT_CAUSE_FOUND | NEED_MORE_INFO | ESCALATE\nROOT_CAUSE: \u003Ccache issue name> — \u003Cspecific root cause>\nCACHE_ISSUE: \u003CORIGIN_NO_CACHE | ORIGIN_NO_STORE | CACHE_POLICY_TOO_NARROW |\n              CACHE_KEY_BLOAT | TTL_TOO_SHORT | STALE_NO_INVALIDATION |\n              ORIGIN_HEADER_OVERRIDE | LAMBDA_EDGE_MUTATION | WAF_BLOCK |\n              COMPRESSION_CACHE_KEY | ORIGIN_ERROR | UNKNOWN>\nEVIDENCE:\n  - \u003Corigin response header>: \u003Cvalue>\n  - \u003Ccache policy field>: \u003Cvalue>\n  - \u003Cx-edge-result-type from access logs>: \u003Cvalue>\nROOT_CAUSE_CATALOG: #\u003CN>\nREMEDIATION:\n  1. \u003Cspecific config change with CLI command>\n  2. \u003Cverification command>\n  3. \u003Cpost-apply monitoring>\n```\n\nSee `references\u002Fworked-examples.md` for full worked examples (origin\nno-store, User-Agent cache key bloat).\n\n## STRICT output contract\n\nThis section codifies the exact output shape the eval harness asserts\nagainst. Every invocation MUST produce output that matches this contract.\n\n### Required output structure\n\nEvery response MUST be a single block with these literal labels, in this\norder:\n\n```text\nDISTRIBUTION: \u003Cdistribution ID or domain>\nVERDICT: ROOT_CAUSE_FOUND | NEED_MORE_INFO | ESCALATE\nROOT_CAUSE: \u003Ccache issue name> — \u003Cspecific root cause>\nCACHE_ISSUE: \u003CORIGIN_NO_CACHE | ORIGIN_NO_STORE | CACHE_POLICY_TOO_NARROW |\n              CACHE_KEY_BLOAT | TTL_TOO_SHORT | STALE_NO_INVALIDATION |\n              ORIGIN_HEADER_OVERRIDE | LAMBDA_EDGE_MUTATION | WAF_BLOCK |\n              COMPRESSION_CACHE_KEY | ORIGIN_ERROR | UNKNOWN>\nEVIDENCE:\n  - \u003Csignal source>: \u003Cobserved value>\n  - \u003Csignal source>: \u003Cobserved value>\n  - \u003Csignal source>: \u003Cobserved value>\nROOT_CAUSE_CATALOG: #\u003CN>\nREMEDIATION:\n  1. \u003Cspecific config change with CLI command>\n  2. \u003Cverification command>\n  3. \u003Cpost-apply monitoring>\n```\n\n### FORBIDDEN output patterns\n\n1. **NEVER diagnose without checking the x-cache header first.** A\n   ROOT_CAUSE_FOUND without an EVIDENCE row citing the observed `x-cache`\n   value is rejected.\n2. **NEVER blame the cache policy without checking origin Cache-Control\n   headers — the origin header overrides the policy.** A ROOT_CAUSE_FOUND\n   citing `CACHE_POLICY_TOO_NARROW` or `TTL_TOO_SHORT` without EVIDENCE\n   showing the origin's actual `Cache-Control` is rejected.\n3. **NEVER suggest `\u002F*` invalidation without confirming content is stale.**\n   `\u002F*` invalidations are expensive and spike origin load. Always prefer\n   path-specific invalidations; reserve `\u002F*` for full-site updates only.\n4. **NEVER confuse `no-cache` with `no-store`.** `no-cache` allows caching\n   but requires revalidation (RefreshHit\u002FRefreshMiss); `no-store` prohibits\n   caching entirely. Mislabeling is rejected.\n5. **NEVER substitute lowercase or markdown-styled labels for the literal\n   all-caps `DISTRIBUTION:`, `VERDICT:`, `ROOT_CAUSE:`, `CACHE_ISSUE:`,\n   `EVIDENCE:`, `ROOT_CAUSE_CATALOG:`, `REMEDIATION:`.** The eval harness\n   pattern-matches on exact labels.\n\n### Perfect example output\n\n```text\nDISTRIBUTION: E1A2B3C4D5 (d123.cloudfront.net)\nVERDICT: ROOT_CAUSE_FOUND\nROOT_CAUSE: ORIGIN_NO_STORE — the origin returns \"Cache-Control: no-store\"\n  on all responses, which instructs CloudFront never to cache.\nCACHE_ISSUE: ORIGIN_NO_STORE\nEVIDENCE:\n  - curl -I https:\u002F\u002Forigin.example.com\u002Fapi\u002Fdata: response includes\n    \"Cache-Control: no-store\"\n  - curl -I https:\u002F\u002Fd123.cloudfront.net\u002Fapi\u002Fdata: \"x-cache: Miss from\n    cloudfront\" on every request; \"Age: 0\"\n  - get-cache-policy: CachePolicyId is CachingOptimized\n    (658327ea-f89d-4fab-a63d-7e88639e58f6), MinTTL=1, DefaultTTL=86400\n    — the policy is correct; the origin header overrides it\n  - CloudFront access logs: x-edge-result-type \"Miss\" on 100% of requests\n    to \u002Fapi\u002Fdata\u002F*\nROOT_CAUSE_CATALOG: #1 (origin sends no-store)\nREMEDIATION:\n  1. Update the origin to send Cache-Control: public, max-age=3600 for\n     cacheable API responses. For an S3 origin:\n     aws s3api copy-object --bucket my-bucket --key api\u002Fdata.json \\\n       --copy-source my-bucket\u002Fapi\u002Fdata.json \\\n       --cache-control \"public, max-age=3600\" \\\n       --metadata-directive REPLACE\n  2. Verify the origin header:\n     curl -sI https:\u002F\u002Forigin.example.com\u002Fapi\u002Fdata | grep -i cache-control\n     Expect: \"Cache-Control: public, max-age=3600\"\n  3. Request via CloudFront twice; the second request should show\n     \"x-cache: Hit from cloudfront\":\n     curl -sI https:\u002F\u002Fd123.cloudfront.net\u002Fapi\u002Fdata | grep -i x-cache\n```\n\n## Anti-Patterns — NEVER (top 5)\n\n1. NEVER assume the cache policy TTL controls caching when the origin sends\n   `Cache-Control: no-store`. The origin header overrides the policy unless\n   explicitly overridden. Always check the origin's `Cache-Control` first.\n2. NEVER include `User-Agent` in the cache key — thousands of distinct\n   values fragment the cache. If response truly varies by client, normalize\n   the header before including it.\n3. NEVER use `CookiesConfig.CookieBehavior: all` unless the response truly\n   varies by every cookie. Use `whitelist` with only cookies that affect\n   the response.\n4. NEVER invalidate `\u002F*` when path-specific invalidation suffices — `\u002F*`\n   clears the entire cache, spiking origin load. Use specific paths.\n5. NEVER set `MaxTTL` lower than `MinTTL` on a cache policy. Always ensure\n   `MinTTL \u003C= DefaultTTL \u003C= MaxTTL`.\n\nSee `references\u002Fworked-examples.md` for additional anti-patterns (no-cache\nvs no-store confusion, x-cache Hit meaning, Accept-Encoding for compressed\ncontent, static vs dynamic mixing).\n\n## Diagnostic command quick reference\n\nDiagnostic command quick-reference listing (config, cache policy, invalidations, CacheHitRate, x-cache probes, origin bypass, Lambda@Edge) moved verbatim to [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\nLoad on demand for live-account probing.\n\nSee `references\u002Fdiagnostic-commands.md` for the full command script per\ncache issue category.\n\n## Recent AWS features (2024-2026)\n\nRecent AWS features (2024-2026) moved verbatim to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md).\nLoad on demand when Functions vs Lambda@Edge timing, KeyValueStore, Origin Shield metrics, or Logs-to-CloudWatch are in play.\n\n## References\n\n- `references\u002Fcache-key-model.md` — full cache key model with worked examples\n- `references\u002Fdiagnostic-commands.md` — canonical command script per cache issue\n- `references\u002Fworked-examples.md` — worked examples, managed policy reference,\n  cache key normalization, and Lambda@Edge edge cases\n- [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md) — senior-engineer heuristics and recent AWS features (2024-2026) moved from SKILL.md\n\n## Domain\n\nAWS CloudOps \u002F CloudFront CDN Caching, Cache Policy, and Edge Performance.\n\n## AWS documentation\n\n- **Amazon CloudFront Developer Guide** — https:\u002F\u002Fdocs.aws.amazon.com\u002FAmazonCloudFront\u002Flatest\u002FDeveloperGuide\u002FIntroduction.html\n- **CloudFront caching** — https:\u002F\u002Fdocs.aws.amazon.com\u002FAmazonCloudFront\u002Flatest\u002FDeveloperGuide\u002FConfiguringCaching.html\n- **Cache policies** — https:\u002F\u002Fdocs.aws.amazon.com\u002FAmazonCloudFront\u002Flatest\u002FDeveloperGuide\u002Fcontrolling-the-cache-key.html\n- **CloudFront access logs** — https:\u002F\u002Fdocs.aws.amazon.com\u002FAmazonCloudFront\u002Flatest\u002FDeveloperGuide\u002FAccessLogs.html\n- **Lambda@Edge** — https:\u002F\u002Fdocs.aws.amazon.com\u002FAmazonCloudFront\u002Flatest\u002FDeveloperGuide\u002Flambda-at-the-edge.html\n- **CloudFront metrics** — https:\u002F\u002Fdocs.aws.amazon.com\u002FAmazonCloudFront\u002Flatest\u002FDeveloperGuide\u002Fcloudwatch-monitoring.html\n- **CloudFront CLI Reference** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fcli\u002Flatest\u002Freference\u002Fcloudfront\u002F\n",{"name":5,"license":15,"metadata":24,"description":7,"compatibility":43},{"tags":25,"phase":26,"author":27,"domain":28,"family":29,"version":30,"keywords":31,"task_type":32,"complexity":33,"entry_point":34,"skill_class":35,"when_to_use":36,"requires_llm":37,"verdict_shape":38,"when_not_to_use":39,"lifecycle_status":40,"invocation_schema":41,"supports_pipeline":37,"activation_triggers":42},"cloudfront, networking, troubleshoot, caching, cdn, cache-policy, ttl, lambda-at-edge","2","Jacky Chan — AWS Community Builder","aws-cloudops","Networking","0.1.0","CloudFront, caching, cache miss, cache hit ratio, stale content, cache key, cache policy, Cache-Control, max-age, no-cache, no-store, TTL, x-edge-result-type, x-cache, Lambda@Edge, origin shield, managed policy, AllViewerExceptReservedHeader, invalidation, troubleshooting","troubleshoot","high","false","capability","Diagnosing CloudFront cache misses on every request, stale content being served, unexpected cache key variation (different content per user), 403\u002F404 errors from the cache edge, low cache hit ratio with elevated origin load, or Lambda@Edge \u002F WAF interference with caching; validating whether the root cause is origin headers, cache policy misconfiguration, TTL settings, invalidation gaps, or cache key bloat.","true","ROOT_CAUSE_FOUND | NEED_MORE_INFO | ESCALATE","CloudFront distribution configuration posture audits (use cloudfront-distribution-auditor), origin failover \u002F multi-origin setup (use cloudfront-distribution-deployer), TLS certificate issues on the distribution (use acm-certificate-expiry-auditor), or WAF rule authoring (use wafv2-web-acl-auditor). This skill diagnoses caching root cause; it does not audit distribution security posture.","active","Input: either (a) a symptom description (cache miss pattern, stale content report, hit-ratio drop), optionally paired with cache policy JSON and response headers, OR (b) a distribution ID plus caller context (origin URL, observed x-cache header, access log excerpt) for live-account diagnosis. Output: a deterministic DISTRIBUTION \u002F VERDICT \u002F ROOT_CAUSE \u002F CACHE_ISSUE \u002F EVIDENCE \u002F REMEDIATION block where VERDICT ∈ {ROOT_CAUSE_FOUND, NEED_MORE_INFO, ESCALATE} and CACHE_ISSUE ∈ {ORIGIN_NO_CACHE, ORIGIN_NO_STORE, CACHE_POLICY_TOO_NARROW, CACHE_KEY_BLOAT, TTL_TOO_SHORT, STALE_NO_INVALIDATION, ORIGIN_HEADER_OVERRIDE, LAMBDA_EDGE_MUTATION, WAF_BLOCK, COMPRESSION_CACHE_KEY, ORIGIN_ERROR, UNKNOWN}.","CloudFront cache miss every request, CloudFront not caching, CloudFront stale content, CloudFront content not updating, CloudFront cache hit ratio low, CloudFront origin load high, CloudFront 403 from cache, CloudFront 404 from edge, CloudFront different content per user, CloudFront cache key variation, CloudFront cache policy misconfigured, x-cache Miss from cloudfront, x-edge-result-type Miss, troubleshoot CloudFront caching","Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). Offline diagnosis works from pasted response headers, access log excerpts, and cache policy JSON. Live-account diagnosis uses aws cloudfront get-distribution-config, get-cache-policy, aws cloudfront get-monitoring-sample, curl -I against the distribution and origin, and CloudFront access logs via aws logs get-log-events (AWS CLI v2, SSO or key-based credentials).","main","eeace51bd5dd1db2030729d83eeab988861553aa","skills\u002Fcloudfront-cache-troubleshooter",0,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills","https:\u002F\u002Fgithub.com\u002Fjhkchan","CTO & Co-Founder @Beever-AI  & @votee. CAISP. AWS Community Builder. Organizer@GDGCloudHK. MongoDB Champion. Technopreneur + Infornographer.","2026-09-24 08:54:10",{"source":8,"skillName":5,"commands":53,"prompt":63,"zipAvailable":64},[54,57,60],{"tool":55,"command":56},"npx","npx skills add jhkchan\u002Faws-agent-skills --skill cloudfront-cache-troubleshooter",{"tool":58,"command":59},"bunx","bunx skills add jhkchan\u002Faws-agent-skills --skill cloudfront-cache-troubleshooter",{"tool":61,"command":62},"pnpm","pnpm dlx skills add jhkchan\u002Faws-agent-skills --skill cloudfront-cache-troubleshooter","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudfront-cache-troubleshooter\u002FSKILL.md",true,[66,72,76,80,84,88,92,96,100,104,108,112,116,120,124,128,132,136,140],{"path":67,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":70,"sourceHtmlUrl":71},"eval\u002Ftest-cases.yaml","REFERENCE","参考文档",5942,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudfront-cache-troubleshooter\u002Feval\u002Ftest-cases.yaml",{"path":73,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":74,"sourceHtmlUrl":75},"evals\u002Fbaselines\u002Finsufficient-context-need-distribution-id.md",982,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudfront-cache-troubleshooter\u002Fevals\u002Fbaselines\u002Finsufficient-context-need-distribution-id.md",{"path":77,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":78,"sourceHtmlUrl":79},"evals\u002Fbaselines\u002Forigin-no-store-header.md",1079,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudfront-cache-troubleshooter\u002Fevals\u002Fbaselines\u002Forigin-no-store-header.md",{"path":81,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":82,"sourceHtmlUrl":83},"evals\u002Fbaselines\u002Fstale-content-no-invalidation.md",1151,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudfront-cache-troubleshooter\u002Fevals\u002Fbaselines\u002Fstale-content-no-invalidation.md",{"path":85,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":86,"sourceHtmlUrl":87},"evals\u002Fbaselines\u002Fuser-agent-in-cache-key.md",1169,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudfront-cache-troubleshooter\u002Fevals\u002Fbaselines\u002Fuser-agent-in-cache-key.md",{"path":89,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":90,"sourceHtmlUrl":91},"evals\u002Fbaselines\u002Fwaf-blocking-cache-requests.md",1097,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudfront-cache-troubleshooter\u002Fevals\u002Fbaselines\u002Fwaf-blocking-cache-requests.md",{"path":93,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":94,"sourceHtmlUrl":95},"evals\u002Feval_config.yaml",2016,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudfront-cache-troubleshooter\u002Fevals\u002Feval_config.yaml",{"path":97,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":98,"sourceHtmlUrl":99},"evals\u002Fevals.json",4538,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudfront-cache-troubleshooter\u002Fevals\u002Fevals.json",{"path":101,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":102,"sourceHtmlUrl":103},"evals\u002Fprompts\u002Finsufficient-context-need-distribution-id.md",1393,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudfront-cache-troubleshooter\u002Fevals\u002Fprompts\u002Finsufficient-context-need-distribution-id.md",{"path":105,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":106,"sourceHtmlUrl":107},"evals\u002Fprompts\u002Forigin-no-store-header.md",1756,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudfront-cache-troubleshooter\u002Fevals\u002Fprompts\u002Forigin-no-store-header.md",{"path":109,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":110,"sourceHtmlUrl":111},"evals\u002Fprompts\u002Fstale-content-no-invalidation.md",2062,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudfront-cache-troubleshooter\u002Fevals\u002Fprompts\u002Fstale-content-no-invalidation.md",{"path":113,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":114,"sourceHtmlUrl":115},"evals\u002Fprompts\u002Fuser-agent-in-cache-key.md",1855,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudfront-cache-troubleshooter\u002Fevals\u002Fprompts\u002Fuser-agent-in-cache-key.md",{"path":117,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":118,"sourceHtmlUrl":119},"evals\u002Fprompts\u002Fwaf-blocking-cache-requests.md",2077,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudfront-cache-troubleshooter\u002Fevals\u002Fprompts\u002Fwaf-blocking-cache-requests.md",{"path":121,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":122,"sourceHtmlUrl":123},"examples\u002FREADME.md",5782,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudfront-cache-troubleshooter\u002Fexamples\u002FREADME.md",{"path":125,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":126,"sourceHtmlUrl":127},"references\u002Fadvanced-patterns.md",5101,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudfront-cache-troubleshooter\u002Freferences\u002Fadvanced-patterns.md",{"path":129,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":130,"sourceHtmlUrl":131},"references\u002Fcache-key-model.md",8743,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudfront-cache-troubleshooter\u002Freferences\u002Fcache-key-model.md",{"path":133,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":134,"sourceHtmlUrl":135},"references\u002Fdiagnostic-commands.md",12314,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudfront-cache-troubleshooter\u002Freferences\u002Fdiagnostic-commands.md",{"path":137,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":138,"sourceHtmlUrl":139},"references\u002Fworked-examples.md",7624,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudfront-cache-troubleshooter\u002Freferences\u002Fworked-examples.md",{"path":141,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":142,"sourceHtmlUrl":143},"skill.usf.yaml",4453,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudfront-cache-troubleshooter\u002Fskill.usf.yaml",[145,152,159,166,173,180],{"skillNo":146,"name":147,"nameZh":6,"description":148,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":149,"categories":150,"keywords":151,"publishedAt":19},"01M7ADVD60X4PCAPKSE58P9NDC","xray-tracing-deployer","Deploys AWS X-Ray distributed tracing with production-grade configuration: X-Ray daemon deployment (EC2 systemd, ECS sidecar, EKS DaemonSet, Lambda built-in), SDK instrumentation (Java, Python, Node.js, Go, .NET) with annotations and metadata, sampling rules (default reservoir + rate vs custom rules with URL \u002F method \u002F service-name predicates), service map generation, trace query and retrieval, groups and insights, CloudWatch ServiceLens integration, IAM permissions (PutTraceSegments, GetSamplingRules), and latest features (Lambda Powertools tracing, OpenTelemetry \u002F ADOT Collector support, W3C trace context). Emits a READY_TO_DEPLOY checklist with every configuration item verified. Use when enabling X-Ray on a new application, adding tracing to ECS \u002F EKS \u002F Lambda, validating a sampling configuration, or generating daemon deployment CLI and IaC templates. Triggers: X-Ray, distributed tracing, X-Ray daemon, sampling rules, service map, X-Ray SDK, OpenTelemetry, ADOT, Lambda Powertools, CloudWatch ServiceLens.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fxray-tracing-deployer\u002FSKILL.md",[],[],{"skillNo":153,"name":154,"nameZh":6,"description":155,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":156,"categories":157,"keywords":158,"publishedAt":19},"01M7ADTVJ7DCBM9CB1FY51GH7J","wellarchitected-workload-auditor","Audits AWS Well-Architected Tool workloads for review staleness, per-pillar high-risk issue counts, milestone tracking gaps, and remediation plan completeness. Emits a deterministic verdict (STALE_REVIEW | HIGH_RISK | CONFIG_GAP | OK) per workload with per-pillar risk breakdown, milestone trend analysis, and specific remediation. Use when reviewing Well-Architected workloads, checking WA review freshness, auditing high-risk issues per pillar, validating milestone coverage, or tracking remediation plans.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwellarchitected-workload-auditor\u002FSKILL.md",[],[],{"skillNo":160,"name":161,"nameZh":6,"description":162,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":163,"categories":164,"keywords":165,"publishedAt":19},"01M7ADT59G6FTTNZYHT2QRPNNP","wellarchitected-review-operator","Operates AWS Well-Architected Tool reviews end-to-end — creates workloads, runs pillar reviews (operational excellence, security, reliability, performance, cost optimization, sustainability, Prosperity), answers questions with risk-tier rationale, generates reports and improvement plans, creates milestones, and integrates with Trusted Advisor and Well-Architected Labs. Runs deterministic pre-checks (workload existence, lens availability, pillar coverage), emits the exact update-answer \u002F get-consolidated-report CLI behind a CONFIRM gate, and verifies risk-tier transitions. Emits READY | BLOCKED | COMPLETED. Use when creating a workload, answering pillar questions, generating an improvement plan, creating a milestone, or integrating with Trusted Advisor. Triggers: well-architected tool, well architected review, workload review, pillar, operational excellence, security, reliability, performance, cost optimization, sustainability, prosperity, improvement plan, milestone, trusted advisor.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwellarchitected-review-operator\u002FSKILL.md",[],[],{"skillNo":167,"name":168,"nameZh":6,"description":169,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":170,"categories":171,"keywords":172,"publishedAt":19},"01M7ADSH5JA9QHNPPHQCD7EVA7","wafv2-web-acl-deployer","Provisions AWS WAFv2 Web ACLs with correct production defaults: scope selection (CLOUDFRONT vs REGIONAL), managed rule groups (AWSManagedRulesCommonRuleSet, SQLiRuleSet, LinuxRuleSet, WindowsRuleSet, IPReputationList, BotControlRuleSet, AmazonIpReputationList, ATP), custom rules (byte match, IP set, regex pattern, geo match, size constraint, rate-based), rule priority ordering, logging destinations (Kinesis Firehose, CloudWatch Logs, S3), resource association (ALB, API Gateway, CloudFront), rate-based rules with aggregate keys (IP, forwarded IP), Challenge and CAPTCHA actions, and account takeover prevention. Emits a READY_TO_DEPLOY checklist. Use when creating a Web ACL, attaching managed rules, configuring rate limiting, enabling WAF logging, associating a Web ACL with an ALB\u002FAPI Gateway\u002FCloudFront, or configuring CAPTCHA\u002FChallenge actions. Triggers: create WAF Web ACL, WAFv2, managed rule groups, WAF rate limiting, WAF logging, WAF CAPTCHA, WAF Challenge action, bot control, ATP managed rules.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwafv2-web-acl-deployer\u002FSKILL.md",[],[],{"skillNo":174,"name":175,"nameZh":6,"description":176,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":177,"categories":178,"keywords":179,"publishedAt":19},"01M7ADRYFAT8R73FBNCHRC573X","wafv2-web-acl-auditor","Audits AWS WAFv2 Web ACL configurations to determine whether the ACL provides effective protection: default-action posture (Allow vs Block), managed-rule-group coverage gaps, rule effectiveness (BLOCK vs COUNT, shadow\u002Fbypass rules, stale exclusions), rate-based rule correctness, logging and visibility configuration, and text-transformation bypass vectors. Emits a deterministic verdict per Web ACL. Use when reviewing a WAFv2 Web ACL for security posture, checking managed-rule coverage, validating rate-limit configuration, auditing WAF logging, or hardening a WAF before production deployment. Triggers: WAF, WAFv2, Web ACL, managed rule group, AWSManagedRules, rate-based rule, CAPTCHA, Challenge, OverrideAction, Count mode, forwarded IP, Bot Control, ATP, text transformation, WAF logging, WAF visibility, OWASP, SQLi, XSS, RFI.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwafv2-web-acl-auditor\u002FSKILL.md",[],[],{"skillNo":181,"name":182,"nameZh":6,"description":183,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":184,"categories":185,"keywords":186,"publishedAt":19},"01M7ADR8W7G72JX4KFGN03QK8Q","waf-rule-deployer","Provisions AWS WAFv2 rule sets with production defaults: Web ACL creation (CloudFront scope in us-east-1 vs Regional scope), rule groups (managed vs custom) with capacity planning in WCU (Web ACL Capacity Units, 1500 default per ACL), managed rule groups (AWSManagedRulesCommonRuleSet, AWSManagedRulesSQLiRuleSet, AWSManagedRulesAmazonIpReputationList, AWSManagedRulesLinuxRuleSet, AWSManagedRulesWindowsRuleSet, AWSManagedRulesUnixRuleSet), custom rules (byte-match, regex pattern set, geo-match, rate-based), IP set and regex pattern set resources, rule priority ordering (lowest number evaluated first), action types (allow, block, count, CAPTCHA, Challenge), bot control managed rule group, account takeover. Triggers: create WAF rule, WAF managed rule group, WAF custom rule, WAF byte match, WAF geo match, WAF rate based rule, WAF IP set, WAF regex pattern set, WAF WCU budget, WAF CloudFront ACL, WAF logging Kinesis Firehose, WAF bot control, WAF ATP, WAF label matching, WAF Challenge action, WAF CAPTCHA.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwaf-rule-deployer\u002FSKILL.md",[],[]]