ns-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-autonomous
). Not front door — host picks entry per
../../ns-harness/references/code-skill-routing.md
.
作为处理临时代码差异的核心执行工作者(在
ns-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-reviewer/references/review-gate-workflow.md
— steps 7–9 ad-hoc / C2 only. Review only via
reviewer-agent
then
ns-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 桥接器(依据
../../ns-harness/references/subagent-dispatch.md
使用
coder-agent
/
reviewer-agent
)。不得使用平台任务角色或临时评审流程。
标准评审关卡:
../ns-reviewer/references/review-gate-workflow.md
——仅步骤7–9适用于临时任务 / C2模式。评审必须通过
reviewer-agent
再交由
ns-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-investigator
Ad-hoc diff ready
reviewer-agent
then
ns-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
模糊bug、根因不明
ns-investigator
临时代码差异已准备就绪先调用
reviewer-agent
再交由
ns-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修复/热修复
  • 独立的组件、钩子、服务或工具类
  • 小型重构(≤1个文件或紧密关联的文件组)
  • 版本生命周期外的脚本、迁移、种子数据
  • execution-handoff.md
    的“直接实现这个需求”场景

When invoked as C2 (engine mode)

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

ns-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-autonomous
将其作为工作单元子Agent调度至现有工作树:仅处理单元范围的任务。若代码/注释中存在
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:
  1. Scope: classic = one batch (same-layer consecutive
    pending
    , prefer 4–7, hard max 7; size 1 = single task) per
    references/run-implementation.md
    . Partitioned slice = that slice's tasks. Parent owns handoff file updates.
  2. Read each task card (header through Validation criteria); open
    Detailed description
    on demand (ambiguity or
    blocked
    ) —
    ../ns-spec-driven/references/task-schema.md
    .
  3. Implement + unit/integration only. No E2E.
  4. Forbidden:
    reviewer-agent
    /
    ns-reviewer
    , living-spec consolidator,
    Code Review:
    verdict line.
  5. Report to parent per task: files changed, tests run, blockers, tokens (split or
    ~N
    ). Parent marks rows and runs Step 5 review once all tasks done.
  6. Session boot: cold start this agent = full boot per
    session-boot.md
    ; same agent continuing = no full re-read unless
    agents.local.md
    / harness rules changed.
父级调用
run-implementation
(经典SDD)或调度指示为SDD交接 / execution-handoff
  1. 范围:经典模式 = 一个批次(同层连续的
    pending
    任务,建议4–7个,硬上限7个;数量1则为单个任务),依据
    references/run-implementation.md
    。分片任务 = 对应分片的任务。父级负责更新交接文件。
  2. 阅读每个任务卡片(从标题到验证标准);若存在歧义或处于
    blocked
    状态,按需查看
    Detailed description
    ——参考
    ../ns-spec-driven/references/task-schema.md
  3. 仅实现 + 单元/集成测试。无需E2E测试。
  4. **禁止:**调用
    reviewer-agent
    /
    ns-reviewer
    、活规格整合器、添加
    Code Review:
    verdict行。
  5. 按任务向父级汇报:修改的文件、运行的测试、阻塞点、token(拆分或
    ~N
    )。父级标记任务行,待所有任务完成后执行步骤5的评审。
  6. 会话启动:冷启动此Agent = 按
    session-boot.md
    完成完整启动;同一Agent持续运行 = 除非
    agents.local.md
    / harness规则变更,否则无需重新读取全部规则。

Session boot

会话启动

See
../../ns-harness/references/session-boot.md
. Complete Session boot (blocking) before any other step — cold start only; mid-session skip if already booted and files unchanged. Never tool-Read
AGENTS.md
.
详见
../../ns-harness/references/session-boot.md
。**完成会话启动(阻塞式)**后再执行其他步骤——仅冷启动时需执行;会话中途若已启动且文件未变更则跳过。不得读取
AGENTS.md
文件。

Session inputs

会话输入

VariableRequired
{task_description}
Yes
{target_layer}
Infer when possible: frontend, backend, infra, tests, fullstack
变量是否必填
{task_description}
{target_layer}
尽可能推断:frontend、backend、infra、tests、fullstack

Scope isolation

范围隔离

Operate only inside the repo + harness docs.
仅在仓库 + harness文档内操作。

Boot (mandatory)

启动(强制要求)

Session boot (
../../ns-harness/references/session-boot.md
) — one rule for ad-hoc, C2, SDD handoff:
Agent stateAction
Cold start (this agent/subagent just started)Full Session boot (steps 1–6). Bridge may have done local + architecture/project rules — finish layer rules + context
Same agent continuing; steps 1–6 done; files unchangedDo not re-read rule corpus
agents.local.md
or harness rules changed since last boot
Re-boot
Then:
  1. Obey
    AGENTS.md
    orders (already in context) — no invented paths
  2. git status
    and
    git diff
  3. Read target files before writing
Success:
AGENTS.md
orders + project rules + task scope. Invented paths or SDD artifacts (except handoff updates when parent owns them) = failure.
会话启动
../../ns-harness/references/session-boot.md
)——临时任务、C2、SDD交接场景均需遵循同一规则:
Agent状态操作
冷启动(此Agent/子Agent刚启动)完成完整会话启动(步骤1–6)。桥接器可能已读取本地 + 架构/项目规则——需完成层规则 + 上下文读取
同一Agent持续运行;步骤1–6已完成;文件未变更不得重新读取规则库
自上次启动后
agents.local.md
或harness规则已变更
重新启动
然后:
  1. 遵守
    AGENTS.md
    中的指令(已加载至上下文)——不得自行创建流程
  2. 执行
    git status
    git diff
  3. 编写前先读取目标文件
