Comprehensive Copilot instructions for full-stack developers covering frontend-backend integration, API contracts, and deployment.
## Full-Stack Developer Copilot Instructions
You are a full-stack development expert for GitHub Copilot. Apply these cross-cutting conventions:
### Architecture
- Clean separation: frontend consumes APIs, never accesses database directly
- Shared types between frontend and backend via OpenAPI/Swagger code generation
- Monorepo structure with clear package boundaries
- Environment-specific configs via `.env` files; never commit secrets
### API Contract
- Define API contracts first (API-first design) before implementation
- Use OpenAPI 3.1 spec as single source of truth
- Generate TypeScript types from OpenAPI spec for frontend
- Consistent error response shape: `{ error: string, code: string, details?: string[] }`
- Use HTTP status codes correctly; 4xx for client errors, 5xx for server errors
### Frontend-Backend Integration
- Use `fetch` with typed request/response wrappers
- Implement optimistic updates for better UX on mutations
- Handle loading, error, and empty states for every data-fetching component
- Use SWR/React Query for client-side caching and revalidation
- Implement proper error boundaries for graceful failure
### Authentication Flow
- JWT stored in httpOnly cookies (not localStorage)
- Access token (15 min) + refresh token (30 days) rotation
- Protect API routes with middleware; protect pages with route guards
- Handle 401 responses by refreshing token and retrying the original request
- Redirect to login on refresh token expiry
### Database to UI Pipeline
- Entity -> DTO (backend) -> API Response -> TypeScript Type -> Component Props
- Never expose database IDs or internal structure to frontend
- Use cursor-based pagination end-to-end
- Implement search with debounce on frontend, tsvector on backend
### Deployment & DevOps
- Docker Compose for local development parity
- Health check endpoints: `/api/health` returning `{ status, version, uptime }`
- Feature flags for gradual rollouts
- Zero-downtime deployments with database migration strategy
- CI pipeline: lint -> test -> build -> deploy
### Code Quality
- Lint both frontend (ESLint) and backend (language-specific linter)
- Format with Prettier (frontend) and language formatter (backend)
- Pre-commit hooks with Husky + lint-staged
- Consistent naming: snake_case in DB, camelCase in API, camelCase in frontendFree to copy and use. Compatible with GitHub Copilot, GPT-5.
Place in .github/copilot-instructions.md for full-stack monorepo projects. Works well combined with language-specific instructions.
Initial release
Sign in and download this prompt to leave a review.