Log first
8 battle-tested discipline skills that stop your AI coding agent from confidently shipping broken code — each with a verifiable done-criterion. Bilingual EN/中文.
npx -y skills add yli769227-jpg/agent-discipline --skill log-firstAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Log first (observability). New code must include key-path logging: connection established, state change, error, request/response. Triggers when you're about to write a new module, interface, async task, or external call — or when debugging code that has no logs. Writing buggy code is normal; locating the bug is the hard part. 日志优先:新代码必须含关键路径日志(连接、状态变化、错误、请求/响应)。触发:写新模块/接口/异步任务/外部调用,或 debug 无日志代码时。写代码犯错正常,定位问题才难。 不触发:纯改文案/配置、纯重命名、写测试断言,或模块已有完整关键路径日志。
SKILL.md
2.7 KB, as published. Nobody here has run it
Log First / 日志优先
Writing buggy code is normal. Locating the bug is the hard part — logs are how you win that part. 写代码犯错是正常的,定位问题才是真正困难的——日志就是你赢下这一关的方式。
The discipline / 纪律
- All new code carries key-path logs: connection established, state change, error raised, request/response. 所有新代码带关键路径日志:连接建立、状态变化、错误发生、请求/响应。
- Keep log format consistent and prefix each line with a module tag so it greps cleanly. 日志格式统一,每行带模块前缀,便于 grep。
- Error logs must carry context: which operation, which arguments, which error. 错误日志必须带上下文:什么操作、什么参数、什么错误。
- This applies to agent-written code too — a sub-task to write code must require key-path logging. agent 写的代码同样适用——派写代码的子任务时要写明"加关键路径日志"。(派子任务的完整必含项见 agent-team 的「派子任务必含清单」)
When this triggers / 触发时机
- About to write a new module / interface / external call / async task.
- Debugging a stretch of code that has no logs (add them first).
- Before handing an agent a code-writing sub-task (require "add key-path logs").
Done criterion (verifiable) / 完成判据(可验证)
✅ A grep over the new code (e.g. grep -nE 'log\.(info|warn|error)' <file>) shows a line at each key path — connect, state change, error, request/response — each module-prefixed and carrying context.
⚠️ Some paths logged, some missing — name the gaps.
❌ The new code is silent. If it fails in prod, you'll be blind. Add logs before shipping.
Worked examples / 实战反例
Real before/after cases for this discipline live in EXAMPLES.md — read them before you act. 本纪律的真实 before/after 反例见 EXAMPLES.md —— 动手前先对照。