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 | $0.00076 | $0.01598 |
| Sonnet 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 7d 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.
- 7d 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 2mo ago), licensed MIT. It adds 152 tokens to every session and 3,197 once invoked, about $0.0008 per session on Opus 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.
Other skills, from other repositories
debug-optimize-lcp
Guides debugging and optimizing Largest Contentful Paint (LCP) using Chrome DevTools MCP tools. Use this skill whenever the user asks about LCP performance, slow page loads, Core Web Vitals optimization, or wants to understand why their page's main content takes too long to appear. Also use when the user mentions…
systematic-debugging
Use when debugging a failing test, build error, or runtime issue that isn't immediately obvious. Guides a 4-phase root cause analysis instead of random fix attempts.
diagnose
Trace from a reproduced symptom to the source code that causes it. Pin the specific file and approximate line, rate confidence in the cause and clarity of the fix independently, and always propose a concrete fix.
repro-admin
Reproduce an EmDash admin UI bug. Attach a container, start the demo dev server, drive the admin with agent-browser using the dev-bypass session, and capture the reproduction as screenshots plus a replayable transcript.
log-error-digest
Analyze log files to troubleshoot errors, identify peak error periods, and produce error clustering, frequency statistics, and time distribution reports. Supports JSON, syslog, and Nginx formats with automatic detection. Use when a user uploads a .log file and asks to analyze errors, find patterns, debug issues, or…
byted-util-volcengine-detect-retry
An orchestration workflow for Volcengine Cloud Detect, a service that checks websites or network endpoints from test locations.