Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add cass-2003/local-workflow-skill --skill structured-logginggit clone --depth 1 https://github.com/cass-2003/local-workflow-skillWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/cass-2003/local-workflow-skill/structured-logging)<a href="https://agentmods.dev/skills/cass-2003/local-workflow-skill/structured-logging"><img src="https://agentmods.dev/badge/skills/cass-2003/local-workflow-skill/structured-logging/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/cass-2003/local-workflow-skill/structured-logging"><img src="https://agentmods.dev/badge/skills/cass-2003/local-workflow-skill/structured-logging.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00152 | $0.03197 |
| Opus 5.5 | $0.00061 | $0.01279 |
| Sonnet 5.5 | $0.00030 | $0.00639 |
| Haiku 4.5 | $0.00015 | $0.00320 |
Grade A, and why
structured-logging scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 338 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Structured Logging Skill — 结构化日志
何时使用
- 新项目立项(日志格式从一开始定型)
- 调试"为什么 SRE 让我加 trace ID"
- 处理"日志体积爆炸 / 检索缓慢"
- 排查跨服务调用的请求链路
- 满足合规(PII / GDPR)的日志脱敏
一、核心原则
- 机器优先:JSON 格式,键值对。人类用
jq/ Loki / ES query 看 - 每条日志带 context:service / version / env / trace_id / user_id / request_id
- 大写 level 严格语义:DEBUG < INFO < WARN < ERROR < FATAL
- 永不日志即吞噬:catch 后必须含 cause 或 rethrow
- 结构化字段稳定:键名固定、不要混用
userId/user_id/uid - PII 默认脱敏:邮件 / 手机 / 身份证 / 卡号永远过滤 redactor
二、JSON 日志标准字段
{
"ts": "2026-05-06T07:00:00.123Z",
"level": "info",
"service": "checkout-api",
"version": "v2.3.1",
"env": "production",
"trace_id": "4bf92f3577b34da6a3ce929d0e0e4736",
"span_id": "00f067aa0ba902b7",
"request_id": "req_abc123",
"user_id": "u_456",
"msg": "order created",
"order_id": "ord_789",
"amount_cents": 12345,
"currency": "USD",
"duration_ms": 87
}
字段约定:
tsISO 8601 UTC(带 Z)level小写:debug/info/warn/error/fatalmsg简短描述(不含变量值;变量在结构化字段里)trace_id/span_id遵循 W3C Trace Context(OpenTelemetry 标准)
反模式:
// ❌ 字符串拼接
{ "msg": "user 123 created order 456 for $123.45" }
// ✅ 结构化
{ "msg": "order created", "user_id": 123, "order_id": 456, "amount_cents": 12345 }
理由:检索 user_id=123 比正则匹配 string 快几个数量级,且不受 msg 文案变化影响。
三、Log Level 语义(严格)
| Level | 含义 | 例子 | 生产开启? |
|---|---|---|---|
| DEBUG | 开发诊断 | "entering function X with args" | ❌ |
| INFO | 正常事件 | "user logged in" / "order created" | ✅ |
| WARN | 异常但已恢复 | "retrying after 5xx" / "fallback to cache" | ✅ |
| ERROR | 失败需关注 | "DB query failed" / "5xx returned" | ✅(有告警) |
| FATAL | 进程终止 | "config invalid, shutting down" | ✅(罕见) |
关键:
- ERROR 应触发告警 → 慎用,不要给瞬时网络抖动打 ERROR
- INFO 日志 = 业务事件;不是函数追踪(用 trace 替代)
- DEBUG 日志生产关闭,但保留代码(dev / staging 启用)
四、Context 透传
Go (1.21+ slog)
import "log/slog"
logger := slog.New(slog.NewJSONHandler(os.Stdout, nil))
// 带 context 的 logger(每个请求基础信息)
reqLogger := logger.With(
"request_id", reqID,
"user_id", userID,
"trace_id", traceID,
)
reqLogger.Info("order created", "order_id", orderID, "amount_cents", 12345)
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3mo ago First seen · 338 lines · 152 tokens per session scan A 9a345dd37c82
structured-logging is a skill published in the GitHub repository cass-2003/local-workflow-skill (12 stars, last pushed 4mo ago), licensed MIT. It adds 152 tokens to every session and 3,197 once invoked, about $0.0006 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
structured-logging compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| structured-loggingcass-2003/local-workflow-skill | Skill | 12 | 4mo ago | MIT | A | 152 | Claude Code, Codex |
| systematic-debuggingopen-metadata/OpenMetadata | Skill | 16k | today | Apache-2.0 | A | 37 | Claude Code |
| log-error-digestzebbern/claude-code-guide | Skill | 4.7k | today | MIT | A | 71 | Claude Code, Codex |
| observability-audit-sessionsIBM/mcp-context-forge | Skill | 4.9k | today | Apache-2.0 | A | 64 | Claude Code, Codex |
| cwv-optimizeradobe/skills | Skill | 343 | today | Apache-2.0 | A | 112 | Claude Code |
| performance-verificationvalkor-ai/loom | Skill | 1.6k | 2d ago | Apache-2.0 | A | 45 | Claude Code, Codex |
| loop-engineeringhuytieu/COG-second-brain | Skill | 1.6k | today | MIT | A | 63 | Claude Code |