Cosmiconfig Setup

SkillDev tools

Set up cosmiconfig for hierarchical configuration loading from multiple sources and formats.

Instructions available. Your AI can read the instructions. Execution depends on the setup they require.

Add ahel to your AI once: Claude, ChatGPT, Cursor, Claude Code or Codex. Then ask it to use this.

Then ask your AI: use the Cosmiconfig Setup skill

What this skill tells your AI

The instructions your AI receives, as published by a5c-ai/babysitter in library/specializations/cli-mcp-development/skills/cosmiconfig-setup/SKILL.md and read by ahel’s review.

Set up cosmiconfig for hierarchical config loading.

Capabilities

  • Configure cosmiconfig search paths
  • Set up format loaders (JSON, YAML, TOML)
  • Create TypeScript config support
  • Implement config caching
  • Handle config validation

Generated Patterns

import { cosmiconfig, cosmiconfigSync } from 'cosmiconfig';
import { TypeScriptLoader } from 'cosmiconfig-typescript-loader';

const moduleName = 'myapp';

const explorer = cosmiconfig(moduleName, {
  searchPlaces: [
    'package.json',
    `.${moduleName}rc`,
    `.${moduleName}rc.json`,
    `.${moduleName}rc.yaml`,
    `.${moduleName}rc.yml`,
    `.${moduleName}rc.js`,
    `.${moduleName}rc.ts`,
    `.${moduleName}rc.cjs`,
    `${moduleName}.config.js`,
    `${moduleName}.config.ts`,
    `${moduleName}.config.cjs`,
  ],
  loaders: {
    '.ts': TypeScriptLoader(),
  },
});

export async function loadConfig(searchFrom?: string) {
  const result = await explorer.search(searchFrom);
  if (!result || result.isEmpty) {
    return { config: getDefaultConfig(), filepath: null };
  }
  return { config: { ...getDefaultConfig(), ...result.config }, filepath: result.filepath };
}

Target Processes

  • configuration-management-system
  • cli-application-bootstrap
  • mcp-server-bootstrap

Signals

GitHub stars
2k
Forks
112
Last commit
Sep 2026
Advanced
Item type
skill
Key
cosmiconfig-setup
Source
github.com/a5c-ai/babysitter