ns-code-coder

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Code Coder

Code Coder

Central execution worker for ad-hoc diffs (and
C2
under
ns-code-autonomous
). Not front door — host picks entry per
../ns-harness/references/code-skill-routing.md
.
用于临时代码差异(以及
ns-code-autonomous
下的
C2
模式)的核心执行工作者非入口技能——宿主需根据
../ns-harness/references/code-skill-routing.md
选择入口技能。

Workflow mode (mandatory)

工作流模式(强制要求)

Fixed workflow, not loose checklist. Steps in order; handoffs = named skills or harness bridges (
coder-agent
/
reviewer-agent
per
../ns-harness/references/subagent-dispatch.md
). No platform Task personas or improvised review.
Canonical review gate:
../ns-harness/references/review-gate-workflow.md
— steps 7–9 ad-hoc / C2 only. Review only via
reviewer-agent
then
ns-code-reviewer
(MUST bridge when available; else skill direct); max 3 rounds; Critical fix requires re-review mandatory; no success without pass or blocked. After Approved: Living specs (8) if match, then Final report (9).
Exception — SDD handoff mode: caller
run-implementation
/
execution-handoff.md
(or dispatch says SDD task mode): skip review gate + living specs. Parent owns review at version closure. See When invoked under execution-handoff.
固定工作流,非松散检查清单。步骤按顺序执行;交接对象为指定技能或 harness 桥接器(
coder-agent
/
reviewer-agent
,详见
../ns-harness/references/subagent-dispatch.md
)。禁止使用平台任务角色或临时评审流程。
标准评审关卡:
../ns-harness/references/review-gate-workflow.md
——仅步骤7–9适用于临时任务 / C2模式。评审必须通过
reviewer-agent
再转
ns-code-reviewer
优先使用桥接器;无桥接器时直接调用技能);最多3轮评审;关键修复需强制重新评审;未通过评审或处于阻塞状态则任务未完成。评审通过后:若符合条件则执行活规格更新(步骤8),然后提交最终报告(步骤9)。
例外——SDD交接模式:调用者为
run-implementation
/
execution-handoff.md
(或调度指令指定SDD任务模式):跳过评审关卡 + 活规格更新。父代理在版本收尾时负责评审。详见在执行交接场景下被调用时

Routing (read first)

路由规则(必读)

SignalRedirect
GitLab
ISSUE_URL
detected
Stop
ns-execution-gitlab-issue
Multi-day / version / SDD scope
ns-spec-driven
Obscure bug, root cause unclear
ns-code-investigator
Ad-hoc diff ready
reviewer-agent
then
ns-code-reviewer
(review loop below)
Entry priority 5 (default). Harness table:
../ns-harness/references/code-skill-routing.md
. Trigger phrases:
references/entry-triggers.md
.
信号重定向目标
检测到GitLab
ISSUE_URL
终止——使用
ns-execution-gitlab-issue
多日/版本/SDD范围任务
ns-spec-driven
问题模糊、根因不明
ns-code-investigator
临时代码差异已就绪
reviewer-agent
再转
ns-code-reviewer
(详见下方评审循环)
入口优先级5(默认)。Harness路由表:
../ns-harness/references/code-skill-routing.md
。触发短语:
references/entry-triggers.md

When to use (entry)

适用场景(入口调用)

  • Bug fixes / hotfixes outside planned version
  • Isolated component, hook, service, or utility
  • Small refactors (≤ 1 file or tight group)
  • Scripts, migrations, seeds outside version lifecycle
  • "Just implement this" without
    execution-handoff.md
  • 计划版本外的bug修复/热修复
  • 独立组件、Hook、服务或工具类
  • 小型重构(≤1个文件或紧密关联的文件组)
  • 版本生命周期外的脚本、迁移、种子数据任务
  • execution-handoff.md
    的“直接实现此需求”任务

When invoked as C2 (engine mode)

作为C2模式调用(引擎模式)

ns-code-autonomous
dispatches as work-unit subagent in existing worktree: unit scope only. Do not re-route to
ns-execution-gitlab-issue
on
ISSUE_URL
in code/comments — context, not routing. Escalate destructive doubts to caller (
A
), not GitLab skills. No living-spec consolidator as C2 — version closure/caller owns. Complete ad-hoc Review loop unless caller says SDD handoff / defer review.
ns-code-autonomous
将其作为工作单元子代理派发到现有工作目录:仅处理单元级范围任务。代码/注释中存在
ISSUE_URL
时,请勿重定向
ns-execution-gitlab-issue
——需结合上下文判断,而非按路由规则处理。若对破坏性操作存疑,需向调用者(
A
)升级反馈,而非调用GitLab相关技能。作为C2子代理时无需执行活规格合并——版本收尾由父代理负责。除非调用者指定SDD交接/延迟评审,否则需完成临时任务评审循环

