process-builder

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Process Builder

流程构建器

Create new process definitions for the babysitter event-sourced orchestration framework.
为基于事件溯源的babysitter编排框架创建新的流程定义。

Quick Reference

快速参考

Processes live in: plugins/babysitter/skills/babysit/process/
├── methodologies/          # Reusable development approaches (TDD, BDD, Scrum, etc.)
│   └── [name]/
│       ├── README.md       # Documentation
│       ├── [name].js       # Main process
│       └── examples/       # Sample inputs
└── specializations/        # Domain-specific processes
    ├── [category]/         # Engineering specializations (direct children)
    │   └── [process].js
    └── domains/
        └── [domain]/       # Business, Science, Social Sciences
            └── [spec]/
                ├── README.md
                ├── references.md
                ├── processes-backlog.md
                └── [process].js
Processes live in: plugins/babysitter/skills/babysit/process/
├── methodologies/          # 可复用的开发方法(TDD、BDD、Scrum等)
│   └── [name]/
│       ├── README.md       # 文档
│       ├── [name].js       # 主流程文件
│       └── examples/       # 示例输入
└── specializations/        # 领域特定流程
    ├── [category]/         # 工程细分领域(直接子目录)
    │   └── [process].js
    └── domains/
        └── [domain]/       # 业务、科学、社会科学领域
            └── [spec]/
                ├── README.md
                ├── references.md
                ├── processes-backlog.md
                └── [process].js

3-Phase Workflow

三阶段工作流

Phase 1: Research & Documentation

阶段1:调研与文档编写

Create foundational documentation:
bash
undefined
创建基础文档:
bash
undefined

Check existing specializations

查看现有细分领域流程

ls plugins/babysitter/skills/babysit/process/specializations/
ls plugins/babysitter/skills/babysit/process/specializations/

Check methodologies

查看现有方法

ls plugins/babysitter/skills/babysit/process/methodologies/

**Create:**
- `README.md` - Overview, roles, goals, use cases, common flows
- `references.md` - External references, best practices, links to sources
ls plugins/babysitter/skills/babysit/process/methodologies/

**需创建:**
- `README.md` - 概述、角色、目标、用例、通用流程
- `references.md` - 外部参考资料、最佳实践、来源链接

Phase 2: Identify Processes

阶段2:识别流程

Create
processes-backlog.md
with identified processes:
markdown
undefined
创建
processes-backlog.md
文档,记录已识别的流程:
markdown
undefined

Processes Backlog - [Specialization Name]

流程待办列表 - [细分领域名称]

Identified Processes

已识别流程

  • process-name - Short description of what this process accomplishes
    • Reference: [Link to methodology or standard]
    • Inputs: list key inputs
    • Outputs: list key outputs
  • another-process - Description ...
undefined
  • process-name - 该流程实现目标的简短描述
    • 参考:[方法或标准链接]
    • 输入:关键输入列表
    • 输出:关键输出列表
  • another-process - 描述 ...
undefined

Phase 3: Create Process Files

阶段3:创建流程文件

Create
.js
process files following SDK patterns (see below).

遵循SDK模式创建
.js
流程文件(详见下文)。

Process File Structure

流程文件结构

Every process file follows this pattern:
javascript
/**
 * @process [category]/[process-name]
 * @description Clear description of what the process accomplishes end-to-end
 * @inputs { inputName: type, optionalInput?: type }
 * @outputs { success: boolean, outputName: type, artifacts: array }
 *
 * @example
 * const result = await orchestrate('[category]/[process-name]', {
 *   inputName: 'value',
 *   optionalInput: 'optional-value'
 * });
 *
 * @references
 * - Book: "Relevant Book Title" by Author
 * - Article: [Title](https://link)
 * - Standard: ISO/IEEE reference
 */

import { defineTask } from '@a5c-ai/babysitter-sdk';