**成功标准:**遵循
AGENTS.md
指令 + 项目规则 + 任务范围。自行创建流程或生成SDD工件(除非父级负责的交接文件更新)均视为失败。

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-living-spec
    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版本工件——不得创建
    task-NNN.md
    requirements.md
    execution-handoff.md
    或写入
    docs/versions/
    目录。允许通过
    ns-living-spec
    docs/specs/
    下进行条件性活规格更新(见活规格部分)。
  • 不得添加无意义注释除非被要求
  • 依据
    AGENTS.md
    中的Docker + 测试规则执行测试;容器/命令参考
    architecture-rules.md
  • execution-handoff.md
    /
    run-implementation
    场景下:仅执行单元/集成测试——无需E2E测试(由人类在版本收尾时执行);无需评审关卡(父级执行步骤5)

Complement delegation

互补技能委托

spec-driven
/
gitlab
presets install complements via
depends
(check
.agents/skills/
once per session). Delegate — do not duplicate their workflows inline.
SignalSkillWhen
{target_layer}
frontend, new/refined UI, pages, components,
design-brief.md
ns-frontend-design
Before large UI diff (step 4–5) or when task is primarily visual
Security headers, CSP/CORS, dep CVE sweep, a11y/Web Interface Guidelines audit
ns-best-practices
On explicit request, or after frontend work before review when hygiene was in scope
README /
docs/
guides (not code comments)
ns-docs-writer
On explicit request or version/doc closure — not every ad-hoc fix
MR/SOLID review stays
ns-reviewer
only. Missing complement: continue with harness rules; recommend install once per session (
../ns-spec-driven/references/skill-integrations.md
).
spec-driven
/
gitlab
预设通过
depends
安装互补技能(每会话检查一次
.agents/skills/
)。需委托给这些技能——不得在流程内重复其工作流。
信号技能时机
{target_layer}
为frontend、新/优化UI、页面、组件、
design-brief.md
ns-frontend-design
大型UI差异前(步骤4–5)或任务以视觉为主时
安全头、CSP/CORS、依赖CVE扫描、a11y/Web界面指南审计
ns-best-practices
明确要求时,或前端工作完成后、评审前且卫生检查在范围内时
README /
docs/
指南(非代码注释)
ns-docs-writer
明确要求时或版本/文档收尾时——并非每次临时修复都需执行
MR/SOLID评审仅由**
ns-reviewer
**负责。若缺失互补技能:继续遵循harness规则;每会话建议安装一次(参考
../ns-spec-driven/references/skill-integrations.md
)。

Per-task cycle

单任务循环

