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.
npx agentmods add skills/wade-devcode/awesome-coding-skills-cn/core-disciplinenpx skills add Wade-DevCode/awesome-coding-skills-cn --skill core-disciplinegit clone --depth 1 https://github.com/Wade-DevCode/awesome-coding-skills-cnWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/wade-devcode/awesome-coding-skills-cn/core-discipline)<a href="https://agentmods.dev/skills/wade-devcode/awesome-coding-skills-cn/core-discipline"><img src="https://agentmods.dev/badge/skills/wade-devcode/awesome-coding-skills-cn/core-discipline.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00031 | $0.01884 |
| Opus 5 | $0.00015 | $0.00942 |
| Sonnet 5 | $0.00006 | $0.00377 |
| Haiku 4.5 | $0.00003 | $0.00188 |
Grade A, and why
core-discipline scanned grade A with 1 finding 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 3d 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.
Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
**为什么:** AI 的训练数据存在截止日期,且会在不同库之间混淆接口。常见事故:把 `pandas` 的方法名张冠李戴到 `polars`,把 Node.js v16 已删除的 API 当作现行 API 调用,编造根本不存在的 `requests.get(...).json_body` 字段。这类代码在 review 时看起来合理,跑起来立刻抛 `AttributeError` / `TypeError`,且错误定位成本很高。 How it starts
The opening of the file, as written. The whole thing — 166 lines — stays where its author put it; the contents beside it link to each section on GitHub.
核心纪律
何时用
- 接到任何新的编码或改码任务,动手前先过一遍本文。
- 发现自己想"顺手"重构无关代码、提取公共抽象时。
- 不确定某个库函数/字段是否真实存在时。
- 准备交付代码或提 PR 前做最终自查。
核心规则
1. 不造 API
规则: 只调用真实存在的库函数、类、字段——不确定就先查文档或读源码,禁止凭记忆编造。
为什么: AI 的训练数据存在截止日期,且会在不同库之间混淆接口。常见事故:把 pandas 的方法名张冠李戴到 polars,把 Node.js v16 已删除的 API 当作现行 API 调用,编造根本不存在的 requests.get(...).json_body 字段。这类代码在 review 时看起来合理,跑起来立刻抛 AttributeError / TypeError,且错误定位成本很高。
怎么做:
- 不确定方法签名 → 用
help()、IDE 补全、或直接读源码确认。 - 不确定返回结构 → 先
print/console.log或写一个小测试确认再用。 - 若无法查证,在代码注释中明确标注
# TODO: 请核实此 API 是否存在,不要默默造假。
2. 外科手术式改动
规则: 只改与当前任务直接相关的代码行,不顺手触碰无关部分。
为什么: AI 极容易在"顺手"时引入意外回归:重排 import 导致循环依赖,格式化改动污染 git blame,重命名变量破坏下游引用。改动面越大,reviewer 越难判断哪些变化是必要的,哪些是噪音,review 成本指数级上升。
怎么做:
- diff 提交前逐行确认:每一处改动都必须有对应的任务理由。
- 不改格式(缩进、引号风格、trailing comma),除非任务本身就是格式化。
- 不重排、增删无关 import。
- 若发现真实 bug 但不在本次任务范围内,新建 issue 记录,不在当前 PR 里修。
3. 拒绝过度工程
规则: 只实现当前需求的最小方案,不预留"将来可能用到"的抽象或扩展点(YAGNI)。
为什么: AI 倾向于生成"通用"、"可扩展"的代码——Strategy 模式、插件系统、多层配置——即使需求只是"把这个数字加一"。这些提前抽象几乎从不被用到,却带来维护负担、理解成本,以及因过度复杂而埋下的 bug。
怎么做:
- 问自己:「当前的具体需求是什么?」写刚好满足它的代码。
- 不引入新的间接层(额外的 interface、factory、wrapper)除非现有需求直接要求。
- 配置项只在真的有多个合法取值时才加,不为"灵活性"提前加开关。
- 泛型/模板只在当前就有两种以上具体类型时才抽象。
4. 显式暴露假设
规则: 动手前列出关键假设;假设有歧义先问清楚,不闷头猜。
为什么: AI 在上下文不足时会悄悄做假设并写进代码:假设某字段不会为 null、假设列表非空、假设调用方已鉴权。这些假设在 happy path 下不报错,在边界场景下造成生产事故,且事后难以溯源(代码里看不到这个"决策"是在哪里做出的)。
怎么做:
- 开始前写出假设列表,例如:
假设: - user.profile 在此处一定非 null(由上游鉴权中间件保证) - items 列表至少有 1 条(调用方已校验) - 对于数据形状不确定的,用
assert/ TypeScript 类型守卫 / Zod schema 在代码中显式检查。 - 若某个假设无法当场验证,暂停并向用户提问,不要继续。
5. 改前先读
规则: 修改任何文件前先完整读一遍,理解现有约定再动手。
为什么: AI 经常在没读完文件的情况下就开始写代码,结果:重复定义已有的工具函数、违反项目既有的错误处理约定、用与周围代码不同的命名风格引入风格割裂。这些问题单独看不严重,积累起来会让代码库越来越难维护。
怎么做:
- 用 Read 工具读取目标文件全文,重点关注:已有的同类函数、命名规范、错误处理模式、import 风格。
- 改多个文件时,每个文件都先读,不要假设"它和另一个文件一样"。
- 读完后在心里(或明文写出)总结「此文件的约定」,再开始改。
正例 / 反例
反例:编造不存在的库方法
# 反例 — AI 凭记忆编造了 httpx 不存在的 .json_body 属性
import httpx
resp = httpx.get("https://api.example.com/data")
payload = resp.json_body # ❌ AttributeError: 'Response' object has no attribute 'json_body'
user_id = payload["id"]
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.
- 3d ago First seen · 166 lines · 31 tokens per session scan A 35b2abd2cb47
core-discipline is a skill published in the GitHub repository Wade-DevCode/awesome-coding-skills-cn (6 stars, last pushed 2mo ago), licensed MIT. It adds 31 tokens to every session and 1,884 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
chinese-documentation
中文文档排版参考——中英文空格、全半角标点、术语保留、链接格式、中文文案排版指北约定。仅在用户显式 /chinese-documentation 时调用,不要根据上下文自动触发。.
chinese-git-workflow
国内 Git 平台配置参考——Gitee、Coding.net、极狐 GitLab、CNB 的 SSH/HTTPS/凭据/CI 接入差异与镜像同步配置。仅在用户显式 /chinese-git-workflow 时调用,不要根据上下文自动触发。.
brainstorming
在任何创造性工作之前必须使用此技能——创建功能、构建组件、添加功能或修改行为。在实现之前先探索用户意图、需求和设计。.
chinese-code-review
中文 review 沟通参考——话术模板、分级标注(必须修复/建议修改/仅供参考)、国内团队常见反模式应对。仅在用户显式 /chinese-code-review 时调用,不要根据上下文自动触发。.
chinese-commit-conventions
中文 commit 与 changelog 配置参考——Conventional Commits 中文适配、commitlint/husky/commitizen 中文模板、conventional-changelog 中文配置。仅在用户显式 /chinese-commit-conventions 时调用,不要根据上下文自动触发。.
mcp-builder
MCP 服务器构建方法论 — 系统化构建生产级 MCP 工具,让 AI 助手连接外部能力.