Logging
Good logging is not "more lines." Good logging makes live behavior legible.
This skill is for:
- designing new log events
- auditing an existing logging approach
- reviewing whether a change extends the repo's logging usefully
- migrating from scattered log lines toward more usable structured events
When directly invoked, always do logging work. Produce a design, audit, or
gap report grounded in the repo's existing logging truth.
Interaction Method
Follow ../references/host-interaction-contract.md.
Call the exact host question tool named in
../references/host-interaction-contract.md when that tool is available. Do
not ask for raw 1/2/3 replies when the host already offers a choice surface.
When the workflow spans multiple material steps, use the host task-tracking
tool named in ../references/host-interaction-contract.md to create and
maintain a short task list.
When more than one logging posture is viable:
- present 2-3 portable predicted options by default
- put the recommended option first
- keep the differences operational, not stylistic
- rely on the host's native freeform final path when it exists
Do not start with an open-ended question when adjacent code and runtime needs
already suggest the likely choices.
Input
#$ARGUMENTS
If blank, inspect the current repo's logger setup and logging patterns first.
Reference Loading Map
Do not load every reference by default. Load only what the current phase needs:
- Read
references/wide-events.md when shaping event strategy.
- Read
references/schema-contract.md when defining required fields and naming.
- Read
references/operability-patterns.md when the path involves retries,
queues, degraded modes, dependency failures, or hot-path production behavior.
- Read
references/review-checklist.md when auditing an existing diff or code
path.
Core Principles
- Log what happened, not what your code is thinking - prefer outcome
events over scattered narration.
- Use one canonical event per request, job, or service hop when practical
- enrich context throughout the flow, then emit once on completion.
- Structured fields beat string search - use consistent names and machine-
queryable values.
- Correlation is mandatory - request IDs, trace IDs, job IDs, message IDs,
and tenant IDs make distributed behavior reconstructable.
- Business and deployment context matter - environment, version, feature
flags, and actor or object identifiers often decide whether a failure is
understandable.
- One logger configuration per app surface - do not spawn ad hoc logger
shapes in random modules.
- Do not leak secrets or sensitive data - debug value is not a license to
dump credentials, tokens, or unsafe payloads.
- Logs should help operators act - include the fields that explain retries,
degraded modes, backlog, dependency failures, or next state when those
behaviors are in play.
- Distill, do not lecture - present condensed Flywheel logging guidance,
not a source summary.
Workflow
Phase 1: Ground the Existing Shape
Inspect:
- logger wrappers, helpers, and configuration
- middleware, interceptors, or request hooks
- adjacent event names and field conventions
- any observability docs or search examples
Prefer extending what exists over introducing a second logging idiom.
Phase 2: Define the Event Model
For the relevant request, job, or message flow:
- decide the canonical event name
- define required identifiers and stable context fields
- define outcome, status, duration, and error fields
- decide where the event is enriched and where it is emitted
- choose whether the best shape is:
- one canonical outcome event
- one canonical outcome event plus a few explicit state-transition events
- a narrower additive event that extends an existing repo pattern
When tradeoffs are real, present the likely choices with a recommended option
and a host-native freeform path rather than improvising silently.
Phase 3: Audit for Logging Quality
Call out:
- scattered low-context log lines
- missing correlation fields
- inconsistent field names
- missing business or deployment context
- string-only logs where structured output is already normal in the repo
- logger duplication or ad hoc configuration
Output Contract
Return a concise logging brief in this order:
- Current logging truth — what the repo already does on this path
- Relevant flow — request, job, message, dependency call, or other runtime
surface being shaped or reviewed
- Recommended logging shape — event names, key fields, and emission points
- Choice surface — predicted options plus recommendation when tradeoffs are
real; otherwise say no material tradeoff
- Gap report — concrete weaknesses, inconsistencies, or missing signals
- Next move — direct implementation guidance or phased migration steps
Included References
@./references/wide-events.md
@./references/schema-contract.md
@./references/operability-patterns.md
@./references/review-checklist.md
1---2name: logging3description: Design or review structured logging. Use when runtime behavior needs useful events, stable fields, or correlation IDs.4---56# Logging78Good logging is not "more lines." Good logging makes live behavior legible.910This skill is for:1112- designing new log events13- auditing an existing logging approach14- reviewing whether a change extends the repo's logging usefully15- migrating from scattered log lines toward more usable structured events1617**When directly invoked, always do logging work.** Produce a design, audit, or18gap report grounded in the repo's existing logging truth.1920## Interaction Method2122Follow `../references/host-interaction-contract.md`.2324Call the exact host question tool named in25`../references/host-interaction-contract.md` when that tool is available. Do26not ask for raw `1/2/3` replies when the host already offers a choice surface.2728When the workflow spans multiple material steps, use the host task-tracking29tool named in `../references/host-interaction-contract.md` to create and30maintain a short task list.3132When more than one logging posture is viable:3334- present 2-3 portable predicted options by default35- put the recommended option first36- keep the differences operational, not stylistic37- rely on the host's native freeform final path when it exists3839Do not start with an open-ended question when adjacent code and runtime needs40already suggest the likely choices.4142## Input4344<logging_input> #$ARGUMENTS </logging_input>4546If blank, inspect the current repo's logger setup and logging patterns first.4748## Reference Loading Map4950Do not load every reference by default. Load only what the current phase needs:5152- Read `references/wide-events.md` when shaping event strategy.53- Read `references/schema-contract.md` when defining required fields and naming.54- Read `references/operability-patterns.md` when the path involves retries,55 queues, degraded modes, dependency failures, or hot-path production behavior.56- Read `references/review-checklist.md` when auditing an existing diff or code57 path.5859## Core Principles60611. **Log what happened, not what your code is thinking** - prefer outcome62 events over scattered narration.632. **Use one canonical event per request, job, or service hop when practical**64 - enrich context throughout the flow, then emit once on completion.653. **Structured fields beat string search** - use consistent names and machine-66 queryable values.674. **Correlation is mandatory** - request IDs, trace IDs, job IDs, message IDs,68 and tenant IDs make distributed behavior reconstructable.695. **Business and deployment context matter** - environment, version, feature70 flags, and actor or object identifiers often decide whether a failure is71 understandable.726. **One logger configuration per app surface** - do not spawn ad hoc logger73 shapes in random modules.747. **Do not leak secrets or sensitive data** - debug value is not a license to75 dump credentials, tokens, or unsafe payloads.768. **Logs should help operators act** - include the fields that explain retries,77 degraded modes, backlog, dependency failures, or next state when those78 behaviors are in play.799. **Distill, do not lecture** - present condensed Flywheel logging guidance,80 not a source summary.8182## Workflow8384### Phase 1: Ground the Existing Shape8586Inspect:8788- logger wrappers, helpers, and configuration89- middleware, interceptors, or request hooks90- adjacent event names and field conventions91- any observability docs or search examples9293Prefer extending what exists over introducing a second logging idiom.9495### Phase 2: Define the Event Model9697For the relevant request, job, or message flow:9899- decide the canonical event name100- define required identifiers and stable context fields101- define outcome, status, duration, and error fields102- decide where the event is enriched and where it is emitted103- choose whether the best shape is:104 - one canonical outcome event105 - one canonical outcome event plus a few explicit state-transition events106 - a narrower additive event that extends an existing repo pattern107108When tradeoffs are real, present the likely choices with a recommended option109and a host-native freeform path rather than improvising silently.110111### Phase 3: Audit for Logging Quality112113Call out:114115- scattered low-context log lines116- missing correlation fields117- inconsistent field names118- missing business or deployment context119- string-only logs where structured output is already normal in the repo120- logger duplication or ad hoc configuration121122## Output Contract123124Return a concise logging brief in this order:1251261. **Current logging truth** — what the repo already does on this path1272. **Relevant flow** — request, job, message, dependency call, or other runtime128 surface being shaped or reviewed1293. **Recommended logging shape** — event names, key fields, and emission points1304. **Choice surface** — predicted options plus recommendation when tradeoffs are131 real; otherwise say no material tradeoff1325. **Gap report** — concrete weaknesses, inconsistencies, or missing signals1336. **Next move** — direct implementation guidance or phased migration steps134135---136137## Included References138139@./references/wide-events.md140@./references/schema-contract.md141@./references/operability-patterns.md142@./references/review-checklist.md