/**
 * [Process Name] Process
 *
 * Methodology: Brief description of the approach
 *
 * Phases:
 * 1. Phase Name - What happens
 * 2. Phase Name - What happens
 * ...
 *
 * Benefits:
 * - Benefit 1
 * - Benefit 2
 *
 * @param {Object} inputs - Process inputs
 * @param {string} inputs.inputName - Description of input
 * @param {Object} ctx - Process context (see SDK)
 * @returns {Promise<Object>} Process result
 */
export async function process(inputs, ctx) {
  const {
    inputName,
    optionalInput = 'default-value',
    // ... destructure with defaults
  } = inputs;

  const artifacts = [];

  // ============================================================================
  // PHASE 1: [PHASE NAME]
  // ============================================================================

  ctx.log?.('info', 'Starting Phase 1...');

  const phase1Result = await ctx.task(someTask, {
    // task inputs
  });

  artifacts.push(...(phase1Result.artifacts || []));

  // Breakpoint for human review (when needed)
  await ctx.breakpoint({
    question: 'Review the results and approve to continue?',
    title: 'Phase 1 Review',
    context: {
      runId: ctx.runId,
      files: [
        { path: 'artifacts/output.md', format: 'markdown', label: 'Output' }
      ]
    }
  });

  // ============================================================================
  // PHASE 2: [PHASE NAME] - Parallel Execution Example
  // ============================================================================

  const [result1, result2, result3] = await ctx.parallel.all([
    () => ctx.task(task1, { /* args */ }),
    () => ctx.task(task2, { /* args */ }),
    () => ctx.task(task3, { /* args */ })
  ]);

  // ============================================================================
  // PHASE 3: [ITERATION EXAMPLE]
  // ============================================================================

  let iteration = 0;
  let targetMet = false;

  while (!targetMet && iteration < maxIterations) {
    iteration++;

    const iterResult = await ctx.task(iterativeTask, {
      iteration,
      previousResults: /* ... */
    });

    targetMet = iterResult.meetsTarget;

    if (!targetMet && iteration % 3 === 0) {
      // Periodic checkpoint
      await ctx.breakpoint({
        question: `Iteration ${iteration}: Target not met. Continue?`,
        title: 'Progress Checkpoint',
        context: { /* ... */ }
      });
    }
  }

  // ============================================================================
  // COMPLETION
  // ============================================================================

  return {
    success: targetMet,
    iterations: iteration,
    artifacts,
    // ... other outputs matching @outputs
  };
}

// ============================================================================
// TASK DEFINITIONS
// ============================================================================

/**
 * Task: [Task Name]
 * Purpose: What this task accomplishes
 */
const someTask = defineTask({
  name: 'task-name',
  description: 'What this task does',

  // Task definition - executed externally by orchestrator
  // This returns a TaskDef that describes HOW to run the task

  inputs: {
    inputName: { type: 'string', required: true },
    optionalInput: { type: 'number', default: 10 }
  },

  outputs: {
    result: { type: 'object' },
    artifacts: { type: 'array' }
  },

  async run(inputs, taskCtx) {
    const effectId = taskCtx.effectId;

    return {
      kind: 'node',  // or 'agent', 'skill', 'shell', 'breakpoint'
      title: `Task: ${inputs.inputName}`,
      node: {
        entry: 'scripts/task-runner.js',
        args: ['--input', inputs.inputName, '--effect-id', effectId]
      },
      io: {
        inputJsonPath: `tasks/${effectId}/input.json`,
        outputJsonPath: `tasks/${effectId}/result.json`
      },
      labels: ['category', 'subcategory']
    };
  }
});

每个流程文件需遵循以下模式:
javascript
/**
 * @process [category]/[process-name]
 * @description 流程端到端实现目标的清晰描述
 * @inputs { inputName: type, optionalInput?: type }
 * @outputs { success: boolean, outputName: type, artifacts: array }
 *
 * @example
 * const result = await orchestrate('[category]/[process-name]', {
 *   inputName: 'value',
 *   optionalInput: 'optional-value'
 * });
 *
 * @references
 * - Book: "Relevant Book Title" by Author
 * - Article: [Title](https://link)
 * - Standard: ISO/IEEE reference
 */

