agentleFS
kelvinkosbabkelvinkosbab/KozBon/.claude/skills/swift-logging-pro/SKILL.md

swift-logging-pro

Skill5 starsChanged 11 days agoMITView on GitHub

Reviews Swift logging code using os.Logger for correct privacy markers, subsystem/category conventions, and appropriate log levels. Use when writing or reviewing logging code.

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 1 is distinctive, and 7 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.

  • 7

    Very specific

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

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

    Check os.Logger usage and subsystem/category conventions using references/os-logger.md.

    line 14
  2. Very specific:

    Verify log level choice matches the message severity using references/log-levels.md.

    line 16
  3. Distinctive:

    If doing a partial review, load only the relevant reference files.

    line 19
  4. Very specific:

    Use os.Logger (modern API), not OSLog (legacy) or print() (no privacy, no levels, no subsystem filtering).

    line 24
  5. Very specific:

    Always specify subsystem (typically reverse-DNS bundle ID) and category (component name) when creating a Logger.

    line 25
  6. Very specific:

    All interpolated values default to private — explicitly mark with .public only when safe (e.g., status enums, fixed strings).

    line 26
  7. Very specific:

    Never log usernames, passwords, tokens, email addresses, or PII — even with .public.

    line 27
  8. Very specific:

    Use the appropriate level: .debug for development noise, .info for normal events, .notice for important events, .error for recoverable …

    line 28

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

Review Swift logging code for correctness, privacy compliance, and consistent subsystem conventions. Report only genuine problems - do not nitpick or invent issues.

Review process:

  1. Check os.Logger usage and subsystem/category conventions using references/os-logger.md.
  2. Validate privacy markers on logged values using references/privacy.md.
  3. Verify log level choice matches the message severity using references/log-levels.md.
  4. Flag print() statements in production code (acceptable in tests, scripts).

If doing a partial review, load only the relevant reference files.

Core Instructions

  • Use os.Logger (modern API), not OSLog (legacy) or print() (no privacy, no levels, no subsystem filtering).
  • Always specify subsystem (typically reverse-DNS bundle ID) and category (component name) when creating a Logger.
  • All interpolated values default to private — explicitly mark with .public only when safe (e.g., status enums, fixed strings).
  • Never log usernames, passwords, tokens, email addresses, or PII — even with .public.
  • Use the appropriate level: .debug for development noise, .info for normal events, .notice for important events, .error for recoverable failures, .fault for programmer errors.
  • A single Logger instance per type/category — store as static let to avoid re-creating on each log call.

Output Format

Organize findings by file. For each issue:

  1. State the file and relevant line(s).
  2. Name the rule being violated.
  3. Show a brief before/after code fix.

Skip files with no issues. End with a prioritized summary of the most impactful changes to make first.

Example output:

MyService.swift

Line 18: Privacy violation — user identifier logged as .public.

// Before
logger.info("Loaded user \(userId, privacy: .public)")

// After
logger.info("Loaded user \(userId, privacy: .private)")

Line 34: Use .error level for recoverable failures, not .info.

// Before
logger.info("Network request failed: \(error.localizedDescription)")

// After
logger.error("Network request failed: \(error.localizedDescription)")

Line 45: print() statement in production code — replace with Logger.

// Before
print("Cache miss for key \(key)")

// After
logger.debug("Cache miss for key \(key, privacy: .public)")

Summary

  1. Privacy (high): User-identifying data logged as .public on line 18 — change to .private.
  2. Severity (medium): Recoverable failure logged at .info — should be .error.
  3. Modernization (low): print() statement should use Logger.

End of example.

References

  • references/os-logger.md — os.Logger basics, subsystem/category conventions, instance creation patterns.
  • references/privacy.md — .public, .private, .sensitive markers, redaction, what never to log.
  • references/log-levels.md — .debug, .info, .notice, .error, .fault semantics, performance impact.

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.