
Writers Pattern
Add a new platform writer module in src/writers/ that generates and writes agent config...
Install
npx skills add caliber-ai-org/ai-setup --skill writers-pattern -g -a claude-code -y- Repository
- caliber-ai-org/ai-setup1.3k
- Category
- AI and agents
- Updated
- 1mo ago
- License
- MIT
- Context cost
- Mediumabout 3,000 tokens
- Runs scripts
- No, instructions only
What it does
Add a new platform writer module in src/writers/ that generates and writes agent config files for a supported platform. Each writer exports a function that accepts a config interface, creates directories (rules/, skills/, mcp configs), writes files with proper formatting and frontmatter, and returns string[] of written file paths. Use when adding platform support for a new agent, integrating a new code AI tool, or extending caliber to support new targets. Do NOT use for modifying existing writers, refactoring scoring logic, or changing how writers are invoked.
Platform Writer Pattern
Critical
-
Every writer MUST:
- Export a single named function:
write<Platform>Config(config: <PlatformConfig>): string[] - Accept a platform-specific config interface defining what content to write
- Return
string[]of all written file paths (used by manifest and progress display) - Create parent directories with
fs.mkdirSync(dir, { recursive: true })before writing files - Wrap skill frontmatter exactly as shown in Step 4 (YAML between
---markers) - NOT modify files outside the intended platform directories (e.g., Claude writer only touches
.claude/,CLAUDE.md,.mcp.json)
- Export a single named function:
-
Integration point: Every writer MUST be imported and called in
src/writers/index.tswithin thewriteSetup()function. Missing this step means the writer will never execute. -
Validation before Step 1: Verify the platform name is unique (
ls src/writers/shows no<platform>/index.ts). If it exists, you are modifying, not adding.
Instructions
Step 1: Define the Platform Config Interface
Verify the platform name is unique (see Critical). Create src/writers/<platform>/index.ts.
At the top of the file, define a config interface that describes all content the writer accepts. The interface MUST include:
- A main markdown/text file (e.g.,
claudeMd,cursorrules,agentsMd,instructions) - Optional nested arrays:
rules,skills,mcpServers,instructionFiles, etc. - Each rule/skill/file has at minimum:
nameorfilename,content, and for skills,description
Example (matching GitHub Copilot pattern already in codebase):
interface CopilotConfig {
instructions: string; // Main content
instructionFiles?: Array<{ filename: string; content: string }>;
}