import { defineTask } from '@a5c-ai/babysitter-sdk';

/**
 * [流程名称] 流程
 *
 * 方法:实现方法的简要描述
 *
 * 阶段:
 * 1. 阶段名称 - 执行内容
 * 2. 阶段名称 - 执行内容
 * ...
 *
 * 优势:
 * - 优势1
 * - 优势2
 *
 * @param {Object} inputs - 流程输入
 * @param {string} inputs.inputName - 输入描述
 * @param {Object} ctx - 流程上下文(详见SDK)
 * @returns {Promise<Object>} 流程结果
 */
export async function process(inputs, ctx) {
  const {
    inputName,
    optionalInput = 'default-value',
    // ... 带默认值的解构赋值
  } = inputs;

  const artifacts = [];

  // ============================================================================
  // 阶段1: [阶段名称]
  // ============================================================================

  ctx.log?.('info', '开始阶段1...');

  const phase1Result = await ctx.task(someTask, {
    // 任务输入
  });

  artifacts.push(...(phase1Result.artifacts || []));

  // 人工审核断点(按需使用)
  await ctx.breakpoint({
    question: '审核结果并批准继续?',
    title: '阶段1审核',
    context: {
      runId: ctx.runId,
      files: [
        { path: 'artifacts/output.md', format: 'markdown', label: '输出结果' }
      ]
    }
  });

  // ============================================================================
  // 阶段2: [阶段名称] - 并行执行示例
  // ============================================================================

  const [result1, result2, result3] = await ctx.parallel.all([
    () => ctx.task(task1, { /* 参数 */ }),
    () => ctx.task(task2, { /* 参数 */ }),
    () => ctx.task(task3, { /* 参数 */ })
  ]);

  // ============================================================================
  // 阶段3: [迭代示例]
  // ============================================================================

  let iteration = 0;
  let targetMet = false;

  while (!targetMet && iteration < maxIterations) {
    iteration++;

    const iterResult = await ctx.task(iterativeTask, {
      iteration,
      previousResults: /* ... */
    });

    targetMet = iterResult.meetsTarget;

    if (!targetMet && iteration % 3 === 0) {
      // 定期检查点
      await ctx.breakpoint({
        question: `${iteration}次迭代:未达成目标。是否继续?`,
        title: '进度检查点',
        context: { /* ... */ }
      });
    }
  }

  // ============================================================================
  // 完成
  // ============================================================================

  return {
    success: targetMet,
    iterations: iteration,
    artifacts,
    // ... 其他与@outputs匹配的输出
  };
}

// ============================================================================
// 任务定义
// ============================================================================

/**
 * 任务: [任务名称]
 * 用途: 该任务的实现目标
 */
const someTask = defineTask({
  name: 'task-name',
  description: '任务功能描述',

  // 任务定义 - 由编排器外部执行
  // 返回描述任务运行方式的TaskDef

  inputs: {
    inputName: { type: 'string', required: true },
    optionalInput: { type: 'number', default: 10 }
  },

  outputs: {
    result: { type: 'object' },
    artifacts: { type: 'array' }
  },

  async run(inputs, taskCtx) {
    const effectId = taskCtx.effectId;

    return {
      kind: 'node',  // 或 'agent', 'skill', 'shell', 'breakpoint'
      title: `Task: ${inputs.inputName}`,
      node: {
        entry: 'scripts/task-runner.js',
        args: ['--input', inputs.inputName, '--effect-id', effectId]
      },
      io: {
        inputJsonPath: `tasks/${effectId}/input.json`,
        outputJsonPath: `tasks/${effectId}/result.json`
      },
      labels: ['category', 'subcategory']
    };
  }
});

