Agent skill

Python Skills

by llama-farm in llama-farm/llamafarm

Shared Python best practices for LlamaFarm. An agent skill from llama-farm/llamafarm.

Apache-2.0Auto-check: notesDevelopment

Install Python Skills

skills CLI
$ npx skills add llama-farm/llamafarm --skill python-skills -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install llama-farm/llamafarm python-skills --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/llama-farm/llamafarm.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/python-skills .claude/skills/python-skills && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
python-skills
GitHub stars
837
Token cost
~1.2k tokens
SKILL.md length
279 words
Files
7
Skills in repo
19
Repo updated
First seen
Licence
Apache-2.0

At a glance

Shared Python best practices for LlamaFarm. An agent skill from llama-farm/llamafarm.

  • Works in 6 steps: Patterns (Medium priority) → Async (High priority) → Typing (Medium priority) → …
  • Tasks that involve Error handling
  • SKILL.md covers Applicable Components, Quick Reference, Code Style and Architecture Patterns, plus 2 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Python Skills is an agent skill from llama-farm/llamafarm. Shared Python best practices for LlamaFarm. Covers patterns, async, typing, testing, error handling, and security.

Its SKILL.md is about 1.2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 6 other files (for example `async.md`, `error-handling.md` and `patterns.md`).

It sits in Development, covering Error handling. It works with Python and Pydantic. The repository describes itself as: Deploy any AI model, agent, database, RAG, and pipeline locally or remotely in minutes. The licence is Apache-2.0.

When your agent uses it

  • Tasks that involve Error handling

Example prompts

  • “/python-skills”

Requirements

  • Python 3
  • Pre-approved tools (allowed-tools): Read, Grep, Glob

Workflow steps

6 steps, taken from the first numbered list in SKILL.md.

  1. Patterns (Medium priority)
  2. Async (High priority)
  3. Typing (Medium priority)
  4. Testing (Medium priority)
  5. Errors (High priority)
  6. Security (Critical priority)

What it can do on your machine

Read from SKILL.md and the folder at commit 6244d46. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Grep
    • Glob

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python and toml).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Python Skills loads about 1.2k tokens when it runs. Until then it costs about 32 tokens; SKILL.md has 279 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~32
When it runs · the whole SKILL.md, loaded when a task matches
~1.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NoteMentions a .env fileSKILL.md:57
    class Settings(BaseSettings, env_file=".env"):

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from llama-farm/llamafarm at commit 6244d46, republished under its Apache-2.0 licence (© llama-farm). 279 words, ~1,209 tokens.

