| name | frontend-from-backend |
| description | Write production-ready frontend specifications deeply grounded in existing backend architecture. Prevents integration issues by starting with backend reality, not frontend imagination. |
| triggers | ["write a frontend spec from the backend","ground the frontend in the backend","frontend spec with backend context","frontend from backend","derive frontend types from Go structs","frontend spec before coding"] |
Frontend From Backend Skill
Version: 1.0
Author: Tres Pies Design
Purpose: Write high-quality frontend specifications that are deeply integrated with an existing backend, ensuring seamless development and preventing integration friction.
I. The Philosophy: Grounding Before Building
Frontend development in a full-stack application does not happen in a vacuum. The most common source of bugs, delays, and rework is a disconnect between the frontend implementation and the backend reality. This skill is built on a simple but powerful principle: grounding before building.
By deeply understanding the existing backend architecture, APIs, and data models before writing a single line of frontend specification, we prevent entire classes of integration problems. What we design is not just beautiful, but buildable.
II. When to Use This Skill
- When planning a new frontend feature that interacts with an existing backend
- When writing specifications for a UI redesign with a backend component
- When commissioning frontend work to an autonomous implementation agent
- When you feel a disconnect between the frontend vision and the backend reality
- At the beginning of any major frontend development cycle
III. The 5-Step Workflow
Step 1: Deep Backend Analysis
Goal: Achieve comprehensive understanding of the existing backend architecture.
- Read key backend files: Entry point, route registration, handlers, middleware
- Document APIs: Map all relevant endpoints with methods, auth requirements, request bodies, success/error responses
- Identify data models: Understand the shapes of data the backend returns
- Map integration points: For each frontend feature area, identify the specific backend endpoint it will consume
Output: A Backend Integration Map (table format).
Backend Integration Map Template:
| Feature Area | Endpoint | Method | Auth | Request Body | Success Response | Error Response |
|---|
| User List | /api/v1/users | GET | Bearer | - | { users: User[] } | { error: string } |
| Create User | /api/v1/users | POST | Bearer | { name: string } | { id: string } | { error: string, code: number } |
Step 2: Comprehensive Feature Specification
Goal: Write a production-ready specification grounded in backend reality.
- Executive summary and problem statement
- Goals, non-goals, and user stories
- Technical architecture — How frontend and backend will interact
- UI/UX interaction flows — With specific API calls mapped to each interaction
- API contracts — Request/response examples for every call
- Security considerations — Auth flow, token handling, CORS
Step 3: Component Architecture
Goal: Design the component tree with state shapes derived from backend data models.
For each component:
- Purpose — What it renders and why
- Props interface — TypeScript interface
- Internal state — TypeScript interface, derived from backend response types
- API calls — Which endpoints it consumes
- Loading state — What renders during fetch
- Error state — What renders on failure
- Empty state — What renders when data is empty
State Shape Derivation:
interface ApiUserResponse {
id: string;
name: string;
email: string;
created_at: string;
}
interface UserState {
users: ApiUserResponse[];
loading: boolean;
error: string | null;
}
Step 4: Integration Guide
Goal: Create a practical guide for wiring frontend to backend.
- Authentication flow — How the frontend handles auth (token storage, refresh, logout)
- API client setup — Base URL, headers, interceptors
- Streaming architecture — SSE/WebSocket connections if applicable
- Error handling patterns — How different HTTP status codes map to UI states
- Code examples — Actual fetch/axios calls with error handling
Step 5: Audit and Deliver
Goal: Verify completeness and save.
- Verify every frontend API call references a real backend endpoint
- Flag Backend Prerequisites — If the frontend needs an endpoint that doesn't exist, mark it explicitly
- Check state shapes match backend response types
- Save as
[version]_frontend_spec_[feature].md
IV. The "Backend Prerequisite" Pattern
When the frontend needs functionality the backend doesn't yet provide:
### Backend Prerequisite: [Feature Name]
**Needed by:** [Component/Feature that needs it]
**Proposed endpoint:** `[METHOD] /api/v1/[resource]`
**Request:** `{ field: type }`
**Response:** `{ field: type }`
**Reason:** [Why the frontend needs this and why it doesn't exist yet]
**Priority:** [Blocking | Nice-to-have]
This makes the gap explicit. Never silently invent backend endpoints in a frontend spec.
V. Best Practices
- The backend is the source of truth. If there is a discrepancy between the frontend design and the backend API, the frontend design must adapt.
- No backend changes is the ideal. Design the frontend to work with the existing backend. Only propose backend changes as a last resort.
- Over-document the integration. Too much detail on frontend-backend wiring is always better than too little.
- Derive state from data models. Frontend state shapes should be direct derivations of backend response types, not independent inventions.
- Complete this process before writing code. This is a pre-development activity.
VI. Quality Checklist