SDK Context API Reference

SDK上下文API参考

The
ctx
object provides these intrinsics:
MethodPurposeBehavior
ctx.task(taskDef, args, opts?)
Execute a taskReturns result or throws typed exception
ctx.breakpoint(payload)
Human approval gatePauses until approved via breakpoints service
ctx.sleepUntil(isoOrEpochMs)
Time-based gatePauses until specified time
ctx.parallel.all([...thunks])
Parallel executionRuns independent tasks concurrently
ctx.parallel.map(items, fn)
Parallel mapMaps items through task function
ctx.now()
Deterministic timeReturns current Date (or provided time)
ctx.log?.(level, msg, data?)
LoggingOptional logging helper
ctx.runId
Run identifierCurrent run's unique ID
ctx
对象提供以下内置方法:
方法用途行为
ctx.task(taskDef, args, opts?)
执行任务返回结果或抛出类型化异常
ctx.breakpoint(payload)
人工批准节点暂停流程,直到通过断点服务获得批准
ctx.sleepUntil(isoOrEpochMs)
时间触发节点暂停到指定时间
ctx.parallel.all([...thunks])
并行执行并发运行独立任务
ctx.parallel.map(items, fn)
并行映射通过任务函数处理所有条目
ctx.now()
确定性时间返回当前时间(或指定时间)
ctx.log?.(level, msg, data?)
日志记录可选的日志辅助方法
ctx.runId
运行标识符当前运行的唯一ID

Task Kinds

任务类型

KindUse CaseExecutor
node
Scripts, builds, testsNode.js process
agent
LLM-powered analysis, generationClaude Code agent
skill
Claude Code skillsSkill invocation
shell
System commandsShell execution
breakpoint
Human approvalBreakpoints UI/service
sleep
Time gatesOrchestrator scheduling
orchestrator_task
Internal orchestrator workSelf-routed

类型适用场景执行器
node
脚本、构建、测试Node.js进程
agent
大语言模型驱动的分析、生成Claude Code agent
skill
Claude Code技能技能调用
shell
系统命令Shell执行
breakpoint
人工批准断点UI/服务
sleep
时间节点编排器调度
orchestrator_task
编排器内部工作内部路由

Breakpoint Patterns

断点模式

Basic Approval Gate

基础批准节点

javascript
await ctx.breakpoint({
  question: 'Approve to continue?',
  title: 'Checkpoint',
  context: { runId: ctx.runId }
});
javascript
await ctx.breakpoint({
  question: '是否批准继续?',
  title: '检查点',
  context: { runId: ctx.runId }
});

With File References (for UI display)

带文件引用的断点(用于UI展示)

javascript
await ctx.breakpoint({
  question: 'Review the generated specification. Does it meet requirements?',
  title: 'Specification Review',
  context: {
    runId: ctx.runId,
    files: [
      { path: 'artifacts/spec.md', format: 'markdown', label: 'Specification' },
      { path: 'artifacts/spec.json', format: 'json', label: 'JSON Schema' },
      { path: 'src/implementation.ts', format: 'code', language: 'typescript', label: 'Implementation' }
    ]
  }
});
javascript
await ctx.breakpoint({
  question: '审核生成的规范是否符合要求?',
  title: '规范审核',
  context: {
    runId: ctx.runId,
    files: [
      { path: 'artifacts/spec.md', format: 'markdown', label: '规范文档' },
      { path: 'artifacts/spec.json', format: 'json', label: 'JSON Schema' },
      { path: 'src/implementation.ts', format: 'code', language: 'typescript', label: '实现代码' }
    ]
  }
});

Conditional Breakpoint

条件断点

javascript
if (qualityScore < targetScore) {
  await ctx.breakpoint({
    question: `Quality score ${qualityScore} is below target ${targetScore}. Continue iterating or accept current result?`,
    title: 'Quality Gate',
    context: {
      runId: ctx.runId,
      data: { qualityScore, targetScore, iteration }
    }
  });
}

