[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7AWV5SPVB39AM9WA1A116ZG":3,"skill-same:01M7AWV5SPVB39AM9WA1A116ZG":44},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":26,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":29,"install":30,"resources":43},"01M7AWV5SPVB39AM9WA1A116ZG","m13-domain-error",null,"Use when designing domain error handling. Keywords: domain error, error categorization, recovery strategy, retry, fallback, domain error hierarchy, user-facing vs internal errors, error code design, circuit breaker, graceful degradation, resilience, error context, backoff, retry with backoff, error recovery, transient vs permanent error, 领域错误, 错误分类, 恢复策略, 重试, 熔断器, 优雅降级","wxxb789\u002Fmarkturbo","wxxb789","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F49564443?v=4","01M7AWR3AB19SNE4ATARY9KV3W","01M7AWR3AZ5Y5ADAY47KF3RBRJ",1,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fm13-domain-error\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: m13-domain-error\ndescription: \"Use when designing domain error handling. Keywords: domain error, error categorization, recovery strategy, retry, fallback, domain error hierarchy, user-facing vs internal errors, error code design, circuit breaker, graceful degradation, resilience, error context, backoff, retry with backoff, error recovery, transient vs permanent error, 领域错误, 错误分类, 恢复策略, 重试, 熔断器, 优雅降级\"\nuser-invocable: false\n---\n\n# Domain Error Strategy\n\n> **Layer 2: Design Choices**\n\n## Core Question\n\n**Who needs to handle this error, and how should they recover?**\n\nBefore designing error types:\n- Is this user-facing or internal?\n- Is recovery possible?\n- What context is needed for debugging?\n\n---\n\n## Error Categorization\n\n| Error Type | Audience | Recovery | Example |\n|------------|----------|----------|---------|\n| User-facing | End users | Guide action | `InvalidEmail`, `NotFound` |\n| Internal | Developers | Debug info | `DatabaseError`, `ParseError` |\n| System | Ops\u002FSRE | Monitor\u002Falert | `ConnectionTimeout`, `RateLimited` |\n| Transient | Automation | Retry | `NetworkError`, `ServiceUnavailable` |\n| Permanent | Human | Investigate | `ConfigInvalid`, `DataCorrupted` |\n\n---\n\n## Thinking Prompt\n\nBefore designing error types:\n\n1. **Who sees this error?**\n   - End user → friendly message, actionable\n   - Developer → detailed, debuggable\n   - Ops → structured, alertable\n\n2. **Can we recover?**\n   - Transient → retry with backoff\n   - Degradable → fallback value\n   - Permanent → fail fast, alert\n\n3. **What context is needed?**\n   - Call chain → anyhow::Context\n   - Request ID → structured logging\n   - Input data → error payload\n\n---\n\n## Trace Up ↑\n\nTo domain constraints (Layer 3):\n\n```\n\"How should I handle payment failures?\"\n    ↑ Ask: What are the business rules for retries?\n    ↑ Check: domain-fintech (transaction requirements)\n    ↑ Check: SLA (availability requirements)\n```\n\n| Question | Trace To | Ask |\n|----------|----------|-----|\n| Retry policy | domain-* | What's acceptable latency for retry? |\n| User experience | domain-* | What message should users see? |\n| Compliance | domain-* | What must be logged for audit? |\n\n---\n\n## Trace Down ↓\n\nTo implementation (Layer 1):\n\n```\n\"Need typed errors\"\n    ↓ m06-error-handling: thiserror for library\n    ↓ m04-zero-cost: Error enum design\n\n\"Need error context\"\n    ↓ m06-error-handling: anyhow::Context\n    ↓ Logging: tracing with fields\n\n\"Need retry logic\"\n    ↓ m07-concurrency: async retry patterns\n    ↓ Crates: tokio-retry, backoff\n```\n\n---\n\n## Quick Reference\n\n| Recovery Pattern | When | Implementation |\n|------------------|------|----------------|\n| Retry | Transient failures | exponential backoff |\n| Fallback | Degraded mode | cached\u002Fdefault value |\n| Circuit Breaker | Cascading failures | failsafe-rs |\n| Timeout | Slow operations | `tokio::time::timeout` |\n| Bulkhead | Isolation | separate thread pools |\n\n## Error Hierarchy\n\n```rust\n#[derive(thiserror::Error, Debug)]\npub enum AppError {\n    \u002F\u002F User-facing\n    #[error(\"Invalid input: {0}\")]\n    Validation(String),\n\n    \u002F\u002F Transient (retryable)\n    #[error(\"Service temporarily unavailable\")]\n    ServiceUnavailable(#[source] reqwest::Error),\n\n    \u002F\u002F Internal (log details, show generic)\n    #[error(\"Internal error\")]\n    Internal(#[source] anyhow::Error),\n}\n\nimpl AppError {\n    pub fn is_retryable(&self) -> bool {\n        matches!(self, Self::ServiceUnavailable(_))\n    }\n}\n```\n\n## Retry Pattern\n\n```rust\nuse tokio_retry::{Retry, strategy::ExponentialBackoff};\n\nasync fn with_retry\u003CF, T, E>(f: F) -> Result\u003CT, E>\nwhere\n    F: Fn() -> impl Future\u003COutput = Result\u003CT, E>>,\n    E: std::fmt::Debug,\n{\n    let strategy = ExponentialBackoff::from_millis(100)\n        .max_delay(Duration::from_secs(10))\n        .take(5);\n\n    Retry::spawn(strategy, || f()).await\n}\n```\n\n---\n\n## Common Mistakes\n\n| Mistake | Why Wrong | Better |\n|---------|-----------|--------|\n| Same error for all | No actionability | Categorize by audience |\n| Retry everything | Wasted resources | Only transient errors |\n| Infinite retry | DoS self | Max attempts + backoff |\n| Expose internal errors | Security risk | User-friendly messages |\n| No context | Hard to debug | .context() everywhere |\n\n---\n\n## Anti-Patterns\n\n| Anti-Pattern | Why Bad | Better |\n|--------------|---------|--------|\n| String errors | No structure | thiserror types |\n| panic! for recoverable | Bad UX | Result with context |\n| Ignore errors | Silent failures | Log or propagate |\n| Box\u003Cdyn Error> everywhere | Lost type info | thiserror |\n| Error in happy path | Performance | Early validation |\n\n---\n\n## Related Skills\n\n| When | See |\n|------|-----|\n| Error handling basics | m06-error-handling |\n| Retry implementation | m07-concurrency |\n| Domain modeling | m09-domain |\n| User-facing APIs | domain-* |\n","# Domain Error Strategy\n\n> **Layer 2: Design Choices**\n\n## Core Question\n\n**Who needs to handle this error, and how should they recover?**\n\nBefore designing error types:\n- Is this user-facing or internal?\n- Is recovery possible?\n- What context is needed for debugging?\n\n---\n\n## Error Categorization\n\n| Error Type | Audience | Recovery | Example |\n|------------|----------|----------|---------|\n| User-facing | End users | Guide action | `InvalidEmail`, `NotFound` |\n| Internal | Developers | Debug info | `DatabaseError`, `ParseError` |\n| System | Ops\u002FSRE | Monitor\u002Falert | `ConnectionTimeout`, `RateLimited` |\n| Transient | Automation | Retry | `NetworkError`, `ServiceUnavailable` |\n| Permanent | Human | Investigate | `ConfigInvalid`, `DataCorrupted` |\n\n---\n\n## Thinking Prompt\n\nBefore designing error types:\n\n1. **Who sees this error?**\n   - End user → friendly message, actionable\n   - Developer → detailed, debuggable\n   - Ops → structured, alertable\n\n2. **Can we recover?**\n   - Transient → retry with backoff\n   - Degradable → fallback value\n   - Permanent → fail fast, alert\n\n3. **What context is needed?**\n   - Call chain → anyhow::Context\n   - Request ID → structured logging\n   - Input data → error payload\n\n---\n\n## Trace Up ↑\n\nTo domain constraints (Layer 3):\n\n```\n\"How should I handle payment failures?\"\n    ↑ Ask: What are the business rules for retries?\n    ↑ Check: domain-fintech (transaction requirements)\n    ↑ Check: SLA (availability requirements)\n```\n\n| Question | Trace To | Ask |\n|----------|----------|-----|\n| Retry policy | domain-* | What's acceptable latency for retry? |\n| User experience | domain-* | What message should users see? |\n| Compliance | domain-* | What must be logged for audit? |\n\n---\n\n## Trace Down ↓\n\nTo implementation (Layer 1):\n\n```\n\"Need typed errors\"\n    ↓ m06-error-handling: thiserror for library\n    ↓ m04-zero-cost: Error enum design\n\n\"Need error context\"\n    ↓ m06-error-handling: anyhow::Context\n    ↓ Logging: tracing with fields\n\n\"Need retry logic\"\n    ↓ m07-concurrency: async retry patterns\n    ↓ Crates: tokio-retry, backoff\n```\n\n---\n\n## Quick Reference\n\n| Recovery Pattern | When | Implementation |\n|------------------|------|----------------|\n| Retry | Transient failures | exponential backoff |\n| Fallback | Degraded mode | cached\u002Fdefault value |\n| Circuit Breaker | Cascading failures | failsafe-rs |\n| Timeout | Slow operations | `tokio::time::timeout` |\n| Bulkhead | Isolation | separate thread pools |\n\n## Error Hierarchy\n\n```rust\n#[derive(thiserror::Error, Debug)]\npub enum AppError {\n    \u002F\u002F User-facing\n    #[error(\"Invalid input: {0}\")]\n    Validation(String),\n\n    \u002F\u002F Transient (retryable)\n    #[error(\"Service temporarily unavailable\")]\n    ServiceUnavailable(#[source] reqwest::Error),\n\n    \u002F\u002F Internal (log details, show generic)\n    #[error(\"Internal error\")]\n    Internal(#[source] anyhow::Error),\n}\n\nimpl AppError {\n    pub fn is_retryable(&self) -> bool {\n        matches!(self, Self::ServiceUnavailable(_))\n    }\n}\n```\n\n## Retry Pattern\n\n```rust\nuse tokio_retry::{Retry, strategy::ExponentialBackoff};\n\nasync fn with_retry\u003CF, T, E>(f: F) -> Result\u003CT, E>\nwhere\n    F: Fn() -> impl Future\u003COutput = Result\u003CT, E>>,\n    E: std::fmt::Debug,\n{\n    let strategy = ExponentialBackoff::from_millis(100)\n        .max_delay(Duration::from_secs(10))\n        .take(5);\n\n    Retry::spawn(strategy, || f()).await\n}\n```\n\n---\n\n## Common Mistakes\n\n| Mistake | Why Wrong | Better |\n|---------|-----------|--------|\n| Same error for all | No actionability | Categorize by audience |\n| Retry everything | Wasted resources | Only transient errors |\n| Infinite retry | DoS self | Max attempts + backoff |\n| Expose internal errors | Security risk | User-friendly messages |\n| No context | Hard to debug | .context() everywhere |\n\n---\n\n## Anti-Patterns\n\n| Anti-Pattern | Why Bad | Better |\n|--------------|---------|--------|\n| String errors | No structure | thiserror types |\n| panic! for recoverable | Bad UX | Result with context |\n| Ignore errors | Silent failures | Log or propagate |\n| Box\u003Cdyn Error> everywhere | Lost type info | thiserror |\n| Error in happy path | Performance | Early validation |\n\n---\n\n## Related Skills\n\n| When | See |\n|------|-----|\n| Error handling basics | m06-error-handling |\n| Retry implementation | m07-concurrency |\n| Domain modeling | m09-domain |\n| User-facing APIs | domain-* |\n",{"name":5,"description":7,"user-invocable":19},"main","0f3f41ed51c357d4f79561a132514089c1aaa97d",".agents\u002Fskills\u002Fm13-domain-error",0,"https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo","https:\u002F\u002Fgithub.com\u002Fwxxb789","2026-11-15 04:06:53",{"source":8,"skillName":5,"commands":31,"prompt":41,"zipAvailable":42},[32,35,38],{"tool":33,"command":34},"npx","npx skills add wxxb789\u002Fmarkturbo --skill m13-domain-error",{"tool":36,"command":37},"bunx","bunx skills add wxxb789\u002Fmarkturbo --skill m13-domain-error",{"tool":39,"command":40},"pnpm","pnpm dlx skills add wxxb789\u002Fmarkturbo --skill m13-domain-error","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fm13-domain-error\u002FSKILL.md",true,[],[45,52,58,65,72,78],{"skillNo":46,"name":47,"nameZh":6,"description":48,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":49,"categories":50,"keywords":51,"publishedAt":18},"01M7AWXVVZ6JEJVFGGT2WBSEN0","hello-diagrams","A valid, fully-populated Agent Skill, shown here so the Skills inspector has something correct to display.","https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo\u002Fblob\u002Fmain\u002Fsample\u002F.claude\u002Fskills\u002Fhello-diagrams\u002FSKILL.md",[],[],{"skillNo":53,"name":54,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":55,"categories":56,"keywords":57,"publishedAt":18},"01M7AWXTNG6ZV6WW5CHJZXJYEC","Broken-Example","https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo\u002Fblob\u002Fmain\u002Fsample\u002F.claude\u002Fskills\u002Fbroken-example\u002FSKILL.md",[],[],{"skillNo":59,"name":60,"nameZh":6,"description":61,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":62,"categories":63,"keywords":64,"publishedAt":18},"01M7AWXS5WN306ENF2MYJYP7VM","valid-skill","A fully conformant skill with every optional field populated.","https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo\u002Fblob\u002Fmain\u002Ffixtures\u002Fskills\u002Fskills\u002Fvalid-skill\u002FSKILL.md",[],[],{"skillNo":66,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":18},"01M7AWXR0NY08YVHE0G8VTJJ97","a-different-name","The name does not match the directory, which is a conformance warning.","https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo\u002Fblob\u002Fmain\u002Ffixtures\u002Fskills\u002Fskills\u002Fname-mismatch\u002FSKILL.md",[],[],{"skillNo":73,"name":74,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":18},"01M7AWXQ5EV9JCA0WG9Q1WB13Y","missing-metadata","https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo\u002Fblob\u002Fmain\u002Ffixtures\u002Fskills\u002Fskills\u002Fmissing-metadata\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":18},"01M7AWXP8GT7FATM53B914ZN50","malformed-yaml","https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo\u002Fblob\u002Fmain\u002Ffixtures\u002Fskills\u002Fskills\u002Fmalformed-yaml\u002FSKILL.md",[],[]]