handlebars
Original:🇺🇸 English
Not Translated
Deep knowledge for creating and modifying Handlebars templates (.hbs files). Trigger: When user needs to create/modify .hbs templates, add helpers, work with template syntax, or understand Handlebars patterns.
2installs
Sourceneversight/skills_feed
Added on
NPX Install
npx skill4agent add neversight/skills_feed handlebarsSKILL.md Content
When to Use
Use this skill when:
- Creating or modifying template files
.hbs - Adding new Handlebars helpers or partials
- Debugging template rendering issues
- Understanding existing template patterns in Aurora CLI
- Working with dynamic code generation
Critical Patterns
Aurora CLI Template Engine Setup
The template engine is configured in :
src/@cliter/utils/template-engine.ts- Uses library with
handlebarsaddon (189+ built-in helpers)handlebars-helpers - Custom helpers are registered in
src/@cliter/handlebars/helpers/ - Partials are registered in
src/@cliter/handlebars/partials/ - Templates are in (back/, front/, pipeline/)
src/templates/
Important: Aurora CLI includes ALL helpers from the package automatically. These 189+ helpers are available in every template without any additional configuration.
handlebars-helpersHelper Registration Pattern
typescript
// src/@cliter/handlebars/helpers/my-helper.ts
import * as handlebars from 'handlebars';
handlebars.registerHelper('myHelper', function(param1: string, param2: any, options)
{
// options.data.root contains all template data
// options.fn(this) executes block content
// options.inverse(this) executes else block
return result;
});Partial Registration Pattern
typescript
// src/@cliter/handlebars/partials/my-partial.ts
import * as handlebars from 'handlebars';
handlebars.registerPartial('myPartial', `
{{#each items}}
{{ this.name }}
{{/each}}
`);Handlebars Syntax Guide
Basic Expressions
handlebars
Whitespace Control
handlebars
Block Helpers
handlebars
content if true
content if false
- - -
content if false
Custom Block Helpers (Aurora CLI)
handlebars
content if equal
content if not equal
Aurora CLI Helper Categories
String Transformation Helpers
| Helper | Description | Example |
|---|---|---|
| Convert to camelCase | |
| Convert to PascalCase | |
| Convert to kebab-case | |
| Convert to snake_case | |
| Concatenate strings | |
| Remove line breaks | |
Variable Management Helpers
handlebars
Array/Object Helpers
handlebars
has items
Conditional Helpers
handlebars
is undefined
not in array
Property Filter Helpers
Most property helpers filter :
schema.aggregatePropertieshandlebars
:
Import Manager Helper
handlebars
ID Generation Helpers
handlebars
Handlebars-Helpers Package (Built-in)
Aurora CLI includes all 189+ helpers from the package. These are available automatically in all templates.
handlebars-helpersString Helpers (36 helpers)
handlebars
is stringArray Helpers (28 helpers)
handlebars
found
is array
has 5
at
Comparison Helpers (24 helpers)
handlebars
both truthy
at least one truthy
falsey
equal
loosely equal
not equal
greater than
greater or equal
less than
less or equal
comparison
found
matches
even
odd
every 2nd
truthy
falsey
both falsey
not equal
not greater
not lessMath Helpers (16 helpers)
handlebars
Number Helpers (9 helpers)
handlebars
Object Helpers (14 helpers)
handlebars
has key
is object
:
:
URL Helpers (9 helpers)
handlebars
Date Helpers (3 helpers)
handlebars
Path Helpers (8 helpers)
handlebars
Collection Helpers (2 helpers)
handlebars
empty
Inflection Helpers (2 helpers)
handlebars
Regex Helpers (2 helpers)
handlebars
matchesHTML Helpers (7 helpers)
handlebars
Markdown Helpers (2 helpers)
handlebars
Misc Helpers (5 helpers)
handlebars
Logging Helpers (11 helpers)
handlebars
Full Reference: See references/handlebars-helpers-reference.md for complete documentation.
Decision Tree
Need string transformation? → toCamelCase, toPascalCase, toKebabCase, toSnakeCase (Aurora)
→ camelcase, pascalcase, snakecase, dashcase (handlebars-helpers)
Need to store temporary data? → setVar
Need to build arrays/objects? → array, object, push
Need conditional rendering? → if, unless, eq, unlessEq, ternary, and, or, not, compare
Need to iterate? → each, loops, forEach, eachIndex, forIn, forOwn
Need to filter properties? → get*Properties helpers (Aurora custom)
Need to manage imports? → importManager with importsArray
Need unique IDs? → uuid, nanoid
Need math operations? → add, subtract, multiply, divide, ceil, floor, round
Need string manipulation? → trim, split, replace, truncate, append, prepend
Need array operations? → first, last, sort, unique, filter, map, join
Need object access? → get, hasOwn, forIn, forOwn
Need URL handling? → encodeURI, decodeURI, urlParse, stripQuerystring
Need path operations? → basename, dirname, extname, resolveCode Examples
Example 1: Creating a New Helper
typescript
// src/@cliter/handlebars/helpers/is-required-property.ts
import * as handlebars from 'handlebars';
import { Property } from '../../types';
handlebars.registerHelper('isRequiredProperty', function(
property: Property,
)
{
return !property.nullable && !property.hasOwnProperty('defaultValue');
});Example 2: Using Multiple Helpers in Template
handlebars
export interface Input
{
?: ;
}Example 3: Complex Import Management
handlebars
Example 4: Conditional Blocks with Context
handlebars
// Handle enum type
// Handle other types
Commands
bash
# Build after adding helpers
yarn build
# Find all helpers
ls src/@cliter/handlebars/helpers/
# Find helper usage in templates
grep -r "helperName" src/templates/
# Test template rendering
yarn testCommon Mistakes to Avoid
-
Missing whitespace control: Useto trim unwanted whitespace
~handlebarscontent content -
Wrong context access: Useto access parent context in loops
../handlebars -
Forgetting to register helper: Add import in
src/@cliter/handlebars/helpers/index.ts -
Usinginstead of
{{: For HTML/code output, use triple braces to avoid escaping{{{
Resources
- Templates: See assets/ for helper and partial templates
- Aurora Helpers: See references/helpers-reference.md for Aurora CLI custom helpers
- Built-in Helpers: See references/handlebars-helpers-reference.md for handlebars-helpers package
- GitHub: https://github.com/helpers/handlebars-helpers