javascript
if (qualityScore < targetScore) {
  await ctx.breakpoint({
    question: `质量分数${qualityScore}低于目标值${targetScore}。是否继续迭代或接受当前结果?`,
    title: '质量节点',
    context: {
      runId: ctx.runId,
      data: { qualityScore, targetScore, iteration }
    }
  });
}

Common Patterns

通用模式

Quality Convergence Loop

质量收敛循环

javascript
let quality = 0;
let iteration = 0;
const targetQuality = inputs.targetQuality || 85;
const maxIterations = inputs.maxIterations || 10;

while (quality < targetQuality && iteration < maxIterations) {
  iteration++;
  ctx.log?.('info', `Iteration ${iteration}/${maxIterations}`);

  // Execute improvement tasks
  const improvement = await ctx.task(improveTask, { iteration });

  // Score quality (parallel checks)
  const [coverage, lint, security, tests] = await ctx.parallel.all([
    () => ctx.task(coverageTask, {}),
    () => ctx.task(lintTask, {}),
    () => ctx.task(securityTask, {}),
    () => ctx.task(runTestsTask, {})
  ]);

  // Agent scores overall quality
  const score = await ctx.task(agentScoringTask, {
    coverage, lint, security, tests, iteration
  });

  quality = score.overall;
  ctx.log?.('info', `Quality: ${quality}/${targetQuality}`);

  if (quality >= targetQuality) {
    ctx.log?.('info', 'Quality target achieved!');
    break;
  }
}

return {
  success: quality >= targetQuality,
  quality,
  iterations: iteration
};
javascript
let quality = 0;
let iteration = 0;
const targetQuality = inputs.targetQuality || 85;
const maxIterations = inputs.maxIterations || 10;

while (quality < targetQuality && iteration < maxIterations) {
  iteration++;
  ctx.log?.('info', `迭代 ${iteration}/${maxIterations}`);

  // 执行优化任务
  const improvement = await ctx.task(improveTask, { iteration });

  // 并行检查质量
  const [coverage, lint, security, tests] = await ctx.parallel.all([
    () => ctx.task(coverageTask, {}),
    () => ctx.task(lintTask, {}),
    () => ctx.task(securityTask, {}),
    () => ctx.task(runTestsTask, {})
  ]);

  // 由Agent评估整体质量
  const score = await ctx.task(agentScoringTask, {
    coverage, lint, security, tests, iteration
  });

  quality = score.overall;
  ctx.log?.('info', `质量分数: ${quality}/${targetQuality}`);

  if (quality >= targetQuality) {
    ctx.log?.('info', '达成质量目标!');
    break;
  }
}

return {
  success: quality >= targetQuality,
  quality,
  iterations: iteration
};

Phased Workflow with Reviews

带审核环节的分阶段工作流

javascript
// Phase 1: Research
const research = await ctx.task(researchTask, { topic: inputs.topic });

await ctx.breakpoint({
  question: 'Review research findings before proceeding to planning.',
  title: 'Research Review',
  context: { runId: ctx.runId }
});

// Phase 2: Planning
const plan = await ctx.task(planningTask, { research });

await ctx.breakpoint({
  question: 'Review plan before implementation.',
  title: 'Plan Review',
  context: { runId: ctx.runId }
});

// Phase 3: Implementation
const implementation = await ctx.task(implementTask, { plan });

// Phase 4: Verification
const verification = await ctx.task(verifyTask, { implementation, plan });

await ctx.breakpoint({
  question: 'Final review before completion.',
  title: 'Final Approval',
  context: { runId: ctx.runId }
});

return { success: verification.passed, plan, implementation };
javascript
// 阶段1:调研
const research = await ctx.task(researchTask, { topic: inputs.topic });

