codemap_template_deploy
Deploy a template to a target file, creating the file with template contents
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
templateName | string | ✅ Required | Template name to deploy |
targetPath | string | ✅ Required | Target file path (relative or absolute) |
Usage Examples
MCP Usage (for AI Agents like Claude)
json
{
"name": "codemap_template_deploy",
"arguments": {
"templateName": "mcp-tool",
"targetPath": "src/mcp/tools/new-category/my-tool.tool.ts"
}
}Example Output
JSON Response
json
{
"success": true,
"message": "Template 'react-component' deployed to src/components/NewFeature.tsx",
"templateName": "react-component",
"targetPath": "src/components/NewFeature.tsx"
}When to Use This Tool
-
Use
- Create new files from standard project patterns
- Scaffold components, services, or utilities quickly
- Ensure consistency across similar file types
- Bootstrap new features with proven structures
- Automate repetitive file creation tasks
codemap_template_deploy when you need to:
Common Patterns
Deploy and Customize Pattern
Standard workflow for scaffolding with templates.
Batch Deployment Pattern
Perfect for creating multiple similar files at once.
1. codemap_template_deploy to create file from template
2. codemap_replace_text to customize placeholders
3. Manual edits for specific implementationStandard workflow for scaffolding with templates.
Batch Deployment Pattern
1. List components/files needed
2. Loop through deploying template for each
3. Customize each with specific valuesPerfect for creating multiple similar files at once.
Pro Tips
- Template must exist: Run
template_listfirst to verify template name - Target path resolved: Relative paths resolved from project root
- Creates parent directories: Will create any missing parent directories automatically
- Placeholders convention: Use
{{UPPERCASE}}in templates for values to replace - Combine with routine: Add template deployment to routines for automated workflows
Best Practices
- Always verify template exists with
template_listbefore deploying - Use descriptive target paths that reflect the file's purpose
- Deploy to test location first to verify template is correct
- Customize placeholders immediately after deployment
- Create routine workflows that combine deployment and customization
- Keep templates focused on structure, not specific implementation
Common Mistakes
❌ Mistake: Deploying without checking template exists
✅ Instead: Run
❌ Mistake: Forgetting to customize placeholders after deployment
✅ Instead: Immediately replace
❌ Mistake: Deploying to wrong location or overwriting existing files
✅ Instead: Double-check target path and ensure file doesn't already exist
❌ Mistake: Using templates for files that need significant customization
✅ Instead: Templates work best for standardized structures - heavily customized files should be written from scratch
❌ Mistake: Not testing template output before deploying to production code
✅ Instead: Deploy to a test file first to verify template produces correct output
✅ Instead: Run
template_list first to verify the template name is correct❌ Mistake: Forgetting to customize placeholders after deployment
✅ Instead: Immediately replace
{{PLACEHOLDERS}} with actual values using replace_text❌ Mistake: Deploying to wrong location or overwriting existing files
✅ Instead: Double-check target path and ensure file doesn't already exist
❌ Mistake: Using templates for files that need significant customization
✅ Instead: Templates work best for standardized structures - heavily customized files should be written from scratch
❌ Mistake: Not testing template output before deploying to production code
✅ Instead: Deploy to a test file first to verify template produces correct output