HTTP caching for web APIs — Cache-Control headers, ETags, conditional requests,
88
84%
Does it follow best practices?
Impact
100%
25.00xAverage score across 4 eval scenarios
Passed
No known issues
{
"instruction": "Add ETag headers and If-None-Match conditional request handling to cacheable GET endpoints, returning 304 Not Modified when the data hasn't changed",
"relevant_when": "Agent creates GET endpoints that return cacheable public data (products, catalogs, articles, menus) — even if the task does not mention ETags, conditional requests, or bandwidth optimization",
"context": "ETags let the server tell clients 'the data hasn't changed, use your cached copy' by returning 304 Not Modified with no body — saving bandwidth and improving response times. Every cacheable GET endpoint should generate an ETag from the response content or a database timestamp, set it as a quoted string header, check the If-None-Match request header, and return 304 with no body when matched.",
"sources": [
{
"type": "file",
"filename": "skills/http-caching-strategy/SKILL.md",
"tile": "tessl-labs/http-caching-strategy@0.2.0"
}
],
"checklist": [
{
"name": "etag-on-cacheable-endpoints",
"rule": "Cacheable GET endpoints set an ETag response header derived from the content hash or database timestamp",
"relevant_when": "Agent creates GET endpoints with public caching (max-age > 0)"
},
{
"name": "if-none-match-check",
"rule": "Cacheable GET endpoints check the If-None-Match request header against the current ETag and return 304 Not Modified when matched",
"relevant_when": "Agent creates GET endpoints that set ETag headers"
},
{
"name": "304-no-body",
"rule": "304 Not Modified responses do not include a response body — use res.status(304).end() not res.status(304).json()",
"relevant_when": "Agent returns 304 Not Modified responses"
},
{
"name": "etag-quoted-string",
"rule": "ETag values are quoted strings (e.g., '\"abc123\"') as required by the HTTP spec",
"relevant_when": "Agent sets ETag headers"
}
]
}