SE

server-skills

Framework-specific best practices and checklists for FastAPI, Celery, and Pydantic.

Install

mkdir -p .claude/skills/server-skills && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/4139" && unzip -o skill.zip -d .claude/skills/server-skills && rm skill.zip

Installs to .claude/skills/server-skills

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Server-specific best practices for FastAPI, Celery, and Pydantic. Extends python-skills with framework-specific patterns.
121 charsno explicit “when” trigger
Intermediate

Key capabilities

  • Standardizes FastAPI routing and middleware
  • Manages Celery task retries and signatures
  • Validates Pydantic v2 model schemas
  • Implements structured logging with structlog

How it works

It applies framework-specific patterns and checklists to ensure server code adheres to LlamaFarm standards.

Inputs & outputs

You give it
Server code or configuration file
You get back
Review checklist or architectural pattern recommendation

When to use server-skills

  • Review FastAPI route structures
  • Optimize Celery task retries
  • Validate Pydantic v2 model schemas
  • Implement structured logging

About this skill

Server Skills for LlamaFarm

Framework-specific patterns and code review checklists for the LlamaFarm Server component.

Overview

PropertyValue
Pathserver/
Python3.12+
FrameworkFastAPI 0.116+
Task QueueCelery 5.5+
ValidationPydantic 2.x, pydantic-settings
Loggingstructlog with FastAPIStructLogger

Links to Shared Skills

This skill extends the shared Python skills. See:

Server-Specific Checklists

TopicFileKey Points
FastAPIfastapi.mdRoutes, dependencies, middleware, exception handlers
Celerycelery.mdTask patterns, error handling, retries, signatures
Pydanticpydantic.mdPydantic v2 models, validation, serialization
Performanceperformance.mdAsync patterns, caching, connection pooling

Architecture Overview

server/
├── main.py                 # Uvicorn entry point, MCP mount
├── api/
│   ├── main.py             # FastAPI app factory, middleware setup
│   ├── errors.py           # Custom exceptions + exception handlers
│   ├── middleware/         # ASGI middleware (structlog, errors)
│   └── routers/            # API route modules
│       ├── projects/       # Project CRUD endpoints
│       ├── datasets/       # Dataset management
│       ├── rag/            # RAG query endpoints
│       └── ...
├── core/
│   ├── settings.py         # pydantic-settings configuration
│   ├── logging.py          # structlog setup, FastAPIStructLogger
│   └── celery/             # Celery app configuration
│       ├── celery.py       # Celery app instance
│       └── rag_client.py   # RAG task signatures and helpers
├── services/               # Business logic layer
│   ├── project_service.py  # Project CRUD operations
│   ├── dataset_service.py  # Dataset management
│   └── ...
├── agents/                 # AI agent implementations
└── tests/                  # Pytest test suite

Quick Reference

Settings Pattern (pydantic-settings)

from pydantic_settings import BaseSettings

class Settings(BaseSettings, env_file=".env"):
    HOST: str = "0.0.0.0"
    PORT: int = 14345
    LOG_LEVEL: str = "INFO"

settings = Settings()  # Module-level singleton

Structured Logging

from core.logging import FastAPIStructLogger

logger = FastAPIStructLogger(__name__)
logger.info("Operation completed", extra={"count": 10, "duration_ms": 150})
logger.bind(namespace=namespace, project=project_id)  # Add context

Custom Exceptions

# Define exception hierarchy
class NotFoundError(Exception): ...
class ProjectNotFoundError(NotFoundError):
    def __init__(self, namespace: str, project_id: str):
        self.namespace = namespace
        self.project_id = project_id
        super().__init__(f"Project {namespace}/{project_id} not found")

# Register handler in api/errors.py
async def _handle_project_not_found(request: Request, exc: Exception) -> Response:
    payload = ErrorResponse(error="ProjectNotFound", message=str(exc))
    return JSONResponse(status_code=404, content=payload.model_dump())

def register_exception_handlers(app: FastAPI) -> None:
    app.add_exception_handler(ProjectNotFoundError, _handle_project_not_found)

Service Layer Pattern

class ProjectService:
    @classmethod
    def get_project(cls, namespace: str, project_id: str) -> Project:
        project_dir = cls.get_project_dir(namespace, project_id)
        if not os.path.isdir(project_dir):
            raise ProjectNotFoundError(namespace, project_id)
        # ... load and validate

Review Checklist Summary

  1. FastAPI Routes (High priority)

    • Proper async/sync function choice
    • Response model defined with response_model=
    • OpenAPI metadata (operation_id, tags, summary)
    • HTTPException with proper status codes
  2. Celery Tasks (High priority)

    • Use signatures for cross-service calls
    • Implement proper timeout and polling
    • Handle task failures gracefully
    • Store group metadata for parallel tasks
  3. Pydantic Models (Medium priority)

    • Use Pydantic v2 patterns (model_config, Field)
    • Proper validation with field constraints
    • Serialization with model_dump()
  4. Performance (Medium priority)

    • Avoid blocking calls in async functions
    • Use proper connection pooling for external services
    • Implement caching where appropriate

See individual topic files for detailed checklists with grep patterns.

When not to use it

  • When working outside the LlamaFarm server component
  • When using frameworks other than FastAPI or Celery

Prerequisites

Python 3.12+FastAPI 0.116+Celery 5.5+

Limitations

  • Limited to LlamaFarm server architecture
  • Requires specific framework versions

How it compares

It provides specialized architectural guidance for LlamaFarm components instead of generic Python advice.

Compared to similar skills

server-skills side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
server-skills (this skill)26moReviewIntermediate
openrouter-streaming-setup127dReviewIntermediate
runtime-skills17moNo flagsAdvanced
fastapi-async-patterns01moNo flagsAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

openrouter-streaming-setup

jeremylongshore

Implement streaming responses with OpenRouter. Use when building real-time chat interfaces or reducing time-to-first-token. Trigger with phrases like 'openrouter streaming', 'openrouter sse', 'stream response', 'real-time openrouter'.

111

runtime-skills

llama-farm

Universal Runtime best practices for PyTorch inference, Transformers models, and FastAPI serving. Covers device management, model loading, memory optimization, and performance tuning.

13

fastapi-async-patterns

hydrosdesenvolvimento

Use for deep FastAPI concurrency, event-loop safety, async I/O, and performance patterns after a service structure already exists. Not a general FastAPI bootstrap skill; pair with fastapi-expert or fastapi-templates when needed.

00

development-rules

Pravin-surawase

Hard-learned development rules by domain — Python, FastAPI, React, Testing. Prevents the specific mistakes that caused 70+ audit findings across v0.21.0-v0.21.3.

00

code-review

hhagely

Perform a full code review of the currently checked out branch against main. Analyzes best practices, unit tests, DRY code, architecture, error handling, correctness & caller-impact, documentation, DB migration safety, and SvelteKit conventions across the diff for this Python (FastAPI/SQLModel) + Sv

00

codex-code-review

tyrchen

Perform comprehensive code reviews using OpenAI Codex CLI. This skill should be used when users request code reviews, want to analyze diffs/PRs, need security audits, performance analysis, or want automated code quality feedback. Supports reviewing staged changes, specific files, entire directories, or git diffs.

16

Search skills

Search the agent skills registry