serverpod/relic/relic-static-files

Claude Code and agent skill by serverpod/relic

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Serve static files and directories with caching and cache busting in Relic. Use when serving assets, images, CSS, JS, favicons, or configuring HTTP cache control headers.

Install

npx vskill@latest install serverpod/relic/relic-static-files

SKILL.md

Relic Static Files

StaticHandler serves files with automatic MIME type detection, cache headers, and built-in security (path traversal protection, hidden file blocking, symlink safety).

Serve a directory

Use a tail pattern (/**) so the handler knows which file to serve:

dart
app.anyOf(
{Method.get, Method.head},
'/static/**',
StaticHandler.directory(
Directory('public'),
cacheControl: (req, fileInfo) => CacheControlHeader(maxAge: 86400),
).asHandler,
);
// public/style.css → http://localhost:8080/static/style.css

Serve a single file

dart
app.get(
'/logo.svg',
StaticHandler.file(
File('assets/logo.svg'),
cacheControl: (req, fileInfo) => CacheControlHeader(maxAge: 3600),
).asHandler,
);

Cache control strategies

Short-term (frequently updated content)
dart
StaticHandler.directory(
dir,
cacheControl: (req, fileInfo) => CacheControlHeader(
maxAge: 3600, // 1 hour
publicCache: true, // allow CDN/proxy caching
),
).asHandler
Long-term immutable (versioned assets)
dart
StaticHandler.directory(
dir,
cacheControl: (req, fileInfo) => CacheControlHeader(
maxAge: 31536000, // 1 year
publicCache: true,
immutable: true, // browsers never revalidate
),
).asHandler

Cache busting

Generates unique URLs based on file content hashes. When file content changes, the hash changes, forcing browsers to fetch the new version.

dart
final buster = CacheBustingConfig(
mountPrefix: '/static',
fileSystemRoot: Directory('public'),
);
// Generate cache-busted URLs (e.g., /static/hello@6cb65f8d.txt)
app.get('/', respondWith((req) async {
final cssUrl = await buster.assetPath('/static/style.css');
final html = '<link rel="stylesheet" href="$cssUrl">';
return Response.ok(body: Body.fromString(html, mimeType: MimeType.html));
}));
// Serve with aggressive caching (safe because URL changes on content change)
app.anyOf(
{Method.get, Method.head},
'/static/**',
StaticHandler.directory(
Directory('public'),
cacheControl: (req, fileInfo) => CacheControlHeader(
maxAge: 31536000,
publicCache: true,
immutable: true,
),
cacheBustingConfig: buster,
).asHandler,
);

Security

These protections are applied automatically:

  • Path traversal -- blocks ../ attempts to escape the served directory.
  • Hidden files -- blocks files starting with . (e.g., .env, .git).
  • Symbolic links -- safely resolved within the allowed directory.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
115
Repository forks
14
7-day trend score
24

Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 20 Mar 2026, 8 months ago.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/serverpod/relic/relic-static-files/badge)](https://verified-skill.com/skills/serverpod/relic/relic-static-files)

Something wrong with this skill or its page? Tell us.