mcpField
E
error-patterns

error-patterns

github.com/atholaDevelopment34397 installsUpdated 1d ago
Repository

About error-patterns

A skill that standardizes error classification, recovery, and debugging patterns for resilient integrations. It is intended for projects using leyline infrastructure patterns and includes guidance for common authentication, rate-limit, timeout, and context-size errors.

Key features

  1. 01按严重程度与可恢复性分类
  2. 02标准化错误结果
  3. 03认证与权限错误处理
  4. 04速率限制和退避策略
  5. 05超时及超大上下文恢复

Use cases

  1. 01构建具备恢复能力的服务集成
  2. 02处理 API 速率限制与超时
  3. 03排查生产环境中的错误

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/athola/claude-night-market --skill error-patterns

After installing, type/error-patternsin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

modules/
agent-damage-control.md
classification.md
recovery-strategies.md

Details

From the project README

Error Patterns

Overview

Standardized error handling patterns for consistent, production-grade behavior across plugins. Provides error classification, recovery strategies, and debugging workflows.

When To Use

  • Building resilient integrations
  • Need consistent error handling
  • Want graceful degradation
  • Debugging production issues

When NOT To Use

  • Project doesn't use the leyline infrastructure patterns
  • Simple scripts without service architecture needs

Error Classification

By Severity
LevelActionExample
CriticalHalt, alertAuth failure, service down
ErrorRetry or secondary strategyRate limit, timeout
WarningLog, continuePartial results, deprecation
InfoLog onlyNon-blocking issues
By Recoverability
class ErrorCategory(Enum):
    TRANSIENT = "transient"  # Retry likely to succeed
    PERMANENT = "permanent"  # Retry won't help
    CONFIGURATION = "config"  # User action needed
    RESOURCE = "resource"  # Quota/limit issue

Verification: Run the command with --help flag to verify availability.

Quick Start

Standard Error Handler
from leyline.error_patterns import handle_error, ErrorCategory

try:
    result = service.execute(prompt)
except RateLimitError as e:
    return handle_error(
        e, ErrorCategory.RESOURCE, {"retry_after": e.retry_after, "service": "gemini"}
    )
except AuthError as e:
    return handle_error(
        e, ErrorCategory.CONFIGURATION, {"action": "Run 'gemini auth login'"}
    )

Verification: Run the command with --help flag to verify availability.

Error Result
@dataclass
class ErrorResult:
    category: ErrorCategory
    message: str
    recoverable: bool
    suggested_action: str
    metadata: dict

Verification: Run the command with --help flag to verify availability.

Common Patterns

Authentication Errors (401/403)
  • Verify credentials exist
  • Check token expiration
  • Validate permissions/scopes
  • Suggest re-authentication
Rate Limit Errors (429)
  • Extract retry-after header
  • Log for quota tracking
  • Implement backoff
  • Consider alternative service
Timeout Errors
  • Increase timeout for retries
  • Break into smaller requests
  • Use async patterns
  • Consider different model
Context Too Large (400)
  • Estimate tokens before request
  • Split into multiple requests
  • Reduce input content
  • Use larger context model

Integration Pattern

# In your skill's frontmatter
dependencies: [leyline:error-patterns]

Verification: Run the command with --help flag to verify availability.

Detailed Resources

  • Classification: See modules/classification.md for error taxonomy
  • Recovery: See modules/recovery-strategies.md for handling patterns
  • Agent Damage Control: See modules/agent-damage-control.md for multi-agent error recovery and escalation

Exit Criteria

  • Error classified correctly
  • Appropriate recovery attempted
  • User-actionable message provided
  • Error logged for debugging

Comments

Markdown supported