agentleFS
vadimvitvickiyvadimvitvickiy/vv-agent-kit/skills/writing-logs/SKILL.md

writing-logs

Skill0 starsChanged 51 days agoMITView on GitHub

Use when adding or reviewing log statements, or when deciding what level a message belongs at.

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    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:

    Every line is multiplied by traffic, shipped, indexed and paid for.

    line 33
  2. Distinctive:

    Labels: Every line carries a label or category.

    line 70

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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

Writing logs

Logs are read at 3am by someone who cannot reproduce the problem. Write for that reader.

  • Levels use the common set — trace, debug, info, warning, error. Map them onto your stack's names; the distinctions are what matter.
  • A logging policy the project already follows wins — a guide, or the density of the files around yours — over both tables below.

An app or library on a device

Logs stay on the device until collected, rarely with a trace. The trail of method entries is the only reconstruction, so log densely.

Code patternLogLevel
Public or internal method entryThe method nameinfo
Method exit, when there are several return pathsWhich path was taken, before returninginfo
Early return or failed preconditionThe reason it failed, before returningdebug
Catch blockThe errorerror
Error callback or failure branchThe errorerror
Conditional branch controlling flowWhich branch, with the state that decided ittrace
Network, IPC, or database callBefore the call, with identifying parametersdebug
State mutation others observeThe new valuetrace

A service

Every line is multiplied by traffic, shipped, indexed and paid for. Where the service has tracing, the trace is the trail — method-entry logging says less than one span.

EventLogLevel
A request or job completesRoute or job, outcome, durationinfo
A request or job failsThe error, and the identifiers that locate the case — never the payloaderror
A dependency call fails, retries or times outThe dependency, the attempt, the errorwarning
An event someone will audit — an order placed, a permission changedThe event and the entity identifiersinfo
A precondition or branch a trace cannot explainWhich one, and the state that decided itdebug
  • Structured fields, not prose. user_id=42 outcome=denied can be queried; a sentence only grepped, and its wording drifts.
  • Every line carries the request or correlation ID — the only way to pull one request out of a million.

Levels

LevelFor
traceFilter evaluations, state checks, branch tracing
debugFailed preconditions, outbound calls, operational detail
infoMethod lifecycle, meaningful business events
warningUnexpected but recovered
errorCatch blocks, error callbacks, unexpected nil where a value was required

Rules

  • Log a result at the consumer, not the producer. The producer is pure and does not know what the result is for.
  • Whole models or nothing. Two cherry-picked fields are incomplete and rot when the model grows. Log a meaningful description in full, or delete the line. Personal data or credentials: log by identifier, or through a redacting description.
  • Never log accessors, pure computations and factories, destructors without cleanup worth tracking, layout methods, or trivial branchless one-liners.
  • Never a context-free "here" or "done"; never tokens, credentials or personal data — check every interpolation; never a failure at debug, where it is invisible exactly when it matters.
  • Labels. Every line carries a label or category. Reuse the file's existing one; only in a file with no logs, fall back to the enclosing type name. A second label for one file fragments the filter.

Logger APIs, privacy annotations and imports live in the stack skill — for Swift, vvkit-swift:swift-logging.

Checklist

  • On a device: new or modified methods log entry. In a service: every request or job outcome is logged once, with its request ID, as structured fields
  • Every failed precondition logs its reason
  • Every catch block and error callback logs the error
  • Significant branches log which path was taken
  • Outbound calls are logged before invocation
  • Labels match what the file already uses
  • No credentials, tokens, or personal data in any message

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.