agentleFS
lbusselllbussell/agent-skills/skills/fix-structured-logging/SKILL.md

fix-structured-logging

Skill0 starsChanged 57 days agoMITView on GitHub

Fix ILogger structured logging usage in C# classes. Use only when explicitly invoked.

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use a constant message template with named placeholders ("Digest '{Digest}'", digest), never string interpolation, a variable template, or …

    line 12
  2. Distinctive:

    Don't log empty strings for spacing.

    line 15
  3. Very specific:

    If a logger call is longer than 120 characters, put each argument on its own indented line.

    line 22
  4. Very specific:

    If the template is still longer than 120 characters, split it into indented + continuation lines, with any leading space on the new line.

    line 23

≈ “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

Fix structured logging

For each class the user names or describes, fix its ILogger calls:

  1. Use a constant message template with named placeholders ("Digest '{Digest}'", digest), never string interpolation, a variable template, or concatenation with non-literal values (CA2254).
  2. Don't log empty strings for spacing.
  3. Log one logical event with one call. Put multi-line content in a placeholder after \n in the template instead of splitting it across calls.
  4. Compute expensive or multi-line values (for example JSON serialization) into a local before the log call.
  5. Inline small helpers that only exist to wrap logging so each call site has its own constant template.
  6. If a logger call is longer than 120 characters, put each argument on its own indented line. If the template is still longer than 120 characters, split it into indented + continuation lines, with any leading space on the new line. Put a blank line between a wrapped logger call and any statement that follows it:

    logger.LogError(
        "Could not annotate digest '{Digest}' because its existing EOL date '{ExistingEolDate}'"
            + " does not match '{EolDate}'.",
        digest,
        existingEolDate,
        eolDate);
    
    failedDigests.Add(digest);
  7. Match the log level to the event (for example LogError for failure summaries).
  8. Build and run the class's tests.

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.