[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6BXZNMDEV58SCC79J99JHA3":3,"skill-same:01M6BXZNMDEV58SCC79J99JHA3":71},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":24,"linkOnly":25,"markdownContent":26,"markdownBody":27,"frontMatter":28,"refName":32,"commitSha":33,"skillDirectory":34,"forksCount":14,"repositoryHtmlUrl":35,"repositoryHomepageUrl":6,"ownerHtmlUrl":36,"ownerBlogUrl":6,"ownerDescription":37,"updatedAt":38,"install":39,"resources":52},"01M6BXZNMDEV58SCC79J99JHA3","logging-best-practices",null,"Logging best practices focused on wide events (canonical log lines) for powerful debugging and analytics","r00tk1d\u002F.dev-setup","r00tk1d","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F25086447?v=4","01M6BXZJ4FBDAQQ87DA6H6C715","Michael Hirsch","01M6BXZJ9AT6AWJ9ASH6XFVJCE",0,"MIT","https:\u002F\u002Fgithub.com\u002Fr00tk1d\u002F.dev-setup\u002Fblob\u002Fmain\u002Fdotfiles\u002Fagents\u002F.agents\u002Fskills\u002Flogging-best-practices\u002FSKILL.md",[],[19,20,21,22,23],"best practices","logging","logging best practices","analytics","debugging","2026-11-10 10:12:30",false,"---\nname: logging-best-practices\ndescription: Logging best practices focused on wide events (canonical log lines) for powerful debugging and analytics\nlicense: MIT\nmetadata:\n  author: boristane\n  version: \"1.0.0\"\n---\n\n# Logging Best Practices Skill\n\nVersion: 1.0.0\n\n## Purpose\n\nThis skill provides guidelines for implementing effective logging in applications. It focuses on **wide events** (also called canonical log lines) - a pattern where you emit a single, context-rich event per request per service, enabling powerful debugging and analytics.\n\n## When to Apply\n\nApply these guidelines when:\n- Writing or reviewing logging code\n- Adding console.log, logger.info, or similar\n- Designing logging strategy for new services\n- Setting up logging infrastructure\n\n## Core Principles\n\n### 1. Wide Events (CRITICAL)\n\nEmit **one context-rich event per request per service**. Instead of scattering log lines throughout your handler, consolidate everything into a single structured event emitted at request completion.\n\n```typescript\nconst wideEvent: Record\u003Cstring, unknown> = {\n  method: 'POST',\n  path: '\u002Fcheckout',\n  requestId: c.get('requestId'),\n  timestamp: new Date().toISOString(),\n};\n\ntry {\n  const user = await getUser(c.get('userId'));\n  wideEvent.user = { id: user.id, subscription: user.subscription };\n\n  const cart = await getCart(user.id);\n  wideEvent.cart = { total_cents: cart.total, item_count: cart.items.length };\n\n  wideEvent.status_code = 200;\n  wideEvent.outcome = 'success';\n  return c.json({ success: true });\n} catch (error) {\n  wideEvent.status_code = 500;\n  wideEvent.outcome = 'error';\n  wideEvent.error = { message: error.message, type: error.name };\n  throw error;\n} finally {\n  wideEvent.duration_ms = Date.now() - startTime;\n  logger.info(wideEvent);\n}\n```\n\n### 2. High Cardinality & Dimensionality (CRITICAL)\n\nInclude fields with high cardinality (user IDs, request IDs - millions of unique values) and high dimensionality (many fields per event). This enables querying by specific users and answering questions you haven't anticipated yet.\n\n### 3. Business Context (CRITICAL)\n\nAlways include business context: user subscription tier, cart value, feature flags, account age. The goal is to know \"a premium customer couldn't complete a $2,499 purchase\" not just \"checkout failed.\"\n\n### 4. Environment Characteristics (CRITICAL)\n\nInclude environment and deployment info in every event: commit hash, service version, region, instance ID. This enables correlating issues with deployments and identifying region-specific problems.\n\n### 5. Single Logger (HIGH)\n\nUse one logger instance configured at startup and import it everywhere. This ensures consistent formatting and automatic environment context.\n\n### 6. Middleware Pattern (HIGH)\n\nUse middleware to handle wide event infrastructure (timing, status, environment, emission). Handlers should only add business context.\n\n### 7. Structure & Consistency (HIGH)\n\n- Use JSON format consistently\n- Maintain consistent field names across services\n- Simplify to two log levels: `info` and `error`\n- Never log unstructured strings\n\n## Anti-Patterns to Avoid\n\n1. **Scattered logs**: Multiple console.log() calls per request\n2. **Multiple loggers**: Different logger instances in different files\n3. **Missing environment context**: No commit hash or deployment info\n4. **Missing business context**: Logging technical details without user\u002Fbusiness data\n5. **Unstructured strings**: `console.log('something happened')` instead of structured data\n6. **Inconsistent schemas**: Different field names across services\n\n## Guidelines\n\n### Wide Events (`rules\u002Fwide-events.md`)\n- Emit one wide event per service hop\n- Include all relevant context\n- Connect events with request ID\n- Emit at request completion in finally block\n\n### Context (`rules\u002Fcontext.md`)\n- Support high cardinality fields (user_id, request_id)\n- Include high dimensionality (many fields)\n- Always include business context\n- Always include environment characteristics (commit_hash, version, region)\n\n### Structure (`rules\u002Fstructure.md`)\n- Use a single logger throughout the codebase\n- Use middleware for consistent wide events\n- Use JSON format\n- Maintain consistent schema\n- Simplify to info and error levels\n- Never log unstructured strings\n\n### Common Pitfalls (`rules\u002Fpitfalls.md`)\n- Avoid multiple log lines per request\n- Design for unknown unknowns\n- Always propagate request IDs across services\n\nReferences:\n- [Logging Sucks](https:\u002F\u002Floggingsucks.com)\n- [Observability Wide Events 101](https:\u002F\u002Fboristane.com\u002Fblog\u002Fobservability-wide-events-101\u002F)\n- [Stripe - Canonical Log Lines](https:\u002F\u002Fstripe.com\u002Fblog\u002Fcanonical-log-lines)\n","# Logging Best Practices Skill\n\nVersion: 1.0.0\n\n## Purpose\n\nThis skill provides guidelines for implementing effective logging in applications. It focuses on **wide events** (also called canonical log lines) - a pattern where you emit a single, context-rich event per request per service, enabling powerful debugging and analytics.\n\n## When to Apply\n\nApply these guidelines when:\n- Writing or reviewing logging code\n- Adding console.log, logger.info, or similar\n- Designing logging strategy for new services\n- Setting up logging infrastructure\n\n## Core Principles\n\n### 1. Wide Events (CRITICAL)\n\nEmit **one context-rich event per request per service**. Instead of scattering log lines throughout your handler, consolidate everything into a single structured event emitted at request completion.\n\n```typescript\nconst wideEvent: Record\u003Cstring, unknown> = {\n  method: 'POST',\n  path: '\u002Fcheckout',\n  requestId: c.get('requestId'),\n  timestamp: new Date().toISOString(),\n};\n\ntry {\n  const user = await getUser(c.get('userId'));\n  wideEvent.user = { id: user.id, subscription: user.subscription };\n\n  const cart = await getCart(user.id);\n  wideEvent.cart = { total_cents: cart.total, item_count: cart.items.length };\n\n  wideEvent.status_code = 200;\n  wideEvent.outcome = 'success';\n  return c.json({ success: true });\n} catch (error) {\n  wideEvent.status_code = 500;\n  wideEvent.outcome = 'error';\n  wideEvent.error = { message: error.message, type: error.name };\n  throw error;\n} finally {\n  wideEvent.duration_ms = Date.now() - startTime;\n  logger.info(wideEvent);\n}\n```\n\n### 2. High Cardinality & Dimensionality (CRITICAL)\n\nInclude fields with high cardinality (user IDs, request IDs - millions of unique values) and high dimensionality (many fields per event). This enables querying by specific users and answering questions you haven't anticipated yet.\n\n### 3. Business Context (CRITICAL)\n\nAlways include business context: user subscription tier, cart value, feature flags, account age. The goal is to know \"a premium customer couldn't complete a $2,499 purchase\" not just \"checkout failed.\"\n\n### 4. Environment Characteristics (CRITICAL)\n\nInclude environment and deployment info in every event: commit hash, service version, region, instance ID. This enables correlating issues with deployments and identifying region-specific problems.\n\n### 5. Single Logger (HIGH)\n\nUse one logger instance configured at startup and import it everywhere. This ensures consistent formatting and automatic environment context.\n\n### 6. Middleware Pattern (HIGH)\n\nUse middleware to handle wide event infrastructure (timing, status, environment, emission). Handlers should only add business context.\n\n### 7. Structure & Consistency (HIGH)\n\n- Use JSON format consistently\n- Maintain consistent field names across services\n- Simplify to two log levels: `info` and `error`\n- Never log unstructured strings\n\n## Anti-Patterns to Avoid\n\n1. **Scattered logs**: Multiple console.log() calls per request\n2. **Multiple loggers**: Different logger instances in different files\n3. **Missing environment context**: No commit hash or deployment info\n4. **Missing business context**: Logging technical details without user\u002Fbusiness data\n5. **Unstructured strings**: `console.log('something happened')` instead of structured data\n6. **Inconsistent schemas**: Different field names across services\n\n## Guidelines\n\n### Wide Events (`rules\u002Fwide-events.md`)\n- Emit one wide event per service hop\n- Include all relevant context\n- Connect events with request ID\n- Emit at request completion in finally block\n\n### Context (`rules\u002Fcontext.md`)\n- Support high cardinality fields (user_id, request_id)\n- Include high dimensionality (many fields)\n- Always include business context\n- Always include environment characteristics (commit_hash, version, region)\n\n### Structure (`rules\u002Fstructure.md`)\n- Use a single logger throughout the codebase\n- Use middleware for consistent wide events\n- Use JSON format\n- Maintain consistent schema\n- Simplify to info and error levels\n- Never log unstructured strings\n\n### Common Pitfalls (`rules\u002Fpitfalls.md`)\n- Avoid multiple log lines per request\n- Design for unknown unknowns\n- Always propagate request IDs across services\n\nReferences:\n- [Logging Sucks](https:\u002F\u002Floggingsucks.com)\n- [Observability Wide Events 101](https:\u002F\u002Fboristane.com\u002Fblog\u002Fobservability-wide-events-101\u002F)\n- [Stripe - Canonical Log Lines](https:\u002F\u002Fstripe.com\u002Fblog\u002Fcanonical-log-lines)\n",{"name":5,"license":15,"metadata":29,"description":7},{"author":30,"version":31},"boristane","1.0.0","main","21ff144fe4e19c6c2fab4cc812422f60c9908184","dotfiles\u002Fagents\u002F.agents\u002Fskills\u002Flogging-best-practices","https:\u002F\u002Fgithub.com\u002Fr00tk1d\u002F.dev-setup","https:\u002F\u002Fgithub.com\u002Fr00tk1d","Backend Developer","2026-10-11 19:54:49",{"source":8,"skillName":5,"commands":40,"prompt":50,"zipAvailable":51},[41,44,47],{"tool":42,"command":43},"npx","npx skills add r00tk1d\u002F.dev-setup --skill logging-best-practices",{"tool":45,"command":46},"bunx","bunx skills add r00tk1d\u002F.dev-setup --skill logging-best-practices",{"tool":48,"command":49},"pnpm","pnpm dlx skills add r00tk1d\u002F.dev-setup --skill logging-best-practices","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fr00tk1d\u002F.dev-setup\u002Fblob\u002Fmain\u002Fdotfiles\u002Fagents\u002F.agents\u002Fskills\u002Flogging-best-practices\u002FSKILL.md",true,[53,59,63,67],{"path":54,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":57,"sourceHtmlUrl":58},"rules\u002Fcontext.md","REFERENCE","参考文档",4806,"https:\u002F\u002Fgithub.com\u002Fr00tk1d\u002F.dev-setup\u002Fblob\u002Fmain\u002Fdotfiles\u002Fagents\u002F.agents\u002Fskills\u002Flogging-best-practices\u002Frules\u002Fcontext.md",{"path":60,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":61,"sourceHtmlUrl":62},"rules\u002Fpitfalls.md",3373,"https:\u002F\u002Fgithub.com\u002Fr00tk1d\u002F.dev-setup\u002Fblob\u002Fmain\u002Fdotfiles\u002Fagents\u002F.agents\u002Fskills\u002Flogging-best-practices\u002Frules\u002Fpitfalls.md",{"path":64,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":65,"sourceHtmlUrl":66},"rules\u002Fstructure.md",5942,"https:\u002F\u002Fgithub.com\u002Fr00tk1d\u002F.dev-setup\u002Fblob\u002Fmain\u002Fdotfiles\u002Fagents\u002F.agents\u002Fskills\u002Flogging-best-practices\u002Frules\u002Fstructure.md",{"path":68,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":69,"sourceHtmlUrl":70},"rules\u002Fwide-events.md",3629,"https:\u002F\u002Fgithub.com\u002Fr00tk1d\u002F.dev-setup\u002Fblob\u002Fmain\u002Fdotfiles\u002Fagents\u002F.agents\u002Fskills\u002Flogging-best-practices\u002Frules\u002Fwide-events.md",[]]