config-skills
Standardized patterns for managing, validating, and generating configuration models in LlamaFarm.
Install
mkdir -p .claude/skills/config-skills && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/6657" && unzip -o skill.zip -d .claude/skills/config-skills && rm skill.zipInstalls to .claude/skills/config-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.
Configuration module patterns for LlamaFarm. Covers Pydantic v2 models, JSONSchema generation, YAML processing, and validation.Key capabilities
- →Generate Pydantic v2 models from JSONSchema
- →Process YAML configuration files
- →Dereference JSONSchema $ref
- →Validate configurations against custom rules
How it works
It runs code-generation utilities to translate schema definitions into strictly typed Pydantic models for configuration validation.
Inputs & outputs
When to use config-skills
- →Compile JSONSchema into Pydantic models
- →Validate YAML configuration files
- →Generate new configuration templates
About this skill
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 | Pydantic v2, dataclasses |
| Typing | python-skills/typing.md | Type hints, constrained types |
| Testing | python-skills/testing.md | Pytest fixtures, temp files |
| Errors | python-skills/error-handling.md | Custom exceptions |
| Security | python-skills/security.md | Path traversal prevention |
Framework-Specific Checklists
| Checklist | Description |
|---|---|
| pydantic.md | Pydantic v2 configuration patterns, nested models, constraints |
| 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/
When not to use it
- →Dynamic runtime configuration updates
- →Storing sensitive credentials directly in configs
Prerequisites
Limitations
- →Requires schema definition for generation
- →Strict coupling to LlamaFarm patterns
How it compares
It provides a rigid, schema-first approach to configuration management that guarantees type safety.
Compared to similar skills
config-skills side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| config-skills (this skill) | 1 | 6mo | Review | Advanced |
| telegram-bot-builder | 106 | 6mo | Review | Intermediate |
| async-python-patterns | 12 | 2mo | No flags | Intermediate |
| modal | 5 | 7mo | Review | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by llama-farm
View all by llama-farm →You might also like
telegram-bot-builder
davila7
Expert in building Telegram bots that solve real problems - from simple automation to complex AI-powered bots. Covers bot architecture, the Telegram Bot API, user experience, monetization strategies, and scaling bots to thousands of users. Use when: telegram bot, bot api, telegram automation, chat bot telegram, tg bot.
async-python-patterns
wshobson
Master Python asyncio, concurrent programming, and async/await patterns for high-performance applications. Use when building async APIs, concurrent systems, or I/O-bound applications requiring non-blocking operations.
modal
davila7
Run Python code in the cloud with serverless containers, GPUs, and autoscaling. Use when deploying ML models, running batch processing jobs, scheduling compute-intensive tasks, or serving APIs that require GPU acceleration or dynamic scaling.
python-background-jobs
wshobson
Python background job patterns including task queues, workers, and event-driven architecture. Use when implementing async task processing, job queues, long-running operations, or decoupling work from request/response cycles.
opentrons-integration
davila7
Lab automation platform for Flex/OT-2 robots. Write Protocol API v2 protocols, liquid handling, hardware modules (heater-shaker, thermocycler), labware management, for automated pipetting workflows.
superpowers-python-automation
anthonylee991
Implements reliable automations in Python for REST APIs: httpx/requests patterns, retries, timeouts, pagination, typing, config, logging, and tests. Use when writing Python scripts/services that call external APIs.