plan-before-code

A Chinese-language guide for planning substantial software changes before writing code. It asks you to clarify the goal, boundaries, constraints, existing code, implementation steps, risks, and how success will be tested.

In plain words
What is it for?
Use it for multi-file changes, unfamiliar libraries or APIs, refactors, and tasks expected to take more than a short session; it also recommends testing the most uncertain part first.
Why use it?
It reduces rework when a task affects several parts of a project or contains uncertainty, by exposing wrong assumptions early.

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/pingfanfan/hello-dsh/plan-before-code
Any agent
npx skills add pingfanfan/hello-dsh --skill plan-before-code
Clone the repo
git clone --depth 1 https://github.com/pingfanfan/hello-dsh

Made for: Claude Code, Codex.

Per session 56 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,035 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.00056 $0.01035
Opus 5 $0.00028 $0.00517
Sonnet 5 $0.00011 $0.00207
Haiku 4.5 $0.00006 $0.00103

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

Security

Grade A, and why

plan-before-code 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.

examples/skills/plan-before-code/SKILL.md · 96 lines

What it actually says

动手前先想清楚

判断标准:你能不能一句话说清"做完之后怎么验证它对了"? 说不清就还不能开始写。

小改动不需要这一套。改一个文件、十分钟能完成、出错能立刻回退的事,直接做。 这个技能针对的是改多处、有不确定性、或者做错了要返工半天的任务。

先问清楚需求

在设计方案之前,确认你理解的和对方要的是同一件事:

  • 真正要解决的问题是什么? 对方说的经常是方案,不是问题。「加个导出按钮」背后可能是「我要把数据给财务」,而后者也许有更好的解法。
  • 边界在哪? 什么算完成,什么明确不做。
  • 有没有约束? 兼容性、时间、不能动的部分。

理解有歧义时问,不要猜。 猜错的成本是整个实现返工,问一句的成本是一分钟。

但也别把所有事都问出去。能从代码、文档、现有惯例里找到答案的,自己找。只问那些「不同答案会导致不同做法」的问题。

摸清现状

动手前至少确认:

  • 有没有现成的东西能用? 这个项目里是不是已经有类似的实现、工具函数、模式
  • 相关代码现在是怎么组织的? 新东西应该按什么模式加进来
  • 谁会受影响? 改的这个接口有哪些调用方

先找再造。 项目里已有的模式即使不完美,一致性通常比局部最优更有价值。

写下方案

不需要正式文档,但要写下来。写的过程会暴露没想清楚的地方。

至少包含:

做什么:要改哪些地方,每处大概做什么。

为什么是这个方案:如果有别的选择,为什么不选它们。这一段在被质疑时能省很多口舌。

怎么验证:做完之后跑什么能证明它对了。这一条必须具体到命令或步骤。

风险:哪部分你没把握,哪部分可能踩到未知。

拆步骤

拆的标准:每一步做完都是一个可验证、可提交的状态。

好的拆法:

1. 加新的数据结构和类型(不改行为,可单独提交)
2. 实现新逻辑,暂不接入(有测试,可单独提交)
3. 切换调用方(行为在这一步改变)
4. 删除旧实现

坏的拆法:

1. 改后端
2. 改前端
3. 联调

区别在于:前者每一步结束时系统都是可用的,后者中间状态是坏的。

中间状态不可用的拆法,等于没拆。

先做最不确定的

如果方案里有一部分你没把握(新的库、没用过的 API、不确定性能够不够),先做那一块

原因很实际:如果它行不通,你要重新设计方案。放在最后做,前面的工作可能全废。

这一步可以写个最小验证脚本,跑通就扔掉,目的只是消除不确定性。

什么时候该停下来重新想

  • 改动范围开始扩散到计划之外
  • 发现需要改一个当初以为不用动的东西
  • 写了一半发现有个更简单的做法
  • 卡在同一个地方超过半小时

这些都是方案有问题的信号,不是「再坚持一下」的信号。 停下来重新想的成本,远低于沿着错的方向继续写。

不要做的事

  • 不要在需求有歧义时开始写
  • 不要把「先写起来再说」当成方案
  • 不要一次动超过你能一眼看完的范围
  • 不要把不确定的部分留到最后
  • 不要为小改动做这一整套(判断标准在开头)
  • 不要写完方案就不改了,发现更好的做法就换
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 · 96 lines · 56 tokens per session scan A 100635bf010c

Subscribe to this mod's changes

plan-before-code is a skill published in the GitHub repository pingfanfan/hello-dsh (87 stars, last pushed 18d ago), licensed MIT. It adds 56 tokens to every session and 1,035 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-30.

Related

Other skills, from other repositories

dsh-plugin-guide

Use when developing, reviewing, packaging, debugging, or answering questions about DeepSeek Harness (DSH) plugins — the plugin-based agent harness on vendored Cordis. Applies the official plugin-development constraints (plugin contract, cordis.yml layers, services/events/effects, tool DSL, bundles/profiles) backed by…

PerryLink/dsh-plugin-guide · 76 tokens

dsh-web-release

Release and publish the dsh-web monorepo (DSH Web GUI plugin family + skin collection) — bump all packages to one unified version, commit and tag (tags are cut from main after dev integration; dev is the integration branch), push the vX.Y.Z tag that triggers the GitHub Actions publish pipeline, and verify the npm…

zhu1090093659/dsh-web · 151 tokens

dsh-web-community-plugin-developer

Develop a DSH community plugin and register it in the dsh-web Community Plugins index — author the plugin in the contributor's own repository following the official cordis bundle standard, add its entry to packages/dsh-community-plugins/community.json, regenerate the index with scripts/community-index, rebuild and…

zhu1090093659/dsh-web · 123 tokens

dsh-web-skin-developer

Build a new skin for the dsh-web skin collection (DSH Web GUI) and publish it into the Skin Center — the first-level settings section — scaffold with scripts/dsh-skin-new, author the v2 skin.json manifest plus skin.css token remap (pure asset directory, no package.json, no build step), validate with scripts/dsh-skin…

zhu1090093659/dsh-web · 120 tokens

dsh-web-pre-push-checks

Use before pushing, opening or updating a pull request, or claiming dsh-web checks pass. Selects the required repository gates and diff-specific generation, build, and GUI evidence.

zhu1090093659/dsh-web · 45 tokens

dsh-web-documentation

Use when adding or editing dsh-web README files, docs, AGENTS.md instructions, user-facing configuration text, or bilingual documentation pairs.

zhu1090093659/dsh-web · 34 tokens