xiaohongshu
xiaohongshu
fixing-templates
Use when fixing template issues in create-faster - indentation, spacing, typos, or formatting problems in .hbs files
Full skill instructions
Fix formatting, spacing, and syntax issues in Handlebars templates systematically.
Core principle: Audit comprehensively, fix consistently, verify output.
Use this skill when:
Do NOT use for:
Problem:
"start": "next start {{#if (eq repo "turborepo")}}--port {{appPort appName}}{{/if}}",
When condition is false, renders:
"start": "next start ", // ← trailing space!
Fix:
"start": "next start{{#if (eq repo "turborepo")}} --port {{appPort appName}}{{/if}}",
Space moved INSIDE conditional.
Problem:
{{#if (hasModule "shadcn")}} // ← extra space after #if
Fix:
{{#if (hasModule "shadcn")}}
Problem:
{{#if condition}}
content
{{/if}} // ← wrong indent level
Fix: Match surrounding code indentation.
digraph fixing_templates {
"Start" [shape=doublecircle];
"Audit ALL templates" [shape=box];
"Identify patterns" [shape=box];
"Group by issue type" [shape=box];
"Fix systematically" [shape=box];
"Verify generation" [shape=box];
"Test renders correctly?" [shape=diamond];
"Fix issues" [shape=box];
"Document patterns" [shape=box];
"Done" [shape=doublecircle];
"Start" -> "Audit ALL templates";
"Audit ALL templates" -> "Identify patterns";
"Identify patterns" -> "Group by issue type";
"Group by issue type" -> "Fix systematically";
"Fix systematically" -> "Verify generation";
"Verify generation" -> "Test renders correctly?";
"Test renders correctly?" -> "Document patterns" [label="yes"];
"Test renders correctly?" -> "Fix issues" [label="no"];
"Fix issues" -> "Verify generation";
"Document patterns" -> "Done";
}
DO NOT fix one issue and stop. Audit ALL templates first.
Search for common patterns:
# Trailing spaces before conditionals
grep -r ' {{#if' templates/
# Double spaces in conditionals
grep -r '{{#if ' templates/
# Trailing spaces in general
grep -r ' $' templates/
# Mixed indentation (tabs vs spaces)
grep -rP '\t' templates/
# Inconsistent blank lines
grep -rP '\n\n\n+' templates/
Count occurrences:
grep -r ' {{#if' templates/ | wc -l
This tells you scope of the problem BEFORE starting fixes.
Group similar issues:
Pattern A: Conditional trailing spaces
Pattern B: Double spaces in conditions
Pattern C: Wrong indentation
DO ONE pattern type at a time across ALL files.
Don't fix:
DO fix:
Why: Consistency. Same fix applied everywhere.
Example - Fix all trailing space conditionals:
# Find all instances
grep -rn ' {{#if (eq repo "turborepo")}}' templates/
# Fix each one:
# Before: "start": "next start {{#if...}}
# After: "start": "next start{{#if...}} --port
CRITICAL: Don't assume visual inspection is enough.
Test generation:
# Single repo mode (conditionals = false)
bunx create-faster test-single --stack nextjs
# Turborepo mode (conditionals = true)
bunx create-faster test-turbo --app web:nextjs --app api:hono
# Check generated files
cat test-single/package.json
cat test-turbo/apps/web/package.json
Verify:
Tools:
# Check JSON validity
cat package.json | jq .
# Check for trailing spaces
grep ' $' package.json
# Visual diff
diff expected.json actual.json
After fixing, document the pattern for future:
Create/update template guidelines:
## Template Spacing Rules
1. **Conditional spacing:** Space goes INSIDE conditional
- ✅ `"cmd": "tool{{#if condition}} --flag{{/if}}"`
- ❌ `"cmd": "tool {{#if condition}}--flag{{/if}}"`
2. **No double spaces in conditions**
- ✅ `{{#if (condition)}}`
- ❌ `{{#if (condition)}}`
3. **Indentation:** 2 spaces, match surrounding code
Before:
"dev": "vite dev {{#if (eq repo "turborepo")}}--port {{appPort appName}}{{/if}}",
After:
"dev": "vite dev{{#if (eq repo "turborepo")}} --port {{appPort appName}}{{/if}}",
Applied to: All package.json templates with port conditionals.
Before:
{{#if (hasModule "shadcn")}}
After:
{{#if (hasModule "shadcn")}}
Applied to: All module conditionals.
Problem:
<View {{#if (hasModule "nativewind")}}className='...'{{/if}}>
When condition is false, renders:
<View > // ← trailing space!
Fix:
<View{{#if (hasModule "nativewind")}} className='...'{{/if}}>
Space moved INSIDE conditional before className.
Applied to: All Expo/React Native templates with conditional className props.
Problem:
{
"extends": "@repo/config/ts/base.json", // ← tab instead of spaces
}
Fix:
{
"extends": "@repo/config/ts/base.json", // ← 2 spaces
}
Standard: Always use 2 spaces for indentation in all files (JSON, TypeScript, JSX, etc.).
Grep command: grep -rPn '\t' . --include="*.hbs"
Applied to: All template files.
Before:
{{#if outer}}
{{#if inner}}
content
{{/if}}
{{/if}}
After:
{{#if outer}}
{{#if inner}}
content
{{/if}}
{{/if}}
Consistent 2-space indentation.
jq| Excuse | Reality |
|---|---|
| "I'll just fix this one file" | 107 occurrences across 21 files. Systematic audit required. |
| "Visual inspection is enough" | Must test actual generation. Trailing spaces invisible. |
| "It's just spacing, not important" | Invalid JSON, broken scripts. Very important. |
| "I'll fix as I find them" | Reactive = missing 90%+ of issues. Proactive audit required. |
| "Too tedious to check all files" | grep does it in 2 seconds. No excuse. |
| "I know the pattern now" | Document it or you'll forget. Others won't know. |
STOP immediately if you think:
These thoughts = baseline failure pattern (fixed 1, missed 104).
# Trailing spaces before conditionals (most common)
grep -rn ' {{#if' templates/
# Double spaces in conditions
grep -rn '{{#if ' templates/
# JSX elements with inline conditionals (potential trailing spaces)
grep -rn '<[A-Z][a-zA-Z]* {{#if' templates/
# All trailing spaces
grep -rn ' $' templates/
# Tabs (should be spaces)
grep -rPn '\t' templates/
# Multiple blank lines
grep -rPn '\n\n\n+' templates/
Without this skill (baseline):
With this skill:
10x more issues fixed, permanently solved.
Pelavo reported: "espace après 'start' si on a pas de turborepo"
Without skill: Fix line 29, miss lines 26, 30, and 104 others With skill: Grep finds 107, fix all systematically, verify generation
This is why systematic audits matter.
Systematic fix of all template formatting issues following this skill:
Issues Found & Fixed:
Pattern A: Trailing spaces in commands & JSX (18 instances)
{{/if}}Pattern B: Double spaces in conditions (0 instances)
Pattern C: Mixed tabs and spaces (18 instances)
Total Fixed: 36 formatting issues across 12 template files
Verification:
grep -rn ' $' . --include="*.hbs" → 0 resultsgrep -rPn '\t' . --include="*.hbs" → 0 resultsgrep -rn '{{#if ' . --include="*.hbs" → 0 resultsNew Patterns Documented:
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience