Skip to main content
curl "http://localhost:8887/api/task-templates?page=1&limit=10"
{
  "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
  }
}

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

ParameterTypeDescription
pageintegerPage number (default: 1)
limitintegerItems per page (default: 20)
categorystringFilter by template category
searchstringSearch by template name
curl "http://localhost:8887/api/task-templates?page=1&limit=10"
{
  "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
  }
}

Get Template

Get a specific template by ID.
GET /api/task-templates/:id
curl http://localhost:8887/api/task-templates/template_feature
{
  "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"
    }
  }
}

Create Template

Create a new task template.
POST /api/task-templates
name
string
required
Template name
description
string
required
Template description
category
string
required
Template category (e.g., “bugfix”, “feature”, “refactor”, “review”)
tasks
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
      }
    ]
  }'
{
  "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"
  }
}

Update Template

Update an existing template.
PUT /api/task-templates/:id
name
string
Updated template name
description
string
Updated template description
category
string
Updated template category
tasks
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"
  }'
{
  "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"
  }
}

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
{
  "success": true,
  "data": {
    "deleted": true,
    "templateId": "template_api_endpoint"
  }
}

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