Adds a new platform writer in src/writers/ following existing patterns (claude, cursor, codex). Returns string[] of generated file paths. Integrates with writeSetup() orchestration. Use when implementing 'add platform', 'new writer', 'support new agent'. Do NOT use for refactoring existing writers or modifying writers/index.ts exports.
(config: WriterConfig, skillLines: SkillLine[]) => Promise<string[]>src/writers/index.ts as named exportssrc/writers/{platform}/index.ts with sibling __tests__/index.test.tsWriterConfig) is shared across all writers — inspect src/writers/claude/index.ts for the exact shapeconfig object and skillLines array passed inCreate directory structure
src/writers/{platform}/index.ts (main writer)src/writers/{platform}/__tests__/index.test.ts (test file)ls -la src/writers/{platform}/Implement writer function signature
WriterConfig and SkillLine from src/writers/index.tsexport default async function write{Platform}(config: WriterConfig, skillLines: SkillLine[]): Promise<string[]>config with properties: cwd, platform, agent, token (optional), quiet (boolean)skillLines array of objects with name, description, path, markdown properties['/path/to/file1', '/path/to/file2'])Implement core write logic
config.cwd (entry point for all writes)skillLines, generate platform-specific file(s)src/writers/claude/index.ts lines 1–50 for pattern (typically generates SKILL.md or equivalent)await fs.promises.writeFile() or Caliber's writeFile() helper if availableconfig.quiet is falsepath.resolve() and path.join() for all path operationsAdd test file
src/writers/{platform}/__tests__/index.test.ts with vitest importsWriterConfig and SkillLine[] inputsstring[] contains expected file pathsfs.promises.writeFileExport writer in src/writers/index.ts
src/writers/index.tsimport write{Platform} from './{platform}/index.js'.js extension (ESM convention in this project)Verify integration
npm run build — must compile without errorsnpm run test -- src/writers/{platform}/__tests__/ — all tests passnpm run lint — no linting errors in new writer codesrc/writers/index.ts to confirm new writer is exported and callableUser says: "Add support for a new agent platform called Jetbrains"
Actions:
src/writers/jetbrains/index.tsexport default async function writeJetbrains(config: WriterConfig, skillLines: SkillLine[]): Promise<string[]> — reads config.cwd, iterates skillLines, writes files to .jetbrains/rules/ (or platform-specific dir)src/writers/jetbrains/__tests__/index.test.ts with testssrc/writers/index.ts: import writeJetbrains from './jetbrains/index.js' and exportResult: New writer available via writeSetup() orchestration; each skill generates a file in the platform-specific directory and returns full paths written.
import type { WriterConfig, SkillLine } from '../index.js' (use type keyword for type imports)path.resolve(config.cwd, relativePath) to construct full paths; all returned paths must be absolute{platform}/index.ts is async and returns Promise<string[]>, then check index.ts import uses .js extension__tests__/index.test.ts imports writer as import write{Platform} from '../index.js' (relative path, ESM)src/writers/{platform}/ dir exists from prior attempt; remove or use different platform name38:["$","$L40",null,{"content":"$41","frontMatter":{"name":"writers-pattern","description":"Adds a new platform writer in src/writers/ following existing patterns (claude, cursor, codex). Returns string[] of generated file paths. Integrates with writeSetup() orchestration. Use when implementing 'add platform', 'new writer', 'support new agent'. Do NOT use for refactoring existing writers or modifying writers/index.ts exports."}}]