Patterns for managing CLI configuration files across multiple scopes and formats. Load this file only when the task involves config loading, dotfiles, XDG compl
Config File Patterns provides a structured approach to managing CLI configuration files across multiple scopes and formats, ensuring consistent loading, validation, and merging of settings. It covers handling user config directories following XDG standards, supports common formats like JSON, YAML, TOML, and TypeScript, and enforces schema validation to catch errors before runtime. This skill helps maintain reliable and predictable config resolution from defaults, files, environment variables, and CLI flags.
This skill is designed for performance marketers and growth leads working with developer tools or internal CLI utilities that require flexible yet robust configuration management. SEO and PPC operators managing automation scripts or reporting tools with complex environment setups will find it useful. Agency strategists integrating multiple client tools can leverage these patterns to standardize configuration handling and reduce errors during deployment or customization.
Practitioners typically start by defining a clear config schema using validation libraries like Zod or Pydantic, establishing default values and type constraints. Next, they implement a hierarchical loading process that merges hardcoded defaults, config files discovered via cosmiconfig or dynaconf, environment variables prefixed with the tool name, and finally CLI flags with the highest priority. They select appropriate file formats—JSON and YAML minimally, optionally TypeScript for enhanced developer experience—and structure config files within XDG-compliant directories. Finally, they validate the assembled config object at load time, reporting aggregated errors to prevent runtime failures.
How should I organize config files across different environments? Use the XDG base directory specification to separate user config, state, cache, and data files, placing tool-specific files under these standard paths for consistency. Can I support multiple config formats in one tool? Yes, by using loaders like cosmiconfig or dynaconf that automatically detect and merge JSON, YAML, TOML, and TypeScript config files. What’s the best way to handle environment variables? Prefix each variable with the tool name in SCREAMING_SNAKE_CASE, map flags directly, and support boolean and list values using conventional formats like true/false and comma-separated strings.
Attach the Config File Patterns skill to any Metaflow agent task that involves CLI config loading, environment setup, or dotfile management. The skill will guide the agent through resolving config paths, detecting and merging multiple config sources, validating schemas, and applying environment variable conventions to ensure reliable and predictable configuration. This approach reduces errors and simplifies troubleshooting when deploying or updating CLI-driven workflows within Metaflow.
For broader context, see our roundup of claude skills marketing, and read Claude skills for SEO for related setup guidance.