
feature-implementation-scaffold
A comprehensive full-stack checklist for implementing new features consistently and safely.
Feature Implementation
Phase 1: Backend
Follow this order — each step builds on the previous:
-
Model —
backend/models/<entity>.py- Define SQLAlchemy ORM class extending
Base - If schema changed → use database_migration skill
- Define SQLAlchemy ORM class extending
-
Schema —
backend/schemas/<entity>.py- Pydantic response/request models with
ConfigDict(from_attributes=True) - Separate
Create,Update, andResponseschemas
- Pydantic response/request models with
-
Repository —
backend/repositories/<entity>_repository.py- Async CRUD operations using
AsyncSession - Use
selectinload/joinedloadto prevent N+1 - Test:
backend/tests/unit/repositories/test_<entity>_repository.py
- Async CRUD operations using
-
Service —
backend/services/<entity>_service.py(if business logic needed)- Orchestrates repository calls, external APIs, KPI calculations
- Injected via
Depends()in routers
-
Router —
backend/routers/v1/<entity>.py- Use
response_modelon all decorators - Inject service via dependency:
service: EntityService = Depends(get_entity_service) - Register in
backend/main.pywith prefix - Test:
backend/tests/unit/routers/test_<entity>.py
- Use
-
Verify: Run
safe_pushbackend validation -
Commit:
feat(backend): implement <entity> logic
Phase 2: Frontend
-
Types —
frontend/src/types/<entity>.ts- Mirror backend Pydantic schemas as TypeScript interfaces
-
Query Hook —
frontend/src/hooks/queries/use<Entity>Query.ts- TanStack Query v5:
useQuery/useSuspenseQuery - Return
{ data, isLoading, error }
- TanStack Query v5:
-
Store (if UI state needed) —
frontend/src/store/<entity>Store.ts- Zustand for client-side state (selections, filters, toggles)
-
Component —
frontend/src/components/<Entity>/- Tailwind CSS v4,
<ResponsiveContainer>for charts - All user-facing text in Norwegian
- Tailwind CSS v4,
-
Route —
frontend/src/routes/<path>.tsx- Use lazy loading:
const Page = lazy(() => import(...)) - Add
<title>and<meta>for SEO
- Use lazy loading:
-
Verify: Run
safe_pushfrontend validation -
Commit:
feat(frontend): add <entity> ui
Phase 3: Push
Use the safe_push skill to push commits incrementally.