When invoked under execution-handoff (SDD task mode)

在执行交接场景下被调用时(SDD任务模式)

Parent
run-implementation
(classic SDD) or dispatch SDD handoff / execution-handoff task:
  1. Task scope:
    ../ns-sdd-execution-handoff-generator/references/run-implementation.md
    ; handoff updates:
    ../ns-sdd-execution-handoff-generator/SKILL.md
    .
  2. Implement + unit/integration only. No E2E.
  3. Forbidden:
    reviewer-agent
    /
    ns-code-reviewer
    , living-spec consolidator,
    Code Review:
    verdict line.
  4. Report to parent: files changed, tests run, blockers. Parent Step 5 review once all tasks done.
  5. Session boot: cold start this agent = full boot; same agent continuing = no full re-read unless
    AGENTS.md
    /
    agents.local.md
    / harness rules changed.
父代理为
run-implementation
(经典SDD)或调度指令为SDD交接 / execution-handoff任务
  1. 任务范围:
    ../ns-sdd-execution-handoff-generator/references/run-implementation.md
    ;交接更新规则:
    ../ns-sdd-execution-handoff-generator/SKILL.md
  2. 仅实现功能 + 单元/集成测试。禁止执行E2E测试。
  3. 禁止:调用
    reviewer-agent
    /
    ns-code-reviewer
    、活规格合并工具、添加
    Code Review:
    verdict行。
  4. 向父代理报告:变更文件列表、已执行测试、阻塞问题。父代理在所有任务完成后执行步骤5评审。
  5. 会话启动:冷启动此代理需完整启动流程;同一代理持续执行时,除非
    AGENTS.md
    /
    agents.local.md
    / harness规则变更,否则无需重新读取全部规则。

Harness discovery

Harness发现流程

See
../ns-harness/references/harness-discovery.md
. Complete Session boot (blocking) before any other step — cold start only; mid-session skip if already booted and files unchanged.
详见
../ns-harness/references/harness-discovery.md
在执行任何其他步骤前,必须完成会话启动(阻塞式)——仅冷启动时需执行;会话中若已完成启动且文件未变更则跳过。

Session inputs

会话输入

VariableRequired
{product_root}
Yes (or infer if single obvious product)
{task_description}
Yes
{target_layer}
Infer when possible: frontend, backend, infra, tests, fullstack
变量是否必填
{product_root}
是(若仅有一个明确产品可自动推断)
{task_description}
{target_layer}
尽可能自动推断:frontend、backend、infra、tests、fullstack

Scope isolation

范围隔离

