code-generation-template

aj-geddes/useful-ai-prompts · updated Apr 8, 2026

$npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill code-generation-template
0 commentsdiscussion
summary

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

skill.md

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

  • 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:

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

  • 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

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.674 reviews
  • Min Nasser· Dec 28, 2024

    Useful defaults in code-generation-template — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Diya Flores· Dec 28, 2024

    code-generation-template has been reliable in day-to-day use. Documentation quality is above average for community skills.

  • Shikha Mishra· Dec 24, 2024

    code-generation-template has been reliable in day-to-day use. Documentation quality is above average for community skills.

  • Min Garcia· Dec 20, 2024

    Solid pick for teams standardizing on skills: code-generation-template is focused, and the summary matches what you get after install.

  • Henry Rahman· Dec 16, 2024

    code-generation-template is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Luis Choi· Dec 4, 2024

    code-generation-template is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Charlotte Gill· Nov 23, 2024

    code-generation-template reduced setup friction for our internal harness; good balance of opinion and flexibility.

  • Min Thompson· Nov 19, 2024

    I recommend code-generation-template for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • Aditi Farah· Nov 11, 2024

    Registry listing for code-generation-template matched our evaluation — installs cleanly and behaves as described in the markdown.

  • Noor Diallo· Nov 7, 2024

    code-generation-template reduced setup friction for our internal harness; good balance of opinion and flexibility.

showing 1-10 of 74

1 / 8