Skip to content

feat: serve skill files dynamically with configurable base URL#21

Open
jonasRoX wants to merge 1 commit into
moleculeprotocol:mainfrom
roxhealth:feat/dynamic-skill-files
Open

feat: serve skill files dynamically with configurable base URL#21
jonasRoX wants to merge 1 commit into
moleculeprotocol:mainfrom
roxhealth:feat/dynamic-skill-files

Conversation

@jonasRoX

Copy link
Copy Markdown

Summary

  • Skill files (skill.md, heartbeat.md, skill.json, skills.json) are now served via API route handlers instead of as static files
  • Source files moved from public/ to data/ so route handlers take precedence
  • Handlers replace the canonical base URL (https://beach.science) with NEXT_PUBLIC_SITE_URL at request time
  • On the canonical deployment, no replacement happens (env var matches the canonical URL)

Motivation

Self-hosted deployments need skill files to point to their own domain. Previously this required build-time sed hacks in the Dockerfile. This approach is clean, maintainable, and works for any deployment by just setting NEXT_PUBLIC_SITE_URL.

Changes

File Change
data/skill.md Moved from public/ (unchanged content)
data/heartbeat.md Moved from public/ (unchanged content)
data/skill.json Moved from public/ (unchanged content)
data/skills.json Moved from public/ (unchanged content)
src/lib/skill-files.ts New — shared helper to read + replace base URL
src/app/skill.md/route.ts New — route handler
src/app/heartbeat.md/route.ts New — route handler
src/app/skill.json/route.ts New — route handler
src/app/skills.json/route.ts New — route handler
CLAUDE.md Updated to reflect data/ location

Test plan

  • curl https://beach.science/skill.md returns skill file with beach.science URLs (no change)
  • Self-hosted instance with NEXT_PUBLIC_SITE_URL=https://custom.domain returns skill file with custom.domain URLs
  • curl https://beach.science/skill.json returns valid JSON
  • Agent registration via skill file works on self-hosted instance

🤖 Generated with Claude Code

Skill files (skill.md, heartbeat.md, skill.json, skills.json) are now
served via API route handlers instead of as static files. The handlers
read source files from data/ and replace the canonical base URL
(https://beach.science) with NEXT_PUBLIC_SITE_URL at request time.

This allows self-hosted deployments to serve skill files that point
to their own domain without any build-time hacks or source modifications.
On the canonical beach.science deployment, no replacement happens.

Changes:
- Move skill files from public/ to data/ (prevents static file override)
- Add src/lib/skill-files.ts (shared read + replace helper)
- Add route handlers for /skill.md, /heartbeat.md, /skill.json, /skills.json
- Update CLAUDE.md to reflect new file locations
@vercel

vercel Bot commented Apr 14, 2026

Copy link
Copy Markdown

@jonasRoX is attempting to deploy a commit to the Molecule Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant