code-execution

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Code Execution

代码执行

Overview

概述

Execute coding subtasks with self-review and quality validation. Runs in isolated coder-agent context with pre-loaded standards.
Announce at start: "I'm using the code-execution skill to implement [subtask title]."
执行带有自我审查和质量验证的编码子任务。在预加载标准的独立coder-agent环境中运行。
开始时需声明: "我正在使用code-execution技能来实现[子任务标题]。"

The Process

流程

Step 1: Read Subtask JSON

步骤1:读取子任务JSON

Load the subtask file specified in $ARGUMENTS:
bash
Read: .tmp/tasks/{feature}/subtask_{seq}.json
Extract:
  • title
    — What to implement
  • acceptance_criteria
    — What defines success
  • deliverables
    — Files/endpoints to create
  • context_files
    — Standards to apply
  • reference_files
    — Existing code to study
加载$ARGUMENTS中指定的子任务文件:
bash
Read: .tmp/tasks/{feature}/subtask_{seq}.json
提取以下内容:
  • title
    — 需实现的内容
  • acceptance_criteria
    — 成功的定义
  • deliverables
    — 需创建的文件/端点
  • context_files
    — 需应用的标准
  • reference_files
    — 需参考的现有代码

Step 2: Load Context Files

步骤2:加载上下文文件

Read each file in
context_files
:
bash
Read: .opencode/context/core/standards/code-quality.md
Read: .opencode/context/core/standards/security-patterns.md
Understand:
  • Project coding standards
  • Naming conventions
  • Security patterns
  • Code quality requirements
读取
context_files
中的每个文件:
bash
Read: .opencode/context/core/standards/code-quality.md
Read: .opencode/context/core/standards/security-patterns.md
理解以下内容:
  • 项目编码标准
  • 命名规范
  • 安全模式
  • 代码质量要求

Step 3: Load Reference Files

步骤3:加载参考文件

Read each file in
reference_files
:
bash
Read: src/middleware/auth.middleware.ts
Study:
  • Existing patterns
  • Code structure
  • Conventions in use
读取
reference_files
中的每个文件:
bash
Read: src/middleware/auth.middleware.ts
研究以下内容:
  • 现有模式
  • 代码结构
  • 当前使用的规范

Step 4: Update Status to In Progress

步骤4:将状态更新为进行中

Edit subtask JSON:
json
"status": "in_progress",
"agent_id": "coder-agent",
"started_at": "2026-02-16T00:00:00Z"
编辑子任务JSON:
json
"status": "in_progress",
"agent_id": "coder-agent",
"started_at": "2026-02-16T00:00:00Z"

Step 5: Implement Deliverables

步骤5:实现交付物

For each deliverable:
  • Create or modify the specified file
  • Follow acceptance criteria EXACTLY
  • Apply standards from context_files
  • Use patterns from reference_files
  • Write clean, modular, functional code
针对每个交付物:
  • 创建或修改指定文件
  • 严格遵循验收标准
  • 应用context_files中的标准
  • 使用reference_files中的模式
  • 编写简洁、模块化、功能完善的代码

Step 6: Run Self-Review (MANDATORY)

步骤6:执行自我审查(必填)

Type & Import Validation:
  • ✅ Function signatures match usage
  • ✅ All imports/exports exist
  • ✅ No missing type annotations
  • ✅ No circular dependencies
Anti-Pattern Scan:
bash
grep "console.log" deliverables  # NO debug statements
grep "TODO\|FIXME" deliverables  # NO unfinished work
grep "api[_-]key\|secret" deliverables  # NO hardcoded secrets
Acceptance Criteria Check:
  • Re-read
    acceptance_criteria
    array
  • Confirm EACH criterion met
  • Fix unmet criteria before proceeding
类型与导入验证:
  • ✅ 函数签名与使用场景匹配
  • ✅ 所有导入/导出均存在
  • ✅ 无缺失的类型注解
  • ✅ 无循环依赖
反模式扫描:
bash
grep "console.log" deliverables  # 禁止调试语句
grep "TODO\|FIXME" deliverables  # 禁止未完成工作
grep "api[_-]key\|secret" deliverables  # 禁止硬编码密钥
验收标准检查:
  • 重新阅读
    acceptance_criteria
    数组
  • 确认每个标准均已满足
  • 在继续之前修复未满足的标准

