Agent skill
script-kit-logging
Logging and observability patterns for Script Kit GPUI. Use when adding logs, debugging, or understanding the logging system. Covers JSONL format, compact AI log mode, correlation IDs, and error handling.
Install this agent skill to your Project
npx add-skill https://github.com/johnlindquist/script-kit-next/tree/main/.claude/skills/script-kit-logging
SKILL.md
Script Kit Logging
Structured logging patterns for debugging and observability.
AI Compact Log Mode (SCRIPT_KIT_AI_LOG=1)
Compact stderr format: SS.mmm|L|C|message
L:iINFO,wWARN,eERROR,dDEBUG,tTRACECcategories:Pposition,Aapp,UUI,Sstdin,HhotkeyVvisibility,Eexec,Kkey,Ffocus,TthemeCcache,Rperf,Wwindow_mgr,XerrorMmouse_hover,Lscroll_state,Qscroll_perfDdesign,Bscript,Nconfig,Zresize
Example:
- Standard:
... INFO ... Selected display origin=(0,0) - Compact:
13.150|i|P|Selected display origin=(0,0)
Enable:
SCRIPT_KIT_AI_LOG=1 ./target/debug/script-kit-gpui 2>&1
Log Modes
| Mode | Command | Use Case |
|---|---|---|
| Compact AI logs | SCRIPT_KIT_AI_LOG=1 |
Default for AI agents (saves ~70% tokens) |
| Full debug logs | RUST_LOG=debug |
Deep debugging |
| Specific module | RUST_LOG=script_kit::theme=debug |
Target one module |
JSONL Logging
Logs to: ~/.scriptkit/logs/script-kit-gpui.jsonl
Line example:
{"timestamp":"...","level":"INFO","target":"script_kit::executor","message":"Script executed","fields":{"script_name":"hello.ts","duration_ms":142,"exit_code":0}}
Tracing Patterns
Use tracing + tracing-subscriber:
#[instrument]for spans- Record
duration_ms; warn if slow (e.g. >100ms)
Correlation IDs:
- Generate UUID per user action/run
- Attach to spans so nested logs inherit it
Required fields when relevant: correlation_id, duration_ms, bead_id, agent_name, files_touched
Log Level Guide
error: failurewarn: unexpected but handledinfo: key eventsdebug: developmenttrace: very verbose
Filter by targets (module paths): script_kit::ui, script_kit::executor, script_kit::theme
Error Handling
- Application errors:
anyhow::Result; add.context()at boundaries - Domain/library errors:
thiserrorwhen callers match variants - User-facing errors:
NotifyResultExt→ log first (tracing::error!) then toast
Best practices:
- Don't
unwrap()/expect() - Add context at each level ("which file?", "what operation?")
- Use typed fields in logs (avoid interpolated strings)
Log Queries
grep '"correlation_id":"abc-123"' ~/.scriptkit/logs/script-kit-gpui.jsonl
grep '"duration_ms":' ~/.scriptkit/logs/script-kit-gpui.jsonl | jq 'select(.fields.duration_ms > 100)'
grep '"level":"ERROR"' ~/.scriptkit/logs/script-kit-gpui.jsonl | tail -50
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
Generate Component Documentation
Based on existing docs styles and specific API implementations, and referencing same name stories, generate comprehensive documentation for the new component.
Generate Component Story
Generate a comprehensive story for a new component for as example.
new-component
How to write a new component of GPUI Component.
troubleshooting
Diagnose and fix common Script Kit issues. Use when the user reports bugs, crashes, missing features, or unexpected behavior in Script Kit GPUI.
script-authoring
Create and manage TypeScript scripts for Script Kit. Use when the user wants to write a new script, edit an existing script, or understand Script Kit's SDK and metadata system.
agents
Create mdflow-backed agent files for Script Kit. Use when the user wants to create AI agents, configure agent backends (Claude, Gemini, Codex), or manage agent metadata.
Didn't find tool you were looking for?