Back to skills
SKILL.md
Cosmiconfig Setup
ASecuritySet up cosmiconfig for hierarchical configuration loading from multiple sources and formats.
- 1,760 stars
- 0 votes
- 0 copies
- 1 view
- Added September 2, 2026
Works with
Security analysis
100/100Pro scans all 2 files and shows the line behind each finding
npx -y skills add a5c-ai/babysitter --skill cosmiconfig-setup --agent claude-codeAre you the author of Cosmiconfig Setup?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/a5c-ai-cosmiconfig-setup-babysitter)---
name: cosmiconfig-setup
description: Set up cosmiconfig for hierarchical configuration loading from multiple sources and formats.
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
graph:
domains: [domain:software-engineering]
specializations: [specialization:cli-mcp-development]
skillAreas: [skill-area:cli-design, skill-area:configuration-management]
roles: [role:backend-engineer, role:platform-engineer]
workflows: [workflow:feature-development]
topics: [topic:developer-experience]
---
# 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-bootstrap
Files in this skill
- README.md
- SKILL.md
Attribution
Comments
Loading comments…