src/prompts/schemas/README.md
This directory contains JSON schemas for validating Task Master prompt templates. These schemas provide IDE support, validation, and better developer experience when working with prompt templates.
The schema system provides:
prompt-template.schema.json (Main Schema)Version: 1.0.0
Purpose: Main schema for Task Master prompt template files
Validates:
Required Fields:
id: Unique template identifier (kebab-case)version: Semantic version (e.g., "1.0.0")description: Human-readable descriptionprompts.default: Default prompt variantOptional Fields:
metadata: Additional template informationparameters: Parameter definitions for template variablesprompts.*: Additional prompt variantsparameter.schema.json (Parameter Schema)Version: 1.0.0
Purpose: Reusable schema for individual prompt parameters
Supports:
string, number, boolean, array, objectParameter Properties:
{
"type": "string|number|boolean|array|object",
"required": true|false,
"default": "any value matching type",
"description": "Parameter documentation",
"enum": ["option1", "option2"],
"pattern": "^regex$",
"minimum": 0,
"maximum": 100,
"minLength": 1,
"maxLength": 255,
"items": { "type": "string" },
"properties": { "key": { "type": "string" } }
}
variant.schema.json (Variant Schema)Version: 1.0.0
Purpose: Schema for prompt template variants
Validates:
Variant Structure:
{
"condition": "JavaScript expression",
"system": "System prompt template",
"user": "User prompt template",
"metadata": {
"description": "When to use this variant"
}
}
^[a-z][a-z0-9-]*[a-z0-9]$add-task, parse-prd, analyze-complexityAddTask, add_task, -invalid-, task-MAJOR.MINOR.PATCH1.0.0, 2.1.3, 10.0.01.0, v1.0.0, 1.0.0-beta{{variable}}, {{#if condition}}, {{#each array}}{{object.property}} notation{{@index}}, {{@first}}, {{@last}} in loopsThe VS Code profile automatically configures schema validation:
{
"json.schemas": [
{
"fileMatch": [
"src/prompts/**/*.json",
".taskmaster/prompts/**/*.json",
"prompts/**/*.json"
],
"url": "./src/prompts/schemas/prompt-template.schema.json"
}
]
}
Features Provided:
For other development environments:
Schema URLs:
./src/prompts/schemas/prompt-template.schema.jsonhttps://github.com/eyaltoledano/claude-task-master/blob/main/src/prompts/schemas/prompt-template.schema.jsonFile Patterns:
src/prompts/**/*.json.taskmaster/prompts/**/*.jsonprompts/**/*.json{
"id": "example-prompt",
"version": "1.0.0",
"description": "Example prompt template with comprehensive validation",
"metadata": {
"author": "Task Master Team",
"category": "task",
"tags": ["example", "validation"]
},
"parameters": {
"taskDescription": {
"type": "string",
"description": "Description of the task to perform",
"required": true,
"minLength": 5,
"maxLength": 500
},
"priority": {
"type": "string",
"description": "Task priority level",
"required": false,
"enum": ["high", "medium", "low"],
"default": "medium"
},
"maxTokens": {
"type": "number",
"description": "Maximum tokens for response",
"required": false,
"minimum": 100,
"maximum": 4000,
"default": 1000
},
"useResearch": {
"type": "boolean",
"description": "Whether to include research context",
"required": false,
"default": false
},
"tags": {
"type": "array",
"description": "Task tags for categorization",
"required": false,
"items": {
"type": "string",
"pattern": "^[a-z][a-z0-9-]*$"
}
}
},
"prompts": {
"default": {
"system": "You are a helpful AI assistant that creates tasks with {{priority}} priority.",
"user": "Create a task: {{taskDescription}}{{#if tags}}\nTags: {{#each tags}}{{this}}{{#unless @last}}, {{/unless}}{{/each}}{{/if}}"
},
"research": {
"condition": "useResearch === true",
"system": "You are a research-focused AI assistant with access to current information.",
"user": "Research and create a task: {{taskDescription}}"
}
}
}
Missing Required Fields:
// ❌ Error: Missing required 'id' field
{
"version": "1.0.0",
"description": "Missing ID"
}
Invalid ID Format:
// ❌ Error: ID must be kebab-case
{
"id": "InvalidID_Format",
"version": "1.0.0"
}
Parameter Type Mismatch:
// ❌ Error: Parameter type doesn't match usage
{
"parameters": {
"count": { "type": "string" }
},
"prompts": {
"default": {
"user": "Process {{count}} items" // Should be number for counting
}
}
}
Invalid Condition Syntax:
// ❌ Error: Invalid JavaScript in condition
{
"prompts": {
"variant": {
"condition": "useResearch = true", // Should be ===
"user": "Research prompt"
}
}
}
When updating schemas themselves:
$id and version fieldsThe schema validates that:
The schema includes custom validation for:
Schema Not Loading:
Validation Not Working:
ajv and ajv-formats dependencies are installedPerformance Issues:
Understanding Error Messages:
// Example error output
{
"instancePath": "/parameters/priority/type",
"schemaPath": "#/properties/parameters/additionalProperties/properties/type/enum",
"keyword": "enum",
"params": { "allowedValues": ["string", "number", "boolean", "array", "object"] },
"message": "must be equal to one of the allowed values"
}
Common Error Patterns:
instancePath: Shows where in the template the error occurredschemaPath: Shows which schema rule was violatedkeyword: Indicates the type of validation that failedparams: Provides additional context about the validation rulemessage: Human-readable description of the errorInternal Resources:
src/prompts/README.mdsrc/prompts/schemas/*.jsonscripts/modules/prompt-manager.jsExternal Resources:
./src/prompts/schemas/prompt-template.schema.jsonhttps://github.com/eyaltoledano/claude-task-master/blob/main/src/prompts/schemas/prompt-template.schema.json$id Field: Use GitHub blob URLs for stable schema identification