agentleFS
vstorm-covstorm-co/agenticos/.claude/skills/frontend-feature/SKILL.md

frontend-feature

Skill54 starsChanged 3 months agoApache-2.0View on GitHub

Build or change a page, view or data-driven feature in the Next.js frontend — a route under the dashboard, wiring UI to a backend endpoint, a Zustand store, a permission that must hide a control, or localized copy. Use for any work in frontend/src, including "the page renders but shows an empty state" and "this button should not be visible to a Viewer".

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use the versions declared in frontend/package.json and the lockfile.

    line 8
  2. Very specific:

    Never scatter fetch in components.

    line 32
  3. Distinctive:

    Every dashboard page fans out to several queries and renders its empty state when a query fails.

    line 63
  4. Distinctive:

    When a page looks empty, check the network tab before the component.

    line 67

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Frontend — Next.js and React

Use the versions declared in frontend/package.json and the lockfile.

.claude/rules/frontend.md has the conventions. docs/architecture.md has the request path. This is the working layout and the traps.

Layout

Path
src/app/[locale]/(dashboard)/…The product: agents, chat, rag (knowledge bases + search; kb only redirects there), skills, vault, mcp-servers, runs, orgs, settings, admin, invitations, profile
src/app/[locale]/(auth)/…, auth/, onboarding/, legal/, shared/Everything else
src/app/api/…Route handlers that proxy to the backend (same-origin auth cookies)
src/lib/Typed API clients on api-client.ts, server-api.ts, query-keys.ts
src/hooks/One per resource: use-agents, use-skills, use-permissions, …
src/stores/Zustand, one per concern, re-exported from index.ts
src/components/<domain>/UI by domain; primitives in components/ui/, empty/error in components/states/

Routes are locale-prefixed. There is no (marketing) group.

Steps

  1. Page — src/app/[locale]/(dashboard)/<feature>/page.tsx. Server Component by default; "use client" only for state, effects or handlers.
  2. Client — a typed module in src/lib/<feature>-api.ts built on api-client.ts. Never scatter fetch in components. Server-side reads go through server-api.ts.
  3. Query keys — register in src/lib/query-keys.ts so invalidation stays consistent.
  4. Hook — src/hooks/use-<feature>.ts wrapping the client, exported from hooks/index.ts. Components consume hooks, not clients.
  5. Store — only for UI/ephemeral state. Server data belongs in the query layer.
  6. Components — under src/components/<domain>/, composed from components/ui/. Under ~100 lines; extract when they grow.
  7. i18n — every user-facing string through next-intl. Never hardcode copy.
  8. Verify:
    cd frontend && bun run type-check && bun run lint && bun run test

Permissions hide controls, and that needs a test

use-permissions.ts reads the effective permission set for the active organization. A control the caller may not use should not be rendered — not rendered-and-then-403.

Write the integration test. *.integration.test.tsx runs Testing Library against a mocked API and is the cheap, precise place to assert that a permission actually hides a button and that a form submits what it claims to. See components/agents/capability-settings.integration.test.tsx, components/teams/members-table.integration.test.tsx, components/mcp/mcp-server-list.integration.test.tsx.

This is not E2E work. Reserve Playwright for journeys crossing the whole stack — see the e2e-tests skill.

The empty-state trap

Every dashboard page fans out to several queries and renders its empty state when a query fails. "No skills yet" and "the skills request answered 502" are the same pixels. So:

  • When a page looks empty, check the network tab before the component.
  • A test that asserts a heading and a button passes against a backend that was never started. Assert on data.

Tests

bun run test          # vitest watch
bun run test:run      # once
bun run test:coverage
bun run test:e2e      # playwright — see the e2e-tests skill

Unit tests sit beside the source (agent-spec.test.ts, auth-store.test.ts); integration tests are *.integration.test.tsx.

Generated files

src/lib/brand-glyphs.generated.ts is written by bun run gen:brand-icons, which fetches every brand mark the console draws — services and connectors from Simple Icons and Font Awesome, model providers from @lobehub/icons-static-svg — and bakes them in as raw SVG path data. It is the only source of a brand mark: BrandIcon, brandMark(name) and ProviderIcon read it, and nothing else. Adding a mark is a row in BRANDS or PROVIDERS in scripts/gen-brand-icons.ts plus a re-run — not an icon package, and not a hand-authored d. This replaced react-icons and @lobehub/icons in #156: 199 MB installed for 89 marks whose artwork the generator fetches from the same upstream sets, byte for byte.

src/lib/mcp-logos.generated.ts is written by bun run gen:mcp-logos, which fetches each catalog server's favicon and bakes it in as a base64 data URI so the demo MCP badge renders in a self-contained HTML export with no network. Do not hand-edit it — regenerate after changing mcp_servers.json.

Neither is hand-edited, and make lint will not catch it if you do — the guard is that both files say so at the top and both regenerate deterministically, so a hand edit is lost on the next run.

That is separate from the backend icon contract (app/core/catalog/icons/<name>.svg, served as a currentColor silhouette) — see the project-docs and mcp-connections skills.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.