diff --git a/.agents/skills/fastapi-python/SKILL.md b/.agents/skills/fastapi-python/SKILL.md new file mode 100644 index 0000000..ab07981 --- /dev/null +++ b/.agents/skills/fastapi-python/SKILL.md @@ -0,0 +1,61 @@ +--- +name: fastapi-python +description: Expert in FastAPI Python development with best practices for APIs and async operations +--- + +# FastAPI Python + +You are an expert in FastAPI and Python backend development. + +## Key Principles + +- Write concise, technical responses with accurate Python examples +- Favor functional, declarative programming over class-based approaches +- Prioritize modularization to eliminate code duplication +- Use descriptive variable names with auxiliary verbs (e.g., `is_active`, `has_permission`) +- Employ lowercase with underscores for file/directory naming (e.g., `routers/user_routes.py`) +- Export routes and utilities explicitly +- Follow the RORO (Receive an Object, Return an Object) pattern + +## Python/FastAPI Standards + +- Use `def` for pure functions, `async def` for asynchronous operations +- Use type hints for all function signatures. Prefer Pydantic models over raw dictionaries +- Structure: exported router, sub-routes, utilities, static content, types (models, schemas) +- Omit curly braces for single-line conditionals +- Write concise one-line conditional syntax + +## Error Handling + +- Handle edge cases at function entry points +- Employ early returns for error conditions +- Place happy path logic last +- Avoid unnecessary else statements; use if-return patterns +- Implement guard clauses for preconditions +- Provide proper error logging and user-friendly messaging + +## FastAPI-Specific Guidelines + +- Use functional components (plain functions) and Pydantic models for input validation +- Declare routes with clear return type annotations +- Prefer lifespan context managers for managing startup and shutdown events +- Leverage middleware for logging, error monitoring, and optimization +- Use HTTPException for expected errors and model them as specific HTTP responses +- Apply Pydantic's BaseModel consistently for validation + +## Performance Optimization + +- Minimize blocking I/O; use async for all database and API calls +- Implement caching with Redis or in-memory stores +- Optimize Pydantic serialization/deserialization +- Use lazy loading for large datasets + +## Key Conventions + +1. Rely on FastAPI's dependency injection system +2. Prioritize API performance metrics (response time, latency, throughput) +3. Structure routes and dependencies for readability and maintainability + +## Dependencies + +FastAPI, Pydantic v2, asyncpg/aiomysql, SQLAlchemy 2.0 diff --git a/.agents/skills/nextjs-app-router-patterns/SKILL.md b/.agents/skills/nextjs-app-router-patterns/SKILL.md new file mode 100644 index 0000000..9a3c48f --- /dev/null +++ b/.agents/skills/nextjs-app-router-patterns/SKILL.md @@ -0,0 +1,537 @@ +--- +name: nextjs-app-router-patterns +description: Master Next.js 14+ App Router with Server Components, streaming, parallel routes, and advanced data fetching. Use when building Next.js applications, implementing SSR/SSG, or optimizing React Server Components. +--- + +# Next.js App Router Patterns + +Comprehensive patterns for Next.js 14+ App Router architecture, Server Components, and modern full-stack React development. + +## When to Use This Skill + +- Building new Next.js applications with App Router +- Migrating from Pages Router to App Router +- Implementing Server Components and streaming +- Setting up parallel and intercepting routes +- Optimizing data fetching and caching +- Building full-stack features with Server Actions + +## Core Concepts + +### 1. Rendering Modes + +| Mode | Where | When to Use | +| --------------------- | ------------ | ----------------------------------------- | +| **Server Components** | Server only | Data fetching, heavy computation, secrets | +| **Client Components** | Browser | Interactivity, hooks, browser APIs | +| **Static** | Build time | Content that rarely changes | +| **Dynamic** | Request time | Personalized or real-time data | +| **Streaming** | Progressive | Large pages, slow data sources | + +### 2. File Conventions + +``` +app/ +├── layout.tsx # Shared UI wrapper +├── page.tsx # Route UI +├── loading.tsx # Loading UI (Suspense) +├── error.tsx # Error boundary +├── not-found.tsx # 404 UI +├── route.ts # API endpoint +├── template.tsx # Re-mounted layout +├── default.tsx # Parallel route fallback +└── opengraph-image.tsx # OG image generation +``` + +## Quick Start + +```typescript +// app/layout.tsx +import { Inter } from 'next/font/google' +import { Providers } from './providers' + +const inter = Inter({ subsets: ['latin'] }) + +export const metadata = { + title: { default: 'My App', template: '%s | My App' }, + description: 'Built with Next.js App Router', +} + +export default function RootLayout({ + children, +}: { + children: React.ReactNode +}) { + return ( + +
+{error}
} ++ * Required field +
+``` + +--- + +## Error Messaging + +### Accessible Error Pattern + +```typescript +Description
++ Learn how to use our API and integration guides +
+ + +3 new notifications
++ This action cannot be undone. +
+
+ Card description text goes here.
+ +
+ + Building amazing products with modern technology. +
+ ++ Modal content goes here. +
+Body text
+Small text +``` + +Responsive typography: + +```html ++ Text with relaxed line height and wide letter spacing +
+``` + +### Text Alignment + +```html ++ Left aligned on mobile, centered on tablet+ +
+``` + +--- + +## Colors + +### Background Colors + +```html +Dark text
+Blue text
+Error text
+``` + +### Opacity + +```html +
+
+
++ Build amazing things with Tailwind CSS +
+ +
+
+
+ + {product.description} +
+ +Description
+
+ Description
+