Communitygithub.com

ben-eddy74/agent-skills

Builds and updates Vite + Lit Web Components inside the frontend/ directory using OpenAPI-generated TypeScript contracts. Trigger this when creating UI views, web components, styling, or wiring frontend state to backend APIs.

What is agent-skills?

agent-skills is a Claude Code agent skill that builds and updates Vite + Lit Web Components inside the frontend/ directory using OpenAPI-generated TypeScript contracts. Trigger this when creating UI views, web components, styling, or wiring frontend state to backend APIs.

Works with~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ben-eddy74/agent-skills/tree/HEAD/vite-lit-frontend

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

Vite + Lit Web Component Workflow

Scope & Directory Boundary

  • STRICT BOUNDARY: Operate ONLY inside frontend/. Never modify backend/ source code.
  • Source of Truth: The backend API contract is read-only from ../backend/target/generated/openapi/openapi.yaml.

Execution Steps

Step 1: Sync OpenAPI Contract & Component Header (STOP FOR HUMAN REVIEW)

  1. Run npm run sync-api in frontend/ to regenerate src/api/schema.d.ts from the backend OpenAPI spec.
  2. Create or update the target Lit .ts component files with ONLY the top contract header (first ~30 lines):
    • @customElement('...')
    • Typed @property() declarations (referencing OpenAPI generated types, never any).
    • Dispatched CustomEvent detail type definitions.
    • declare global { interface HTMLElementTagNameMap { ... } }
  3. PAUSE: If creating a new view or changing component contracts, let the user verify the @property() header before writing heavy DOM/CSS. (Skip pause for pure CSS/visual tweaks).

Step 2: Black-Box Implementation

  1. Implement render() and static styles = css inside the Lit component.
  2. Encapsulation Rules:
    • Properties Down, Events Up.
    • Never use document.querySelector or pierce another component's shadowRoot.
    • Never hand-write raw fetch() calls with untyped JSON; use the typed API client.
    • Keep each component file under 250 lines.

Step 3: Mechanical Verification & Static Bundle Build

Run inside frontend/ and fix any errors before reporting completion:

npm run verify && npm run build

Individual skills in this repo

This repo contains 1 individual skill — each has its own dedicated page.

Related Skills