Coding Standards for
Humans & AI Agents
Curated best practices with structured metadata for AI coding assistants. Let your AI follow the same standards as your team.
DevOps
10Monorepo Patterns
Organize multiple packages in a single repository with Turborepo, Nx, or pnpm workspaces.
Docker Compose
Docker Compose patterns for local development covering service definitions, networking, volumes, health checks, hot reloading, and production-ready configurations.
Docker Multi-Stage Builds
Docker multi-stage build patterns for optimized images covering build separation, layer caching, security hardening, and language-specific examples.
Kubernetes ConfigMaps & Secrets
Kubernetes configuration management patterns covering ConfigMaps, Secrets, External Secrets Operator, Sealed Secrets, and production security practices.
Kubernetes Deployment Patterns
Kubernetes deployment strategies covering rolling updates, blue-green, canary deployments, Argo Rollouts, and zero-downtime patterns.
Kubernetes Health Checks
Kubernetes health check patterns covering liveness, readiness, and startup probes with configuration best practices and debugging techniques.
Terraform Patterns
Terraform patterns covering module design, state management, workspace strategies, testing, and production best practices.
GitHub Actions Best Practices
GitHub Actions best practices for CI/CD workflows, caching, reusable workflows, security, and efficient pipeline design.
Docker Best Practices
Docker best practices for multi-stage builds, security hardening, image optimization, and production-ready containers.
Kubernetes Best Practices
Kubernetes best practices for deployments, health checks, resource management, security, and production-ready workloads.
Design Patterns
23CQRS Patterns
Separate read and write operations for scalability, performance, and complexity management.
Domain-Driven Design Patterns
Model complex business domains with aggregates, entities, value objects, and bounded contexts.
Event Sourcing Patterns
Store state changes as immutable events for audit trails, temporal queries, and system reconstruction.
Microservices Communication Patterns
Patterns for service-to-service communication including sync, async, and service mesh approaches.
Configuration Management Patterns
Manage application configuration with environment variables, validation, and secrets.
DTO & Mapper Pattern
Data Transfer Object (DTO) and Mapper patterns for decoupling layers, controlling API contracts, and safely transforming data between boundaries.
Email Patterns
Implement transactional emails with templates, delivery tracking, and best practices.
Feature Flags Patterns
Feature flag patterns covering implementation strategies, flag types, lifecycle management, testing, and production best practices.
Internationalization (i18n) Patterns
Implement internationalization with translations, locale formatting, and RTL support.
File Upload Patterns
Implement secure, scalable file uploads with validation, presigned URLs, and virus scanning.
Multi-tenancy Patterns
Design multi-tenant applications with proper data isolation, routing, and tenant context.
Notification Patterns
Implement push notifications, in-app notifications, and user preference management.
Payment Integration Patterns
Implement payment processing with Stripe, webhooks, idempotency, and error handling.
State Machine Patterns
Model complex workflows with state machines using XState and explicit state transitions.
Circuit Breaker & Resilience Patterns
Implement fault tolerance with circuit breakers, retries, bulkheads, and fallback strategies.
Dependency Injection
Dependency Injection (DI) is a technique for achieving Inversion of Control by supplying dependencies from outside rather than creating them internally. Covers constructor injection, DI containers, and scopes.
Factory Pattern
The Factory Pattern provides a way to create objects without exposing instantiation logic, using a common interface. Includes Simple Factory, Factory Method, and Abstract Factory variations.
Observer Pattern & Pub/Sub
The Observer Pattern establishes a one-to-many dependency between objects, so when one object changes state, all dependents are notified. Includes event-driven and publish/subscribe variations.
Repository Pattern
The Repository pattern abstracts data access, providing a collection-like interface for domain objects. Implementations for TypeScript with Prisma and Python with SQLAlchemy.
Result/Either Pattern
The Result/Either Pattern provides explicit error handling using discriminated unions instead of exceptions. Enables composable, type-safe error handling with map/flatMap operations.
Service Layer Pattern
The Service Layer pattern organizes business logic into a dedicated layer that orchestrates operations between controllers and repositories, handling transactions and complex workflows.
SOLID Principles
The five SOLID principles applied to TypeScript and Python - Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, and Dependency Inversion.
Strategy Pattern
The Strategy Pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. Enables switching algorithms at runtime without modifying client code.
Security
7CSRF Protection Patterns
Prevent cross-site request forgery attacks with tokens, SameSite cookies, and origin validation.
Content Security Policy
Prevent XSS and data injection attacks with proper Content Security Policy configuration.
API Authentication Patterns
API authentication patterns covering API keys, JWT, OAuth 2.0, session management, and production security best practices.
Session Management Patterns
Implement secure session management with tokens, cookies, and rotation.
Authentication Patterns
Session-based authentication, JWT tokens, OAuth/OIDC integration, refresh token rotation, and secure cookie handling for web applications.
Input Validation & Sanitization
Input validation with Zod and Pydantic, preventing SQL injection, XSS, command injection, and sanitization patterns for secure applications.
Secrets Management
Environment variables, secret vaults (Azure Key Vault, AWS Secrets Manager), .env file handling, secret scanning, and rotation patterns.
Testing
4Contract Testing Patterns
Verify API contracts between services using Pact and OpenAPI schema validation.
Load Testing Patterns
Performance and load testing with k6, Artillery, and Locust for capacity planning and reliability.
Test Strategy
Test strategy guidance covering test pyramid, testing trophy, what to test at each level, coverage targets, and practical approaches to building confidence.
E2E Testing with Playwright
End-to-end testing patterns using Playwright. Covers page objects, fixtures, authentication, visual testing, API mocking, and CI/CD integration.
ai
2LLM Integration Patterns
LLM integration patterns covering API usage, structured output, function calling, streaming, error handling, and production best practices.
RAG Patterns
Retrieval Augmented Generation patterns covering chunking strategies, embeddings, vector stores, retrieval optimization, and production best practices.
API Design
12GraphQL Patterns
GraphQL API patterns covering schema design, resolvers, DataLoader, Apollo Server/Client, mutations, subscriptions, and performance optimization.
gRPC Patterns
gRPC patterns covering Protocol Buffers design, service definitions, streaming, error handling, and production best practices.
Message Queue Patterns
Message queue patterns covering RabbitMQ, Kafka, queue selection, messaging patterns, error handling, and production best practices.
CORS Patterns
Configure Cross-Origin Resource Sharing correctly for secure API access.
OpenAPI Documentation Patterns
Design and maintain OpenAPI specifications with code generation and validation.
API Versioning
API versioning strategies covering URL path vs header versioning, breaking changes, deprecation policies, and migration patterns for long-lived APIs.
Rate Limiting Patterns
Rate limiting patterns covering token bucket, sliding window, distributed rate limiting, and production implementation strategies.
WebSocket Patterns
WebSocket patterns for real-time communication covering Socket.IO, native WebSockets, scaling, authentication, and production best practices.
Webhook Patterns
Design and implement reliable webhooks with signatures, retries, and idempotency.
API Error Responses
Standardized API error responses using RFC 9457 Problem Details format for consistent, machine-readable error handling.
API Pagination & Filtering
API pagination patterns including offset, cursor, and keyset approaches with filtering, sorting, and consistent response structures.
REST API Conventions
REST API design conventions covering resource naming, HTTP methods, status codes, and URL structure for consistent, intuitive APIs.
backend
2Background Jobs Patterns
Background job patterns covering queue design, worker implementation, error handling, monitoring, and production best practices with BullMQ and Celery.
Cron & Scheduled Tasks Patterns
Scheduled task patterns covering cron syntax, job scheduling, distributed locking, monitoring, and production best practices.
Cloud
13AWS Lambda Patterns
AWS Lambda best practices covering cold start optimization, Powertools for observability, layers, error handling, and TypeScript/Python patterns for serverless functions.
AWS CDK Patterns
AWS CDK patterns covering TypeScript constructs, L1/L2/L3 levels, project structure, custom constructs, aspects for security, testing, and infrastructure as code best practices.
DynamoDB Patterns
DynamoDB patterns covering single table design, GSI optimization, access patterns, transactions, TypeScript/Python examples, and NoSQL data modeling best practices.
AWS ECS Fargate Patterns
AWS ECS Fargate patterns covering task definitions, CDK deployment, autoscaling, health checks, secrets management, load balancing, and security best practices.
S3 Patterns
AWS S3 patterns covering presigned URLs, multipart uploads, bucket policies, CORS configuration, lifecycle rules, encryption, and TypeScript/Python implementations.
Azure Functions Patterns
Azure Functions patterns covering triggers, bindings, Python v2 and TypeScript v4 models, Cosmos DB integration, Durable Functions, and serverless best practices.
Azure Storage Patterns
Azure Storage patterns covering Blob Storage, Queue Storage, TypeScript SDK v12, Python async SDK, SAS tokens, lifecycle management, and security best practices.
Azure Bicep Modules
Azure Bicep module patterns covering Azure Verified Modules, private registries, reusable module design, parameters, outputs, and project structure.
Azure Container Apps Patterns
Azure Container Apps patterns covering deployment, scaling, Dapr integration, health probes, ingress configuration, and Bicep infrastructure as code.
Azure Cosmos DB Patterns
Azure Cosmos DB patterns covering data modeling, partition key design, denormalization, TypeScript SDK v4, Python async SDK, change feed, and performance optimization.
Firebase Cloud Functions Patterns
Firebase Cloud Functions patterns covering 2nd gen functions, TypeScript and Python, Firestore triggers, callable functions, HTTPS endpoints, and deployment best practices.
Firebase Authentication Patterns
Firebase Authentication patterns covering session cookies, custom claims, RBAC, Next.js App Router integration, token verification, and secure authentication flows.
Firestore Patterns
Firebase Firestore patterns covering data modeling, security rules, real-time listeners, denormalization, indexes, and React/Next.js integration for NoSQL databases.
Data
10ML Model Deployment
Machine learning model deployment patterns covering FastAPI serving, MLflow integration, containerization, inference optimization, and production monitoring.
ML Project Structure
Machine learning project structure patterns covering directory organization, experiment tracking, reproducibility, data versioning, and MLOps-ready architecture.
MongoDB Patterns
MongoDB patterns covering schema design, embedding vs referencing, indexing, aggregation pipelines, and production best practices.
PostgreSQL Patterns
PostgreSQL patterns covering indexing strategies, JSONB optimization, query performance, partitioning, and production best practices.
ML Training Patterns
Machine learning training patterns covering checkpointing, early stopping, learning rate scheduling, gradient accumulation, mixed precision, and reproducible training loops.
Data Pipelines
Python data pipeline patterns covering ETL architecture, Polars for high-performance processing, Prefect orchestration, idempotency, and production best practices.
Pandas Patterns
Pandas patterns covering vectorization, method chaining, memory optimization, chunked processing, categorical dtypes, and performance best practices.
NumPy Patterns
NumPy patterns covering broadcasting, vectorization, memory layout, universal functions, array creation, and performance optimization.
Redis Patterns
Redis patterns covering caching strategies, data structures, pub/sub, rate limiting, sessions, and production best practices.
Search Patterns
Implement full-text search with Elasticsearch, faceted filtering, and autocomplete.
Database
4Database Migrations
Database migration patterns covering version control, rollback strategies, zero-downtime deployments, and the expand-contract pattern for production safety.
Database Query Optimization
Query optimization patterns including N+1 prevention, indexing strategies, EXPLAIN analysis, connection pooling, and performance monitoring.
Prisma Best Practices
Prisma ORM patterns for schema design, relations, migrations, transactions, and performance optimization in TypeScript applications.
SQLAlchemy 2.0 Async Patterns
Async database patterns with SQLAlchemy 2.0, AsyncSession, eager loading, repository implementation, and FastAPI integration.
Desktop
2Electron IPC Patterns
Secure Electron IPC patterns using contextBridge, preload scripts, and type-safe communication between main and renderer processes.
Tauri Patterns
Tauri application patterns covering Rust backend commands, type-safe IPC, state management, event handling, and secure desktop app development.
Observability
4OpenTelemetry Tracing
OpenTelemetry distributed tracing patterns covering context propagation, instrumentation, sampling strategies, and production setup for TypeScript and Python.
Error Tracking Best Practices
Error tracking best practices with Sentry integration, source maps, release tracking, alerting, and effective error triage.
Metrics & Monitoring Best Practices
Application metrics best practices with Prometheus, OpenTelemetry, custom instrumentation, dashboards, and alerting strategies.
Structured Logging Best Practices
Structured logging best practices with JSON format, OpenTelemetry integration, context propagation, and consistent schemas across services.
Performance
4Caching Strategies
Implement effective caching with cache invalidation, CDN strategies, and application-level caching.
Bundle Size Optimization
Code splitting, tree shaking, dynamic imports, bundle analysis, and dependency optimization for smaller JavaScript bundles.
Caching Strategies
Browser caching, CDN configuration, HTTP cache headers, service workers, and API caching strategies for web applications.
Core Web Vitals Optimization
Optimizing LCP, INP, and CLS for better user experience and SEO. Measurement tools, common issues, and actionable fixes.
React
6React Composition Patterns
React composition patterns including children, slots, compound components, render props, and the asChild pattern for flexible, reusable component APIs.
React State Management
React state management patterns for choosing between useState, Context, Zustand, and TanStack Query based on state type and complexity.
Compound Components Pattern
The Compound Components pattern creates flexible, declarative component APIs where parent and children work together implicitly. Used by Radix UI, Headless UI, and other modern component libraries.
Custom Hooks Patterns
Patterns for extracting, composing, and testing custom React hooks. Covers common hooks like useAsync, useLocalStorage, useDebounce, and best practices for hook design.
React Hook Form + Zod
Form handling patterns with React Hook Form and Zod for type-safe validation, error handling, and complex form scenarios.
React Testing with Vitest
Comprehensive React testing patterns using Vitest and React Testing Library. Covers component testing, hooks, async operations, mocking, and accessibility testing.
Servers
4Linux Server Hardening
Linux server hardening patterns covering SSH security, firewall configuration, systemd hardening, user management, automatic updates, and security monitoring.
SSH Security
SSH security best practices covering key management, daemon hardening, authentication methods, and access control for production servers.
systemd Service Management
systemd service unit file patterns covering service creation, hardening, sandboxing, resource limits, and production best practices.
Nginx Patterns
Nginx patterns covering reverse proxy, SSL/TLS with Let's Encrypt, security headers, gzip compression, caching, rate limiting, and performance tuning.
Systems
12Modern C++ Patterns
Modern C++20/23 patterns covering smart pointers, RAII, concepts, std::expected, ranges, coroutines, and modules for safe, expressive, high-performance code.
Go Error Handling
Go error handling patterns covering error wrapping, sentinel errors, custom error types, errors.Is/As, and idiomatic error propagation.
Go Concurrency Patterns
Go concurrency patterns covering goroutines, channels, worker pools, fan-out/fan-in, context cancellation, and production-ready concurrent code.
Go Interfaces
Go interface patterns covering implicit implementation, composition, duck typing, and the 'accept interfaces, return structs' principle.
Go Project Structure
Go project structure patterns covering directory layouts, domain-driven design, hexagonal architecture, internal packages, and scalable organization strategies.
Rust Async Networking
Rust async networking patterns covering Tokio runtime, TCP/UDP sockets, HTTP clients, connection pooling, graceful shutdown, and high-performance server design.
Rust CLI Applications
Rust CLI application patterns covering clap argument parsing, error handling with anyhow/thiserror, async with tokio, configuration, and production-ready CLI design.
Rust Error Handling
Rust error handling patterns covering Result, Option, the ? operator, thiserror for libraries, anyhow for applications, and custom error types.
Rust Ownership & Borrowing
Rust ownership and borrowing patterns covering ownership rules, borrowing, lifetimes, smart pointers, and memory safety without garbage collection.
Embedded C/C++ Patterns
Modern C++ patterns for embedded systems, covering RAII, memory management, FreeRTOS task patterns, interrupt handling, and real-time constraints.
Go Programming Patterns
Go best practices for project structure, error handling, goroutines, channels, interfaces, and building maintainable Go applications.
Rust Programming Patterns
Rust best practices for ownership, borrowing, error handling with Result/Option, async programming with Tokio, and project organization.
TypeScript
4TypeScript Type Inference
TypeScript type inference patterns including Zod inference, const assertions, satisfies operator, utility types, and when to let TypeScript infer vs explicit annotations.
TypeScript Strict Mode
TypeScript strict mode configuration with additional strictness options for maximum type safety in production applications.
TypeScript Generics
TypeScript generics patterns for reusable, type-safe code including constraints, inference, and common patterns.
TypeScript Utility Types
TypeScript utility types for type transformations including Pick, Omit, Partial, Record, and combining types for real-world use cases.
Tailwind CSS
3Tailwind CSS v4 Component Patterns
Reusable component patterns with @layer, CVA for variants, group/peer modifiers, data and ARIA attributes, and accessible interactive components.
Tailwind CSS v4 Configuration
CSS-first configuration with @theme directive, automatic content detection, custom utilities, and migration from tailwind.config.js to pure CSS setup.
Tailwind CSS v4 Theming
Design tokens, semantic colors, dark mode with @custom-variant, OKLCH color palette, multi-theme support, and runtime theme switching with next-themes.
FastAPI
5Dependency Injection Patterns
FastAPI dependency injection patterns including caching, lifespan management, yield dependencies for cleanup, and testing overrides.
Project Structure
Domain-driven project organization with routers, services, repositories, and models. Separation of concerns for maintainable FastAPI applications.
Pydantic Best Practices
Pydantic v2 validation patterns, field validators, custom base models, settings management, and serialization for FastAPI applications.
FastAPI Testing with Pytest
Comprehensive FastAPI testing patterns using pytest and httpx. Covers async testing, fixtures, database testing, dependency overrides, and mocking.
Never Block the Async Event Loop
Never use blocking operations in async endpoints. Blocking calls like time.sleep(), requests.get(), or synchronous database queries will block the entire event loop.
UI/UX
14Error Handling & Recovery
Design patterns for error messages, error pages, inline validation, and recovery strategies that help users understand and resolve issues.
Button Design Best Practices
Button states, hierarchy, accessibility, loading states, and sizing based on WCAG 2.2, Material Design 3, Apple HIG, and Nielsen Norman Group research.
Form Design Best Practices
Form validation, error messages, labels, autocomplete, input types, and layout based on WCAG, Nielsen Norman Group, Baymard Institute, and Material Design 3.
Modal Dialog Design Best Practices
Modal dialog patterns, focus management, escape key handling, backdrop design, and accessibility based on WCAG 2.2, WAI-ARIA APG, Material Design 3, and Nielsen Norman Group research.
Navigation Design Best Practices
Navigation patterns, mobile navigation, skip links, breadcrumbs, mega menus, and keyboard navigation based on WCAG 2.2, Nielsen Norman Group, Material Design 3, and WebAIM.
Data Table Design Best Practices
Responsive table patterns, accessibility with headers and scope, sorting, pagination, and mobile layouts based on WCAG 2.2, WAI-ARIA APG, Material Design, and CSS-Tricks.
Color Systems Best Practices
Color contrast, OKLCH color space, semantic tokens, dark mode, and accessibility guidelines based on WCAG 2.2, Apple HIG, and Material Design 3.
Layout Best Practices
CSS Grid vs Flexbox, container queries, viewport units, subgrid, and bento layouts based on MDN, CSS-Tricks, and modern CSS best practices.
Spacing & Sizing Best Practices
Spacing scales, touch targets, gap vs margin, and logical properties based on WCAG 2.2, Apple HIG, Material Design 3, and CSS best practices.
Web Accessibility Best Practices
WCAG 2.2 AA compliance, ARIA usage, keyboard navigation, screen reader support, color contrast, and semantic HTML based on W3C WAI, WebAIM, and MDN.
Loading States Best Practices
Skeleton screens, spinners, progress bars, optimistic UI, and accessible loading states based on Nielsen Norman Group, UX research, and React/Next.js patterns.
Motion & Animation Best Practices
Animation timing, easing, duration, micro-interactions, prefers-reduced-motion, CSS transitions vs keyframes, and View Transitions API based on Material Design 3, MDN, web.dev, and Nielsen Norman Group.
Responsive Design Best Practices
Breakpoints, mobile-first approach, container queries, fluid typography, responsive images, and modern CSS layout techniques based on MDN, web.dev, Smashing Magazine, and Tailwind CSS.
Typography Best Practices
Font selection, sizing, line height, and text styling guidelines based on WCAG 2.2, Apple HIG, Material Design 3, and web typography research.
Mobile
4Jetpack Compose & Kotlin Patterns
Jetpack Compose best practices with MVVM architecture, StateFlow, Kotlin Coroutines, Hilt dependency injection, and modern Android development patterns.
Flutter Architecture Patterns
Flutter best practices with Riverpod state management, feature-first architecture, widget composition, and performance optimization.
SwiftUI & Swift Concurrency Patterns
SwiftUI best practices with @Observable macro, MVVM architecture, Swift Concurrency (async/await, actors), and modern iOS development patterns.
React Native & Expo Patterns
React Native best practices with Expo SDK 52+, Expo Router navigation, performance optimization, and modern architecture patterns.
Next.js
6Data Fetching Patterns
Server component data fetching with fetch, caching strategies, revalidation patterns, parallel requests, and React cache for optimal performance.
Performance Optimization
Image optimization with next/image, font loading with next/font, bundle analysis, code splitting, dynamic imports, and Core Web Vitals optimization.
Routing & File Conventions
App Router file conventions including layouts, loading states, error boundaries, route groups, parallel routes, intercepting routes, and dynamic segments.
Security Headers & Environment Variables
HTTP security headers (CSP, HSTS, X-Frame-Options), environment variable safety, CORS configuration, and authentication patterns for Next.js 15.
Default to Server Components
Use Server Components by default in Next.js App Router. Only add 'use client' when you need interactivity, browser APIs, or React hooks.
Always Validate Server Action Inputs
Server Actions are public HTTP endpoints. Always validate and sanitize all inputs using Zod or similar validation libraries to prevent security vulnerabilities.
Access Guidelines via API
Integrate guidelines into your AI workflows. Pro plan includes full API access for AI agents to fetch relevant guidelines programmatically.
GET /api/v1/guidelines
Authorization: Bearer erold_xxx
{
"guidelines": [
{
"id": "uiux/foundations/layout",
"ai": {
"prompt_snippet": "Grid for 2D, Flex for 1D...",
"applies_when": ["..."],
"related": ["typography", "colors"]
}
}
]
}