cosmiconfig-setup
Set up cosmiconfig for hierarchical configuration loading from multiple sources and formats.
Best use case
cosmiconfig-setup is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Set up cosmiconfig for hierarchical configuration loading from multiple sources and formats.
Teams using cosmiconfig-setup should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/cosmiconfig-setup/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How cosmiconfig-setup Compares
| Feature / Agent | cosmiconfig-setup | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Set up cosmiconfig for hierarchical configuration loading from multiple sources and formats.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Cosmiconfig Setup
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
```typescript
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-bootstrapRelated Skills
visual-regression-setup
Configure visual regression testing with Percy, Chromatic, or custom screenshot comparison
tauri-project-setup
Initialize Tauri project with Rust backend and frontend framework integration
spectron-test-setup
Set up Spectron (deprecated) tests for legacy Electron application testing
sentry-desktop-setup
Configure Sentry for comprehensive desktop application crash reporting, error monitoring, performance tracking, and release health for Electron and native desktop apps
file-watcher-setup
Set up cross-platform file system watching with debouncing and efficient change detection
electron-protocol-handler-setup
Register and handle custom URL protocols (deep linking) across platforms for Electron applications
electron-auto-updater-setup
Configure electron-updater with code signing verification, delta updates, staged rollouts, and multiple update channels for Electron applications
avalonia-ui-setup
Set up Avalonia UI project with cross-platform XAML for Windows, macOS, and Linux
viper-go-setup
Set up Viper for Go configuration management with file, env, and flag binding.
plugin-sandbox-setup
Configure plugin sandboxing with vm2 or isolated-vm for secure plugin execution.
mcp-transport-websocket-setup
Configure WebSocket transport for bidirectional MCP communication with connection management and reconnection handling.
mcp-transport-sse-setup
Configure HTTP/SSE transport for web-based MCP servers with proper endpoints, authentication, and CORS.