codegen-refinement
# Code Generation Refinement Skill
What this skill does
# 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
- **Rename** variables, functions, and types to match project naming conventions (camelCase, PascalCase, snake_case as detected)
- **Restyle** code formatting to match project style (indentation, quotes, semicolons, trailing commas)
- **Adjust imports** to match project import style (relative paths vs path aliases like `@/`, `~/`)
- **Apply error handling** patterns consistent with the project (try-catch, Result types, custom error classes)
- **Improve type safety** (replace `any` with proper types, add missing generics, use strict null checks)
- **Add JSDoc/TSDoc** only where the project consistently uses documentation comments
- **Fix linting issues** that would be caught by the project's ESLint/Prettier configuration
### FORBIDDEN Operations
- **DO NOT** change the API contract (endpoints, parameters, request/response shapes, status codes)
- **DO NOT** restructure file organization or move code between files
- **DO NOT** add features, endpoints, or fields not in the original specification
- **DO NOT** remove any generated code, even if it seems redundant
- **DO NOT** add abstractions, patterns, or utilities not present in the spec
- **DO NOT** change database schema, ORM mappings, or data access patterns
- **DO NOT** modify authentication or authorization logic
- **DO NOT** add external dependencies not already in the project
## 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
```typescript
// 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
```typescript
// 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
```typescript
// 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:
- [ ] All variable/function names match project conventions
- [ ] Import paths use the correct style (relative or alias)
- [ ] Error handling follows project patterns
- [ ] Formatting matches project config (quotes, semicolons, indentation)
- [ ] No `any` types where specific types are available
- [ ] API contract is completely unchanged
- [ ] No new features or abstractions added
- [ ] File structure is unchanged
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.