npx skills add smithery/llama-farm --skill config-skills
llama-farm/llamafarm
config-skills
Configuration module patterns for LlamaFarm. Covers Pydantic v2 models, JSONSchema generation, YAML processing, and validation.
Installation
npx skills add llama-farm/llamafarm --skill config-skills
Similar popular skills
Related neighbors and high-traction skills in the same topics — useful to compare before installing.
>- Manages Firebase Remote Config templates, feature flags, loading strategies, and SDKs (Andro…
94.5K installsGenerates a comprehensive and best-practice-oriented .editorconfig file based on project analys…
11K installsConfigure an MCP server for GitHub Copilot with your Dataverse environment.
7K installsConfigures VPC endpoints (interface and gateway) for private AWS service access using AWS Priva…
4.7K installsSet up the Discord channel — save the bot token and review access policy. Use when the user pas…
2.8K installsDEPRECATED redirect — this skill was renamed to tools. Do not use this skill; invoke tools inst…
2.7K installsAlso in this package
Other skills from llama-farm/llamafarm · top by installs.
npx skills add llama-farm/llamafarm
More details
Agent compatibility
Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.
Also listed on
Alternate registries and mirrors of this skill.
Repository health
main
Skill metadata
Parsed from SKILL.md frontmatter.
Read, Grep, GlobPackage contents
Files included with this skill beyond the listing page.
-
skill md
SKILL.md5,219 B -
docs
SUMMARY.md148 B
History
- First seen on skills.sh
- First recorded snapshot · 42 installs
SKILL.md
Config Skills for LlamaFarm
Specialized patterns and best practices for the LlamaFarm configuration module (config/).
Module Overview
The config module provides YAML/TOML/JSON configuration loading with JSONSchema validation:
| File | Purpose |
|---|---|
datamodel.py |
Generated Pydantic v2 models from JSONSchema |
schema.yaml |
Source JSONSchema with $ref references |
compile_schema.py |
Dereferences $ref to create schema.deref.yaml |
generate_types.py |
Generates Python types via datamodel-codegen |
validators.py |
Custom validators beyond JSONSchema capabilities |
helpers/loader.py |
Config loading, saving, and format detection |
helpers/generator.py |
Template-based config generation |
Links to Shared Skills
This module follows Python conventions from the shared skills:
| Topic | Link | Key Relevance |
|---|---|---|
| Patterns | [python-skills/patterns.md](../python-skills/patterns.md) | Pydantic v2, dataclasses |
| Typing | [python-skills/typing.md](../python-skills/typing.md) | Type hints, constrained types |
| Testing | [python-skills/testing.md](../python-skills/testing.md) | Pytest fixtures, temp files |
| Errors | [python-skills/error-handling.md](../python-skills/error-handling.md) | Custom exceptions |
| Security | [python-skills/security.md](../python-skills/security.md) | Path traversal prevention |
Framework-Specific Checklists
| Checklist | Description |
|---|---|
| [pydantic.md](pydantic.md) | Pydantic v2 configuration patterns, nested models, constraints |
| [jsonschema.md](jsonschema.md) | JSONSchema generation, dereferencing, validation |
Tech Stack
- Python: 3.11+
- Pydantic: v2 with
ConfigDict,Field, constrained types - JSONSchema: Draft-07 with
$refdereferencing viajsonref - YAML:
ruamel.yamlfor comment-preserving read/write - Code Generation:
datamodel-codegenfor schema-to-Pydantic
Key Patterns
Generated Pydantic Models
The datamodel.py file is auto-generated from JSONSchema:
# Generated by datamodel-codegen from schema.deref.yaml
from pydantic import BaseModel, ConfigDict, Field, conint, constr
class Database(BaseModel):
model_config = ConfigDict(extra="forbid")
name: constr(pattern=r"^[a-z][a-z0-9_]*$", min_length=1, max_length=50)
type: Type
config: dict[str, Any] | None = Field(None, description="Database-specific configuration")
Custom Validators for Cross-Field Constraints
JSONSchema draft-07 cannot express all constraints. Custom validators extend validation:
def validate_llamafarm_config(config_dict: dict[str, Any]) -> None:
"""Validate constraints beyond JSONSchema (uniqueness, references)."""
# Check for duplicate prompt names
prompt_names = [p.get("name") for p in config_dict.get("prompts", [])]
duplicates = [name for name in prompt_names if prompt_names.count(name) > 1]
if duplicates:
raise ValueError(f"Duplicate prompt set names: {', '.join(set(duplicates))}")
Comment-Preserving YAML with ruamel.yaml
Configuration files preserve user comments when modified:
from ruamel.yaml import YAML
from ruamel.yaml.comments import CommentedMap
def _get_ruamel_yaml() -> YAML:
yaml_instance = YAML()
yaml_instance.preserve_quotes = True
yaml_instance.indent(mapping=2, sequence=4, offset=2)
return yaml_instance
Directory Structure
config/
├── pyproject.toml # UV-managed dependencies
├── schema.yaml # Source JSONSchema with $ref
├── schema.deref.yaml # Dereferenced schema (generated)
├── datamodel.py # Pydantic models (generated)
├── compile_schema.py # Schema compilation script
├── generate_types.py # Type generation script
├── validators.py # Custom validation beyond JSONSchema
├── validate_config.py # CLI validation wrapper
├── __init__.py # Public API exports
├── helpers/
│ ├── loader.py # Config loading/saving
│ └── generator.py # Template-based generation
├── templates/
│ └── default.yaml # Default config template
└── tests/
├── conftest.py # Shared fixtures
└── test_*.py # Test modules
Workflow: Schema Changes
When modifying the configuration schema:
- Edit
schema.yaml(or referenced schemas like../rag/schema.yaml) - Run
nx run generate-typesto compile and generate types - Update
validators.pyif new cross-field constraints are needed - Test with
uv run pytest config/tests/
Common Commands
# Generate types from schema
nx run generate-types
# Validate a config file
uv run python config/validate_config.py path/to/llamafarm.yaml --verbose
# Run tests
uv run pytest config/tests/ -v
# Lint and format
ruff check config/ --fix
ruff format config/