Code generation template

From aj-geddes/useful-ai-prompts · View interactive version

Code generation template is an AI agent skill from the GitHub repository aj-geddes/useful-ai-prompts. 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.

How to use this skill

Skill file

Code Generation & Templates

Table of Contents

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

Quick Start

Minimal working example:

// 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 | Template Engines |

| AST-Based Code Generation | AST-Based Code Generation |

| Project Scaffolding | Project Scaffolding |

| OpenAPI Client Generation | OpenAPI Client Generation |

| Database Model Generation | Database Model Generation |

| GraphQL Code Generation | GraphQL Code Generation |

| Plop.js Generator | Plop.js Generator |

Best Practices

✅ DO

❌ DON'T

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.