Prompt Caching
sickn33/agentic-awesome-skills
Caching strategies for LLM prompts including Anthropic prompt caching, response caching, and CAG (Cache Augmented Generation)
The Datapages service worker: offline page snapshots and cached shims written by handlers through the pageCache parameter, the offline module and its Config, and the PageOffline fallback.
$ npx skills add romshark/datapages --skill datapages-offline -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install romshark/datapages datapages-offline --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/romshark/datapages.git skills-src && mkdir -p .claude/skills && cp -r skills-src/internal/generator/agentdocs/data/skills/datapages-offline .claude/skills/datapages-offline && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "datapages-offline" agent skill from https://github.com/romshark/datapages/tree/main/internal/generator/agentdocs/data/skills/datapages-offline into .claude/skills/datapages-offline/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "datapages-offline", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/romshark/datapages/tree/main/internal/generator/agentdocs/data/skills/datapages-offlineType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add romshark/datapages --skill datapages-offline -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install romshark/datapages datapages-offline --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/romshark/datapages.git skills-src && mkdir -p .agents/skills && cp -r skills-src/internal/generator/agentdocs/data/skills/datapages-offline .agents/skills/datapages-offline && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "datapages-offline" agent skill from https://github.com/romshark/datapages/tree/main/internal/generator/agentdocs/data/skills/datapages-offline into .agents/skills/datapages-offline/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "datapages-offline", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add romshark/datapages --skill datapages-offline -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install romshark/datapages datapages-offline --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/romshark/datapages.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/internal/generator/agentdocs/data/skills/datapages-offline .cursor/skills/datapages-offline && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "datapages-offline" agent skill from https://github.com/romshark/datapages/tree/main/internal/generator/agentdocs/data/skills/datapages-offline into .cursor/skills/datapages-offline/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "datapages-offline", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/romshark/datapages.git --path internal/generator/agentdocs/data/skills/datapages-offline--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add romshark/datapages --skill datapages-offline -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install romshark/datapages datapages-offline --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/romshark/datapages.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/internal/generator/agentdocs/data/skills/datapages-offline .gemini/skills/datapages-offline && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "datapages-offline" agent skill from https://github.com/romshark/datapages/tree/main/internal/generator/agentdocs/data/skills/datapages-offline into .gemini/skills/datapages-offline/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "datapages-offline", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install romshark/datapages datapages-offlineInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add romshark/datapages --skill datapages-offline -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/romshark/datapages.git skills-src && mkdir -p .github/skills && cp -r skills-src/internal/generator/agentdocs/data/skills/datapages-offline .github/skills/datapages-offline && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "datapages-offline" agent skill from https://github.com/romshark/datapages/tree/main/internal/generator/agentdocs/data/skills/datapages-offline into .github/skills/datapages-offline/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "datapages-offline", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add romshark/datapages --skill datapages-offline -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install romshark/datapages datapages-offline --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/romshark/datapages.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/internal/generator/agentdocs/data/skills/datapages-offline .opencode/skills/datapages-offline && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "datapages-offline" agent skill from https://github.com/romshark/datapages/tree/main/internal/generator/agentdocs/data/skills/datapages-offline into .opencode/skills/datapages-offline/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "datapages-offline", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
datapages-offlineThe Datapages service worker: offline page snapshots and cached shims written by handlers through the pageCache parameter, the offline module and its Config, and the PageOffline fallback.
Datapages Offline is an agent skill from romshark/datapages. The Datapages service worker: offline page snapshots and cached shims written by handlers through the pageCache parameter, the offline module and its Config, and the PageOffline fallback.
Its SKILL.md is about 2.6k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
The repository describes itself as: A Datastar Go web frontend framework. The licence is MIT.
Read from SKILL.md and the folder at commit 87d5a44. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are go and css).
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Datapages Offline loads about 2.6k tokens when it runs. Until then it costs about 51 tokens; SKILL.md has 1,124 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from romshark/datapages at commit 87d5a44, republished under its MIT licence (© romshark). 1,124 words, ~2,571 tokens.
.claude/skills/datapages-offline/SKILL.md (or your agent's skills folder).Read datapages first for the build loop, hard rules and naming conventions.
modules/offline serves a service worker and adds registration to HTML responses. Handlers write its cache through the pageCache datapages.PageCacheWriter parameter:
Set): served only while the browser is offline.SetShim): served online too, at once, then replaced by the live page.The worker runs only in a secure context (HTTPS or localhost). Everywhere else the API does nothing.
Declaring PageOffline generates a WithOffline option with that page's route:
// PageOffline is /offline
type PageOffline struct{ App *App }
func (PageOffline) GET(r *http.Request) (body datapages.Component, err error) {
return pageOffline(), nil
}opts := []datapages.ServerOption{
// Self-host Datastar: the CDN is unreachable offline.
datapages.WithDatastarJS(assets.Path("datastar.js")),
datapagesgen.WithOffline(app.OfflineConfig()),
}// OfflineWorkerVersion identifies the installed worker and its cache. Increment
// it after a Datapages upgrade or a change to Assets, ExcludePaths,
// CrossOriginDestinations, OfflineClass, or PageOffline. Changes to Assets or
// PageOffline require a new installation because the worker fetches them only
// during installation.
const OfflineWorkerVersion = 1
func OfflineConfig() offline.Config {
return offline.Config{
WorkerVersion: OfflineWorkerVersion,
// Precache the files required to render cached pages offline.
Assets: []string{
assets.Path("style.css"), assets.Path("datastar.js"),
},
}
}For shims without PageOffline, install the module directly:
offline.WithServiceWorker("", offline.Config{WorkerVersion: 1})offline.Config field | default |
|---|---|
WorkerVersion | 1; increment after a Datapages upgrade or a change to Assets, ExcludePaths, CrossOriginDestinations, OfflineClass, or PageOffline |
ScriptURL | /service-worker.js; the scope is the whole origin either way |
Assets | none; files cached during installation |
OfflineClass | is-offline, toggled on <html> while offline |
CrossOriginDestinations | image, style, script, font; empty non-nil disables |
ExcludePaths | none; same-origin prefixes never cached |
Style offline state in CSS, no Go code:
.is-offline [data-needs-network] { opacity: .5; pointer-events: none }Register a compressing middleware before WithOffline. Middleware runs in the order it is given, and the offline middleware rewrites the HTML it receives. A response that already carries a Content-Encoding passes through unchanged, which leaves the page without the worker registration.
Offline support writes inline scripts: the connectivity script, the worker registration and queued cache writes. Each script uses the nonce from WithCSPNonce. WithOffline reads the nonce when each request arrives, independent of option order. Set offline.Config.CSPNonce to use a different nonce for these scripts.
When offline.Config.CSPNonce is nil, offline.WithServiceWorker uses the nonce from WithCSPNonce. Calling offline.Middleware through datapages.WithMiddleware does not copy the server nonce. A nonce-only policy blocks the middleware scripts.
A cached page is rendered once and replayed. It cannot contain a valid per-response nonce. Its shim hydration trigger and connectivity script are written without one. The service worker provides no policy header, and the browser does not require a nonce. A Content-Security-Policy in a meta element would block those scripts.
PageOffline is reserved like PageError404 and PageError500. The worker caches it during installation and returns it for an uncached URL while offline. It renders with a zero Session. Datapages supplies a minimal default.
The parameter is optional on GET methods and on page or *App actions.
| method | effect |
|---|---|
Version() | the version the client holds for this request's URL, 0 if none |
Set(url, body, version) | cache body for url, served only while offline |
SetShim(url, body, version) | cache body for url, served online too |
Clear(url) | remove one entry |
ClearAll() | remove every page cache entry |
url comes from the generated href package. Writes remain queued until the handler returns without error. The worker then applies them together, with ClearAll first.
Version() covers this URL only. Caching any other URL is therefore unconditional.
func (p PagePost) GET(
r *http.Request,
pageCache datapages.PageCacheWriter,
path datapages.Path[struct {
Slug string `path:"slug"`
}],
) (body datapages.Component, err error) {
post, ok := p.App.Post(path.Values.Slug)
if !ok {
return nil, datapages.ErrNotFound
}
if ver := postVersion(post); pageCache.Version() != ver {
pageCache.Set(href.PagePost(post.Slug), postOffline(post), ver)
}
return postPage(post), nil
}A snapshot need not match the live body. It is what the user sees with no network: leave out what cannot work there.
A GET can cache its own page when visited. An action can cache other URLs, such as ticket pages created by a purchase.
A shim renders the navigation and layout with placeholders for slow content. The worker returns the cached shim immediately and fetches the live page in parallel. Datapages adds the trigger that replaces the shim's head and body through Datastar. The shim contains no Datastar attributes.
A shim renders with no session and contains no CSRF script. Do not put actions in the placeholder content.
// shimVersion changes when the placeholder markup changes.
const shimVersion = 1
func (p PageIndex) GET(
r *http.Request, pageCache datapages.PageCacheWriter,
) (body datapages.Component, err error) {
rows, err := p.App.Rows(r.Context())
if err != nil {
return nil, err
}
if pageCache.Version() != shimVersion {
pageCache.SetShim(href.PageIndex(), shim(len(rows)), shimVersion)
}
return indexPage(rows), nil
}A shim is also shown online. It must not make an offline-only claim. If the live request fails, the shim remains visible.
Pass the page body, not a document. Datapages adds the same <head>, stylesheets and Datastar bundle used by a live page. Adding <!DOCTYPE html> to the body would nest one document inside another.
A cached page is only as complete as its assets. Its stylesheets, scripts, fonts and images must be cached too. Config.Assets is precached on install. Everything else is cached on its first load while online: same-origin files other than what Datastar requests (actions, hydrates and event streams always come from the network) and other than Config.ExcludePaths, plus cross-origin requests whose destination is in Config.CrossOriginDestinations. An asset that is neither listed nor ever loaded online is missing offline. A cached same-origin asset is refreshed behind the copy it serves: a file redeployed at the same URL lands on the next visit, with no WorkerVersion bump.
Version by everything the body depends on. A constant version caches once and never refreshes. Include the content state, such as an item count or an ownership flag.
// The ownership button changes, so ownership is part of the version.
ver := snapshotVersion(session.UserID, owned) // For example, an FNV-1a hash.
if pageCache.Version() != ver {
pageCache.Set(href.PagePost(slug), postOffline(post), ver)
}Use !=, not <, for an unordered version key such as a hash. < re-caches only on an increase and silently keeps a stale entry.
Use ClearAll() when one change invalidates many pages. Examples include locale, permission and session changes. Entries return only after a handler calls Set again. Call ClearAll() during sign-in and sign-out.
Update invalidated entries. A page cached by its GET updates on the next online visit. An action that changes another cached page should call Set for that page.
A snapshot is stored in the browser's cache for the origin. Any script on that origin can read it. It is not bound to a session and stays readable after the visitor signs out.
ClearAll() from the sign-in and sign-out handlers. Only Clear and ClearAll remove an entry.The generated code picks how queued writes reach the worker from the handler signature, first row that matches. An action on *App follows the same rules as one on a page.
| handler | delivery |
|---|---|
GET | embedded in the page HTML and applied on load |
action taking sse | sent over that stream |
action returning redirect | sent in its text/javascript response; navigation waits up to 500ms for the worker. This applies even when the action also returns a body |
| action returning only a body | embedded in the rendered document |
| action returning neither | sent over an SSE stream opened for that purpose |
An action that takes datapages.PageCacheWriter answers 406 to a request without Datastar-Request: true. Call it through a Datastar action, not a plain form: an HTTP redirect cannot carry the writes.
newSession and closeSession cannot be combined with sse. Sign-in and sign-out therefore take pageCache and return a redirect. Navigation waits up to 500ms for the worker to apply ClearAll before loading the destination.
© romshark, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in internal/generator/agentdocs/data/skills/datapages-offline of romshark/datapages.
Open the folder on GitHubat commit 87d5a44
Datapages Offline next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Datapages Offline this skillromshark/datapages | 113 | — | ~2.6k | Automated safety check: Pass | MIT | |
| Prompt Cachingsickn33/agentic-awesome-skills | 47k | 2 repos | ~3.4k | Automated safety check: Pass | MIT | |
| Prompt Cachingdavila7/claude-code-templates | 32k | 5 repos | ~452 | Automated safety check: Pass | MIT | |
| Turborepo Cachingwshobson/agents | 40k | 9 repos | ~2k | Automated safety check: Notes | MIT | |
| OmniRoute LLM Cachediegosouzapw/OmniRoute | 74k | — | ~529 | Automated safety check: Pass | MIT | |
| Cachingzebbern/claude-code-guide | 4.7k | — | ~1.5k | Automated safety check: Pass | MIT |
sickn33/agentic-awesome-skills
Caching strategies for LLM prompts including Anthropic prompt caching, response caching, and CAG (Cache Augmented Generation)
davila7/claude-code-templates
Caching strategies for LLM prompts including Anthropic prompt caching, response caching, and CAG (Cache Augmented Generation) Use when: prompt caching, cache prompt, response cache, cag, cache…
wshobson/agents
Configures Turborepo pipelines and local or remote caching for monorepo builds, including Vercel remote cache, a self-hosted cache and cache-miss debugging.
diegosouzapw/OmniRoute
Documents OmniRoute's cache endpoints for reading cache statistics and clearing entries, statistics or the reasoning cache, with notes on TTL and similarity settings.
zebbern/claude-code-guide
Caching strategies — invalidation, TTL guidelines, cache keys, cache layers, and when not to cache.
affaan-m/ECC
Caches slow file processing results in Python keyed by a SHA-256 hash of the file content, so renames still hit the cache and edits invalidate it automatically.
romshark/datapages
Apply the Datapages framework rules, build loop and naming conventions, and select the relevant task skill.
romshark/datapages
Datapages real-time events: event types and subjects, dispatchers, On handlers, per-user and signal-bound subject fields, and the StreamOpen and StreamClose hooks.
romshark/datapages
Add Datapages authentication: define and read the Session type, open and close sessions, configure CSRF protection and choose a session manager.
romshark/datapages
Add per-tab Datapages State[T], initialize and use it in handlers, dispatch state-scoped events, and configure the live instance limit.
romshark/datapages
Classify Datapages findings by reach and severity and write review-.md reports.
romshark/datapages
Write Datapages commit messages, including the breaking-change marker and the BREAKING block.
The Datapages service worker: offline page snapshots and cached shims written by handlers through the pageCache parameter, the offline module and its Config, and the PageOffline fallback. Datapages Offline is an agent skill from romshark/datapages. The Datapages service worker: offline page snapshots and cached shims written by handlers through the pageCache parameter, the offline module and its Config, and the PageOffline fallback.
Run `npx skills add romshark/datapages --skill datapages-offline -a claude-code`. Or copy the skill folder (internal/generator/agentdocs/data/skills/datapages-offline in romshark/datapages) into .claude/skills/datapages-offline in your project. Claude Code loads it when a task matches its description.
Run `npx skills add romshark/datapages --skill datapages-offline -a codex`. Or copy the skill folder (internal/generator/agentdocs/data/skills/datapages-offline in romshark/datapages) into .agents/skills/datapages-offline in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add romshark/datapages --skill datapages-offline -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/datapages-offline, .gemini/skills/datapages-offline, .github/skills/datapages-offline and .opencode/skills/datapages-offline in your project.
SKILL.md names no scripts, command-line tools or credentials: Datapages Offline is instructions for the agent only.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Datapages Offline is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 2.6k tokens (SKILL.md is roughly 10k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Datapages Offline: Prompt Caching (sickn33/agentic-awesome-skills, 47k stars), Prompt Caching (davila7/claude-code-templates, 32k stars), Turborepo Caching (wshobson/agents, 40k stars) and OmniRoute LLM Cache (diegosouzapw/OmniRoute, 74k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
romshark (a GitHub user) maintains it in romshark/datapages, which has 113 GitHub stars. The repository holds 15 skills in this directory. The repository was last updated on October 7, 2026.
Source: romshark/datapages on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.