Only
{product_root}/**
+ harness docs. No other monorepo products unless asked.
仅访问
{product_root}/**
+ harness文档。除非明确要求,否则不得访问其他单仓产品。

Boot (mandatory)

启动流程(强制要求)

Session boot (
../ns-harness/references/harness-discovery.md
) — one rule for ad-hoc, C2, SDD handoff:
Agent stateAction
Cold start (this agent/subagent just started)Full Session boot (steps 1–7). Bridge may have done harness 1–4 (AGENTS through project-rules) — finish 5–7
Same agent continuing; steps 1–7 done; files unchangedDo not full re-read
AGENTS.md
/ rule corpus
AGENTS.md
,
agents.local.md
, or harness rules changed since last boot
Re-boot
Then:
  1. Obey
    AGENTS.md
    orders — no invented paths or cross-product changes
  2. git status
    and
    git diff
  3. Read target files before writing
Success:
AGENTS.md
orders + project rules + task scope. Invented paths, SDD artifacts (except handoff updates when parent owns them), or cross-product changes = failure.
会话启动
../ns-harness/references/harness-discovery.md
)——临时任务、C2模式、SDD交接场景均遵循同一规则:
代理状态操作
冷启动(此代理/子代理刚启动)完整会话启动(步骤1–7)。桥接器可能已完成harness步骤1–4(从AGENTS到project-rules)——需完成剩余步骤5–7
同一代理持续执行;步骤1–7已完成;文件未变更请勿重新读取
AGENTS.md
/ 规则全集
自上次启动后
AGENTS.md
agents.local.md
或harness规则已变更
重新启动
然后:
  1. 遵守
    AGENTS.md
    中的指令——不得自行创建路径或跨产品变更
  2. 执行
    git status
    git diff
  3. 编写前先读取目标文件
成功标准:遵循
AGENTS.md
指令 + 项目规则 + 任务范围。自行创建路径、生成SDD版本 artifacts(父代理负责的交接更新除外)或跨产品变更均视为失败。

Implementation rules

实现规则

  • Diff-first — only required lines; no unrelated formatting
  • Prefer editing existing files over new files
  • Large change gate: >1 file simultaneously, >20 lines in one file, or public contract change: one-line plan, wait for approval
  • No commits unless human explicitly asks — when committing, see
    ../ns-harness/references/agent-git-identity.md
  • No SDD version artifacts — no
    task-NNN.md
    ,
    requirements.md
    ,
    execution-handoff.md
    , or
    docs/versions/
    writes. Conditional living-spec updates under
    docs/specs/
    via
    ns-sdd-living-spec-consolidator
    allowed (see Living specs).
  • No gratuitous comments unless requested
  • Tests per
    AGENTS.md
    Docker + testing; container/commands in
    architecture-rules.md
  • Under
    execution-handoff.md
    /
    run-implementation
    : unit/integration only — no E2E (human at version end); no review gate (parent Step 5)
  • 优先生成差异——仅变更必要代码行;禁止无关格式调整
  • 优先编辑现有文件,而非创建新文件
  • 大变更关卡:同时修改>1个文件、单个文件变更>20行或修改公共契约:需提交一行计划,等待批准
  • 禁止提交代码,除非人类明确要求——提交时需遵循
    ../ns-harness/references/agent-git-identity.md
  • 禁止生成SDD版本 artifacts——不得创建
    task-NNN.md
    requirements.md
    execution-handoff.md
    或向
    docs/versions/
    写入内容。符合条件时可通过
    ns-sdd-living-spec-consolidator
    docs/specs/
    更新活规格(详见活规格更新)。
  • 禁止无意义注释,除非明确要求
  • 根据
    AGENTS.md
    中的Docker + 测试规则执行测试;容器/命令规则详见
    architecture-rules.md
  • execution-handoff.md
    /
    run-implementation
    场景下:仅执行单元/集成测试——禁止E2E测试(由人类在版本收尾时执行);跳过评审关卡(父代理负责步骤5评审)

Per-task cycle

单任务循环

SDD handoff mode: stop after step 6; report to parent; skip 7–9.
  1. Understand task
  2. Load rules — obey
    AGENTS.md
    already booted; Session boot again only if cold start this agent or files changed
  3. Explore (grep/head large fixtures — no full test dumps)
  4. Identify minimal diff
  5. Apply (or plan if large-change gate)
  6. Run tests if in scope (see Pre-review)
  7. Review loopMUST
    reviewer-agent
    when available (else
    ns-code-reviewer
    );
    ../ns-harness/references/review-gate-workflow.md
  8. Living specs (conditional) — see below
  9. Final report — mandatory fields; never skip verdict or round count
SDD交接模式:完成步骤6后停止;向父代理报告;跳过步骤7–9。
  1. 理解任务需求
  2. 加载规则——若已启动则遵守
    AGENTS.md
    指令;仅冷启动此代理或文件变更时需重新执行会话启动
  3. 探索代码(对大型 fixture 使用grep/head——禁止完整导出测试内容)
  4. 确定最小变更范围
  5. 应用变更(或触发大变更关卡时提交计划)
  6. 若在任务范围内则执行测试(详见评审前准备
  7. 评审循环——必须在可用时调用
    reviewer-agent
    (否则调用
    ns-code-reviewer
    );遵循
    ../ns-harness/references/review-gate-workflow.md
  8. 活规格更新(条件触发)——详见下方
  9. 最终报告——必填字段;不得跳过 verdict 或评审轮次统计

Pre-review (before step 7)

评审前准备(步骤7前)

  • Tests covering changed files per
    AGENTS.md
    and
    ../ns-harness/references/docker-and-testing.md
    .
  • Diff removes exports/constants/env flags/public symbols: search remaining call sites; resolve before review.
  • 根据
    AGENTS.md
    ../ns-harness/references/docker-and-testing.md
    执行覆盖变更文件的测试。
  • 若差异移除了导出/常量/环境变量/公共符号:搜索剩余调用位置;在评审前解决问题。

Review loop (mandatory ad-hoc / C2; skip SDD handoff)

评审循环(临时任务/C2模式强制执行;SDD交接模式跳过)

After step 6, run
../ns-harness/references/review-gate-workflow.md
before done — except SDD handoff (return to parent; no review).
  • MUST invoke
    reviewer-agent
    when available (else
    ns-code-reviewer
    ) on working-tree diff (
    git diff
    ) — reviewer bridge/skill begins Session boot at cold start then reviewer workflow; no
    ISSUE_URL
    , no version-closure path. Ad-hoc diff only.
  • Max 3 rounds. Score gate from
    ns-code-reviewer
    : pass ≥9/10, ideal 10/10.
    • Pass: zero Critical Issues and overall score ≥ 9/10: proceed step 8.
    • Fail (Criticals or score ≤ 8) with rounds left: apply minimal diff that clears Criticals and lifts quality to ≥9 (
      reviewer-agent
      /
      ns-code-reviewer
      read-only — this skill applies fixes), re-run tests if in scope, then mandatory re-review via
      reviewer-agent
      (MUST when available; else
      ns-code-reviewer
      ).
    • Rounds exhausted still failing gate: stop, report blocked. List unresolved Criticals and/or last score. No success. Skip step 8 (living specs).
  • Fixes within original task scope. Critical (or score-blocking Warning) needs changes outside scope (public contract, cross-product, multi-day): stop, escalate per Stop conditions.
  • Suggestions (P2) alone do not block when score already ≥9: carry into final report as follow-ups.
完成步骤6后,在任务结束前需执行
../ns-harness/references/review-gate-workflow.md
——SDD交接模式除外(返回父代理;无需评审)。
  • 必须在可用时调用**
    reviewer-agent
    (否则调用
    ns-code-reviewer
    **)对工作目录差异(
    git diff
    )进行评审——评审桥接器/技能在冷启动时先执行会话启动,再进入评审工作流;不得使用
    ISSUE_URL
    ,不得走版本收尾路径。仅处理临时代码差异。
  • 最多3轮评审。
    ns-code-reviewer
    的评分关卡:通过≥9/10,理想为10/10。
    • 通过:无关键问题 总分≥9/10:进入步骤8。
    • 失败(存在关键问题 总分≤8/10)且仍有剩余轮次:应用最小差异修复关键问题并将质量提升至≥9/10(
      reviewer-agent
      /
      ns-code-reviewer
      仅读取——此技能负责修复),若在范围内则重新执行测试,然后必须通过
      reviewer-agent
      (可用时优先)重新评审(否则调用
      ns-code-reviewer
      )。
    • 轮次耗尽仍未通过关卡:停止任务,报告阻塞状态。列出未解决的关键问题和/或最终评分。任务未成功。跳过步骤8(活规格更新)。
  • 修复需在原任务范围内。关键问题(或影响评分的警告)需要超出范围的变更(公共契约、跨产品、多日任务):停止任务,根据终止条件升级反馈。
  • 仅存在建议(P2)且总分已≥9/10时,不阻塞任务:将建议作为后续事项纳入最终报告。

Living specs (step 8, conditional)

活规格更新(步骤8,条件触发)

Only after
Code Review: Approved
(not as C2). Invoke
ns-sdd-living-spec-consolidator
in ad-hoc mode when all true:
  1. {product_root}/docs/specs/
    exists
  2. Diff behavioral (API, schema, UX, or domain behavior) — skip cosmetic / rename-only / pure refactor
  3. Skill available (installed via
    depends
    )
Pass: mode
ad-hoc
,
{task_description}
, approved
git diff
. Read consolidator
SKILL.md
, follow it. No invent
{version_san}
or write under
docs/versions/
.
Skip (note reason in final report) when any condition fails, review not Approved, or consolidator reports skipped.
仅在
Code Review: Approved
后执行(C2模式除外)。当所有以下条件满足时,以临时任务模式调用**
ns-sdd-living-spec-consolidator
**:
  1. {product_root}/docs/specs/
    存在
  2. 差异为行为性变更(API、 schema、UX或领域行为)——跳过 cosmetic/重命名/纯重构变更
  3. 该技能可用(已通过
    depends
    安装)
传入参数:模式
ad-hoc
{task_description}
、已通过评审的
git diff
。阅读合并工具的
SKILL.md
并遵循其规则。不得自行生成
{version_san}
或向
docs/versions/
写入内容。
跳过(在最终报告中注明原因)的情况:任一条件不满足、评审未通过、或合并工具报告跳过。

Final report (step 9)

最终报告(步骤9)

No success language until gate passes or blocked (
review-gate-workflow.md
). SDD handoff: report implement status to parent; no
Code Review:
line — version closure owns verdict.
Every ad-hoc / C2 closure response must include:
FieldValue
Active skill
ns-code-coder
Reviewer skill
ns-code-reviewer
(via
reviewer-agent
when dispatched)
Review roundLast round executed:
1
,
2
, or
3
ScoreLast overall score from reviewer
VerdictExact line:
Code Review: {Approved|Rejected|Blocked}
Living specs
updated
|
skipped: {reason}
|
n/a
(blocked/rejected)
Then: what changed, follow-ups, blocked Criticals if applicable.
在关卡通过或处于阻塞状态前,不得使用成功类表述(遵循
review-gate-workflow.md
)。SDD交接模式:向父代理报告实现状态;不得添加
Code Review:
行——版本收尾时由父代理给出 verdict。
所有临时任务/C2模式的收尾响应必须包含以下字段:
字段
当前技能
ns-code-coder
评审技能
ns-code-reviewer
(通过
reviewer-agent
调度时需注明)
评审轮次最后执行的轮次:
1
2
3
评分评审给出的最终总分
Verdict固定格式行:
Code Review: {Approved|Rejected|Blocked}
活规格更新
updated
|
skipped: {reason}
|
n/a
(阻塞/未通过评审)
然后说明:变更内容、后续事项、阻塞状态下的未解决关键问题(若有)。

Stop conditions

终止条件

ConditionAction
{product_root}
unclear with multiple products
Ask once
Large change gatePlan + wait
Public contract or cross-product boundaryStop, explain, ask
Task needs multi-day SDD planningRedirect to
ns-spec-driven
条件操作
{product_root}
不明确且存在多个产品
询问一次
触发大变更关卡提交计划 + 等待批准
涉及公共契约或跨产品边界停止任务,说明原因,请求指示
任务需要多日SDD规划重定向到
ns-spec-driven

Related skills

相关技能

  • ns-code-reviewer
    — mandatory review loop after implementation (Review loop)
  • ns-sdd-living-spec-consolidator
    — conditional ad-hoc living-spec update after Approved (Living specs)
  • ns-code-investigator
    — blocked by unclear bug
  • ns-code-autonomous
    — autonomous multi-agent execution (GitLab issue or local plan); GitLab issue use
    ns-execution-gitlab-issue
    instead
  • ns-code-reviewer
    ——实现完成后的强制评审循环(评审循环
  • ns-sdd-living-spec-consolidator
    ——评审通过后的条件性临时活规格更新(活规格更新
  • ns-code-investigator
    ——问题模糊时的重定向目标
  • ns-code-autonomous
    ——自主多代理执行(GitLab issue或本地计划);GitLab issue场景应使用
    ns-execution-gitlab-issue
    替代

Forbidden

禁止操作

  • SDD version artifact generation (
    docs/versions/
    , handoff, requirements/tasks)
  • Living-spec consolidator before
    Code Review: Approved
    , or when
    {specs_root}/
    missing
  • Cross-product access without scope
  • Commits without explicit request
  • Refactors outside task scope
  • Review substitutes — Cursor Task subagents (
    senior-tech-lead-reviewer
    ,
    bugbot
    ,
    security-review
    ) or any review not via
    reviewer-agent
    /
    ns-code-reviewer
    SKILL.md
    . Harness
    reviewer-agent
    allowed.
  • Skipping re-review — success after fix when previous
    ns-code-reviewer
    verdict was
    Rejected
    or score < 9 without new passing round (ad-hoc / C2)
  • Success without verdict — ad-hoc / C2 closure without mandatory Final report fields and parseable
    Code Review:
    line
  • Per-task review under handoff
    reviewer-agent
    /
    ns-code-reviewer
    during
    run-implementation
    task (parent owns Step 5)
  • 生成SDD 版本 artifacts(
    docs/versions/
    、交接文档、需求/任务文档)
  • Code Review: Approved
    前调用活规格合并工具,或
    {specs_root}/
    不存在时调用
  • 无范围授权时跨产品访问
  • 无明确请求时提交代码
  • 超出任务范围的重构
  • 替代评审流程——使用Cursor Task子代理(
    senior-tech-lead-reviewer
    bugbot
    security-review
    )或任何未通过
    reviewer-agent
    /
    ns-code-reviewer
    SKILL.md
    的评审流程。允许使用Harness
    reviewer-agent
  • 跳过重新评审——修复后未通过新的评审轮次(临时任务/C2模式),但之前
    ns-code-reviewer
    的verdict为
    Rejected
    或评分<9时,不得标记任务成功
  • 无verdict时标记成功——临时任务/C2模式收尾时,缺少必填的最终报告字段和可解析的
    Code Review:
  • 交接场景下的单任务评审——在
    run-implementation
    任务中调用
    reviewer-agent
    /
    ns-code-reviewer
    (父代理负责步骤5评审)