Download SKILL.mdSave it as .claude/skills/python-skills/SKILL.md (or your agent's skills folder). This skill also uses 6 other files; get the full folder from GitHub.
name
python-skills
description
Shared Python best practices for LlamaFarm. Covers patterns, async, typing, testing, error handling, and security.
allowed-tools
Read, Grep, Glob
user-invocable
false

Python Skills for LlamaFarm

Shared Python best practices and code review checklists for all Python components in the LlamaFarm monorepo.

Applicable Components

ComponentPathPythonKey Dependencies
Serverserver/3.12+FastAPI, Celery, Pydantic, structlog
RAGrag/3.11+LlamaIndex, ChromaDB, Celery
Universal Runtimeruntimes/universal/3.11+PyTorch, transformers, FastAPI
Configconfig/3.11+Pydantic, JSONSchema
Commoncommon/3.10+HuggingFace Hub

Quick Reference

TopicFileKey Points
Patternspatterns.mdDataclasses, Pydantic, comprehensions, imports
Asyncasync.mdasync/await, asyncio, concurrent execution
Typingtyping.mdType hints, generics, protocols, Pydantic
Testingtesting.mdPytest fixtures, mocking, async tests
Errorserror-handling.mdCustom exceptions, logging, context managers
Securitysecurity.mdPath traversal, injection, secrets, deserialization

Code Style

LlamaFarm uses ruff with shared configuration in ruff.toml:

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
python
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
python
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
python
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
python
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
python
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:

  1. Patterns (Medium priority)

    • Modern Python syntax (3.10+ type hints)
    • Dataclass vs Pydantic used appropriately
    • No mutable default arguments
  2. Async (High priority)

    • No blocking calls in async functions
    • Proper asyncio.Lock usage
    • Cancellation handled correctly
  3. Typing (Medium priority)

    • Complete return type hints
    • Generic types parameterized
    • Pydantic v2 patterns
  4. Testing (Medium priority)

    • Fixtures properly scoped
    • Async tests use pytest-asyncio
    • Mocks cleaned up
  5. Errors (High priority)

    • Custom exceptions with context
    • Structured logging with extra dict
    • Proper exception chaining
  6. Security (Critical priority)

    • Path traversal prevention
    • Input sanitization
    • Safe deserialization

See individual topic files for detailed checklists with grep patterns.

© llama-farm, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 6 other files in .claude/skills/python-skills of llama-farm/llamafarm.

  • SKILL.md
  • async.md
  • error-handling.md
  • patterns.md
  • security.md
  • testing.md
  • typing.md

Open the folder on GitHubat commit 6244d46

Compare with similar skills

Python Skills next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Python Skills compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Python Skills this skillllama-farm/llamafarm837—~1.2kAutomated safety check: NotesApache-2.0
Cross-Language Coding Standardszereight/gitlab-mcp2k1 repos~1.4kAutomated safety check: PassMIT
Python Devdatabricks-solutions/ai-dev-kit1.9k—~1.6kAutomated safety check: PassCustom licence
A2ui Generate Pydantic Modelsa2ui-project/a2ui17k—~2.3kAutomated safety check: PassApache-2.0
Releasezmievsa/cadwyn309—~522Automated safety check: PassMIT
Python Patternskurealnum/dotfiles2908 repos~4.1kAutomated safety check: PassNone

Similar skills

  • Shared reference for naming, function size, complexity and error handling rules that reviewer agents apply across TypeScript, Python, Go, Rust, Java, C# and Swift.

    2k GitHub starsUsed in 1 repo~1.4k tokens
    DevelopmentAuto-check passed
  • Python Dev

    databricks-solutions/ai-dev-kit

    Python development guidance with code quality standards, error handling, testing practices, and environment management.

    1.9k GitHub stars~1.6k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed
  • Automated generator for strongly typed Pydantic v2 data models and basic catalogs across any A2UI protocol version (v0.8, v0.9, v0.9.1, v1.0, etc.).

    17k GitHub stars~2.3k tokensUpdated today
    DevelopmentAuto-check passed
  • Release

    zmievsa/cadwyn

    Prepare and publish Cadwyn releases. An agent skill from zmievsa/cadwyn.

    309 GitHub stars~522 tokensUpdated today
    DevelopmentAuto-check passed
  • Python Patterns

    kurealnum/dotfiles

    Pythonic idioms, PEP 8 standards, type hints, and best practices for building robust, efficient, and maintainable Python applications.

    290 GitHub starsUsed in 8 repos~4.1k tokens
    DevelopmentAuto-check passed
  • Ag2 Add Custom Tool

    ag2ai/build-with-ag2

    Add a custom Python tool to an AG2 beta Agent using the @tool decorator.

    252 GitHub stars~1.9k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed

More from llama-farm/llamafarm

All 19 skills in this repo
  • Reflect

    llama-farm/llamafarm

    Analyze the current session and propose improvements to skills.

    837 GitHub stars~1.5k tokensUpdated 3 mo ago
    Auto-check: notes
  • RAG Skills

    llama-farm/llamafarm

    RAG-specific best practices for LlamaIndex, ChromaDB, and Celery workers.

    837 GitHub starsUsed in 1 repo~1.3k tokens
    Auto-check passed
  • Temp Files

    llama-farm/llamafarm

    Guidelines for creating temporary files in system temp directory.

    837 GitHub stars~515 tokensUpdated 3 mo ago
    Auto-check: notes
  • Runtime Skills

    llama-farm/llamafarm

    Universal Runtime best practices for PyTorch inference, Transformers models, and FastAPI serving.

    837 GitHub starsUsed in 1 repo~1.3k tokens
    Auto-check passed
  • CLI Skills

    llama-farm/llamafarm

    CLI best practices for LlamaFarm. An agent skill from llama-farm/llamafarm.

    837 GitHub stars~1.2k tokensUpdated 3 mo ago
    Auto-check passed
  • Code Review

    llama-farm/llamafarm

    Comprehensive code review for diffs. An agent skill from llama-farm/llamafarm.

    837 GitHub stars~2.3k tokensUpdated 3 mo ago
    Auto-check: notes

Works with

Questions about Python Skills

What does Python Skills do?

Shared Python best practices for LlamaFarm. An agent skill from llama-farm/llamafarm. Python Skills is an agent skill from llama-farm/llamafarm. Shared Python best practices for LlamaFarm.

When should I use Python Skills?

Python Skills fits situations like: tasks that involve Error handling.

How do I install Python Skills in Claude Code?

Run `npx skills add llama-farm/llamafarm --skill python-skills -a claude-code`. Or copy the skill folder (.claude/skills/python-skills in llama-farm/llamafarm) into .claude/skills/python-skills in your project. Claude Code loads it when a task matches its description.

How do I install Python Skills in Codex?

Run `npx skills add llama-farm/llamafarm --skill python-skills -a codex`. Or copy the skill folder (.claude/skills/python-skills in llama-farm/llamafarm) into .agents/skills/python-skills in your project. Codex loads it when a task matches its description.

Can I use Python Skills in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add llama-farm/llamafarm --skill python-skills -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/python-skills, .gemini/skills/python-skills, .github/skills/python-skills and .opencode/skills/python-skills in your project.

What does Python Skills need to run?

SKILL.md names no scripts, command-line tools or credentials: Python Skills is instructions for the agent only. Our summary lists: Python 3. Its frontmatter pre-approves these tools: Read, Grep, Glob.

Does Python Skills access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Python Skills safe to install?

Our automated static check of SKILL.md found notes only (mentions a .env file), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Python Skills use?

Python Skills is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Python Skills use?

About 1.2k tokens (SKILL.md is roughly 4.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Python Skills?

Skills that share tags, products or a category with Python Skills: Cross-Language Coding Standards (zereight/gitlab-mcp, 2k stars), Python Dev (databricks-solutions/ai-dev-kit, 1.9k stars), A2ui Generate Pydantic Models (a2ui-project/a2ui, 17k stars) and Release (zmievsa/cadwyn, 309 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Python Skills?

llama-farm (a GitHub organization) maintains it in llama-farm/llamafarm, which has 837 GitHub stars. The repository holds 19 skills in this directory. The repository was last updated on June 10, 2026.

Source: llama-farm/llamafarm on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.