
Prompt Templating
- 10 installs
- Updated November 18, 2025
- wesley1600/claudecodeframework
Helps with ai & agent building tasks.
About
prompt-templating is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted coding.
- prompt-templating
- AI & Agent Building
- AI-coding skill
Prompt Templating by the numbers
- 10 all-time installs (skills.sh)
- Ranked #11,937 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Jul 27, 2026 (Skillselion catalog sync)
npx skills add https://github.com/wesley1600/claudecodeframework --skill prompt-templatingAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 10 |
|---|---|
| Last updated | November 18, 2025 |
| Repository | wesley1600/claudecodeframework ↗ |
What it does
Helps with ai & agent building tasks.
Files
Prompt Templating
Transforms prompt templates with placeholders into complete prompts by filling in variables from the current task context. Ensures consistency, reduces repetition, and validates that all required variables are provided.
Overview
This skill enables you to:
- Load prompt templates with placeholders like
{variable_name} - Fill placeholders with values from the current context
- Distinguish between required and optional variables
- Provide default values for optional variables
- Warn users about missing required variables
- Validate and sanitize variable values
When to Use
Use this skill when:
- Creating consistent prompts across multiple similar tasks
- Building reusable prompt patterns for summarization, analysis, or code review
- Ensuring critical context variables are always included
- Maintaining a library of standardized prompts
- Reducing copy-paste errors in repetitive prompting tasks
Template Syntax
Basic Placeholders
{variable_name}Optional Variables with Defaults
{variable_name:default_value}Syntax Rules
- Variable names: lowercase, alphanumeric, underscores only
- No spaces inside braces:
{name}✓,{ name }✗ - Nested braces not supported
- Escape literal braces with backslash:
\{not_a_variable\}
Workflow
1. Identify Template Requirements
When a user requests templating:
- Ask which template file to use (or create a new one)
- Identify what variables need to be filled
- Determine which variables are required vs optional
2. Load Template
Read the template file from:
.claude/skills/prompt-templating/templates/(shared templates)- User-specified path (custom templates)
Example templates available:
code-review.txt- Code review promptssummarization.txt- Document summarizationanalysis.txt- General analysis tasksbug-report.txt- Bug investigation prompts
See templates/ directory for all available templates.
3. Parse Template
Scan template for placeholders:
- Extract all
{variable_name}patterns - Identify required variables (no default)
- Identify optional variables (has
:default) - Build a list of needed variables
4. Gather Variables
Collect variable values from:
- User's explicit instructions
- Current task context
- File contents (if referenced)
- Previous conversation context
- Default values (for optional variables)
5. Validate Variables
CRITICAL: Missing Required Variables
If any required variable lacks a value: 1. STOP - Do not proceed with template filling 2. List all missing required variables clearly 3. Ask the user to provide values for missing variables 4. Suggest reasonable values if context provides hints 5. Wait for user confirmation before proceeding
Example warning:
⚠️ Missing Required Variables:
- {user_name}: The name of the user or author
- {project_name}: The project being analyzed
Please provide these values to continue.6. Fill Template
Replace placeholders with values: 1. Process required variables first 2. Apply default values for unprovided optional variables 3. Perform substitution left-to-right 4. Preserve formatting and indentation 5. Handle escaped braces (don't replace \{...\})
7. Output Result
Present the filled template:
- Show the complete rendered prompt
- Indicate which default values were used
- Confirm with user if appropriate
- Save to file if requested
Variable Extraction Patterns
From User Messages
User: "Use 'John Smith' for the author name"
→ {author_name} = "John Smith"From Context
Working on file: src/components/Header.tsx
→ {file_path} = "src/components/Header.tsx"
→ {file_name} = "Header.tsx"
→ {component_name} = "Header"From Code Analysis
Function being reviewed: calculateTotal()
→ {function_name} = "calculateTotal"Best Practices
1. Clear Variable Names
Use descriptive names:
- Good:
{analysis_type},{target_audience},{code_file_path} - Bad:
{x},{temp},{var1}
2. Reasonable Defaults
For optional variables, provide sensible defaults:
{tone:professional}- Default tone is professional{max_length:500}- Default max length 500 words{format:markdown}- Default output format
3. Document Templates
Every template should have:
- Header comment explaining purpose
- List of required variables
- List of optional variables with defaults
- Example usage
4. Validate Early
Check for missing variables BEFORE filling template to avoid partial outputs.
5. Sanitize Input
For security-sensitive contexts:
- Escape special characters if needed
- Validate variable formats (emails, paths, etc.)
- Warn about potentially unsafe values
Example Usage Scenarios
Scenario 1: Code Review Template
Template file: templates/code-review.txt
Review the following code in {file_path}:
Focus areas:
- {focus_area_1}
- {focus_area_2:performance}
- {focus_area_3:security}
Code to review:
{code_content}
Provide feedback for: {reviewer_name}User request: "Review Header.tsx for bugs"
Process: 1. Load template 2. Extract variables: file_path, focus_area_1, focus_area_2 (optional), focus_area_3 (optional), code_content, reviewer_name 3. Gather from context:
file_path= "src/components/Header.tsx"focus_area_1= "bugs" (from user request)code_content= (read from file)
4. Missing: reviewer_name 5. WARN about missing reviewer_name 6. Ask user for reviewer name 7. Fill template once all values provided
Scenario 2: Analysis Summary
Template: templates/summarization.txt User provides all variables explicitly Fill and output immediately
See examples/ directory for complete scenarios.
Error Handling
Missing Required Variable
❌ Error: Required variable '{variable_name}' not provided
Description: {what this variable represents}
Please provide a value to continue.Invalid Variable Name in Template
⚠️ Warning: Invalid variable syntax at position X
Found: '{INVALID NAME}'
Variables must use lowercase, alphanumeric, underscore only.Template File Not Found
❌ Error: Template file not found: {path}
Available templates:
- templates/code-review.txt
- templates/analysis.txt
...Advanced Features
Conditional Sections (Optional)
For advanced templates, support conditional inclusion:
{?if:variable_name}
This section only appears if variable_name is provided
{?endif}Repeated Sections (Optional)
For lists:
{?foreach:item in items}
- {item}
{?endforeach}Note: These advanced features are optional enhancements. Start with basic placeholder replacement.
Reference Files
templates/- Pre-built template filesexamples/- Complete usage examplesreference/variables.md- Common variable definitionsreference/template-syntax.md- Detailed syntax guide
Quick Start
1. User requests templated prompt 2. Load template from templates/ or custom path 3. Extract all {variables} 4. Check for missing required variables 5. WARN if any missing and stop 6. Fill template with values 7. Output result
Summary
This skill ensures consistent, validated prompts by:
- ✓ Replacing placeholders with context values
- ✓ Warning about missing required variables
- ✓ Applying defaults for optional variables
- ✓ Maintaining prompt style consistency
- ✓ Reducing manual repetition
Always validate before filling to prevent incomplete outputs.
Basic Usage Examples
Example 1: Simple Variable Replacement
Template:
Hello {user_name}, welcome to {project_name}!Variables:
user_name= "Alice"project_name= "Claude Code"
Result:
Hello Alice, welcome to Claude Code!---
Example 2: Optional Variables with Defaults
Template:
Generate a {report_type:monthly} report for {department}.
Format: {format:PDF}Provided Variables:
department= "Engineering"
Result:
Generate a monthly report for Engineering.
Format: PDFNote: `report_type` and `format` used their default values
---
Example 3: Missing Required Variable (Error Case)
Template:
Review code in {file_path} by {reviewer_name}.Provided Variables:
file_path= "src/app.js"
Result:
⚠️ Missing Required Variables:
- {reviewer_name}: The name of the code reviewer
Please provide these values to continue.Process stops until user provides the missing variable
---
Example 4: Code Review Workflow
User Request: "Use the code-review template to review my authentication module"
Step 1: Load Template
templates/code-review.txtStep 2: Extract Variables Required:
file_pathcode_contentfocus_areas
Optional (with defaults):
reviewer_name:Teamstyle_guide:standardseverity_level:all
Step 3: Gather from Context
file_path= "src/auth/authentication.js" (inferred from "authentication module")code_content= (read from file)focus_areas= "authentication security" (inferred from context)
Step 4: Validate All required variables present ✓
Step 5: Fill Template
Please review the following code from src/auth/authentication.js:
## Review Criteria
Focus on: authentication security
Style Guide: standard coding practices
Severity Level: all issues
## Code to Review
[... actual code content ...]
## Expected Output
Provide a detailed review covering:
1. Code quality and best practices
2. Potential bugs or errors
3. Performance considerations
4. Security vulnerabilities
5. Readability and maintainability
Reviewer: Development Team---
Example 5: Summarization with Custom Parameters
User Request: "Summarize this documentation for executives, max 200 words"
Template: templates/summarization.txt
Variables Gathered:
content= (documentation content)content_type= "documentation"max_length= "200" (from user request)target_audience= "executives" (from user request)focus= "key points" (default)
Filled Template:
Summarize the following documentation:
## Content
[... documentation content ...]
## Summarization Parameters
- Maximum Length: 200 words
- Target Audience: executives
- Focus: key points and main takeaways
## Output Format
Provide:
1. Executive summary (2-3 sentences)
2. Main points (bullet list)
3. Key takeaways
4. Recommendations (if applicable)---
Example 6: Bug Investigation
User Request: "Investigate the login timeout bug (high severity)"
Template: templates/bug-report.txt
Interactive Gathering:
Claude: I need more information to fill the bug report template.
Missing required variables:
- bug_description: What happens during the login timeout?
- reproduction_steps: How can we reproduce this issue?
I can infer:
- severity: high (from your request)
Please provide the missing details.User Provides:
Description: Users are logged out after 30 seconds of inactivity
Steps:
1. Log in to the application
2. Wait 30 seconds without interaction
3. Try to navigate - user is logged outFilled Template:
## Bug Report
**Description**: Users are logged out after 30 seconds of inactivity
**Severity**: high
**Affected Component**: to be determined
**User Impact**: moderate
## Reproduction Steps
1. Log in to the application
2. Wait 30 seconds without interaction
3. Try to navigate - user is logged out
## Investigation Tasks
Please investigate and provide:
1. Root cause analysis
2. Affected code locations
3. Potential fix approaches
4. Risk assessment for each fix
5. Recommended solution
## Additional Context
No additional context provided---
Example 7: Creating Custom Templates
User Request: "Create a template for database migration reviews"
Process: 1. Discuss with user what variables are needed 2. Create new template file 3. Save to templates/db-migration-review.txt 4. Document required and optional variables 5. Provide example usage
Custom Template Created:
# Database Migration Review Template
# Required variables: migration_name, migration_type, affected_tables
# Optional variables: rollback_plan:TBD, impact:low, downtime:none
Review migration: {migration_name}
Type: {migration_type}
Affected Tables: {affected_tables}
Impact Assessment: {impact:low}
Downtime Required: {downtime:none expected}
Rollback Plan: {rollback_plan:To be determined}
Please review for:
1. Data integrity risks
2. Performance impact
3. Rollback safety
4. Index optimization---
Key Takeaways
1. Always validate required variables before filling 2. Use defaults wisely for optional variables 3. Gather context from user messages, file paths, and previous conversation 4. Ask for clarification when required variables are missing 5. Document templates with clear variable lists 6. Provide feedback on which defaults were used
Prompt Templating Skill
A Claude Code skill for creating consistent, reusable prompts with dynamic variable substitution.
Overview
This skill enables you to:
- Create prompt templates with placeholders like
{variable_name} - Fill templates with values from task context
- Validate required variables before execution
- Use default values for optional variables
- Maintain consistent prompt styles across tasks
Quick Start
Using a Built-in Template
You: Use the code-review template to review src/auth.js for security issues
Claude: [Uses prompt-templating skill]
- Loads templates/code-review.txt
- Extracts required variables
- Fills in from context:
- file_path = "src/auth.js"
- focus_areas = "security issues"
- code_content = [reads from file]
- Applies defaults for optional variables
- Outputs filled templateCreating a Custom Template
You: Create a summarization template for my weekly reports
Claude: [Uses prompt-templating skill]
- Asks what variables you need
- Creates custom template
- Saves to templates/
- Shows example usageFeatures
✓ Variable Substitution
Replace {placeholders} with actual values from context
✓ Required Variable Validation
Warns if critical variables are missing:
⚠️ Missing Required Variables:
- {user_name}: Name of the user
- {file_path}: Path to file being analyzed
Please provide these values to continue.✓ Optional Variables with Defaults
{severity:medium} → Uses "medium" if not provided
{format:markdown} → Uses "markdown" if not provided
{max_length:500} → Uses "500" if not provided✓ Context-Aware
Automatically extracts variables from:
- User messages
- File paths and content
- Previous conversation
- Git context
- Code being analyzed
Directory Structure
.claude/skills/prompt-templating/
├── SKILL.md # Main skill instructions
├── README.md # This file
├── templates/ # Pre-built templates
│ ├── code-review.txt
│ ├── summarization.txt
│ ├── analysis.txt
│ └── bug-report.txt
├── examples/ # Usage examples
│ └── basic-usage.md
└── reference/ # Documentation
├── variables.md # Common variables reference
└── template-syntax.md # Syntax guideBuilt-in Templates
code-review.txt
Review code with configurable focus areas and style guides.
Required: file_path, code_content, focus_areas Optional: reviewer_name, style_guide, severity_level
summarization.txt
Summarize documents with target audience and length constraints.
Required: content, content_type Optional: max_length, target_audience, focus
analysis.txt
General-purpose analysis template.
Required: subject, analysis_type Optional: depth, format, include_examples
bug-report.txt
Investigate bugs with structured format.
Required: bug_description, reproduction_steps Optional: severity, affected_component, user_impact
Template Syntax
Basic Variable
{variable_name}Required if not provided.
Optional Variable with Default
{variable_name:default_value}Uses default if not provided.
Escaping Literal Braces
\{not_a_variable\}Outputs: {not_a_variable}
Example Usage
Example 1: Code Review
Template: templates/code-review.txt
User provides:
- File: "src/components/Header.tsx"
- Focus: "React hooks usage"
Skill fills:
- {file_path} = "src/components/Header.tsx"
- {code_content} = [reads file content]
- {focus_areas} = "React hooks usage"
- {reviewer_name} = "Team" (default)
- {style_guide} = "standard coding practices" (default)
Result: Complete code review prompt ready to useExample 2: Document Summary
Template: templates/summarization.txt
User provides:
- Content: [documentation text]
- Type: "API documentation"
- Audience: "frontend developers"
- Max length: "300 words"
Skill fills:
- {content} = [documentation text]
- {content_type} = "API documentation"
- {target_audience} = "frontend developers"
- {max_length} = "300 words"
Result: Customized summarization promptExample 3: Missing Variables
Template: templates/bug-report.txt
User provides:
- "Investigate the timeout issue"
Required but missing:
- {bug_description} - needs detail
- {reproduction_steps} - needs steps
Skill warns:
⚠️ Missing Required Variables:
- {bug_description}: Detailed description of the bug
- {reproduction_steps}: Steps to reproduce the issue
Please provide these values to continue.
User provides missing info, skill continuesCreating Custom Templates
Template File Format
# Template Name
# Required variables: var1, var2
# Optional variables: var3:default3, var4:default4
[Your template content with {variables}]Example Custom Template
# Pull Request Template
# Required: pr_title, changes_summary
# Optional: related_issue:none, breaking_changes:no
## {pr_title}
### Summary
{changes_summary}
### Related Issue
{related_issue:None}
### Breaking Changes
{breaking_changes:No breaking changes}
### Checklist
- [ ] Tests added
- [ ] Documentation updated
- [ ] Reviewed by teamCommon Variables
See reference/variables.md for complete list.
General:
{user_name},{project_name},{date}
File & Code:
{file_path},{code_content},{function_name}
Review:
{reviewer_name},{focus_areas},{severity}
Documentation:
{content},{target_audience},{max_length}
Best Practices
1. Descriptive Variable Names
Good: {analysis_type}, {max_word_count}
Bad: {type}, {max}2. Sensible Defaults
Good: {format:markdown}, {severity:medium}
Bad: {format:?}, {severity:unknown}3. Document Templates
Include header comment listing:
- Required variables
- Optional variables with defaults
- Example usage
4. Validate Early
Check for missing required variables BEFORE filling template.
5. Preserve Context
Keep templates focused on structure, let context provide details.
Workflow
1. Identify Need - User requests templated prompt 2. Load Template - From templates/ or custom path 3. Parse Variables - Extract {variables} from template 4. Gather Values - From user, context, files 5. Validate - Check all required variables present 6. Warn if Missing - Stop and ask user for missing values 7. Fill Template - Replace placeholders with values 8. Output - Return completed prompt
Advanced Features (Optional)
Conditional Sections
{?if:variable_name}
Include this only if variable_name is provided
{?endif}List Iteration
{?foreach:item in items}
- {item}
{?endforeach}Note: These are optional enhancements. Basic replacement is the core functionality.
Files Reference
- SKILL.md - Main skill instructions for Claude
- README.md - This documentation
- *templates/.txt** - Pre-built prompt templates
- examples/basic-usage.md - Usage examples
- reference/variables.md - Common variables guide
- reference/template-syntax.md - Complete syntax reference
Getting Help
1. See examples/basic-usage.md for practical examples 2. See reference/template-syntax.md for syntax details 3. See reference/variables.md for common variables 4. Check existing templates in templates/ for patterns
Version
v1.0.0 - Initial release
License
Part of Claude Code skills collection.
Template Syntax Guide
Complete reference for the prompt templating syntax.
Basic Syntax
Simple Variable
{variable_name}- Replaced with the value of
variable_name - If not provided and no default, treated as required
- Variable names: lowercase, alphanumeric, underscore only
Examples:
Hello {user_name}!
Review file: {file_path}
Analysis type: {analysis_type}Optional Variable with Default
{variable_name:default_value}- If
variable_namenot provided, usesdefault_value - Default value can contain spaces, but not colons
- For colons in defaults, see escaping section
Examples:
Tone: {tone:professional}
Maximum length: {max_length:500 words}
Format: {output_format:markdown with code blocks}Variable Naming Rules
Valid Names
{user_name} ✓ Lowercase with underscore
{file_path} ✓ Descriptive
{analysis_type} ✓ Multi-word with underscore
{max_length} ✓ Clear meaning
{severity1} ✓ Numbers allowed
{component_name_v2}✓ Complex but validInvalid Names
{UserName} ✗ Capital letters
{user-name} ✗ Hyphens not allowed
{user.name} ✗ Dots not allowed
{user name} ✗ Spaces not allowed
{user@name} ✗ Special characters
{2fast} ✗ Cannot start with numberRegex Pattern
^[a-z][a-z0-9_]*$- Must start with lowercase letter
- Can contain lowercase letters, digits, underscores
- No spaces, no special characters
Escaping
Literal Braces
To include literal { or } in output:
Use \{this\} to show braces literallyOutput:
Use {this} to show braces literallyColons in Default Values
For defaults containing colons, use quotes:
{timestamp:"2024-01-15 10:30:00"}
{url:"https://example.com"}Or escape:
{timestamp:2024-01-15 10\:30\:00}Whitespace Handling
No Spaces in Braces
{variable_name} ✓ Correct
{ variable_name } ✗ Invalid
{ variable_name} ✗ Invalid
{variable_name } ✗ InvalidWhitespace in Values
Whitespace outside braces is preserved:
Hello {name},
Welcome to {project}!If name = "Alice" and project = "Claude":
Hello Alice,
Welcome to Claude!Indentation Preservation
Template indentation is preserved:
class {class_name}:
def {method_name}(self):
return {return_value}Multi-line Variables
Content Blocks
Variables can contain multi-line content:
Code to review:
{code_content}If code_content is:
def hello():
print("world")Result:
Code to review:
def hello():
print("world")Preserving Formatting
Original formatting in variable values is preserved:
- Line breaks
- Indentation
- Spacing
Default Value Syntax
Simple Defaults
{severity:medium}
{format:markdown}
{max_lines:100}Defaults with Spaces
{reviewer_name:Engineering Team}
{style_guide:Google Python Style Guide}
{focus:key points and takeaways}Defaults with Special Characters
{separator:, } (comma-space)
{bullet:• } (bullet point)
{format:markdown with **bold**}Empty Defaults
{optional_note:} (empty string)
{additional_context:None} (explicit "None")Variable Extraction
From Template to Variable List
Template:
Review {file_path} for {issue_type}.
Severity: {severity:medium}
Assigned to: {assignee}Extracted variables:
- Required:
file_path,issue_type,assignee - Optional:
severity(default: "medium")
Parsing Algorithm
1. Find all {text} patterns
2. For each pattern:
a. Check for colon (:)
b. If colon present:
- Left of colon = variable name
- Right of colon = default value
- Mark as optional
c. If no colon:
- Entire text = variable name
- Mark as required
3. Validate variable names
4. Build variable listAdvanced Patterns
Nested Defaults (Not Supported)
{var1:{var2:default}} ✗ Not supportedUse separate variables instead:
{var1:default1}
{var2:default2}Conditional Inclusion (Optional Enhancement)
Basic templates don't support conditionals, but can be added:
{?if:show_advanced}
Advanced section here
{?endif}This is an optional enhancement. Start with basic replacement.
Lists (Optional Enhancement)
{?foreach:item in items}
- {item}
{?endforeach}Also optional. Start with basic functionality.
Common Patterns
Code Review Template
# Review: {file_path}
Reviewer: {reviewer_name:Team}
Focus: {focus_areas}
{code_content}
Check for:
- {check1:bugs}
- {check2:performance}
- {check3:security}Analysis Template
Analyze {subject} for {purpose}.
Depth: {analysis_depth:detailed}
Format: {output_format:structured markdown}
Provide:
1. {section1:Overview}
2. {section2:Detailed Analysis}
3. {section3:Recommendations}Report Template
# {report_type:Monthly} Report
Department: {department}
Period: {time_period}
Metrics:
{metrics_content}
Summary: {summary:To be generated}Validation Rules
Variable Name Validation
import re
def is_valid_variable_name(name):
pattern = r'^[a-z][a-z0-9_]*$'
return re.match(pattern, name) is not None
# Valid
is_valid_variable_name("user_name") # True
is_valid_variable_name("file_path") # True
# Invalid
is_valid_variable_name("UserName") # False
is_valid_variable_name("user-name") # False
is_valid_variable_name("2fast") # FalseTemplate Validation
Before filling: 1. Extract all variables 2. Validate each variable name 3. Check for required variables 4. Warn if any required variable missing 5. Only proceed if all required variables have values
Error Messages
Invalid Variable Name
⚠️ Warning: Invalid variable name at line 5
Found: {User-Name}
Expected: {user_name}
Variable names must be lowercase with underscores only.Missing Required Variable
❌ Error: Missing required variable
Variable: {file_path}
Description: Path to the file to analyze
Please provide this value to continue.Malformed Syntax
⚠️ Warning: Malformed placeholder at line 3
Found: {variable name with spaces}
Spaces are not allowed in variable names.
Did you mean: {variable_name_with_underscores}?Best Practices
1. Use Descriptive Names
Good: {analysis_type}, {target_audience}, {max_word_count}
Bad: {type}, {audience}, {max}2. Provide Sensible Defaults
Good: {format:markdown}, {severity:medium}, {verbose:no}
Bad: {format:fmt}, {severity:?}, {verbose:0}3. Document Required vs Optional
At top of template:
# Required: file_path, analysis_type
# Optional: format:markdown, depth:detailed4. Group Related Variables
# File Variables
{file_path}
{file_name}
{file_type}
# Review Variables
{reviewer_name:Team}
{review_type:general}
{severity:all levels}5. Consistent Naming Scheme
Pick a convention and stick to it:
# Good (consistent)
{user_name}
{user_email}
{user_role}
# Bad (inconsistent)
{userName}
{user_email}
{UserRole}Template File Format
Recommended Structure
# Template Name
# Required variables: var1, var2
# Optional variables: var3:default3, var4:default4
#
# Description: What this template does
# Use case: When to use this template
#
# Example usage:
# var1 = "example1"
# var2 = "example2"
[Template content here with {variables}]File Extension
.txt- Plain text templates.md- Markdown templates.template- Generic templates
All formats work the same way.
Summary
Key Points: 1. Variables: {name} for required, {name:default} for optional 2. Names: lowercase, alphanumeric, underscores only 3. No spaces inside braces 4. Validate before filling 5. Preserve formatting and indentation 6. Warn on missing required variables
Processing Order: 1. Parse template 2. Extract variables 3. Validate names 4. Check for required variables 5. Gather values 6. Warn if missing 7. Fill template 8. Return result
Common Variables Reference
This document lists commonly used variables across templates and their typical meanings.
General Context Variables
| Variable | Type | Description | Example |
|---|---|---|---|
user_name | String | Name of the user | "Alice Johnson" |
date | String | Current date | "2025-11-18" |
project_name | String | Name of the project | "Claude Code" |
task_name | String | Name of the current task | "Authentication Refactor" |
File & Code Variables
| Variable | Type | Description | Example |
|---|---|---|---|
file_path | String | Path to file being analyzed | "src/components/Header.tsx" |
file_name | String | Name of file without path | "Header.tsx" |
code_content | String/Block | Actual code content | "function foo() {...}" |
function_name | String | Name of function | "calculateTotal" |
class_name | String | Name of class | "UserController" |
component_name | String | Name of component | "Header" |
line_number | Number | Line number reference | "42" |
Review & Analysis Variables
| Variable | Type | Description | Example |
|---|---|---|---|
reviewer_name | String | Name of reviewer | "Engineering Team" |
review_type | String | Type of review | "security audit" |
focus_areas | String | What to focus on | "performance, security" |
severity_level | String | Issue severity | "high, medium, low" |
analysis_type | String | Type of analysis | "performance analysis" |
style_guide | String | Coding style guide | "Google Style Guide" |
Documentation Variables
| Variable | Type | Description | Example |
|---|---|---|---|
content | String/Block | Content to process | "Full documentation text" |
content_type | String | Type of content | "API documentation" |
target_audience | String | Intended audience | "developers" |
max_length | Number | Maximum output length | "500" |
format | String | Output format | "markdown" |
Bug & Issue Variables
| Variable | Type | Description | Example |
|---|---|---|---|
bug_description | String | Bug description | "Login fails on Safari" |
reproduction_steps | String/List | How to reproduce | "1. Open Safari\n2. ..." |
severity | String | Bug severity | "critical" |
affected_component | String | Which component | "AuthService" |
user_impact | String | Impact on users | "Cannot log in" |
expected_behavior | String | What should happen | "Login succeeds" |
actual_behavior | String | What actually happens | "Error message shown" |
Testing Variables
| Variable | Type | Description | Example |
|---|---|---|---|
test_type | String | Type of test | "unit test" |
coverage_target | Number | Coverage percentage | "80" |
test_framework | String | Testing framework | "Jest" |
test_file | String | Test file path | "src/__tests__/auth.test.js" |
Report Variables
| Variable | Type | Description | Example |
|---|---|---|---|
report_type | String | Type of report | "monthly" |
department | String | Department name | "Engineering" |
time_period | String | Time period | "Q4 2024" |
metrics | String/List | Metrics to include | "velocity, quality, bugs" |
Optional Variable Defaults
Common default values for optional variables:
{tone:professional}
{format:markdown}
{max_length:500}
{severity:medium}
{impact:moderate}
{priority:normal}
{status:pending}
{confidence:medium}
{verbosity:detailed}
{include_examples:yes}
{style_guide:standard coding practices}
{target_audience:general}
{output_format:structured}Variable Naming Conventions
Good Variable Names
- Descriptive:
{analysis_type}not{type} - Lowercase:
{user_name}not{UserName} - Underscores:
{max_length}not{maxLength}or{max-length} - Specific:
{code_file_path}not{path}
Bad Variable Names
- Too short:
{x},{val},{tmp} - Too generic:
{data},{info},{stuff} - Wrong case:
{UserName},{PROJECT_NAME} - Special chars:
{user-name},{user.name}
Context Extraction Patterns
From User Messages
"Review the header component" → {component_name} = "header"
"Use John as the reviewer" → {reviewer_name} = "John"
"Make it brief" → {max_length} = "200"
"High priority bug" → {severity} = "high"From File Paths
File: src/components/auth/LoginForm.tsx
→ {file_path} = "src/components/auth/LoginForm.tsx"
→ {file_name} = "LoginForm.tsx"
→ {component_name} = "LoginForm"
→ {module_name} = "auth"From Code Context
Reviewing function: async calculateTotal(items) { ... }
→ {function_name} = "calculateTotal"
→ {is_async} = "yes"
→ {parameter_count} = "1"From Git Context
Current branch: feature/user-auth
→ {branch_name} = "feature/user-auth"
→ {feature_name} = "user-auth"
Latest commit: "Fix login bug"
→ {commit_message} = "Fix login bug"Variable Validation
Type Validation
- Strings: Any text value
- Numbers: Validate numeric format (e.g.,
{max_length}should be a number) - Enums: Check against allowed values (e.g.,
{severity}in [low, medium, high, critical]) - Paths: Validate file path format
- Dates: Validate date format (ISO 8601 recommended)
Content Validation
- Email: Check email format for
{email}variables - URLs: Validate URL format for
{url}variables - Code blocks: Preserve formatting for
{code_content} - Lists: Handle comma-separated or newline-separated lists
Security Validation
For potentially sensitive contexts:
- Escape special characters in
{user_input}variables - Validate file paths don't escape project directory
- Sanitize SQL/code injection risks
- Warn on potentially unsafe patterns
Custom Variable Definitions
When creating templates, document your variables:
# Custom Template Name
# Required variables: var1, var2, var3
# Optional variables: var4:default1, var5:default2
#
# Variable Descriptions:
# - var1: Description of what this represents
# - var2: Description of what this represents
# - var3: Description of what this represents
# - var4: Description (default: default1)
# - var5: Description (default: default2)This helps users understand what values to provide.
# General Analysis Template
# Required variables: subject, analysis_type
# Optional variables: depth:detailed, format:markdown, include_examples:yes
Perform a {analysis_type} analysis of: {subject}
## Analysis Parameters
- Depth: {depth:detailed}
- Output Format: {format:markdown}
- Include Examples: {include_examples:yes}
## Analysis Requirements
Please analyze:
1. Current state and characteristics
2. Strengths and advantages
3. Weaknesses and limitations
4. Opportunities for improvement
5. Potential risks or concerns
Provide actionable insights and recommendations.
# Bug Investigation Template
# Required variables: bug_description, reproduction_steps
# Optional variables: severity:medium, affected_component:unknown, user_impact:moderate
## Bug Report
**Description**: {bug_description}
**Severity**: {severity:medium}
**Affected Component**: {affected_component:to be determined}
**User Impact**: {user_impact:moderate}
## Reproduction Steps
{reproduction_steps}
## Investigation Tasks
Please investigate and provide:
1. Root cause analysis
2. Affected code locations
3. Potential fix approaches
4. Risk assessment for each fix
5. Recommended solution
## Additional Context
{additional_context:No additional context provided}
# Code Review Template
# Required variables: file_path, code_content, focus_areas
# Optional variables: reviewer_name:Team, style_guide:standard, severity_level:all
Please review the following code from {file_path}:
## Review Criteria
Focus on: {focus_areas}
Style Guide: {style_guide:standard coding practices}
Severity Level: {severity_level:all issues}
## Code to Review
```
{code_content}
```
## Expected Output
Provide a detailed review covering:
1. Code quality and best practices
2. Potential bugs or errors
3. Performance considerations
4. Security vulnerabilities
5. Readability and maintainability
Reviewer: {reviewer_name:Development Team}
# Document Summarization Template
# Required variables: content, content_type
# Optional variables: max_length:500, target_audience:general, focus:key points
Summarize the following {content_type}:
## Content
{content}
## Summarization Parameters
- Maximum Length: {max_length:500 words}
- Target Audience: {target_audience:general readers}
- Focus: {focus:key points and main takeaways}
## Output Format
Provide:
1. Executive summary (2-3 sentences)
2. Main points (bullet list)
3. Key takeaways
4. Recommendations (if applicable)