config-skills
Configuration module patterns for LlamaFarm. Covers Pydantic v2 models, JSONSchema generation, YAML processing, and validation.
Install
mkdir -p .claude/skills/config-skills && curl -L -o skill.zip "https://mcp.directory/api/skills/download/6657" && unzip -o skill.zip -d .claude/skills/config-skills && rm skill.zipInstalls to .claude/skills/config-skills
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/
More by llama-farm
View all skills by llama-farm →You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
fastapi-templates
wshobson
Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
Related MCP Servers
Browse all serversMagento 2 Development tool integrates seamlessly with n98-magerun2 for efficient cache, module, config, and database man
TON Blockchain Analyzer tracks wallet addresses, analyzes transactions, and uncovers trading patterns for smarter crypto
Use our Security Scanner as a website virus scanner to detect site scanner virus threats, vulnerabilities, and exposed s
Security Scanner analyzes code repositories to find exposed secrets, vulnerabilities, dependency flaws and misconfigurat
Fetch JSONPath retrieves and extracts data from HTTP APIs using JSONPath, supporting batch processing, custom headers, p
The Nuxt SEO MCP server gives AI assistants access to module documentation, configuration examples, and quick reference
Stay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.