Overview
Task Templates allow you to create reusable task configurations for common workflows like bug fixes, feature development, code reviews, and refactoring. Base URL:http://localhost:8887/api/task-templates
List Templates
Get all available task templates.GET /api/task-templates
Query Parameters
| Parameter | Type | Description |
|---|---|---|
page | integer | Page number (default: 1) |
limit | integer | Items per page (default: 20) |
category | string | Filter by template category |
search | string | Search by template name |
curl "http://localhost:8887/api/task-templates?page=1&limit=10"
const response = await fetch('http://localhost:8887/api/task-templates?page=1&limit=10');
const data = await response.json();
console.log(data);
import requests
response = requests.get(
'http://localhost:8887/api/task-templates',
params={'page': 1, 'limit': 10}
)
templates = response.json()
{
"success": true,
"data": [
{
"id": "template_bug_fix",
"name": "Bug Fix Workflow",
"description": "Standard bug fix workflow with reproduction, fix, and testing",
"category": "bugfix",
"tasks": [
{
"title": "Reproduce bug",
"description": "Create minimal reproduction",
"order": 1
},
{
"title": "Fix bug",
"description": "Implement fix",
"order": 2
},
{
"title": "Add tests",
"description": "Add regression tests",
"order": 3
}
],
"createdAt": "2024-01-10T00:00:00Z"
}
],
"pagination": {
"page": 1,
"limit": 10,
"total": 5,
"pages": 1
}
}
{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "Authentication required"
}
}
Get Template
Get a specific template by ID.GET /api/task-templates/:id
curl http://localhost:8887/api/task-templates/template_feature
const response = await fetch('http://localhost:8887/api/task-templates/template_feature');
const data = await response.json();
console.log(data);
import requests
response = requests.get('http://localhost:8887/api/task-templates/template_feature')
template = response.json()
{
"success": true,
"data": {
"id": "template_feature",
"name": "Feature Development",
"description": "Complete feature development workflow",
"category": "feature",
"tasks": [
{
"title": "Design feature",
"description": "Create technical design",
"order": 1,
"estimatedTime": 60
},
{
"title": "Implement feature",
"description": "Write implementation code",
"order": 2,
"estimatedTime": 180
},
{
"title": "Write tests",
"description": "Add unit and integration tests",
"order": 3,
"estimatedTime": 90
},
{
"title": "Update documentation",
"description": "Document new feature",
"order": 4,
"estimatedTime": 30
}
],
"metadata": {
"totalEstimatedTime": 360,
"difficulty": "medium"
}
}
}
{
"success": false,
"error": {
"code": "NOT_FOUND",
"message": "Template not found"
}
}
{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "Authentication required"
}
}
Create Template
Create a new task template.POST /api/task-templates
string
required
Template name
string
required
Template description
string
required
Template category (e.g., “bugfix”, “feature”, “refactor”, “review”)
array
required
Array of task definitions with title, description, and order
curl -X POST http://localhost:8887/api/task-templates \
-H "Content-Type: application/json" \
-d '{
"name": "API Endpoint Template",
"description": "Template for creating new API endpoints",
"category": "development",
"tasks": [
{
"title": "Define API schema",
"description": "Create OpenAPI specification",
"order": 1
},
{
"title": "Implement endpoint",
"description": "Write handler and validation",
"order": 2
},
{
"title": "Add tests",
"description": "Unit and integration tests",
"order": 3
},
{
"title": "Update API docs",
"description": "Document in API reference",
"order": 4
}
]
}'
const response = await fetch('http://localhost:8887/api/task-templates', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
name: 'API Endpoint Template',
description: 'Template for creating new API endpoints',
category: 'development',
tasks: [...]
})
});
const data = await response.json();
import requests
response = requests.post(
'http://localhost:8887/api/task-templates',
json={
'name': 'API Endpoint Template',
'description': 'Template for creating new API endpoints',
'category': 'development',
'tasks': [...]
}
)
template = response.json()
{
"success": true,
"data": {
"id": "template_api_endpoint",
"name": "API Endpoint Template",
"description": "Template for creating new API endpoints",
"category": "development",
"tasks": [
{
"title": "Define API schema",
"description": "Create OpenAPI specification",
"order": 1
},
{
"title": "Implement endpoint",
"description": "Write handler and validation",
"order": 2
},
{
"title": "Add tests",
"description": "Unit and integration tests",
"order": 3
},
{
"title": "Update API docs",
"description": "Document in API reference",
"order": 4
}
],
"createdAt": "2024-01-15T11:00:00Z"
}
}
{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "Authentication required"
}
}
Update Template
Update an existing template.PUT /api/task-templates/:id
string
Updated template name
string
Updated template description
string
Updated template category
array
Updated task definitions array
curl -X PUT http://localhost:8887/api/task-templates/template_api_endpoint \
-H "Content-Type: application/json" \
-d '{
"name": "Updated Template Name",
"description": "Updated description with new details"
}'
const response = await fetch('http://localhost:8887/api/task-templates/template_api_endpoint', {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
name: 'Updated Template Name',
description: 'Updated description'
})
});
const data = await response.json();
import requests
response = requests.put(
'http://localhost:8887/api/task-templates/template_api_endpoint',
json={
'name': 'Updated Template Name',
'description': 'Updated description'
}
)
template = response.json()
{
"success": true,
"data": {
"id": "template_api_endpoint",
"name": "Updated Template Name",
"description": "Updated description with new details",
"category": "development",
"tasks": [...],
"updatedAt": "2024-01-15T14:30:00Z"
}
}
{
"success": false,
"error": {
"code": "NOT_FOUND",
"message": "Template not found"
}
}
{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "Authentication required"
}
}
Delete Template
Delete a template.DELETE /api/task-templates/:id
Deleting a template is permanent and cannot be undone.
curl -X DELETE http://localhost:8887/api/task-templates/template_api_endpoint
const response = await fetch('http://localhost:8887/api/task-templates/template_api_endpoint', {
method: 'DELETE'
});
const data = await response.json();
import requests
response = requests.delete('http://localhost:8887/api/task-templates/template_api_endpoint')
result = response.json()
{
"success": true,
"data": {
"deleted": true,
"templateId": "template_api_endpoint"
}
}
{
"success": false,
"error": {
"code": "NOT_FOUND",
"message": "Template not found"
}
}
{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "Authentication required"
}
}
Built-in Templates
Forge includes several built-in templates:Bug Fix
name: Bug Fix Workflow
tasks:
- Reproduce bug
- Fix issue
- Add regression tests
- Update changelog
Feature Development
name: Feature Development
tasks:
- Design feature
- Implement code
- Write tests
- Update documentation
Code Review
name: Code Review
tasks:
- Review code quality
- Check test coverage
- Verify documentation
- Approve or request changes
Refactoring
name: Refactoring
tasks:
- Analyze current code
- Plan refactoring approach
- Execute refactoring
- Verify tests pass
SDK Examples
import { ForgeClient } from '@automagik/forge-sdk';
const forge = new ForgeClient();
// List templates
const templates = await forge.templates.list();
// Get template
const template = await forge.templates.get('template_bug_fix');
// Create from template
const tasks = await forge.templates.createTasks('proj_123', 'template_feature', {
context: {
feature: 'User notifications',
description: 'Add email and push notifications'
}
});
// Create custom template
const newTemplate = await forge.templates.create({
name: 'My Custom Template',
category: 'custom',
tasks: [...]
});
Next Steps
Tasks API
Create tasks from templates
Workflows
Template-based workflows

