agentleFS
yli769227-jpgyli769227-jpg/agent-discipline/skills/log-first/SKILL.md

log-first

Skill1 starsChanged 6 months agoMITView on GitHub

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 无日志代码时。写代码犯错正常,定位问题才难。 不触发:纯改文案/配置、纯重命名、写测试断言,或模块已有完整关键路径日志。

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    All new code carries key-path logs: connection established, state change, error raised, request/response.

    line 20
  2. Distinctive:

    Keep log format consistent and prefix each line with a module tag so it greps cleanly.

    line 22
  3. Distinctive:

    Before handing an agent a code-writing sub-task (require "add key-path logs").

    line 33

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Log First / 日志优先

Writing buggy code is normal. Locating the bug is the hard part — logs are how you win that part. 写代码犯错是正常的,定位问题才是真正困难的——日志就是你赢下这一关的方式。

The discipline / 纪律

  1. All new code carries key-path logs: connection established, state change, error raised, request/response. 所有新代码带关键路径日志:连接建立、状态变化、错误发生、请求/响应。
  2. Keep log format consistent and prefix each line with a module tag so it greps cleanly. 日志格式统一,每行带模块前缀,便于 grep。
  3. Error logs must carry context: which operation, which arguments, which error. 错误日志必须带上下文:什么操作、什么参数、什么错误。
  4. 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 —— 动手前先对照。

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.