Skip to main content
skill CX Codex

code-generation-template — Claude Code skill: generate code

A skill for generating code from templates: project scaffolding, boilerplate, AST-based generation and template engines. Useful when you need to produce repetitive code fast.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add aj-geddes/useful-ai-prompts --skill code-generation-template -a claude-code
Open on GitHub

What code-generation-template does

The skill covers code generation techniques: template engines, AST manipulation, scaffolding and automated boilerplate. Inside you get a short guide plus reference files in the references/ directory — template engines, AST-based generation, project scaffolding, OpenAPI client generation, database model generation, GraphQL code generation and the Plop.js generator.

The quick start shows a Handlebars component template: a props interface, the component itself, and the pascalCase and kebabCase helpers. From there the skill advises keeping templates configurable, versioning them, including tests and docs in generated code, and validating inputs before generation. A separate list covers what to avoid: hardcoded values in templates, mixing business logic into templates, building generators for one-off cases.

The skill installs through npx skills add and runs in Claude, Codex, Cursor, GitHub Copilot, Gemini CLI and OpenCode. It is a set of instructions, not a ready-made generator — you still build the working CLI yourself from the references. If your project already has a code generator, this skill will overlap with it, so it is worth checking whether extending the existing one is simpler.

What it helps with

  • scaffold a new project or component
  • generate repetitive boilerplate code
  • create CRUD operations automatically
  • build an API client from an OpenAPI spec
  • generate TypeScript types from JSON Schema

Example prompts for the agent

  • generate a React component from templates/component.hbs with name and type props
  • scaffold a new TypeScript project
  • generate an API client from an OpenAPI spec

How to install code-generation-template

1Skills CLI (Vercel)

npx skills add aj-geddes/useful-ai-prompts --skill code-generation-template -a claude-code

2Manually: put the files in place

~/.claude/skills/code-generation-template/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/code-generation-template/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about code-generation-template

How do I install code-generation-template in Claude?

Run npx skills add aj-geddes/useful-ai-prompts --skill code-generation-template -a claude-code. The skill lands in ~/.claude/skills/code-generation-template/SKILL.md.

What does code-generation-template do?

It covers code generation techniques: template engines, AST work, project scaffolding and boilerplate creation. It ships reference guides for each area plus a Handlebars template example.

Which platforms does the skill support?

Claude, Codex, Cursor, GitHub Copilot, Gemini CLI and OpenCode. Each platform has its own install command.

Source text

SKILL.md · MIT
---
name: code-generation-template
description: >
  Generate code from templates and patterns including scaffolding, boilerplate
  generation, AST-based code generation, and template engines. Use when
  generating code, scaffolding projects, creating boilerplate, or using
  templates.
---

# Code Generation & Templates

## Table of Contents

- [Overview](#overview)
- [When to Use](#when-to-use)
- [Quick Start](#quick-start)
- [Reference Guides](#reference-guides)
- [Best Practices](#best-practices)

## Overview

Comprehensive guide to code generation techniques including template engines, AST manipulation, code scaffolding, and automated boilerplate generation for increased productivity and consistency.

## When to Use

- Scaffolding new projects or components
- Generating repetitive boilerplate code
- Creating CRUD operations automatically
- Generating API clients from OpenAPI specs
- Building code from templates
- Creating database models from schemas
- Generating TypeScript types from JSON Schema
- Building custom CLI generators

## Quick Start

Minimal working example:

```typescript
// templates/component.hbs
import React from 'react';

export interface {{pascalCase name}}Props {
  {{#each props}}
  {{this.name}}{{#if this.optional}}?{{/if}}: {{this.type}};
  {{/each}}
}

export const {{pascalCase name}}: React.FC<{{pascalCase name}}Props> = ({
  {{#each props}}{{this.name}},{{/each}}
}) => {
  return (
    <div className="{{kebabCase name}}">
      {/* Component implementation */}
    </div>
  );
};
```

## Reference Guides

Detailed implementations in the `references/` directory:

| Guide | Contents |
|---|---|
| [Template Engines](references/template-engines.md) | Template Engines |
| [AST-Based Code Generation](references/ast-based-code-generation.md) | AST-Based Code Generation |
| [Project Scaffolding](references/project-scaffolding.md) | Project Scaffolding |
| [OpenAPI Client Generation](references/openapi-client-generation.md) | OpenAPI Client Generation |
| [Database Model Generation](references/database-model-generation.md) | Database Model Generation |
| [GraphQL Code Generation](references/graphql-code-generation.md) | GraphQL Code Generation |
| [Plop.js Generator](references/plopjs-generator.md) | Plop.js Generator |

## Best Practices

### ✅ DO

- Use templates for repetitive code patterns
- Generate TypeScript types from schemas
- Include tests in generated code
- Follow project conventions in templates
- Add comments to explain generated code
- Version control your templates
- Make templates configurable
- Generate documentation alongside code
- Validate inputs before generating
- Use consistent naming conventions
- Keep templates simple and maintainable
- Provide CLI for easy generation

### ❌ DON'T

- Over-generate (avoid unnecessary complexity)
- Generate code that's hard to maintain
- Forget to validate generated code
- Hardcode values in templates
- Generate code without documentation
- Create generators for one-off use cases
- Mix business logic in templates
- Generate code without formatting
- Skip error handling in generators
- Create overly complex templates

© aj-geddes · MIT · aj-geddes/useful-ai-prompts

Similar skills

All skills for Programming languages →

From the same set118

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor