代码实现

A coding workflow for checking requirements, understanding existing code, designing module boundaries, writing tests first, implementing changes, and reviewing risks. TDD means writing a failing test, making it pass, then improving the code.

In plain words
What is it for?
Use it when building features, changing code, refactoring, or adding tests. It guides requirement checks, code investigation, test design, implementation, and regression checks.
Why use it?
It reduces guesswork before coding and helps prevent duplicate work, broken interfaces, and changes that are not covered by tests.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/jianchen08/agent-os-open/code-implement
Any agent
npx skills add jianchen08/Agent-os-open --skill code-implement
Clone the repo
git clone --depth 1 https://github.com/jianchen08/Agent-os-open

Made for: Claude Code, Codex.

Per session 54 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,785 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00054 $0.01785
Opus 5 $0.00027 $0.00892
Sonnet 5 $0.00011 $0.00357
Haiku 4.5 $0.00005 $0.00178

Measured 2d ago against content hash b6ade87b3884, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

代码实现 scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/code-implement/SKILL.md · 116 lines

How it starts

The opening of the file, as written. The whole thing — 116 lines — stays where its author put it; the contents beside it link to each section on GitHub.

代码实现

执行流程

第 1 步:确认需要(编码前必做)

进入编码前,先确认输入和目标就绪,缺则停下追问,不靠猜测推进。

  1. 确认功能目标:逐条过验收标准(AC),确认每条都理解且可执行;有 state_machine 时确认要覆盖所有状态和转换
  2. 确认涉及范围:本任务要改哪些模块/文件,各自职责是什么
  3. 确认技术栈与约束:前端/后端/全栈;前端任务的设计系统约束;接口契约变更预期
  4. 确认上下文就位:相关参考文件、现有代码位置、依赖的接口契约都已拿到
  5. 信息不全则停下:通过 human_interaction 向上追问,确认齐了再进入第 2 步

第 2 步:摸清现有实现(防重复实现、防破坏架构,编码前必做)

调研现有实现,需要得出以下结论:

  • 调用链摘要:相关模块/函数的调用关系和数据流
  • 可复用项清单:逐项标注【可直接调用】/【改一下能兼容(说明怎么改)】/【不适用(说明理由)】
  • 接口契约:本任务要依赖/修改的对外接口的现有签名、入参出参、异常、调用约束
  • 架构边界:涉及的模块职责边界、依赖方向,本改动是否违反模块边界规则

调研深度按任务规模调整:单文件小改不必深挖;跨模块/涉及复用判断的任务必须把上下游和接口都摸清。

第 3 步:模块边界设计

按 coding_domain_rules.md §5.2 执行模块边界设计。

新增文件前先更新所在模块的「结构 > 文件清单」,改接口前先更新模块级/项目级文档(文档不存在先创建)。

迁移/重构任务:先读旧代码产架构审查(含现有架构概述/计划变更范围/接口契约变更清单/风险评估),通过 human_interaction 向用户确认后再编码。新建任务跳过此步。

第 4 步:测试设计(Red 阶段,先写失败测试)

优先复用现有测试:先搜项目中已有测试,已覆盖的场景跳过,只补缺失的。

场景覆盖清单(补缺失部分):

  • 正常场景:标准输入,预期成功
  • 边界场景:最小/最大值、空值、临界值
  • 异常场景:错误输入、异常处理路径
  • 状态机:有 state_machine 时,覆盖所有状态和转换(state_coverage=100%,transition_coverage=100%)

测试类型选择:

  • 单元测试:单函数/方法,隔离外部依赖
  • 集成测试:多组件协作,验证模块间交互
  • API 端点测试(后端/全栈任务必做):每端点覆盖 2xx 成功 + 4xx 客户端错误 + 5xx 服务端错误,校验响应 Schema
  • 前端 E2E(前端任务必做):用 playwright_test 做浏览器级测试,不能只用 Jest 组件测试代替

写完测试必须运行确认全部失败(Red),保留失败证据。禁止在本阶段写实现代码。

第 5 步:实现代码(Green 阶段)

  1. 写最少的代码让测试通过
  2. 每个公共接口的实际实现必须与第 3 步的契约一致
  3. 完整类型注解和文档字符串
  4. 每个 must 级 AC 必须在代码中有对应实现
  5. 复用落地:第 2 步判定为"直接复用/需修改现有实现"的,按结论执行;禁止在实现阶段另起炉灶重复造轮子
  6. 运行测试确认通过(Green)

