nextjs-fastapi-conventions
Shared conventions for Next.js 16 + FastAPI full-stack projects.
Skill by wtsi-hgi
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/wtsi-hgi-nextjs-fastapi-conventions
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: frontend, backend, testing
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/nextjs-fastapi-conventions
What's inside
- Skill name
nextjs-fastapi-conventions- Description
- Shared conventions for Next.js 16 + FastAPI full-stack projects. Architecture, code quality, testing, styling, and commands. Referenced by nextjs-fastapi-implementor and nextjs-fastapi-reviewer.
- License
- MIT
- Instructions
- 165 lines in SKILL.md · view on GitHub
Files (2)
- SKILL.md
- openai.yaml · agents/
SKILL.md (first lines)
# Next.js + FastAPI Conventions Single source of truth for architecture, code quality, and testing in Next.js + FastAPI full-stack projects. ## Project Stack - **Frontend:** Next.js 16 (App Router) + React 19 + shadcn/ui + Tailwind CSS v4 (TypeScript, in `frontend/`) - **Backend:** FastAPI + Uvicorn + Pydantic (Python 3.11+, in `backend/`) ## Architecture ### BFF Pattern The browser NEVER calls FastAPI directly. All backend communication flows through the Next.js server layer: - **Server Actions** (`app/actions.ts`) handle mutations. Client components call these; they run on the Next.js server and proxy to FastAPI. - **API Routes** (`app/api/*/route.ts`) exist ONLY for external consumers (health checks, webhooks), NOT for frontend use. ### Type Safety (Zod Contracts) Every FastAPI response is validated on the frontend with Zod: - `lib/contracts.ts`: Zod schemas mirroring Pydantic models. - `lib/backend-client.ts`: `backendJson()` fetches + validates against Zod. - Contract breaks fail fast with `BackendRequestError`. **New endpoint checklist:** 1. Pydantic response model in `backend/api/schemas.py`. 2. Matching Zod schema in `frontend/lib/contracts.ts`. 3. Contract test in `frontend/tests/contracts.test.ts`. 4. `backendJson()` with schema in Server Action. ### Components - **Server Components** (default): fetch data, pass as props. - **Client Components** (`'use client'`): interactivity, browser APIs, hooks. ### React 19 - `useActionState` (NOT deprecated `useFormState`). - Explicit state types (e.g. `GreetingState` in `lib/greeting-state.ts`). ### Backend Structure - Lifespan via `@asynccontextmanager` (NOT `@app.on_event`). - `pydantic-settings` for typed config from env vars. - Versioned routers under `api/v1/`. - Every endpoint declares `response_model` and returns a Pydantic model. ## Code Quality ### Python - Async endpoints, `httpx.AsyncClient` (not `requests`). - Type hints everywhere. `Annotated` for FastAPI params. - Docstrings on modules, classes, public functions. - `HTTPException` for API errors. No swallowed exceptions. - Import grouping: stdlib | third-party | local. ### TypeScript - `strict: true`. Never `any` (prefer `unknown` + narrowing). - Zod for all external data; derive types with `z.infer<>`. - Server Actions: `'use server'`, return typed state objects. - shadcn/ui components from `components/ui/`. - Import grouping: React/Next.js | third-party | local `@/` (components > lib > types). - Tailwind v4 semantic tokens (`text-foreground`, `bg-muted`), not raw colours. ### Styling - Tailwind utility classes in JSX. `cn()` from `lib/utils.ts` for conditional classes. - Semantic tokens from `@theme`, not raw colour values. - Mobile-first responsive (`sm:`, `md:`, `lg:`). - CVA for component variants. Sonner for toasts. next-themes for theming. ### Tailwind v4 Runtime Theming - Treat Tailwind v4 theme variables as part of the runtime contract, not as ordinary CSS constants. Read the project's actual `globals.css`/theme setup before changing visual states. - If dark mode is driven by `next-themes` with `attribute="class"`, ensure Tailwind's `dark:` variant is also class-driven (for example with `@custom-variant dark (&:where(.dark, .dark *));`). Do not assume `.dark` affects Tailwind utilities when the compiled CSS still uses `prefers-color-scheme`. - Use `@theme inline` only when utilities should inline a referenced value. Do not use it for semantic colours that must change at runtime between light and dark themes; compiled utilities may freeze light-mode literals such as `#ffffff` or `#e2e8f0`. - For semantic colours that must respond to theme changes, prefer utilities that compile to runtime CSS variables, explicit arbitrary values such as `bg-[var(--color-card)]`, or small custom CSS rules that use `var(...)`. - When debugging Tailwind v4 styling, inspect the generated CSS or browser computed styles before changing specificity. Cascade layers, `!important`, and `@theme inline` can make source CSS misleading. ### File Organisation - Pages in `app/` (App Router). Reusable components in `components/`. - shadcn/ui in `components/ui/` (don't edit directly). - Shared utils/types in `lib/`. Import via `@/`. ## Testing - Follow **testing-principles** for test intent; this section covers stack mechanics. ### Backend (pytest) - `pytest` + `pytest-asyncio` (auto mode). - `httpx.AsyncClient` + `ASGITransport` against FastAPI `app`. - Assert status codes AND JSON payloads. - `@pytest.mark.anyio` for async tests.
From wtsi-hgi/agentskills, MIT.
More from wtsi-hgi/agentskills
- 0.592score
implementation-principles
wtsi-hgi
Shared cross-language delivery workflow and guidance for implementing the simplest sufficient solution, maximizing reuse of existing code, fixing root causes…
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
bugfix
wtsi-hgi
Orchestrates standalone or caller-batched bug fixes via implementor and reviewer subagents using TDD.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
orchestrator
wtsi-hgi
Orchestrates implementation, review, and user-path verification of phase plans via subagents.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
final-response
wtsi-hgi
Remove filler, repetition, process narration, fake enthusiasm, and AI-sounding prose from every chat message, and end each one with a "Your next action" line.
SkillAFreshness: A★ 1Claude Code +9 - 0.586score
agent-conduct
wtsi-hgi
Mandatory safety rules for all agents.
SkillAFreshness: A★ 1Claude Code +9 - 0.584score
go-reviewer
wtsi-hgi
Review Go implementations against spec acceptance tests.
SkillAFreshness: A★ 1Claude Code +9 - 0.584score
go-conventions
wtsi-hgi
Shared conventions for Go projects.
SkillAFreshness: A★ 1Claude Code +9 - 0.584score
deliver
wtsi-hgi
Only when explicitly invoked, take the requested change and every resulting branch, including incidental fixes, through PR review and verified user merges.
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
phase-creator
wtsi-hgi
Creates phase plan documents from a spec.md Implementation Order.
SkillAFreshness: A★ 1Claude Code +9 - 0.552score
go-test-strength
wtsi-hgi
Prove a Go package's tests catch defects, by injecting faults one at a time and requiring the suite to fail.
SkillBFreshness: B★ 1Claude Code +9 - 0.547score
frontend-design
wtsi-hgi
Create distinctive, production-grade frontend interfaces that avoid generic AI aesthetics.
SkillBFreshness: B★ 1Claude Code +9 - 0.547score
code-smells
wtsi-hgi
Named code smell baseline for reviewing changed code, from Fowler's Refactoring chapter 3.
SkillBFreshness: B★ 1Claude Code +9
Signals
- Stars
- 1
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Aug 20, 2026 (2 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/wtsi-hgi/agentskills
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from wtsi-hgi
- 0.592score
implementation-principles
wtsi-hgi
Shared cross-language delivery workflow and guidance for implementing the simplest sufficient solution, maximizing reuse of existing code, fixing root causes…
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
bugfix
wtsi-hgi
Orchestrates standalone or caller-batched bug fixes via implementor and reviewer subagents using TDD.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
final-response
wtsi-hgi
Remove filler, repetition, process narration, fake enthusiasm, and AI-sounding prose from every chat message, and end each one with a "Your next action" line.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
orchestrator
wtsi-hgi
Orchestrates implementation, review, and user-path verification of phase plans via subagents.
SkillAFreshness: A★ 1Claude Code +9 - 0.586score
agent-conduct
wtsi-hgi
Mandatory safety rules for all agents.
SkillAFreshness: A★ 1Claude Code +9 - 0.584score
go-conventions
wtsi-hgi
Shared conventions for Go projects.
SkillAFreshness: A★ 1Claude Code +9
Cite this page
nextjs-fastapi-conventions skill. Agent Mart. https://agentmart.dev/skills/wtsi-hgi-nextjs-fastapi-conventions (last updated 2026-10-24)