fix-structured-logging
Skill0 starsChanged 57 days agoMITView on GitHub
Fix ILogger structured logging usage in C# classes. Use only when explicitly invoked.
In this repository9 other files it gives its agents.
- AGENTS.mdAGENTS.md
- broSkill
- convert-to-primary-constructorSkill
- design-csharpSkill
- find-red-flagsSkill
- formatting-pull-requestSkill
- over-engineering-review-loopSkill
- prompting-agentsSkill
- unslopSkill
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
- Very specific: line 12
Use a constant message template with named placeholders ("Digest '{Digest}'", digest), never string interpolation, a variable template, or …
- Distinctive: line 15
Don't log empty strings for spacing.
- Very specific: line 22
If a logger call is longer than 120 characters, put each argument on its own indented line.
- Very specific: line 23
If the template is still longer than 120 characters, split it into indented + continuation lines, with any leading space on the new line.
≈ “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.
Files
Fix structured logging
For each class the user names or describes, fix its ILogger calls:
- Use a constant message template with named placeholders (
"Digest '{Digest}'", digest), never string interpolation, a variable template, or concatenation with non-literal values (CA2254). - Don't log empty strings for spacing.
- Log one logical event with one call. Put multi-line content in a placeholder after
\nin the template instead of splitting it across calls. - Compute expensive or multi-line values (for example JSON serialization) into a local before the log call.
- Inline small helpers that only exist to wrap logging so each call site has its own constant template.
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);- Match the log level to the event (for example
LogErrorfor failure summaries). - Build and run the class's tests.
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
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.

