Agent skill

Datapages Offline

by romshark in 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.

MITAuto-check passed

Install Datapages Offline

skills CLI
$ npx skills add romshark/datapages --skill datapages-offline -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install romshark/datapages datapages-offline --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ 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-src

Use ~/.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/

Facts

Skill name
datapages-offline
GitHub stars
113
Token cost
~2.6k tokens
SKILL.md length
1,124 words
Files
1
Skills in repo
15
Repo updated
First seen
Licence
MIT

At a glance

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.

  • SKILL.md covers Configure the module, PageOffline, The pageCache parameter and Snapshots, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

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.

Example prompts

  • “/datapages-offline”

What it can do on your machine

Read from SKILL.md and the folder at commit 87d5a44. It shows what the files ask for, not the result of running them.

  • Tool permissions

    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.

  • Runs code

    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.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

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.

Always · name and description, kept in context so the agent knows when to use it
~51
When it runs · the whole SKILL.md, loaded when a task matches
~2.6k

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.

Safety

Auto-check passed

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.

SKILL.md

The full file from romshark/datapages at commit 87d5a44, republished under its MIT licence (© romshark). 1,124 words, ~2,571 tokens.

Download SKILL.mdSave it as .claude/skills/datapages-offline/SKILL.md (or your agent's skills folder).
name
datapages-offline
description
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.

Offline and instant loads

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:

  • Snapshots (Set): served only while the browser is offline.
  • Shims (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.

Configure the module

Declaring PageOffline generates a WithOffline option with that page's route:

go
// PageOffline is /offline
type PageOffline struct{ App *App }

func (PageOffline) GET(r *http.Request) (body datapages.Component, err error) {
	return pageOffline(), nil
}
go
opts := []datapages.ServerOption{
	// Self-host Datastar: the CDN is unreachable offline.
	datapages.WithDatastarJS(assets.Path("datastar.js")),
	datapagesgen.WithOffline(app.OfflineConfig()),
}
go
// 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:

go
offline.WithServiceWorker("", offline.Config{WorkerVersion: 1})
offline.Config fielddefault
WorkerVersion1; 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
Assetsnone; files cached during installation
OfflineClassis-offline, toggled on <html> while offline
CrossOriginDestinationsimage, style, script, font; empty non-nil disables
ExcludePathsnone; same-origin prefixes never cached

Style offline state in CSS, no Go code:

css
.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

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 pageCache parameter

The parameter is optional on GET methods and on page or *App actions.

methodeffect
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.

Snapshots

go
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.

Shims

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.

go
// 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.

Show full SKILL.md (559 more words)Show less

Rules

  • 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.

    go
    // 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.

What may be cached

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.

  • Call ClearAll() from the sign-in and sign-out handlers. Only Clear and ClearAll remove an entry.
  • A redirect waits up to 500ms for the worker. A tab closed before that keeps its old entries.
  • Leave out what must not outlive the session: a payment detail, a token, another person's data. Cache the page without it.
  • A snapshot renders with the zero session. A template that branches on the session takes the signed-out branch. Put the visitor in the version key when a snapshot has to differ per visitor.

Delivery

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.

handlerdelivery
GETembedded in the page HTML and applied on load
action taking ssesent over that stream
action returning redirectsent 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 bodyembedded in the rendered document
action returning neithersent 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

Files

Just SKILL.md in internal/generator/agentdocs/data/skills/datapages-offline of romshark/datapages.

Open the folder on GitHubat commit 87d5a44

Compare with similar skills

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.

Datapages Offline compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Datapages Offline this skillromshark/datapages113—~2.6kAutomated safety check: PassMIT
Prompt Cachingsickn33/agentic-awesome-skills47k2 repos~3.4kAutomated safety check: PassMIT
Prompt Cachingdavila7/claude-code-templates32k5 repos~452Automated safety check: PassMIT
Turborepo Cachingwshobson/agents40k9 repos~2kAutomated safety check: NotesMIT
OmniRoute LLM Cachediegosouzapw/OmniRoute74k—~529Automated safety check: PassMIT
Cachingzebbern/claude-code-guide4.7k—~1.5kAutomated safety check: PassMIT

Similar skills

  • Prompt Caching

    sickn33/agentic-awesome-skills

    Caching strategies for LLM prompts including Anthropic prompt caching, response caching, and CAG (Cache Augmented Generation)

    47k GitHub starsUsed in 2 repos~3.4k tokens
    AI & LLM EngineeringAuto-check passed
  • Prompt Caching

    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…

    32k GitHub starsUsed in 5 repos~452 tokens
    Backend & APIsAuto-check passed
  • Turborepo Caching

    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.

    40k GitHub starsUsed in 9 repos~2k tokens
    DevelopmentAuto-check: notes
  • OmniRoute LLM Cache

    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.

    74k GitHub stars~529 tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • Caching

    zebbern/claude-code-guide

    Caching strategies — invalidation, TTL guidelines, cache keys, cache layers, and when not to cache.

    4.7k GitHub stars~1.5k tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • 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.

    276k GitHub starsUsed in 5 repos~1.4k tokens
    DevelopmentAuto-check passed

More from romshark/datapages

All 15 skills in this repo
  • Datapages

    romshark/datapages

    Apply the Datapages framework rules, build loop and naming conventions, and select the relevant task skill.

    113 GitHub stars~1.9k tokensUpdated 2 days ago
    Auto-check passed
  • Datapages Events

    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.

    113 GitHub stars~1.4k tokensUpdated 2 days ago
    Auto-check passed
  • Datapages Sessions

    romshark/datapages

    Add Datapages authentication: define and read the Session type, open and close sessions, configure CSRF protection and choose a session manager.

    113 GitHub stars~1.1k tokensUpdated 2 days ago
    Auto-check passed
  • Datapages State

    romshark/datapages

    Add per-tab Datapages State[T], initialize and use it in handlers, dispatch state-scoped events, and configure the live instance limit.

    113 GitHub stars~806 tokensUpdated 2 days ago
    Auto-check passed
  • Review Criteria

    romshark/datapages

    Classify Datapages findings by reach and severity and write review-.md reports.

    113 GitHub stars~1.2k tokensUpdated 2 days ago
    Auto-check passed
  • Git Commits

    romshark/datapages

    Write Datapages commit messages, including the breaking-change marker and the BREAKING block.

    113 GitHub stars~960 tokensUpdated 2 days ago
    Auto-check passed

Questions about Datapages Offline

What does Datapages Offline do?

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.

How do I install Datapages Offline in Claude Code?

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.

How do I install Datapages Offline in Codex?

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.

Can I use Datapages Offline in Cursor, Gemini CLI or GitHub Copilot?

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.

What does Datapages Offline need to run?

SKILL.md names no scripts, command-line tools or credentials: Datapages Offline is instructions for the agent only.

Does Datapages Offline access the network?

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.

Is Datapages Offline safe to install?

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.

What licence does Datapages Offline use?

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.

How many tokens does Datapages Offline use?

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.

What are the alternatives to Datapages Offline?

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.

Who maintains Datapages Offline?

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.