[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7C0EPTTY787AYBA905QTCK6":3,"skill-same:01M7C0EPTTY787AYBA905QTCK6":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":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":27,"commitSha":28,"skillDirectory":29,"forksCount":30,"repositoryHtmlUrl":31,"repositoryHomepageUrl":6,"ownerHtmlUrl":32,"ownerBlogUrl":6,"ownerDescription":33,"updatedAt":34,"install":35,"resources":48},"01M7C0EPTTY787AYBA905QTCK6","logging-best-practices",null,"Logging best practices focused on wide events (canonical log lines) for powerful debugging and analytics","FarisHijazi\u002Fdotclaude","FarisHijazi","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F47270244?v=4","01M7C0C0QMQFPCNMGAJEYZXQEW","Faris Hijazi","01M7C0C0R7ECSSPP6GNPTMMJBV",1,"MIT","https:\u002F\u002Fgithub.com\u002FFarisHijazi\u002Fdotclaude\u002Fblob\u002Fmaster\u002Fskills\u002Flogging-best-practices\u002FSKILL.md",[],[],"2026-11-15 14:19:17",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":24,"description":7},{"author":25,"version":26},"boristane","1.0.0","master","4ac19257e9aa57a0af1557880fb4d8aa50d67f71","skills\u002Flogging-best-practices",0,"https:\u002F\u002Fgithub.com\u002FFarisHijazi\u002Fdotclaude","https:\u002F\u002Fgithub.com\u002FFarisHijazi","🇸🇦🇵🇸\r\nAI Researcher in Computer Vision\r\n\r\nScripts | Vision Foundation Models","2026-11-05 00:53:38",{"source":8,"skillName":5,"commands":36,"prompt":46,"zipAvailable":47},[37,40,43],{"tool":38,"command":39},"npx","npx skills add FarisHijazi\u002Fdotclaude --skill logging-best-practices",{"tool":41,"command":42},"bunx","bunx skills add FarisHijazi\u002Fdotclaude --skill logging-best-practices",{"tool":44,"command":45},"pnpm","pnpm dlx skills add FarisHijazi\u002Fdotclaude --skill logging-best-practices","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FFarisHijazi\u002Fdotclaude\u002Fblob\u002Fmaster\u002Fskills\u002Flogging-best-practices\u002FSKILL.md",true,[49,55,59,63,67],{"path":50,"resourceType":51,"resourceTypeDesc":52,"sizeBytes":53,"sourceHtmlUrl":54},"README.md","REFERENCE","参考文档",2102,"https:\u002F\u002Fgithub.com\u002FFarisHijazi\u002Fdotclaude\u002Fblob\u002Fmaster\u002Fskills\u002Flogging-best-practices\u002FREADME.md",{"path":56,"resourceType":51,"resourceTypeDesc":52,"sizeBytes":57,"sourceHtmlUrl":58},"rules\u002Fcontext.md",4806,"https:\u002F\u002Fgithub.com\u002FFarisHijazi\u002Fdotclaude\u002Fblob\u002Fmaster\u002Fskills\u002Flogging-best-practices\u002Frules\u002Fcontext.md",{"path":60,"resourceType":51,"resourceTypeDesc":52,"sizeBytes":61,"sourceHtmlUrl":62},"rules\u002Fpitfalls.md",3373,"https:\u002F\u002Fgithub.com\u002FFarisHijazi\u002Fdotclaude\u002Fblob\u002Fmaster\u002Fskills\u002Flogging-best-practices\u002Frules\u002Fpitfalls.md",{"path":64,"resourceType":51,"resourceTypeDesc":52,"sizeBytes":65,"sourceHtmlUrl":66},"rules\u002Fstructure.md",5942,"https:\u002F\u002Fgithub.com\u002FFarisHijazi\u002Fdotclaude\u002Fblob\u002Fmaster\u002Fskills\u002Flogging-best-practices\u002Frules\u002Fstructure.md",{"path":68,"resourceType":51,"resourceTypeDesc":52,"sizeBytes":69,"sourceHtmlUrl":70},"rules\u002Fwide-events.md",3629,"https:\u002F\u002Fgithub.com\u002FFarisHijazi\u002Fdotclaude\u002Fblob\u002Fmaster\u002Fskills\u002Flogging-best-practices\u002Frules\u002Fwide-events.md",[]]