CO

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

Installs 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.
127 charsno explicit “when” trigger
Advanced

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

You give it
JSONSchema or YAML source file
You get back
Validated Python models or dereferenced config files

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:

FilePurpose
datamodel.pyGenerated Pydantic v2 models from JSONSchema
schema.yamlSource JSONSchema with $ref references
compile_schema.pyDereferences $ref to create schema.deref.yaml
generate_types.pyGenerates Python types via datamodel-codegen
validators.pyCustom validators beyond JSONSchema capabilities
helpers/loader.pyConfig loading, saving, and format detection
helpers/generator.pyTemplate-based config generation

Links to Shared Skills

This module follows Python conventions from the shared skills:

TopicLinkKey Relevance
Patternspython-skills/patterns.mdPydantic v2, dataclasses
Typingpython-skills/typing.mdType hints, constrained types
Testingpython-skills/testing.mdPytest fixtures, temp files
Errorspython-skills/error-handling.mdCustom exceptions
Securitypython-skills/security.mdPath traversal prevention

Framework-Specific Checklists

ChecklistDescription
pydantic.mdPydantic v2 configuration patterns, nested models, constraints
jsonschema.mdJSONSchema generation, dereferencing, validation

Tech Stack

  • Python: 3.11+
  • Pydantic: v2 with ConfigDict, Field, constrained types
  • JSONSchema: Draft-07 with $ref dereferencing via jsonref
  • YAML: ruamel.yaml for comment-preserving read/write
  • Code Generation: datamodel-codegen for 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:

  1. Edit schema.yaml (or referenced schemas like ../rag/schema.yaml)
  2. Run nx run generate-types to compile and generate types
  3. Update validators.py if new cross-field constraints are needed
  4. 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

Python 3.11+Pydantic v2

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.

SkillInstallsUpdatedSafetyDifficulty
config-skills (this skill)16moReviewAdvanced
telegram-bot-builder1066moReviewIntermediate
async-python-patterns122moNo flagsIntermediate
modal57moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

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.

106130

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.

1299

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.

587

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.

615

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.

314

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.

36

Search skills

Search the agent skills registry