[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75G9DHT1EQ17CK93DT4WN4X":3,"skill-same:01M75G9DHT1EQ17CK93DT4WN4X":50},{"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},"01M75G9DHT1EQ17CK93DT4WN4X","python-resilience",null,"Python resilience patterns including automatic retries, exponential backoff, timeouts, and fault-tolerant decorators. Use when adding retry logic, implementing timeouts, building fault-tolerant services, or handling transient failures.","RudyCity\u002Fsuperagent","RudyCity","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F82188919?v=4","01M75FP5X8AW8ACBH0SH34WS7M","01M75FP5YAHJK8M1Q52BWXB82K",70,"MIT","https:\u002F\u002Fgithub.com\u002FRudyCity\u002Fsuperagent\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fpython-resilience\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: python-resilience\ndescription: Python resilience patterns including automatic retries, exponential backoff, timeouts, and fault-tolerant decorators. Use when adding retry logic, implementing timeouts, building fault-tolerant services, or handling transient failures.\n---\n\n# Python Resilience Patterns\n\nBuild fault-tolerant Python applications that gracefully handle transient failures, network issues, and service outages. Resilience patterns keep systems running when dependencies are unreliable.\n\n## When to Use This Skill\n\n- Adding retry logic to external service calls\n- Implementing timeouts for network operations\n- Building fault-tolerant microservices\n- Handling rate limiting and backpressure\n- Creating infrastructure decorators\n- Designing circuit breakers\n\n## Core Concepts\n\n### 1. Transient vs Permanent Failures\n\nRetry transient errors (network timeouts, temporary service issues). Don't retry permanent errors (invalid credentials, bad requests).\n\n### 2. Exponential Backoff\n\nIncrease wait time between retries to avoid overwhelming recovering services.\n\n### 3. Jitter\n\nAdd randomness to backoff to prevent thundering herd when many clients retry simultaneously.\n\n### 4. Bounded Retries\n\nCap both attempt count and total duration to prevent infinite retry loops.\n\n## Quick Start\n\n```python\nfrom tenacity import retry, stop_after_attempt, wait_exponential_jitter\n\n@retry(\n    stop=stop_after_attempt(3),\n    wait=wait_exponential_jitter(initial=1, max=10),\n)\ndef call_external_service(request: dict) -> dict:\n    return httpx.post(\"https:\u002F\u002Fapi.example.com\", json=request).json()\n```\n\n## Fundamental Patterns\n\n### Pattern 1: Basic Retry with Tenacity\n\nUse the `tenacity` library for production-grade retry logic. For simpler cases, consider built-in retry functionality or a lightweight custom implementation.\n\n```python\nfrom tenacity import (\n    retry,\n    stop_after_attempt,\n    stop_after_delay,\n    wait_exponential_jitter,\n    retry_if_exception_type,\n)\n\nTRANSIENT_ERRORS = (ConnectionError, TimeoutError, OSError)\n\n@retry(\n    retry=retry_if_exception_type(TRANSIENT_ERRORS),\n    stop=stop_after_attempt(5) | stop_after_delay(60),\n    wait=wait_exponential_jitter(initial=1, max=30),\n)\ndef fetch_data(url: str) -> dict:\n    \"\"\"Fetch data with automatic retry on transient failures.\"\"\"\n    response = httpx.get(url, timeout=30)\n    response.raise_for_status()\n    return response.json()\n```\n\n### Pattern 2: Retry Only Appropriate Errors\n\nWhitelist specific transient exceptions. Never retry:\n\n- `ValueError`, `TypeError` - These are bugs, not transient issues\n- `AuthenticationError` - Invalid credentials won't become valid\n- HTTP 4xx errors (except 429) - Client errors are permanent\n\n```python\nfrom tenacity import retry, retry_if_exception_type\nimport httpx\n\n# Define what's retryable\nRETRYABLE_EXCEPTIONS = (\n    ConnectionError,\n    TimeoutError,\n    httpx.ConnectTimeout,\n    httpx.ReadTimeout,\n)\n\n@retry(\n    retry=retry_if_exception_type(RETRYABLE_EXCEPTIONS),\n    stop=stop_after_attempt(3),\n    wait=wait_exponential_jitter(initial=1, max=10),\n)\ndef resilient_api_call(endpoint: str) -> dict:\n    \"\"\"Make API call with retry on network issues.\"\"\"\n    return httpx.get(endpoint, timeout=10).json()\n```\n\n### Pattern 3: HTTP Status Code Retries\n\nRetry specific HTTP status codes that indicate transient issues.\n\n```python\nfrom tenacity import retry, retry_if_result, stop_after_attempt\nimport httpx\n\nRETRY_STATUS_CODES = {429, 502, 503, 504}\n\ndef should_retry_response(response: httpx.Response) -> bool:\n    \"\"\"Check if response indicates a retryable error.\"\"\"\n    return response.status_code in RETRY_STATUS_CODES\n\n@retry(\n    retry=retry_if_result(should_retry_response),\n    stop=stop_after_attempt(3),\n    wait=wait_exponential_jitter(initial=1, max=10),\n)\ndef http_request(method: str, url: str, **kwargs) -> httpx.Response:\n    \"\"\"Make HTTP request with retry on transient status codes.\"\"\"\n    return httpx.request(method, url, timeout=30, **kwargs)\n```\n\n### Pattern 4: Combined Exception and Status Retry\n\nHandle both network exceptions and HTTP status codes.\n\n```python\nfrom tenacity import (\n    retry,\n    retry_if_exception_type,\n    retry_if_result,\n    stop_after_attempt,\n    wait_exponential_jitter,\n    before_sleep_log,\n)\nimport logging\nimport httpx\n\nlogger = logging.getLogger(__name__)\n\nTRANSIENT_EXCEPTIONS = (\n    ConnectionError,\n    TimeoutError,\n    httpx.ConnectError,\n    httpx.ReadTimeout,\n)\nRETRY_STATUS_CODES = {429, 500, 502, 503, 504}\n\ndef is_retryable_response(response: httpx.Response) -> bool:\n    return response.status_code in RETRY_STATUS_CODES\n\n@retry(\n    retry=(\n        retry_if_exception_type(TRANSIENT_EXCEPTIONS) |\n        retry_if_result(is_retryable_response)\n    ),\n    stop=stop_after_attempt(5),\n    wait=wait_exponential_jitter(initial=1, max=30),\n    before_sleep=before_sleep_log(logger, logging.WARNING),\n)\ndef robust_http_call(\n    method: str,\n    url: str,\n    **kwargs,\n) -> httpx.Response:\n    \"\"\"HTTP call with comprehensive retry handling.\"\"\"\n    return httpx.request(method, url, timeout=30, **kwargs)\n```\n\n## Detailed worked examples and patterns\n\nDetailed sections (starting with `## Advanced Patterns`) live in `references\u002Fdetails.md`. Read that file when the navigation summary above is insufficient.\n\n## Best Practices Summary\n\n1. **Retry only transient errors** - Don't retry bugs or authentication failures\n2. **Use exponential backoff** - Give services time to recover\n3. **Add jitter** - Prevent thundering herd from synchronized retries\n4. **Cap total duration** - `stop_after_attempt(5) | stop_after_delay(60)`\n5. **Log every retry** - Silent retries hide systemic problems\n6. **Use decorators** - Keep retry logic separate from business logic\n7. **Inject dependencies** - Make infrastructure testable\n8. **Set timeouts everywhere** - Every network call needs a timeout\n9. **Fail gracefully** - Return cached\u002Fdefault values for non-critical paths\n10. **Monitor retry rates** - High retry rates indicate underlying issues\n","# Python Resilience Patterns\n\nBuild fault-tolerant Python applications that gracefully handle transient failures, network issues, and service outages. Resilience patterns keep systems running when dependencies are unreliable.\n\n## When to Use This Skill\n\n- Adding retry logic to external service calls\n- Implementing timeouts for network operations\n- Building fault-tolerant microservices\n- Handling rate limiting and backpressure\n- Creating infrastructure decorators\n- Designing circuit breakers\n\n## Core Concepts\n\n### 1. Transient vs Permanent Failures\n\nRetry transient errors (network timeouts, temporary service issues). Don't retry permanent errors (invalid credentials, bad requests).\n\n### 2. Exponential Backoff\n\nIncrease wait time between retries to avoid overwhelming recovering services.\n\n### 3. Jitter\n\nAdd randomness to backoff to prevent thundering herd when many clients retry simultaneously.\n\n### 4. Bounded Retries\n\nCap both attempt count and total duration to prevent infinite retry loops.\n\n## Quick Start\n\n```python\nfrom tenacity import retry, stop_after_attempt, wait_exponential_jitter\n\n@retry(\n    stop=stop_after_attempt(3),\n    wait=wait_exponential_jitter(initial=1, max=10),\n)\ndef call_external_service(request: dict) -> dict:\n    return httpx.post(\"https:\u002F\u002Fapi.example.com\", json=request).json()\n```\n\n## Fundamental Patterns\n\n### Pattern 1: Basic Retry with Tenacity\n\nUse the `tenacity` library for production-grade retry logic. For simpler cases, consider built-in retry functionality or a lightweight custom implementation.\n\n```python\nfrom tenacity import (\n    retry,\n    stop_after_attempt,\n    stop_after_delay,\n    wait_exponential_jitter,\n    retry_if_exception_type,\n)\n\nTRANSIENT_ERRORS = (ConnectionError, TimeoutError, OSError)\n\n@retry(\n    retry=retry_if_exception_type(TRANSIENT_ERRORS),\n    stop=stop_after_attempt(5) | stop_after_delay(60),\n    wait=wait_exponential_jitter(initial=1, max=30),\n)\ndef fetch_data(url: str) -> dict:\n    \"\"\"Fetch data with automatic retry on transient failures.\"\"\"\n    response = httpx.get(url, timeout=30)\n    response.raise_for_status()\n    return response.json()\n```\n\n### Pattern 2: Retry Only Appropriate Errors\n\nWhitelist specific transient exceptions. Never retry:\n\n- `ValueError`, `TypeError` - These are bugs, not transient issues\n- `AuthenticationError` - Invalid credentials won't become valid\n- HTTP 4xx errors (except 429) - Client errors are permanent\n\n```python\nfrom tenacity import retry, retry_if_exception_type\nimport httpx\n\n# Define what's retryable\nRETRYABLE_EXCEPTIONS = (\n    ConnectionError,\n    TimeoutError,\n    httpx.ConnectTimeout,\n    httpx.ReadTimeout,\n)\n\n@retry(\n    retry=retry_if_exception_type(RETRYABLE_EXCEPTIONS),\n    stop=stop_after_attempt(3),\n    wait=wait_exponential_jitter(initial=1, max=10),\n)\ndef resilient_api_call(endpoint: str) -> dict:\n    \"\"\"Make API call with retry on network issues.\"\"\"\n    return httpx.get(endpoint, timeout=10).json()\n```\n\n### Pattern 3: HTTP Status Code Retries\n\nRetry specific HTTP status codes that indicate transient issues.\n\n```python\nfrom tenacity import retry, retry_if_result, stop_after_attempt\nimport httpx\n\nRETRY_STATUS_CODES = {429, 502, 503, 504}\n\ndef should_retry_response(response: httpx.Response) -> bool:\n    \"\"\"Check if response indicates a retryable error.\"\"\"\n    return response.status_code in RETRY_STATUS_CODES\n\n@retry(\n    retry=retry_if_result(should_retry_response),\n    stop=stop_after_attempt(3),\n    wait=wait_exponential_jitter(initial=1, max=10),\n)\ndef http_request(method: str, url: str, **kwargs) -> httpx.Response:\n    \"\"\"Make HTTP request with retry on transient status codes.\"\"\"\n    return httpx.request(method, url, timeout=30, **kwargs)\n```\n\n### Pattern 4: Combined Exception and Status Retry\n\nHandle both network exceptions and HTTP status codes.\n\n```python\nfrom tenacity import (\n    retry,\n    retry_if_exception_type,\n    retry_if_result,\n    stop_after_attempt,\n    wait_exponential_jitter,\n    before_sleep_log,\n)\nimport logging\nimport httpx\n\nlogger = logging.getLogger(__name__)\n\nTRANSIENT_EXCEPTIONS = (\n    ConnectionError,\n    TimeoutError,\n    httpx.ConnectError,\n    httpx.ReadTimeout,\n)\nRETRY_STATUS_CODES = {429, 500, 502, 503, 504}\n\ndef is_retryable_response(response: httpx.Response) -> bool:\n    return response.status_code in RETRY_STATUS_CODES\n\n@retry(\n    retry=(\n        retry_if_exception_type(TRANSIENT_EXCEPTIONS) |\n        retry_if_result(is_retryable_response)\n    ),\n    stop=stop_after_attempt(5),\n    wait=wait_exponential_jitter(initial=1, max=30),\n    before_sleep=before_sleep_log(logger, logging.WARNING),\n)\ndef robust_http_call(\n    method: str,\n    url: str,\n    **kwargs,\n) -> httpx.Response:\n    \"\"\"HTTP call with comprehensive retry handling.\"\"\"\n    return httpx.request(method, url, timeout=30, **kwargs)\n```\n\n## Detailed worked examples and patterns\n\nDetailed sections (starting with `## Advanced Patterns`) live in `references\u002Fdetails.md`. Read that file when the navigation summary above is insufficient.\n\n## Best Practices Summary\n\n1. **Retry only transient errors** - Don't retry bugs or authentication failures\n2. **Use exponential backoff** - Give services time to recover\n3. **Add jitter** - Prevent thundering herd from synchronized retries\n4. **Cap total duration** - `stop_after_attempt(5) | stop_after_delay(60)`\n5. **Log every retry** - Silent retries hide systemic problems\n6. **Use decorators** - Keep retry logic separate from business logic\n7. **Inject dependencies** - Make infrastructure testable\n8. **Set timeouts everywhere** - Every network call needs a timeout\n9. **Fail gracefully** - Return cached\u002Fdefault values for non-critical paths\n10. **Monitor retry rates** - High retry rates indicate underlying issues\n",{"name":5,"description":7},"main","62c7af5ced2c21355d148c243edb6d5921cca1a6",".agents\u002Fskills\u002Fpython-resilience",8,"https:\u002F\u002Fgithub.com\u002FRudyCity\u002Fsuperagent","https:\u002F\u002Fgithub.com\u002FRudyCity","2026-11-14 22:58:49",{"source":8,"skillName":5,"commands":31,"prompt":41,"zipAvailable":42},[32,35,38],{"tool":33,"command":34},"npx","npx skills add RudyCity\u002Fsuperagent --skill python-resilience",{"tool":36,"command":37},"bunx","bunx skills add RudyCity\u002Fsuperagent --skill python-resilience",{"tool":39,"command":40},"pnpm","pnpm dlx skills add RudyCity\u002Fsuperagent --skill python-resilience","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FRudyCity\u002Fsuperagent\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fpython-resilience\u002FSKILL.md",true,[44],{"path":45,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":48,"sourceHtmlUrl":49},"references\u002Fdetails.md","REFERENCE","参考文档",5376,"https:\u002F\u002Fgithub.com\u002FRudyCity\u002Fsuperagent\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fpython-resilience\u002Freferences\u002Fdetails.md",[51,58,65,72,79,86],{"skillNo":52,"name":53,"nameZh":6,"description":54,"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},"01M75GP28CM6QCSXSHKFF3NNKS","telegram_bot","Use Telegram Bot when the user asks for Telegram Bot or this provider's API.","https:\u002F\u002Fgithub.com\u002FRudyCity\u002Fsuperagent\u002Fblob\u002Fmain\u002Fmuse-bridge-kit\u002Fskills\u002Ftelegram-bot\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},"01M75GNZGZYM7NWDV6MBP3HS14","superagent-bridge","Operate the Muse\u003C->superagent Telegram bridge: poll the private group for task_request\u002Ftask_result envelopes, validate senders, and reply with task_batch\u002Ftask_done as Muse (the remote brain).","https:\u002F\u002Fgithub.com\u002FRudyCity\u002Fsuperagent\u002Fblob\u002Fmain\u002Fmuse-bridge-kit\u002Fskills\u002Fsuperagent-bridge\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},"01M75GNHN19HJWZ7NAPM5E5JCV","Writing Skills","TDD for process documentation - test with subagents before writing, iterate until bulletproof","https:\u002F\u002Fgithub.com\u002FRudyCity\u002Fsuperagent\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fwriting-skills\u002FSKILL.md",[],[],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":18},"01M75GNCQEKVRA4FH161NZPZNB","writing-shape","Take a markdown file of raw material and shape it into an article through a conversational session — drafting candidate openings, growing the piece paragraph by paragraph, arguing about format (lists, tables, callouts, quotes) at each step. Use when the user has a pile of notes, fragments, or a rough draft and wants help turning it into something publishable.","https:\u002F\u002Fgithub.com\u002FRudyCity\u002Fsuperagent\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fwriting-shape\u002FSKILL.md",[],[],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":18},"01M75GNAF9NAYCSTBDZDGMK0DZ","Writing Plans","Create detailed implementation plans with bite-sized tasks for engineers with zero codebase context","https:\u002F\u002Fgithub.com\u002FRudyCity\u002Fsuperagent\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fwriting-plans\u002FSKILL.md",[],[],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":18},"01M75GN72EV0V5NQAW9CSPFRFH","writing-guidelines","Review docs\u002Fprose for Writing Guidelines compliance. Use when asked to \"review my docs\", \"check writing style\", \"audit prose\", \"review docs voice and tone\", or \"check this page against the writing handbook\".","https:\u002F\u002Fgithub.com\u002FRudyCity\u002Fsuperagent\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fwriting-guidelines\u002FSKILL.md",[],[]]