await ctx.breakpoint({
  question: '审核调研结果后再进入规划阶段?',
  title: '调研结果审核',
  context: { runId: ctx.runId }
});

// 阶段2:规划
const plan = await ctx.task(planningTask, { research });

await ctx.breakpoint({
  question: '审核规划方案后再进入实现阶段?',
  title: '规划方案审核',
  context: { runId: ctx.runId }
});

// 阶段3:实现
const implementation = await ctx.task(implementTask, { plan });

// 阶段4:验证
const verification = await ctx.task(verifyTask, { implementation, plan });

await ctx.breakpoint({
  question: '完成前进行最终审核?',
  title: '最终批准',
  context: { runId: ctx.runId }
});

return { success: verification.passed, plan, implementation };

Parallel Fan-out with Aggregation

并行分发与聚合

javascript
// Fan out to multiple parallel analyses
const analyses = await ctx.parallel.map(components, component =>
  ctx.task(analyzeTask, { component }, { label: `analyze:${component.name}` })
);

// Aggregate results
const aggregated = await ctx.task(aggregateTask, { analyses });

return { analyses, summary: aggregated.summary };

javascript
// 并行执行多份分析任务
const analyses = await ctx.parallel.map(components, component =>
  ctx.task(analyzeTask, { component }, { label: `analyze:${component.name}` })
);

// 聚合结果
const aggregated = await ctx.task(aggregateTask, { analyses });

return { analyses, summary: aggregated.summary };

Testing Processes

流程测试

CLI Commands

CLI命令

bash
undefined
bash
undefined

Create a new run

创建新运行实例

babysitter run:create
--process-id methodologies/my-process
--entry ./plugins/babysitter/skills/babysit/process/methodologies/my-process.js#process
--inputs ./test-inputs.json
--json
babysitter run:create
--process-id methodologies/my-process
--entry ./plugins/babysitter/skills/babysit/process/methodologies/my-process.js#process
--inputs ./test-inputs.json
--json

Iterate the run

迭代运行实例

babysitter run:iterate .a5c/runs/<runId> --json
babysitter run:iterate .a5c/runs/<runId> --json

List pending tasks

列出待处理任务

babysitter task:list .a5c/runs/<runId> --pending --json
babysitter task:list .a5c/runs/<runId> --pending --json

Post a task result

提交任务结果

babysitter task:post .a5c/runs/<runId> <effectId>
--status ok
--value ./result.json
babysitter task:post .a5c/runs/<runId> <effectId>
--status ok
--value ./result.json

Check run status

查看运行状态

babysitter run:status .a5c/runs/<runId>
babysitter run:status .a5c/runs/<runId>

View events

查看事件日志

babysitter run:events .a5c/runs/<runId> --limit 20 --reverse
undefined
babysitter run:events .a5c/runs/<runId> --limit 20 --reverse
undefined

Sample Test Input File

测试输入文件示例

json
{
  "feature": "User authentication with JWT",
  "acceptanceCriteria": [
    "Users can register with email and password",
    "Users can login and receive a JWT token",
    "Invalid credentials are rejected"
  ],
  "testFramework": "jest",
  "targetQuality": 85,
  "maxIterations": 5
}

json
{
  "feature": "User authentication with JWT",
  "acceptanceCriteria": [
    "Users can register with email and password",
    "Users can login and receive a JWT token",
    "Invalid credentials are rejected"
  ],
  "testFramework": "jest",
  "targetQuality": 85,
  "maxIterations": 5
}

Process Builder Workflow

流程构建器工作流

1. Gather Requirements

1. 收集需求

