config-schema-migrator

Migrate Pydantic configuration schemas with backward-compatible migration scripts.

1|1|Updated Oct 13, 2025
One-click install
npx skills add https://github.com/blueman82/ai-counsel --skill config-schema-migrator
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: config-schema-migrator
Source: https://github.com/blueman82/ai-counsel/tree/main/.claude/skills/config-schema-migrator
Command: npx skills add https://github.com/blueman82/ai-counsel --skill config-schema-migrator

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pydantic, pyyaml, python-dotenv.

What problem does it solve?

Evolving Pydantic configuration schemas while maintaining backward compatibility, handling environment variables, and providing automated migration paths is challenging. This skill provides patterns to manage config changes gracefully, preventing breaking changes and simplifying updates.

Core Features & Use Cases

  • Backward-Compatible Schema Evolution: Add new config sections and fields without breaking existing configurations.
  • Type Discrimination: Implement discriminated unions for flexible configuration of different types (e.g., CLI vs. HTTP adapters).
  • Environment Variable Substitution: Securely inject secrets and dynamic values from environment variables into your config.
  • Automated Migration Scripts: Create robust Python scripts to automatically update old config files to new formats, including backups.
  • Use Case: Migrate an existing config.yaml from a legacy cli_tools section to a new adapters section, automatically adding type: cli to each entry, without requiring manual edits from users.

Quick Start

To migrate your config.yaml from the deprecated cli_tools format to the new adapters format, run the provided migration script: python scripts/migrate_config.py config.yaml

Frequently Asked Questions about config-schema-migrator

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle backward-compatible changes to Pydantic configuration schemas?

Backward-compatible schema evolution in Pydantic allows you to add new fields and sections without breaking existing configs. Use optional legacy sections, post-init validation, and deprecation warnings to support old formats while guiding users to new ones.

Can I automatically migrate old YAML config files to a new schema format?

Yes, automated migration scripts update legacy config files to new formats while preserving data. The migration process can add missing fields, rename sections, and apply type transformations, then backup originals before overwriting.

How do I inject environment variables into Pydantic configuration?

Environment variable substitution in Pydantic configs securely injects secrets and dynamic values at runtime. Fields marked for substitution read from environment variables, allowing secure credential handling without hardcoding sensitive data.

What's the best way to support multiple configuration types with Pydantic discriminated unions?

Discriminated unions use a type discriminator field to flexibly configure different variants—such as CLI vs. HTTP adapters—within a single schema. The discriminator determines which variant structure Pydantic validates, enabling polymorphic config handling.

Do I need to manually update existing config files when my schema changes?

No, migration scripts automate updates to old config files, eliminating manual edits. The migration detects legacy formats, transforms them to the new schema, and backs up originals, so users receive updated configs without manual intervention.

When should I use deprecation warnings instead of breaking schema changes?

Deprecation warnings flag fields or sections moving to new locations, giving users time to adapt before removal. This approach maintains backward compatibility during transitions, reducing friction while signaling where config updates are needed.