code-generation-template
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.
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o code-generation-template.zip https://jpskill.com/download/21368.zip && unzip -o code-generation-template.zip && rm code-generation-template.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/21368.zip -OutFile "$d\code-generation-template.zip"; Expand-Archive "$d\code-generation-template.zip" -DestinationPath $d -Force; ri "$d\code-generation-template.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
code-generation-template.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
code-generation-templateフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 9
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
コード生成とテンプレート
目次
概要
テンプレートエンジン、AST操作、コードスキャフォールディング、自動ボイラープレート生成など、生産性と一貫性を向上させるためのコード生成技術に関する包括的なガイドです。
使用する場面
- 新しいプロジェクトやコンポーネントのスキャフォールディング
- 繰り返し発生するボイラープレートコードの生成
- CRUD操作の自動作成
- OpenAPI仕様からのAPIクライアントの生成
- テンプレートからのコードの構築
- スキーマからのデータベースモデルの作成
- JSON SchemaからのTypeScript型の生成
- カスタムCLIジェネレーターの構築
クイックスタート
最小限の動作例です。
// 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>
);
};
リファレンスガイド
references/ ディレクトリ内の詳細な実装です。
| ガイド | 内容 |
|---|---|
| テンプレートエンジン | テンプレートエンジン |
| ASTベースのコード生成 | ASTベースのコード生成 |
| プロジェクトスキャフォールディング | プロジェクトスキャフォールディング |
| OpenAPIクライアント生成 | OpenAPIクライアント生成 |
| データベースモデル生成 | データベースモデル生成 |
| GraphQLコード生成 | GraphQLコード生成 |
| Plop.jsジェネレーター | Plop.jsジェネレーター |
ベストプラクティス
✅ DO
- 繰り返し発生するコードパターンにはテンプレートを使用してください。
- スキーマからTypeScript型を生成してください。
- 生成されたコードにテストを含めてください。
- テンプレートでプロジェクトの慣例に従ってください。
- 生成されたコードを説明するコメントを追加してください。
- テンプレートをバージョン管理してください。
- テンプレートを設定可能にしてください。
- コードと一緒にドキュメントを生成してください。
- 生成前にインプットを検証してください。
- 一貫した命名規則を使用してください。
- テンプレートをシンプルで保守しやすいものに保ってください。
- 簡単な生成のためにCLIを提供してください。
❌ DON'T
- 過剰に生成しないでください(不必要な複雑さを避けてください)。
- 保守が難しいコードを生成しないでください。
- 生成されたコードの検証を忘れないでください。
- テンプレートに値をハードコードしないでください。
- ドキュメントなしでコードを生成しないでください。
- 一回限りのユースケースのためにジェネレーターを作成しないでください。
- テンプレートにビジネスロジックを混在させないでください。
- フォーマットなしでコードを生成しないでください。
- ジェネレーターでエラー処理をスキップしないでください。
- 過度に複雑なテンプレートを作成しないでください。
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
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
同梱ファイル
※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。
- 📄 SKILL.md (3,151 bytes)
- 📎 references/ast-based-code-generation.md (3,221 bytes)
- 📎 references/database-model-generation.md (1,484 bytes)
- 📎 references/graphql-code-generation.md (678 bytes)
- 📎 references/openapi-client-generation.md (2,843 bytes)
- 📎 references/plopjs-generator.md (1,916 bytes)
- 📎 references/project-scaffolding.md (4,717 bytes)
- 📎 references/template-engines.md (2,737 bytes)
- 📎 scripts/validate-api.sh (440 bytes)