Ask the user:
QuestionPurpose
Domain/CategoryDetermines directory location
Process Namekebab-case identifier
GoalWhat should the process accomplish?
InputsWhat data does the process need?
OutputsWhat artifacts/results does it produce?
PhasesWhat are the major steps?
Quality GatesWhere should humans review?
Iteration StrategyFixed phases vs. convergence loop?
询问用户以下问题:
问题用途
领域/分类确定目录位置
流程名称kebab-case格式的标识符
目标流程需实现的核心目标
输入流程所需的输入数据
输出流程生成的产物/结果
阶段主要执行步骤
质量节点需要人工审核的关键节点
迭代策略固定阶段还是收敛循环?

2. Research Similar Processes

2. 调研同类流程

bash
undefined
bash
undefined

Find similar processes

查找同类流程

ls plugins/babysitter/skills/babysit/process/methodologies/ ls plugins/babysitter/skills/babysit/process/specializations/
ls plugins/babysitter/skills/babysit/process/methodologies/ ls plugins/babysitter/skills/babysit/process/specializations/

Read similar process for patterns

查看同类流程的实现模式

cat plugins/babysitter/skills/babysit/process/methodologies/atdd-tdd/atdd-tdd.js | head -200
cat plugins/babysitter/skills/babysit/process/methodologies/atdd-tdd/atdd-tdd.js | head -200

Check methodology README structure

查看方法类文档结构

cat plugins/babysitter/skills/babysit/process/methodologies/atdd-tdd/README.md
undefined
cat plugins/babysitter/skills/babysit/process/methodologies/atdd-tdd/README.md
undefined

3. Check Methodologies Backlog

3. 查看方法类待办列表

bash
cat plugins/babysitter/skills/babysit/process/methodologies/backlog.md
bash
cat plugins/babysitter/skills/babysit/process/methodologies/backlog.md

4. Create the Process

4. 创建流程

For Methodologies:
  1. Create
    methodologies/[name]/README.md
    (comprehensive documentation)
  2. Create
    methodologies/[name]/[name].js
    (process implementation)
  3. Create
    methodologies/[name]/examples/
    (sample inputs)
For Specializations:
  1. If domain-specific:
    specializations/domains/[domain]/[spec]/
  2. If engineering:
    specializations/[category]/[process].js
  3. Create README.md, references.md, processes-backlog.md first
  4. Then create individual process.js files
方法类流程:
  1. 创建
    methodologies/[name]/README.md
    (完整文档)
  2. 创建
    methodologies/[name]/[name].js
    (流程实现)
  3. 创建
    methodologies/[name]/examples/
    (示例输入)
细分领域流程:
  1. 领域特定流程:
    specializations/domains/[domain]/[spec]/
  2. 工程类流程:
    specializations/[category]/[process].js
  3. 先创建README.md、references.md、processes-backlog.md
  4. 再创建单个process.js文件

5. Validate Structure

5. 验证结构

Checklist:
  • JSDoc header with @process, @description, @inputs, @outputs, @example, @references
  • Import from
    @a5c-ai/babysitter-sdk
  • Main
    export async function process(inputs, ctx)
  • Input destructuring with defaults
  • Clear phase comments (
    // === PHASE N: NAME ===
    )
  • Logging via
    ctx.log?.('info', message)
  • Tasks via
    ctx.task(taskDef, inputs)
  • Breakpoints at key decision points
  • Artifact collection throughout
  • Return object matches @outputs schema

