Skip to content

feat: add web-fragments skill#29

Open
oto-macenauer-absa wants to merge 1 commit into
masterfrom
feature/skill-web-fragments
Open

feat: add web-fragments skill#29
oto-macenauer-absa wants to merge 1 commit into
masterfrom
feature/skill-web-fragments

Conversation

@oto-macenauer-absa

Copy link
Copy Markdown
Contributor

Summary

Adds a web-fragments skill: building, embedding, debugging, and deploying micro-frontends with the Web Fragments framework (the web-fragments npm package).

The skill encodes the real v0.8.x API (from the library source, not stale public docs) so an agent can write correct code without reading node_modules or re-researching the basics.

Structure (progressive disclosure, token-optimized)

skills/web-fragments/
├── SKILL.md                      hub: mental model, exact API, workflow, gotchas
├── references/
│   ├── api-reference.md          every export, full FragmentConfig, deprecations
│   ├── host-integration.md       per-framework middleware (Express, CF, Vercel, Netlify, Hono, Angular, Next, Vite)
│   ├── fragment-authoring.md     build a fragment (unique assetsDir ↔ routePattern rule)
│   ├── troubleshooting.md        known issues + fixes
│   ├── css-and-styling.md        verified shadow-boundary behavior (:root vs :host, @layer, inheritance)
│   ├── csp-and-iframe.md         X-Frame-Options / frame-ancestors so the hidden iframe isn't blocked
│   ├── piercing-and-performance.md  piercing internals, caching, mode:production, route specificity
│   └── frameworks-astro.md       Astro embed, ClientRouter, #297 bug, smooth-transition workaround
├── scripts/
│   ├── scaffold-fragment.mjs     generate a Vite fragment + aligned gateway snippet
│   ├── doctor.mjs                static-check a host/fragment project for v0.8.x gotchas
│   └── experiments/             reproducible Playwright experiments backing the verified findings
└── evals/evals.json

How it was validated

  • API verified against the library source (gateway middleware + element source), not just the website docs (several of which are stale — e.g. the non-existent web-fragments/middleware import path).
  • Empirical findings via Playwright: CSS isolation across the nested shadow boundary (:root is dead inside a fragment, :host works, @layer is tree-scoped), and Astro <ClientRouter /> behavior.
  • Bug found, reproduced, and filed upstream as web-fragments#297 (head <style>/<link> accumulate across ClientRouter navigation), plus a verified smooth-transition-without-ClientRouter workaround.
  • doctor.mjs checks (wrong import path, register vs registerFragment, asset/routePattern mismatch, missing middleware, X-Frame-Options: DENY, unscoped static before middleware) are smoke-tested.

Notes

  • Reference experiments under scripts/experiments/ are source-only (no node_modules/build output); re-running them needs Node + a Chromium from @playwright/test.
  • Complements the upstream /web-fragments:* slash commands proposed in web-fragments PR #294 — this skill supplies auto-triggered knowledge; those commands run specific tasks.

Skill for building, embedding, debugging, and deploying micro-frontends with
the Web Fragments framework (web-fragments npm package).

- SKILL.md hub: mental model, exact v0.8.x API, workflow, gotchas (progressive
  disclosure, token-optimized)
- references/: api-reference, host-integration (per-framework middleware),
  fragment-authoring, troubleshooting, css-and-styling, csp-and-iframe,
  piercing-and-performance, frameworks-astro
- scripts/: scaffold-fragment.mjs (generate a Vite fragment + gateway snippet),
  doctor.mjs (static-check a host/fragment project for v0.8.x gotchas)
- scripts/experiments/: reproducible Playwright experiments backing the verified
  CSS-isolation and Astro findings

Knowledge verified against the library source and Playwright; includes the
head-style-accumulation bug filed upstream as web-fragments#297 and a verified
smooth-transition-without-ClientRouter workaround.
@oto-macenauer-absa oto-macenauer-absa force-pushed the feature/skill-web-fragments branch from a8f9ed5 to febec37 Compare June 24, 2026 08:28

@miroslavpojer miroslavpojer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, this is big and complex.
From skill point of view I do not see an issue.

I suggest to invite UI developer as reviewer here.

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.

2 participants