🎯

server-skills

🎯Skill

from llama-farm/llamafarm

VibeIndex|
What it does

Provides server-side best practices and code review guidelines for FastAPI, Celery, and Pydantic frameworks in Python.

server-skills

Installation

Install skill:
npx skills add https://github.com/llama-farm/llamafarm --skill server-skills
8
Last UpdatedJan 26, 2026

Skill Details

SKILL.md

Server-specific best practices for FastAPI, Celery, and Pydantic. Extends python-skills with framework-specific patterns.

Overview

# Server Skills for LlamaFarm

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

Overview

| Property | Value |

|----------|-------|

| Path | server/ |

| Python | 3.12+ |

| Framework | FastAPI 0.116+ |

| Task Queue | Celery 5.5+ |

| Validation | Pydantic 2.x, pydantic-settings |

| Logging | structlog with FastAPIStructLogger |

Links to Shared Skills

This skill extends the shared Python skills. See:

  • [Python Patterns](../python-skills/patterns.md) - Dataclasses, comprehensions, imports
  • [Async Patterns](../python-skills/async.md) - async/await, asyncio, concurrency
  • [Typing Patterns](../python-skills/typing.md) - Type hints, generics, Pydantic
  • [Testing Patterns](../python-skills/testing.md) - Pytest, fixtures, mocking
  • [Error Handling](../python-skills/error-handling.md) - Exceptions, logging, context managers
  • [Security Patterns](../python-skills/security.md) - Path traversal, injection, secrets

Server-Specific Checklists

| Topic | File | Key Points |

|-------|------|------------|

| FastAPI | [fastapi.md](fastapi.md) | Routes, dependencies, middleware, exception handlers |

| Celery | [celery.md](celery.md) | Task patterns, error handling, retries, signatures |

| Pydantic | [pydantic.md](pydantic.md) | Pydantic v2 models, validation, serialization |

| Performance | [performance.md](performance.md) | Async 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)

```python

from pydantic_settings import BaseSettings

class Settings(BaseSettings, env_file=".env"):

HOST: str = "0.0.0.0"

PORT: int = 8000

LOG_LEVEL: str = "INFO"

settings = Settings() # Module-level singleton

```

Structured Logging

```python

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

```python

# 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

```python

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

  1. 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

  1. Pydantic Models (Medium priority)

- Use Pydantic v2 patterns (model_config, Field)

- Proper validation with field constraints

- Serialization with model_dump()

  1. 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.

More from this repository10

🎯
generate-subsystem-skills🎯Skill

Generates specialized Claude Code skills for each subsystem, creating shared language and subsystem-specific checklists to optimize AI code generation across the monorepo.

🎯
rag-skills🎯Skill

Implements robust RAG document processing and retrieval using LlamaIndex, ChromaDB, and Celery for efficient, scalable AI document workflows.

🎯
common-skills🎯Skill

Manages shared Python utilities for LlamaFarm, focusing on HuggingFace model handling, GGUF file management, and cross-service consistency.

🎯
electron-skills🎯Skill

Configures secure Electron desktop application architecture with isolated processes, type-safe IPC, and cross-platform packaging for LlamaFarm.

🎯
go-skills🎯Skill

Enforces Go best practices and idiomatic patterns for secure, maintainable LlamaFarm CLI development.

🎯
commit-push-pr🎯Skill

Automates git workflow by committing changes, pushing to GitHub, and opening a PR with intelligent checks and handling of edge cases.

🎯
cli-skills🎯Skill

Provides comprehensive Go CLI development guidelines using Cobra, Bubbletea, and Lipgloss for creating robust, interactive command-line interfaces in LlamaFarm projects.

🎯
typescript-skills🎯Skill

Enforces strict TypeScript best practices for React and Electron frontend applications, ensuring type safety, immutability, and clean code patterns.

🎯
runtime-skills🎯Skill

Optimizes ML inference runtime with best practices for PyTorch, Transformers, and FastAPI, focusing on device management, model loading, and performance tuning.

🎯
python-skills🎯Skill

Provides comprehensive Python best practices and code review guidelines for ensuring high-quality, secure, and maintainable code across LlamaFarm's Python components.