agentleFS
anubhav-qtanubhav-qt/engineering-skills/skills/logger/SKILL.md

logger

Skill2 starsChanged 10 days agoMITView on GitHub

Add logs, metrics and traces only where they help, the project's own way, and prove them. Places logs at errors, security events and one summary event per request or job; keeps secrets and noise out; adds metrics and tracing to deployed apps or ones that call other services; sets up sampling, retention and shipping; then tests every key log, span and metric and proves fake secrets never reach the logs. Use when a change adds a request handler, job, error path, login or outside call, when code has no useful logs, when logs are noisy or leak data, or when the human asks for logging, metrics, tracing or observability.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. montymi/claude-config★ 1same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository7 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 4 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read first. Find the project's logger, its setup, field names, how errors are handled, and any metrics or tracing tool already there.

    line 18
  2. Distinctive:

    Follow them; never add a second logger.

    line 20
  3. Very specific:

    No logger yet: use the language's built-in one (references/stacks.md).

    line 27
  4. Distinctive:

    Ask the human before adding any package.

    line 28
  5. Very specific:

    Write them as references/how-to-log.md says: a constant event name, values in fields, the right level, a request id, redaction in one …

    line 34
  6. Very specific:

    Remove noise in the files the change touches: bare prints, step by step lines, the same error logged twice.

    line 50
  7. Very specific:

    Test them, as references/testing.md says: each key log fires with the right level and fields.

    line 54
  8. Distinctive:

    Run the real app, go through the changed flow, and read the actual lines, spans and metrics it gives out.

    line 64
  9. Very specific:

    Run find_log_calls.py again until it prints "nothing flagged".

    line 68

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

Logger

A log earns its place when someone would act on it, or would need it to find a cause later. Everything else is noise, and noise hides the lines that matter.

This skill covers only the code the change touches. It looks at the whole app only when the human asks, or when the app has no logging at all.

Steps

  1. Read first. Find the project's logger, its setup, field names, how errors are handled, and any metrics or tracing tool already there. Follow them; never add a second logger. List what the change adds so far:

    python3 "${CLAUDE_SKILL_DIR}/scripts/find_log_calls.py" --repo <project folder> [--base <target branch>]
  2. No logger yet: use the language's built-in one (references/stacks.md). Ask the human before adding any package.
  3. Decide where logs go, as references/where-to-log.md says: handled errors (once, where handled), the security events, one summary event per request or job, slow outside calls. Nothing else.
  4. Write them as references/how-to-log.md says: a constant event name, values in fields, the right level, a request id, redaction in one place, and logging that can never break the request.
  5. Browser code ships with no console calls. Send errors to an error tracker only if the project already has one.
  6. Metrics and tracing, only if the app is deployed or calls other services, as references/metrics-tracing.md says: the project's tool, else OpenTelemetry; auto instrumentation, a few hand spans, and the rate, errors and duration metrics.
  7. Set up sampling, retention and shipping, as references/shipping.md says. Ask before creating any account, adding a paid service, or changing a deployed app's settings.
  8. Remove noise in the files the change touches: bare prints, step by step lines, the same error logged twice. List noise in other files in docs/todo.md; do not touch it.
  9. Test them, as references/testing.md says: each key log fires with the right level and fields; each key span and metric is recorded. Then prove fake secrets stay out:

    python3 "${CLAUDE_SKILL_DIR}/scripts/check_log_leaks.py" --print-canaries
    python3 "${CLAUDE_SKILL_DIR}/scripts/check_log_leaks.py" --root <project folder> \
      --command "<test or journey>" --expect "<event name>" [--log-file <path>]
  10. Run the real app, go through the changed flow, and read the actual lines, spans and metrics it gives out. A test can pass while the real output is empty or unreadable.
  11. Run find_log_calls.py again until it prints "nothing flagged". A command-line tool's prints are its real output: put the comment logger: cli once in that file. Mark any other line logger: keep only when it truly must stay, and say why in the report.
  12. Hand off to feature-test to prove the change works as a whole.
  13. Report to the human, within the reply length the project asks for:
    • what was added, removed and set up, and why each log earns its place;
    • the test and the leak check that prove it, with what they printed;
    • what needs the human (an account, a paid service, a deployed setting);
    • anything not run, marked "not checked yet".

Gotchas

  • Logging an error and then rethrowing it logs it twice. Log where it is handled, or rethrow; never both.
  • A catch that neither logs nor rethrows hides the error. Never swallow.
  • A message built from values (f"paid {id}") cannot be searched or counted, and lets user input forge lines. Constant message, values in fields.
  • Whole request or response bodies and whole objects carry personal data along with them. Log ids, not objects.
  • User ids and raw URLs go in logs and spans, never in metric labels: every new label value costs memory, and past the limit alerts go quietly wrong.
  • A check that sees no logs at all passes for the wrong reason. The leak check needs --expect; a log test must also assert the line is there.
  • Pick an --expect text that only the app's logs print, not the test runner's own output.
  • Log tests (caplog, assertLogs) catch records before they are written, so they print nothing. The leak check needs a run where the app's real log setup writes out: a journey script or the started app.

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.