$120 tested Claude codes · real before/after data · Full tier $15 one-timebuy --sheet=15 →
$Free 40-page Claude guide — setup, 120 prompt codes, MCP servers, AI agents. download --free →
clskills.sh — terminal v2.4 — 2,347 skills indexed● online
[CL]Skills_
CLI Toolsintermediate

CLI Config Manager

Share

Build CLI configuration management

Works with OpenClaude

You are a CLI application architect building a configuration management system. The user wants to create a command-line tool that reads, validates, writes, and manages application configuration files with support for multiple formats and environment variable overrides.

What to check first

  • Confirm Node.js version supports fs/promises (v14+) by running node --version
  • Verify target config formats: JSON, YAML, .env, TOML — decide which to support initially
  • Check if dotenv and yaml packages are already installed with npm list dotenv yaml

Steps

  1. Install required dependencies: npm install dotenv yaml commander chalk table-layout for parsing, CLI building, and output formatting
  2. Create a Config class that uses fs/promises.readFile() to load config files with format auto-detection based on file extension
  3. Implement a validate() method using a schema object to enforce required keys and type checking with early validation errors
  4. Add an override() method that merges command-line arguments and process.env variables with loaded config, prioritizing CLI args > env vars > file config
  5. Create a set() and get() method for dot-notation key access (e.g., get('database.host') reaches nested config.database.host)
  6. Build CLI commands with Commander.js: config get <key>, config set <key> <value>, config list, config validate
  7. Implement a write() method using fs/promises.writeFile() to persist changes back to the config file in original format
  8. Add error handling for file not found, permission denied, invalid JSON/YAML, and schema validation failures with descriptive messages

Code

import fs from 'fs/promises';
import path from 'path';
import { parse as parseYaml, stringify as stringifyYaml } from 'yaml';
import { program } from 'commander';
import chalk from 'chalk';
import dotenv from 'dotenv';

class ConfigManager {
  constructor(configPath, schema = {}) {
    this.configPath = configPath;
    this.schema = schema;
    this.config = {};
    this.format = path.extname(configPath).slice(1) || 'json';
  }

  async load() {
    try {
      const content = await fs.readFile(this.configPath, 'utf-8');
      
      if (this.format === 'json') {
        this.config = JSON.parse(content);
      } else if (this.format === 'yaml' || this.format === 'yml') {
        this.config = parseYaml(content);
      } else if (this.format === 'env') {
        this.config = dotenv.parse(content);
      }
      
      this.validate();
      return this.config;
    } catch (err) {
      if (err.code === 'ENOENT

Note: this example was truncated in the source. See the GitHub repo for the latest full version.

Common Pitfalls

  • Treating this skill as a one-shot solution — most workflows need iteration and verification
  • Skipping the verification steps — you don't know it worked until you measure
  • Applying this skill without understanding the underlying problem — read the related docs first

When NOT to Use This Skill

  • When a simpler manual approach would take less than 10 minutes
  • On critical production systems without testing in staging first
  • When you don't have permission or authorization to make these changes

How to Verify It Worked

  • Run the verification steps documented above
  • Compare the output against your expected baseline
  • Check logs for any warnings or errors — silent failures are the worst kind

Production Considerations

  • Test in staging before deploying to production
  • Have a rollback plan — every change should be reversible
  • Monitor the affected systems for at least 24 hours after the change

Quick Info

CategoryCLI Tools
Difficultyintermediate
Version1.0.0
AuthorClaude Skills Hub
cliconfigmanagement

Install command:

curl -o ~/.claude/skills/cli-config-manager.md https://claude-skills-hub.vercel.app/skills/cli/cli-config-manager.md

Related CLI Tools Skills

Other Claude Code skills in the same category — free to download.

Want a CLI Tools skill personalized to YOUR project?

This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.