Templates
Templates let you save and reuse your schema definitions. Build a library of project scaffolds for quick setup.
Saving Templates
- Create or edit a schema in the Schema panel
- Click Save as Template in the toolbar
- Enter a name and optional description
- Click Save
Your template is now available in the template library.
Using Templates
- Find the Templates section in the left sidebar
- Browse or search for a template
- Click on a template to load it
- Fill in the required variables
- Create your structure
Template Properties
Templates store:
- Schema XML - The folder/file structure definition
- Variables - Default values for variables
- Validation Rules - Input validation for variables
- Tags - Categories for organization
- Wizard Config - Optional interactive setup wizard
Exporting Templates
Share templates as .sctemplate files:
- Select a template in the library
- Click the Export button
- Choose a save location
Export Format
Templates are exported as JSON:
{
"version": "1.0",
"type": "template",
"exported_at": "2024-01-15T10:30:00Z",
"template": {
"name": "React Component",
"description": "A React component with tests",
"schema_xml": "<folder name=\"%NAME%\">...</folder>",
"variables": {
"NAME": "MyComponent"
},
"variable_validation": {
"NAME": { "required": true }
},
"tags": ["react", "component"]
}
}
Importing Templates
Import templates from files:
- Click Import in the template library
- Select a
.sctemplatefile - Choose how to handle duplicates:
- Skip - Keep existing template
- Replace - Overwrite existing template
- Rename - Import with a new name
Template Bundles
Export multiple templates as a bundle:
- Select multiple templates (Cmd-click)
- Click the Export Bundle button
- Save as a
.scbundlefile
Import bundles the same way as single templates.
Community Templates
Browse and share templates with the community:
- Visit the Templates page
- Download templates to use locally
- Submit your own templates for others to use
Template Inheritance
Extend existing templates to build on common configurations:
<template extends="base-react">
<folder name="src">
<folder name="features">
<file name="%FEATURE_NAME%.tsx" />
</folder>
</folder>
</template>
The child template inherits:
- Base schema structure
- Variables (can be overridden)
- Validation rules (can be overridden)
Multiple Inheritance
Templates can extend multiple base templates by using comma-separated values:
<template extends="base-react, typescript-config, testing-setup">
<folder name="src">
<!-- Your custom structure -->
</folder>
</template>
When extending multiple templates:
- Schema structures are merged in order (left to right)
- Variables from later templates override earlier ones
- Validation rules are merged (later rules override conflicts)
Variable Merging
Variables from base templates are automatically available in child templates:
<!-- Base template defines PROJECT_NAME and AUTHOR -->
<template extends="base-project">
<!-- PROJECT_NAME and AUTHOR are available here -->
<file name="README.md">
# %PROJECT_NAME%
By %AUTHOR%
</file>
</template>
You can override inherited variable defaults by defining them in your template's variables.
Hooks Accumulation
Post-create hooks from all inherited templates are combined and run in order:
<!-- If base-react has: npm install -->
<!-- If testing-setup has: npm test -->
<template extends="base-react, testing-setup">
<hooks>
<post-create>npm run build</post-create>
</hooks>
</template>
<!-- Result: npm install → npm test → npm run build -->
Circular Dependency Detection
Structure Creator automatically detects and prevents circular inheritance:
<!-- This would cause an error -->
<template name="a" extends="b" />
<template name="b" extends="a" />
Best Practices
- Use descriptive names - Make it clear what the template creates
- Add default values - Provide sensible defaults for variables
- Add validation - Prevent invalid input with validation rules
- Use tags - Organize templates by technology or purpose
- Write descriptions - Explain when and how to use the template
- Create wizards - For complex templates, add a configuration wizard