Python Skills for LlamaFarm
SkillSecurityPython Skills gives your AI a set of Python best practices drawn from PEP 8, the Zen of Python, the Google Python Style Guide, and Effective Python. Once added, your AI can write and review Python code that follows these widely accepted style and quality guidelines.
Use Python Skills for LlamaFarm in Claude, ChatGPT or Ahel Desktop
Free. Sign in, add Python Skills for LlamaFarm and connect your AI. About a minute.
Also: Claude Code · Cursor · Codex
Then ask your AI: use the Python Skills for LlamaFarm
Details
Instructions available. Your AI can read the instructions. Execution depends on the setup they require.
Account requirements not reviewed. Check the skill instructions before use; Ahel provides instructions and does not run this skill.
No other account needed.
Add Python Skills, then ask your AI to write or review Python code. It will apply these best practices automatically.
What your AI can do with it
- Write Python code that follows PEP 8 style conventions
- Apply the Zen of Python principles when designing code
- Review Python code against the Google Python Style Guide
- Use patterns from Effective Python to improve code quality
What this skill tells your AI
The instructions your AI receives, as published by llama-farm/llamafarm in .claude/skills/python-skills/SKILL.md and read by Ahel’s review.
Shared Python best practices and code review checklists for all Python components in the LlamaFarm monorepo.
Applicable Components
| Component | Path | Python | Key Dependencies |
|---|---|---|---|
| Server | server/ | 3.12+ | FastAPI, Celery, Pydantic, structlog |
| RAG | rag/ | 3.11+ | LlamaIndex, ChromaDB, Celery |
| Universal Runtime | runtimes/universal/ | 3.11+ | PyTorch, transformers, FastAPI |
| Config | config/ | 3.11+ | Pydantic, JSONSchema |
| Common | common/ | 3.10+ | HuggingFace Hub |
Quick Reference
| Topic | File | Key Points |
|---|---|---|
| Patterns | patterns.md | Dataclasses, Pydantic, comprehensions, imports |
| Async | async.md | async/await, asyncio, concurrent execution |
| Typing | typing.md | Type hints, generics, protocols, Pydantic |
| Testing | testing.md | Pytest fixtures, mocking, async tests |
| Errors | error-handling.md | Custom exceptions, logging, context managers |
| Security | security.md | Path traversal, injection, secrets, deserialization |
Code Style
LlamaFarm uses ruff with shared configuration in ruff.toml:
line-length = 88
target-version = "py311"
select = ["E", "F", "I", "B", "UP", "SIM"]
Key rules:
- E, F: Core pyflakes and pycodestyle
- I: Import sorting (isort)
- B: Bugbear (common pitfalls)
- UP: Upgrade syntax to modern Python
- SIM: Simplify code patterns
Architecture Patterns
Settings with pydantic-settings
from pydantic_settings import BaseSettings
class Settings(BaseSettings, env_file=".env"):
LOG_LEVEL: str = "INFO"
HOST: str = "0.0.0.0"
PORT: int = 14345
settings = Settings() # Singleton at module level
Structured Logging with structlog
from core.logging import FastAPIStructLogger # Server
from core.logging import RAGStructLogger # RAG
from core.logging import UniversalRuntimeLogger # Runtime
logger = FastAPIStructLogger(__name__)
logger.info("Operation completed", extra={"count": 10, "duration_ms": 150})
Abstract Base Classes for Extensibility
from abc import ABC, abstractmethod
class Component(ABC):
def __init__(self, name: str, config: dict[str, Any] | None = None):
self.name = name or self.__class__.__name__
self.config = config or {}
@abstractmethod
def process(self, documents: list[Document]) -> ProcessingResult:
pass
Dataclasses for Internal Data
from dataclasses import dataclass, field
@dataclass
class Document:
content: str
metadata: dict[str, Any] = field(default_factory=dict)
id: str = field(default_factory=lambda: str(uuid.uuid4()))
Pydantic Models for API Boundaries
from pydantic import BaseModel, Field, ConfigDict
class EmbeddingRequest(BaseModel):
model: str
input: str | list[str]
encoding_format: Literal["float", "base64"] | None = "float"
model_config = ConfigDict(str_strip_whitespace=True)
Directory Structure
Each Python component follows this structure:
component/
├── pyproject.toml # UV-managed dependencies
├── core/ # Core functionality
│ ├── __init__.py
│ ├── settings.py # Pydantic Settings
│ └── logging.py # structlog setup
├── services/ # Business logic (server)
├── models/ # ML models (runtime)
├── tasks/ # Celery tasks (rag)
├── utils/ # Utility functions
└── tests/
├── conftest.py # Shared fixtures
└── test_*.py
Review Checklist Summary
When reviewing Python code in LlamaFarm:
-
Patterns (Medium priority)
- Modern Python syntax (3.10+ type hints)
- Dataclass vs Pydantic used appropriately
- No mutable default arguments
-
Async (High priority)
- No blocking calls in async functions
- Proper asyncio.Lock usage
- Cancellation handled correctly
-
Typing (Medium priority)
- Complete return type hints
- Generic types parameterized
- Pydantic v2 patterns
-
Testing (Medium priority)
- Fixtures properly scoped
- Async tests use pytest-asyncio
- Mocks cleaned up
-
Errors (High priority)
- Custom exceptions with context
- Structured logging with extra dict
- Proper exception chaining
-
Security (Critical priority)
- Path traversal prevention
- Input sanitization
- Safe deserialization
See individual topic files for detailed checklists with grep patterns.
Signals
- GitHub stars
- 837
- Forks
- 59
- Last commit
- Jun 2026
Advanced
- Item type
- skill
- Key
python-skills- Source
- github.com/llama-farm/llamafarm
github.com/llama-farm/llamafarm
Related picks
Skill · wshobson
The pick for Pythonpython-pro
Skill · jeffallan
The pick for Pythonfastapi
Skill · fastapi
The pick for FastAPIintegration-fastapi
Skill · posthog
The pick for FastAPIgws-shared
Skill · googleworkspace
More in Securitydefi-amm-security
Skill · affaan-m
More in Security