adding-templates
Use when adding new stacks, libraries, or project addons to create-faster CLI tool - covers META entries, template creation, and testing for all addon types
Best use case
adding-templates is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Use when adding new stacks, libraries, or project addons to create-faster CLI tool - covers META entries, template creation, and testing for all addon types
Teams using adding-templates should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/adding-templates/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How adding-templates Compares
| Feature / Agent | adding-templates | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Use when adding new stacks, libraries, or project addons to create-faster CLI tool - covers META entries, template creation, and testing for all addon types
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Adding Templates to create-faster
## Overview
Add new content to the create-faster CLI: framework stacks, per-app libraries, or project-level addons. All additions are data-driven through META configuration + Handlebars templates.
**Core principle:** Understand-first, copy-second. Know the library/framework BEFORE writing templates.
## When to Use
Use this skill when:
- Adding a new framework stack (Remix, Astro, SvelteKit, etc.)
- Adding a new library (tRPC, i18n, Storybook, etc.)
- Adding a new project addon (new database, ORM, tooling)
Do NOT use for:
- Fixing existing templates (use `fixing-templates` skill)
- Extracting a library from an external project (use `extracting-templates` skill first, then come here)
- Updating dependency versions
## Architecture Context
Adding content is **data-driven**. Most CLI code operates generically on META configuration. Only source files that define types need changes. Everything else is META entries + template files.
**What does NOT change** when adding content (17+ files are generic):
- `cli.ts`, `flags.ts`, `index.ts` — iterate META entries
- `template-resolver.ts` — scans template directories by convention
- `package-json-generator.ts` — merges from `META.*.packageJson`
- `env-generator.ts` — collects envs from META
- `handlebars.ts` — generic helpers
- `addon-utils.ts` — generic compatibility checks
- All prompts, TUI, summary code
### Three Addon Types
| Type | META location | Template directory | Scope |
|------|--------------|-------------------|-------|
| Stack | `META.stacks` | `templates/stack/{name}/` | Per-app |
| Library | `META.libraries` | `templates/libraries/{name}/` | Per-app |
| Project addon | `META.project.{category}.options` | `templates/project/{category}/{name}/` | Project-level |
## Adding a Stack
### Source Changes
**Only 2-3 source files need code changes:**
#### a. Add to `StackName` union (`types/meta.ts`)
```typescript
export type StackName = 'nextjs' | 'expo' | 'hono' | 'tanstack-start' | 'newstack';
```
All downstream types derive from `StackName` automatically.
#### b. Add stack entry to META (`__meta__.ts`)
```typescript
newstack: {
type: 'app' | 'server',
label: 'Framework Name',
hint: 'Short description',
packageJson: {
dependencies: { 'framework-core': '^1.0.0' },
devDependencies: { typescript: '^5' },
scripts: {
dev: 'framework dev --port {{port}}',
build: 'framework build',
start: 'framework start --port {{port}}',
},
},
},
```
**Scripts with `{{port}}`:** `package-json-generator.ts` resolves placeholders:
- Turborepo: `{{port}}` → `3000 + appIndex`
- Single repo: the `--port {{port}}` portion is stripped entirely
#### c. Add file extensions to KNOWN_EXTENSIONS (if needed, `lib/frontmatter.ts`)
Non-standard extensions (`.svelte`, `.vue`, `.astro`) prevent the stack suffix parser from misidentifying them.
### Template Structure
```
templates/stack/{stackname}/
{config}.config.ts.hbs # Vite, Next, etc.
tsconfig.json.hbs # TypeScript config
src/
{entry-point}.tsx.hbs # Main entry
routes/ # Routing (if file-based)
components/ # Shared components
public/ # Static assets (if needed)
```
### Library Compatibility
Check existing libraries with `support: { stacks: 'all' }`. React libraries shouldn't be available for non-React stacks — change to explicit list:
```typescript
support: { stacks: ['nextjs', 'tanstack-start'] }, // React-only
```
## Adding a Library
### META Entry (`META.libraries`)
```typescript
newlib: {
label: 'Library Name',
hint: 'Short description',
category: 'UI', // Groups in interactive prompt (UI, Content, Auth, API, Data Fetching, Forms, Deploy)
support: { stacks: ['nextjs', 'tanstack-start'] },
// Optional: require other addons
require: { orm: ['drizzle', 'prisma'] },
// Optional: turborepo shared package
mono: { scope: 'pkg', name: 'libname' },
packageJson: {
dependencies: { 'the-lib': '^1.0.0' },
// Optional: package exports (for shared packages)
exports: { '.': './src/index.ts' },
},
// Optional: environment variables
envs: [
{ value: 'LIB_SECRET=changeme', monoScope: [{ pkg: 'libname' }, 'app'] },
],
},
```
**Key fields:**
- `category` — prompt group name (UI, Content, Auth, API, Data Fetching, Forms, Deploy)
- `support.stacks` — which stacks can use this library (`'all'` or explicit list)
- `require` — dependencies on other addons (e.g., better-auth requires orm)
- `mono` — if set, library gets its own `packages/{name}/` in turborepo
- `envs` — env vars with scope resolution (which `.env.example` files get them)
### Template Structure
```
templates/libraries/{libname}/
src/lib/{feature}.ts.hbs # Library setup files
src/lib/{feature}-client.ts.hbs # Client-side setup
src/app/api/{route}/route.ts.nextjs.hbs # Stack-specific API routes
```
### Handlebars Conditionals for Cross-Library Integration
When a library's behavior changes based on OTHER selected libraries:
```handlebars
{{!-- In the library's own template --}}
{{#if (hasLibrary "other-lib")}}
import { something } from '{{#if (isMono)}}@repo/other{{else}}@/lib/other{{/if}}';
{{/if}}
{{!-- Conditional feature based on project addon --}}
{{#if (has "orm" "drizzle")}}
import { db } from '{{#if (isMono)}}@repo/db{{else}}@/lib/db{{/if}}';
{{/if}}
```
### Modifying Existing Templates
Libraries often need to modify existing stack templates (e.g., `app-providers.tsx.hbs`):
```handlebars
{{!-- Add import --}}
{{#if (hasLibrary "newlib")}}
import { NewLibProvider } from '@/lib/newlib';
{{/if}}
{{!-- Add provider wrapper --}}
{{#if (hasLibrary "newlib")}}
<NewLibProvider>
{{/if}}
{children}
{{#if (hasLibrary "newlib")}}
</NewLibProvider>
{{/if}}
```
**Wrap order matters** — check existing conditionals and add in the right position.
## Adding a Project Addon
### META Entry (`META.project.{category}.options`)
```typescript
// In META.project.{category}.options:
newoption: {
label: 'Option Name',
hint: 'Short description',
mono: { scope: 'root' }, // or { scope: 'pkg', name: 'pkgname' }
packageJson: {
dependencies: { 'the-pkg': '^1.0.0' },
scripts: { 'task:run': 'the-pkg run' },
},
envs: [
{ value: 'DB_URL="connection-string"', monoScope: [{ pkg: 'db' }, 'app'] },
],
},
```
### Template Structure
```
templates/project/{category}/{name}/
config-file.ts.hbs
scripts/seed.ts.hbs
```
## Programmatic Files — NO Templates
**package.json** — generated from META `packageJson`. No `package.json.hbs`.
**.env.example** — generated from META `envs`. No `.env.example.hbs`.
## Template Authoring Reference
### YAML Frontmatter
```yaml
---
path: src/lib/feature.ts # Output path (single repo)
mono:
scope: app | pkg | root # Monorepo scope (overrides META)
path: src/feature.ts # Monorepo path (relative to scope)
only: mono | single # Repo type filter
---
```
### Stack-Specific File Suffix
`file.ext.{stack}.hbs` — only included when app uses that stack:
```
route.ts.nextjs.hbs → only for Next.js apps
adapter.ts.hono.hbs → only for Hono apps
```
### Available Handlebars Helpers
| Helper | Purpose |
|--------|---------|
| `isMono` | Check if turborepo |
| `hasLibrary "name"` | Check if current app has library |
| `has "category" "value"` | Check database/orm/tooling/stack |
| `hasContext "key"` | Check if key exists in context |
| `appPort appName` | Get port for app (3000 + index) |
| `eq`, `ne`, `and`, `or` | Logical operators |
### Special Filename Handling
- `__filename` → `.filename` (dotfiles like `.gitignore`)
- `___filename` → `__filename` (literal double underscore)
## Testing
**DO NOT assume templates work. Verify.**
1. Single repo mode:
```bash
bunx create-faster test-single --app test-single:{stack}:{lib1},{lib2}
```
2. Turborepo mode:
```bash
bunx create-faster test-turbo --app web:{stack}:{lib1},{lib2} --app api:hono
```
3. Verify:
- All template files present in output
- `package.json` has correct dependencies
- Conditional code renders correctly for all combinations
- `bun install && bun run dev` works
4. Test all library combinations that affect templates:
- Library alone
- Library + each cross-library integration
- Library in single vs turborepo mode
## Checklist
### Stack
- [ ] Added to `StackName` union in `types/meta.ts`
- [ ] Added META entry with `packageJson` (deps + scripts)
- [ ] Added file extension to `KNOWN_EXTENSIONS` (if applicable)
- [ ] Created `templates/stack/{name}/` with all source files
- [ ] Checked library compatibility (`stacks: 'all'` audit)
- [ ] Tested single + turborepo mode
- [ ] Verified dev/build works
### Library
- [ ] Added META entry in `META.libraries` with category/support/require/mono/packageJson/envs
- [ ] Created `templates/libraries/{name}/` with template files
- [ ] Modified existing stack templates for cross-library conditionals
- [ ] Used stack-specific suffix where needed (`.nextjs.hbs`)
- [ ] Tested all library combinations
- [ ] Tested single + turborepo mode
### Project Addon
- [ ] Added META entry in `META.project.{category}.options`
- [ ] Created `templates/project/{category}/{name}/`
- [ ] Tested with different stack/library combinations
## Common Rationalizations — STOP
| Excuse | Reality |
|--------|---------|
| "I need a package.json.hbs" | Package.json is programmatic from META. No template. |
| "I need a .env.example.hbs" | Env files are programmatic from META `envs`. No template. |
| "I'll skip testing combinations" | Library combinations produce different output. Test them. |
| "Close enough, it'll probably work" | Probably = broken. Test it. |
| "I can skip the monorepo test" | Single and turborepo produce different paths. Test both. |
| "I'll use magic comments" | Removed. Use YAML frontmatter. |
## Quick Reference
| What | Where | How |
|------|-------|-----|
| Stack definition | `META.stacks` | `type`, `label`, `hint`, `packageJson` |
| Library definition | `META.libraries` | `label`, `hint`, `category`, `support`, `require`, `mono`, `packageJson`, `envs` |
| Project addon | `META.project.{cat}.options` | `label`, `hint`, `mono`, `packageJson`, `envs` |
| Type union | `StackName` in `types/meta.ts` | Add new literal |
| Stack templates | `templates/stack/{name}/` | `.hbs` files |
| Library templates | `templates/libraries/{name}/` | `.hbs` files |
| Project templates | `templates/project/{cat}/{name}/` | `.hbs` files |
| Package.json | Programmatic | `package-json-generator.ts` reads META |
| Env vars | Programmatic | `env-generator.ts` reads META `envs` |
| File extensions | `KNOWN_EXTENSIONS` | `frontmatter.ts` |
| Frontmatter | YAML in `.hbs` | `path`, `mono`, `only` |
| Helpers | `handlebars.ts` | `isMono`, `hasLibrary`, `has`, `hasContext`, `appPort` |Related Skills
defi-protocol-templates
Implement DeFi protocols with production-ready templates for staking, AMMs, governance, and lending systems. Use when building decentralized finance applications or smart contract protocols.
adding-tweets
Add tweets to the Second Brain. Use when the user provides a Twitter/X URL and pasted tweet content, asking to "add a tweet", "save this tweet", or "capture this tweet".
adding-new-metric
Guides systematic implementation of new sustainability metrics in OSS Sustain Guard using the plugin-based metric system. Use when adding metric functions to evaluate project health aspects like issue responsiveness, test coverage, or security response time.
adding-milestones
Use this skill when adding a milestone to an existing project, starting a new milestone cycle, creating the first milestone after project init, or defining what's next after completing work. Triggers include "add milestone", "new milestone", "start milestone", "create milestone", "first milestone", "next milestone", and "milestone cycle".
documentation-templates
Documentation templates and structure guidelines. README, API docs, code comments, and AI-friendly documentation.
adding-service-documentation
Documents new Coolify one-click services by creating markdown pages in docs/services/, downloading logos to docs/public/images/services/, and updating List.vue catalog. Use when adding service documentation, creating service pages, onboarding services from templates/compose/, or updating the services catalog with new entries.
adding-nango-provider-support
Use when adding support for a new Nango provider - configures provider in providers.yaml, creates documentation (main page, setup guide, connect guide), and updates docs.json following established patterns
github-actions-templates
Create production-ready GitHub Actions workflows for automated testing, building, and deploying applications. Use when setting up CI/CD with GitHub Actions, automating development workflows, or creating reusable workflow templates.
employment-contract-templates
Create employment contracts, offer letters, and HR policy documents following legal best practices. Use when drafting employment agreements, creating HR policies, or standardizing employment docume...
templates
Project scaffolding templates for new applications. Use when creating new projects from scratch. Contains 12 templates for various tech stacks.
setup-cdk-templates
Use when creating CLAUDE.md files or .claude/ directories - detects project type, generates appropriate templates, and scaffolds Claude configuration with commands and hooks
railway-templates
Search and deploy services from Railway's template marketplace. Use when user wants to add a service from a template, find templates for a specific use case, or deploy tools like Ghost, Strapi, n8n, Minio, Uptime Kuma, etc. For databases (Postgres, Redis, MySQL, MongoDB), prefer the railway-database skill.