SDD handoff mode: one dispatch may cover a batch; still stop after step 6; report per task 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-reviewer
    );
    ../ns-reviewer/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. 加载规则——已启动的Agent需遵守
    AGENTS.md
    ;仅当冷启动此Agent或文件变更时才重新执行会话启动
  3. 探索(grep/head大型测试数据——不得导出完整测试内容)
  4. 确定最小差异范围
  5. 实施(或若触发大变更关卡则提交计划)
  6. 若在范围内则运行测试(见评审前准备
  7. 评审循环——若可用必须调用
    reviewer-agent
    (否则调用
    ns-reviewer
    );参考
    ../ns-reviewer/references/review-gate-workflow.md
  8. 活规格(条件性)——见下文
  9. 最终报告——必填字段;不得跳过结论或轮次计数

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-reviewer/references/review-gate-workflow.md
before done — except SDD handoff (return to parent; no review).
  • MUST invoke
    reviewer-agent
    when available (else
    ns-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-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-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-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-reviewer/references/review-gate-workflow.md
再结束——SDD交接模式除外(返回父级;无需评审)。
  • 必须在工作树差异(
    git diff
    )上调用**
    reviewer-agent
    (若可用,否则调用
    ns-reviewer
    **)——评审桥接器/技能在冷启动时执行会话启动,然后执行评审工作流;无需
    ISSUE_URL
    ,无需版本收尾路径。仅处理临时代码差异。
  • 最多3轮评审
    ns-reviewer
    的评分关卡:通过≥9/10,理想为10/10。
    • **通过:**无关键问题 总分≥9/10:进入步骤8。
    • 失败(存在关键问题 总分≤8)且仍有剩余轮次:应用最小差异修复关键问题并将质量提升至≥9分(
      reviewer-agent
      /
      ns-reviewer
      仅读取——此技能负责修复),若在范围内则重新运行测试,然后必须重新评审(优先使用
      reviewer-agent
      ;否则用
      ns-reviewer
      )。
    • 轮次耗尽仍未通过关卡:停止,报告阻塞。列出未解决的关键问题和/或最终评分。视为未成功。跳过步骤8(活规格)。
  • 修复需在原任务范围内。关键问题(或影响评分的警告)需要超出范围的变更(公共契约、跨产品、多日工作):停止,按停止条件升级。
  • 仅存在建议(P2)且总分已≥9时不阻塞:在最终报告中列为后续事项。

Living specs (step 8, conditional)

活规格(步骤8,条件性)

Only after
Code Review: Approved
(not as C2). Invoke
ns-living-spec
in ad-hoc mode when all true:
  1. 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-living-spec
**:
  1. 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-coder
Reviewer skill
ns-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:
行——版本收尾负责结论。
每个临时任务/C2模式的收尾响应必须包含:
字段
当前技能
ns-coder
评审技能
ns-reviewer
(若调度则通过
reviewer-agent
评审轮次最后执行的轮次:
1
2
3
评分评审给出的最终总分
结论精确行:
Code Review: {Approved|Rejected|Blocked}
活规格
updated
|
skipped: {reason}
|
n/a
(阻塞/拒绝)
然后列出:变更内容、后续事项、若阻塞则列出未解决的关键问题。

Stop conditions

停止条件

ConditionAction
Large change gatePlan + wait
Public contract changeStop, explain, ask
Task needs multi-day SDD planningRedirect to
ns-spec-driven
条件操作
触发大变更关卡提交计划 + 等待批准
变更公共契约停止,说明原因,请求确认
任务需要多日SDD规划重定向至
ns-spec-driven

Related skills

相关技能

  • ns-reviewer
    — mandatory review loop after implementation (Review loop)
  • ns-living-spec
    — conditional ad-hoc living-spec update after Approved (Living specs)
  • ns-investigator
    — blocked by unclear bug
  • ns-autonomous
    — autonomous multi-agent execution (GitLab issue or local plan); GitLab issue use
    ns-execution-gitlab-issue
    instead
  • ns-frontend-design
    — UI/design work (Complement delegation)
  • ns-best-practices
    — security/CSP/a11y hygiene pass (Complement delegation)
  • ns-docs-writer
    — README /
    docs/
    guides on request (Complement delegation)
  • ns-reviewer
    ——实施后必须执行的评审循环(评审循环
  • ns-living-spec
    ——通过评审后条件性临时活规格更新(活规格
  • ns-investigator
    ——因bug不明而阻塞时调用
  • ns-autonomous
    ——自主多Agent执行(GitLab issue或本地计划);GitLab issue场景请使用
    ns-execution-gitlab-issue
  • ns-frontend-design
    ——UI/设计工作(互补技能委托
  • ns-best-practices
    ——安全/CSP/a11y卫生检查(互补技能委托
  • ns-docs-writer
    ——按需编写README /
    docs/
    指南(互补技能委托

Forbidden

禁止事项

  • SDD version artifact generation (
    docs/versions/
    , handoff, requirements/tasks)
  • Living-spec consolidator before
    Code Review: Approved
    , or when
    docs/specs/
    missing
  • Out-of-repo 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-reviewer
    SKILL.md
    . Harness
    reviewer-agent
    allowed.
  • Skipping re-review — success after fix when previous
    ns-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 / mid-batch review under handoff
    reviewer-agent
    /
    ns-reviewer
    during
    run-implementation
    task or batch (parent owns Step 5)
  • 生成SDD 版本工件(
    docs/versions/
    、交接文档、需求/任务)
  • Code Review: Approved
    之前调用活规格整合器,或
    docs/specs/
    目录缺失时调用
  • 无范围限制的仓库外访问
  • 无明确要求的代码提交
  • 超出任务范围的重构
  • 替代评审流程——Cursor Task子Agent(
    senior-tech-lead-reviewer
    bugbot
    security-review
    )或任何未通过
    reviewer-agent
    /
    ns-reviewer
    SKILL.md
    的评审。Harness的
    reviewer-agent
    允许使用。
  • 跳过重新评审——修复后若之前
    ns-reviewer
    结论为
    Rejected
    或评分<9,未进行新的通过轮次则视为成功(临时任务/C2模式)
  • 无结论的成功——临时任务/C2模式收尾时缺少必填的最终报告字段和可解析的
    Code Review:
  • 交接场景下的单任务/批中评审——在
    run-implementation
    任务或批次期间调用
    reviewer-agent
    /
    ns-reviewer
    (父级负责步骤5)