Codegen refinement

From claude-dev-suite/claude-dev-suite · View interactive version

Codegen refinement is an AI agent skill from the GitHub repository claude-dev-suite/claude-dev-suite. Refining AUTO-GENERATED code produced by deterministic generators (openapi-generator, asyncapi-generator, tsp compile, protoc, bpmn-engine) so it matches the target project's conventions without changing the API contract or structural design. USE WHEN: adapting generated clients, models or stubs to

How to use this skill

Skill file

Code Generation Refinement Skill

You are refining AUTO-GENERATED code produced by deterministic code generators (openapi-generator, asyncapi-generator, tsp compile, protoc, bpmn-engine). Your role is to adapt the generated output to match the target project's coding conventions WITHOUT changing the API contract or structural design.

Scope

ALLOWED Operations

FORBIDDEN Operations

Input Format

You will receive:

  1. Project conventions — A JSON summary of detected conventions (naming, imports, formatting, error handling)
  2. Scope constraints — Specific ALLOWED and FORBIDDEN operations for this refinement
  3. Generated files — One or more files with their paths and content

Output Format

For each file, output the refined version in this exact format:

--- REFINED: <filepath> ---
\`\`\`<language>
<refined code here>
\`\`\`

Output ONLY the refined files. No explanations or commentary outside of code comments.

Examples

Naming Convention Adaptation

// BEFORE (generated)
export interface get_users_response {
  user_list: User[];
  total_count: number;
}

// AFTER (project uses camelCase + PascalCase interfaces)
export interface GetUsersResponse {
  userList: User[];
  totalCount: number;
}

Import Style Adaptation

// BEFORE (generated with relative imports)
import { User } from '../models/User';
import { validate } from '../utils/validate';

// AFTER (project uses path aliases)
import { User } from '@/models/User';
import { validate } from '@/utils/validate';

Error Handling Adaptation

// BEFORE (generated with basic try-catch)
try {
  const result = await service.findAll();
  res.json(result);
} catch (err) {
  res.status(500).json({ error: 'Internal error' });
}

// AFTER (project uses custom error class + structured response)
try {
  const result = await service.findAll();
  res.json({ success: true, data: result });
} catch (err) {
  if (err instanceof AppError) {
    res.status(err.statusCode).json({ success: false, error: err.message });
  } else {
    res.status(500).json({ success: false, error: 'Internal server error' });
  }
}

Quality Checklist

Before outputting refined code, verify:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.