Step 7: Mark Complete

步骤7:标记完成

Update subtask status:
bash
bash .opencode/skills/task-management/router.sh complete {feature} {seq} "{summary}"
Verify:
bash
bash .opencode/skills/task-management/router.sh status {feature}
更新子任务状态:
bash
bash .opencode/skills/task-management/router.sh complete {feature} {seq} "{summary}"
验证状态:
bash
bash .opencode/skills/task-management/router.sh status {feature}

Step 8: Return Report

步骤8:返回报告

✅ Subtask {feature}-{seq} COMPLETED

Self-Review: ✅ Types | ✅ Imports | ✅ No debug code | ✅ Criteria met

Deliverables:
- src/auth/jwt.service.ts
- src/auth/jwt.service.test.ts

Summary: JWT service with RS256 signing and 15min token expiry
✅ 子任务 {feature}-{seq} 已完成

自我审查:✅ 类型检查 | ✅ 导入检查 | ✅ 无调试代码 | ✅ 满足所有标准

交付物:
- src/auth/jwt.service.ts
- src/auth/jwt.service.test.ts

摘要:支持RS256签名、令牌有效期15分钟的JWT服务

Error Handling

错误处理

Missing subtask JSON:
  • Main agent must create subtask before invoking this skill
Context files not found:
  • Main agent must run
    /context-discovery
    first
Acceptance criteria unmet:
  • DO NOT mark complete—fix issues first
缺失子任务JSON:
  • 主Agent必须先创建子任务,再调用此技能
上下文文件未找到:
  • 主Agent必须先运行
    /context-discovery
验收标准未满足:
  • 禁止标记完成——先修复问题

Red Flags

警示信号

If you think any of these, STOP and re-read this skill:
  • "I know the pattern, I don't need to read the context files"
  • "I'll do the self-review quickly at the end"
  • "The acceptance criteria are obvious, I don't need to check them"
  • "I'll mark it done and fix the edge cases later"
如果出现以下想法,请停止操作并重新阅读本技能说明:
  • "我了解这个模式,不需要读上下文文件"
  • "我会在最后快速完成自我审查"
  • "验收标准很明显,我不需要检查"
  • "我先标记完成,之后再修复边缘情况"

Common Rationalizations

常见合理化借口

ExcuseReality
"I've seen this pattern before, context files will just confirm what I know"Projects diverge from common patterns. One wrong assumption = rework. Read the files.
"Self-review is just checking my own work"Self-review catches type errors, missing imports, and debug code before the main agent sees it.
"The criteria are implied by the task title"Implied criteria are unverifiable. If it's not written, it's not a gate.
"I'll handle edge cases in a follow-up"Edge cases left for follow-up become bugs in production. Handle them now.
借口实际情况
"我之前见过这个模式,上下文文件只会验证我已知的内容"项目会与通用模式产生差异。一个错误的假设就会导致返工。请务必阅读文件。
"自我审查只是检查自己的工作"自我审查能在主Agent看到代码前捕获类型错误、缺失导入和调试代码。
"标准已隐含在任务标题中"隐含的标准无法验证。未书面明确的内容不能作为验收门槛。
"我会在后续处理边缘情况"留到后续处理的边缘情况会变成生产环境中的Bug。现在就处理它们。

Remember

注意事项

  • Context FIRST, code SECOND—always read context_files before implementing
  • One subtask at a time—complete fully before moving on
  • Self-review is MANDATORY—quality gate before marking done
  • Functional, declarative, modular—clean code patterns only
  • Return results to main agent—report completion for orchestration
  • 先上下文,后代码——实施前务必阅读context_files
  • 一次处理一个子任务——完全完成后再进行下一个
  • 自我审查是必填项——标记完成前的质量关卡
  • 仅使用功能完善、声明式、模块化的简洁代码模式
  • 向主Agent返回结果——报告完成状态以进行编排

Related

相关技能

  • context-discovery
  • task-breakdown
  • test-generation
  • code-review

Task: Execute coding subtask: $ARGUMENTS
  • context-discovery
  • task-breakdown
  • test-generation
  • code-review

任务:执行编码子任务:$ARGUMENTS