Codebot — Code generator by templatesStop copying and pasting boilerplate. Define your file structure once as a template and generate it anywhere with two clicks. What it doesCodebot reads a folder of Handlebars (
Templates can be as simple as a single Quick start1. Create your templates folder By default, Codebot looks for a
2. Write your template files using
3. Right-click any folder in the Explorer Select ✨ Build Template, type the component name (e.g.
Every Template file naming conventionCodebot renames template files to match the component name using two patterns:
Any filename that contains either the template folder name or the literal word Template variablesOnly one variable is available inside
The formatting of CommandsBoth commands are available by right-clicking a folder in the VS Code Explorer. ✨ Build Template
🔁 Update Template
Adds any template files that are missing from an existing component folder. The component name is derived from the folder you right-click. Existing files are never overwritten. ConfigurationOpen VS Code settings (
|
| Format | Output example | Use case |
|---|---|---|
pascal-case (default) |
MyComponent |
React components, classes |
kebab-case |
my-component |
npm packages, CSS classes |
camel-case |
myComponent |
JavaScript functions, variables |
snake-case |
my_component |
Python modules, database tables |
Example: typing "my button" with each format:
pascal-case → MyButton
kebab-case → my-button
camel-case → myButton
snake-case → my_button
Nested template directories
Templates can contain subdirectories of any depth (up to 10 levels). The directory structure is preserved in the output.
templates/
└── ReactPackage/
├── package.json.hbs
├── tsconfig.json.hbs
├── vite.config.ts.hbs
└── src/
├── App.tsx.hbs
├── main.tsx.hbs
└── lib/
└── main.tsx.hbs
Generates:
packages/
└── my-package/
├── package.json
├── tsconfig.json
├── vite.config.ts
└── src/
├── App.tsx
├── main.tsx
└── lib/
└── main.tsx
Examples
The examples/ folder in this repository contains ready-to-use templates you can copy into your project:
| Template | Files generated | Best for |
|---|---|---|
ComponentSass |
.tsx, .module.scss, .spec.tsx, index.tsx |
React components with CSS Modules |
ComponentTailwind |
.tsx, .style.ts, index.tsx |
React components with Tailwind Variants |
ComponentStyled |
index.tsx, styles.ts |
React components with Styled Components |
StoriesTsx |
.stories.tsx |
Storybook story files |
ReactPackage |
Full Vite + React package scaffold | Monorepo packages (kebab-case) |
ComponentSass example
ComponentSass.tsx.hbs
import { ReactNode } from 'react';
import styles from './{{name}}.module.scss';
export interface {{name}}Props {
children: ReactNode;
}
export function {{name}}({ children }: {{name}}Props) {
return (
<div className={styles.container}>
{children}
</div>
);
}
index.tsx.hbs
export * from './{{name}}';
ReactPackage example (kebab-case)
package.json.hbs
{
"name": "@myorg/{{name}}",
"version": "0.0.1",
"main": "./dist/index.js",
"types": "./dist/index.d.ts"
}
.vscode/settings.json
{
"codebot.templateSettings": {
"ReactPackage": {
"nameFormat": "kebab-case"
}
}
}
Typing "my button" generates a folder named my-button with package.json containing "name": "@myorg/my-button".
Requirements
- VS Code
1.100.0or later - Templates folder must exist in the workspace before using the extension