检查清单:
  • 包含@process、@description、@inputs、@outputs、@example、@references的JSDoc头部
  • @a5c-ai/babysitter-sdk
    导入依赖
  • 主函数
    export async function process(inputs, ctx)
  • 带默认值的输入解构
  • 清晰的阶段注释(
    // === 阶段N: 名称 ===
  • 通过
    ctx.log?.('info', message)
    记录日志
  • 通过
    ctx.task(taskDef, inputs)
    调用任务
  • 在关键决策点设置断点
  • 全程收集产物
  • 返回对象与@outputs schema匹配

Examples by Type

按类型分类的示例

Methodology Process (atdd-tdd style)

方法类流程(atdd-tdd风格)

javascript
/**
 * @process methodologies/my-methodology
 * @description My development methodology with quality convergence
 * @inputs { feature: string, targetQuality?: number }
 * @outputs { success: boolean, quality: number, artifacts: array }
 */
export async function process(inputs, ctx) {
  const { feature, targetQuality = 85 } = inputs;
  // ... implementation
}
javascript
/**
 * @process methodologies/my-methodology
 * @description 带质量收敛的自定义开发方法
 * @inputs { feature: string, targetQuality?: number }
 * @outputs { success: boolean, quality: number, artifacts: array }
 */
export async function process(inputs, ctx) {
  const { feature, targetQuality = 85 } = inputs;
  // ... 实现代码
}

Specialization Process (game-development style)

细分领域流程(游戏开发风格)

javascript
/**
 * @process specializations/game-development/core-mechanics-prototyping
 * @description Prototype and validate core gameplay mechanics through iteration
 * @inputs { prototypeName: string, mechanicsToTest: array, engine?: string }
 * @outputs { success: boolean, mechanicsValidated: array, playtestResults: object }
 */
export async function process(inputs, ctx) {
  const { prototypeName, mechanicsToTest, engine = 'Unity' } = inputs;
  // ... implementation
}
javascript
/**
 * @process specializations/game-development/core-mechanics-prototyping
 * @description 通过迭代实现并验证核心游戏机制原型
 * @inputs { prototypeName: string, mechanicsToTest: array, engine?: string }
 * @outputs { success: boolean, mechanicsValidated: array, playtestResults: object }
 */
export async function process(inputs, ctx) {
  const { prototypeName, mechanicsToTest, engine = 'Unity' } = inputs;
  // ... 实现代码
}

Domain Process (science/research style)

领域流程(科学/研究风格)

javascript
/**
 * @process specializations/domains/science/bioinformatics/sequence-analysis
 * @description Analyze genomic sequences using standard bioinformatics workflows
 * @inputs { sequences: array, analysisType: string, referenceGenome?: string }
 * @outputs { success: boolean, alignments: array, variants: array, report: object }
 */
export async function process(inputs, ctx) {
  const { sequences, analysisType, referenceGenome = 'GRCh38' } = inputs;
  // ... implementation
}

javascript
/**
 * @process specializations/domains/science/bioinformatics/sequence-analysis
 * @description 使用标准生物信息学工作流分析基因组序列
 * @inputs { sequences: array, analysisType: string, referenceGenome?: string }
 * @outputs { success: boolean, alignments: array, variants: array, report: object }
 */
export async function process(inputs, ctx) {
  const { sequences, analysisType, referenceGenome = 'GRCh38' } = inputs;
  // ... 实现代码
}

Resources

参考资源

  • SDK Reference:
    plugins/babysitter/skills/babysit/reference/sdk.md
  • Methodology Backlog:
    plugins/babysitter/skills/babysit/process/methodologies/backlog.md
  • Specializations Backlog:
    plugins/babysitter/skills/babysit/process/specializations/backlog.md
  • Example: ATDD/TDD:
    plugins/babysitter/skills/babysit/process/methodologies/atdd-tdd/
  • Example: Spec-Driven:
    plugins/babysitter/skills/babysit/process/methodologies/spec-driven-development.js
  • README: Root
    README.md
    for full framework documentation
  • SDK参考文档:
    plugins/babysitter/skills/babysit/reference/sdk.md
  • 方法类待办列表:
    plugins/babysitter/skills/babysit/process/methodologies/backlog.md
  • 细分领域待办列表:
    plugins/babysitter/skills/babysit/process/specializations/backlog.md
  • 示例:ATDD/TDD:
    plugins/babysitter/skills/babysit/process/methodologies/atdd-tdd/
  • 示例:规范驱动开发:
    plugins/babysitter/skills/babysit/process/methodologies/spec-driven-development.js
  • 主文档: 根目录
    README.md
    (完整框架文档)