第 6 步:重构优化(Refactor 阶段)

测试全通过后才能重构:

  • 消除重复代码、改善命名和可读性
  • 内聚性检查:每个模块/文件职责单一,不相关功能已拆分
  • 耦合度检查:模块间只通过公共接口交互,无隐式耦合
  • 每次重构后运行测试确保仍通过

第 7 步:回归验证

  1. 运行全部测试套件(不只是新写的)
  2. 检查覆盖率:核心逻辑 100% 分支覆盖,一般代码 80%(按 testing_rules 的 P0/P1/P2 分级)
  3. 接口一致性验证:所有公共接口实现与契约文档一致
  4. 确认无残留临时诊断代码(print/console.log 等)

编码完成后的风险分级

在编排执行报告中标注本次改动命中的风险维度(用于追溯改动范围):

  • 接口契约变更:新增/修改/删除对外接口、函数签名、数据结构、配置项
  • 跨模块改动:涉及 ≥2 个模块(非同模块多文件)
  • 安全相关:认证、鉴权、加密、密钥、权限、用户数据
  • 数据持久化:数据库 schema、配置文件结构、状态存储
  • 控制流核心:主循环、状态机、任务调度、错误处理策略

规则

  • TDD 红绿循环不可跳过:必须先写测试并确认 Red,再写实现使其 Green
  • 提交 task_evaluate 前必须运行全部测试并通过
  • 每个 must 级 AC 必须在代码中实现
  • 前端代码必须遵守设计系统约束(间距、颜色、组件使用规范)
  • 门禁回退修复时用 search_replace 定向修改,禁止重写整个文件
  • 修改代码局限在最小范围,优先改现有文件,除非必要不新建文件
  • 新增文件前必须先更新模块「结构 > 文件清单」,文档不存在先创建
  • 修改接口/配置前必须先更新对应模块级和项目级文档
  • 禁止重复实现:能直接调用或修改现有实现满足需求时,禁止新建;新建必须有"为何不适用现有实现"的理由
  • 编码前必须先摸清现有相关实现并核对接口契约和架构边界,没看到就动手视为不合格
  • 如果输入包含 state_machine,测试必须覆盖所有状态和转换
  • API 端点测试必须覆盖 2xx 和 4xx 场景,必须做 Schema 校验
  • 必须先搜现有测试文件,有现成测试时优先复用和补充,禁止另起炉灶

Read the full file on GitHub · 116 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 116 lines · 54 tokens per session scan A b6ade87b3884

Subscribe to this mod's changes

代码实现 is a skill published in the GitHub repository jianchen08/Agent-os-open (5 stars, last pushed 7d ago), licensed Apache-2.0. It adds 54 tokens to every session and 1,785 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

deep-research

深度研究编排方法论:澄清范围、拆解规划、并行调度子智能体调研、对抗式核验、综合成带引用的结构化报告。当任务需要多来源、可追溯、需事实核查的深度研究时使用此技能。.

xerrors/Yuxi · 69 tokens

mysql reporter

生成 MySQL 查询报表并生成可视化图表。当用户需要查询 MySQL 数据库并以报表形式展示结果时使用此技能,包括:统计销售数据、分析用户行为、生成业务报表、查询业务指标等。.

xerrors/Yuxi · 55 tokens

frontend-feature

Build a new page, view, or data-driven feature in the Next.js frontend. Use when adding a route under the dashboard/marketing area, wiring UI to a backend endpoint, adding client state, or creating a localized page. Covers App Router, data fetching, Zustand stores, and i18n.

vstorm-co/full-stack-ai-agent-template · 64 tokens

rag-knowledge

Work with the RAG knowledge base — ingest documents, run semantic search, manage collections, or add a sync source/connector (Google Drive, S3). Use when populating or debugging the knowledge base, tuning retrieval, or adding a new document source. This project uses {{ cookiecutter.vectorstore }} + {{…

vstorm-co/full-stack-ai-agent-template · 76 tokens

alembic-migration

Create, review, and apply database schema changes with Alembic. Use whenever a SQLAlchemy model is added or changed, a column/index/constraint needs to change, or a data backfill is required — anything that alters the PostgreSQL schema.

vstorm-co/full-stack-ai-agent-template · 56 tokens

image-gen

在 Agent 沙盒中生成图片并保存到 outputs。当用户要求生成图片、海报、插画、文生图,或指定 Qwen-Image、其它兼容图片生成接口时使用此技能。.

xerrors/Yuxi · 48 tokens