Logo di Error Recovery Skill

Error Recovery Skill

Community
zeenie-ai
error-recovery-skill

Handle errors gracefully with retry strategies and fallback patterns

Panoramica

Pubblicato dazeenie-ai
RepositoryOpenCompany
Nome della skillerror-recovery-skill
Stelle
912
Fork
137
File inclusi
Solo istruzioni
LicenzaMIT
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • Tutto nelle istruzioni

    Tutto ciò che serve al modello è nelle istruzioni: nessun file aggiuntivo da sincronizzare.

  • Open source

    Pubblicata da zeenie-ai su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Error Recovery Skill in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/zeenie-ai/OpenCompany/tree/main/server/skills/autonomous/error-recovery-skill
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Aggiungi skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella della skill nella directory delle skill di quell'agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/zeenie-ai/OpenCompany.git /tmp/OpenCompany
mkdir -p .claude/skills
cp -r /tmp/OpenCompany/server/skills/autonomous/error-recovery-skill .claude/skills/error-recovery-skill
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Error Recovery Skill in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Error Recovery Skill non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Error Recovery Skill non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

Error Recovery Pattern

You are an agent that handles errors gracefully through retry strategies, alternative approaches, and graceful degradation.

Error Classification

┌─────────────────────────────────────────────────────────────┐
│                    ERROR CATEGORIES                          │
├─────────────────────────────────────────────────────────────┤
│                                                              │
│  TRANSIENT (Retry)          RECOVERABLE (Alternative)       │
│  ─────────────────          ────────────────────────        │
│  • Network timeout          • Missing data → try another    │
│  • Rate limit (429)         • Format error → parse differ   │
│  • Service busy (503)       • Partial failure → use partial │
│  • Connection reset         • Auth expired → re-auth        │
│                                                              │
│  PERMANENT (Report)         CRITICAL (Escalate)             │
│  ──────────────────         ───────────────────             │
│  • Not found (404)          • Security violation            │
│  • Permission denied (403)  • Data corruption               │
│  • Invalid input (400)      • System failure                │
│  • Resource deleted (410)   • Unrecoverable state           │
│                                                              │
└─────────────────────────────────────────────────────────────┘

Retry Strategy

For transient errors, use exponential backoff:

┌─────────────────────────────────────────────────────────────┐
│                 EXPONENTIAL BACKOFF                          │
├─────────────────────────────────────────────────────────────┤
│                                                              │
│   Attempt 1 ──▶ FAIL ──▶ Wait 1 second                      │
│                              │                               │
│                              ▼                               │
│   Attempt 2 ──▶ FAIL ──▶ Wait 2 seconds                     │
│                              │                               │
│                              ▼                               │
│   Attempt 3 ──▶ FAIL ──▶ Wait 4 seconds                     │
│                              │                               │
│                              ▼                               │
│   Attempt 4 ──▶ FAIL ──▶ Report failure                     │
│                                                              │
│   Formula: wait_time = 2^(attempt - 1) seconds              │
│   Max attempts: 4 (configurable)                            │
│                                                              │
└─────────────────────────────────────────────────────────────┘

Code Mode Retry Implementation

python
import json
import time

def with_retry(operation, max_attempts=4):
    """Execute operation with exponential backoff retry."""
    last_error = None

    for attempt in range(1, max_attempts + 1):
        try:
            result = operation()
            return {"success": True, "result": result, "attempts": attempt}
        except Exception as e:
            last_error = str(e)

            # Check if error is retryable
            if is_permanent_error(e):
                return {
                    "success": False,
                    "error": last_error,
                    "error_type": "permanent",
                    "attempts": attempt
                }

            # Wait before retry (exponential backoff)
            if attempt < max_attempts:
                wait_time = 2 ** (attempt - 1)
                time.sleep(wait_time)

    return {
        "success": False,
        "error": last_error,
        "error_type": "transient_exhausted",
        "attempts": max_attempts
    }

def is_permanent_error(e):
    """Check if error is permanent (should not retry)."""
    error_msg = str(e).lower()
    permanent_indicators = [
        "not found", "404",
        "permission denied", "403", "forbidden",
        "invalid", "400", "bad request",
        "unauthorized", "401"
    ]
    return any(indicator in error_msg for indicator in permanent_indicators)

# Usage
result = with_retry(lambda: risky_operation())
print(json.dumps(result, indent=2))

Alternative Approach Pattern

When the primary approach fails, try alternatives:

┌─────────────────────────────────────────────────────────────┐
│                 ALTERNATIVE APPROACHES                       │
├─────────────────────────────────────────────────────────────┤
│                                                              │
│   Primary: API call to service A                            │
│       │                                                     │
│       ▼                                                     │
│   FAILED (service down)                                     │
│       │                                                     │
│       ▼                                                     │
│   Alternative 1: Try service B (backup API)                 │
│       │                                                     │
│       ▼                                                     │
│   FAILED (rate limited)                                     │
│       │                                                     │
│       ▼                                                     │
│   Alternative 2: Use cached data                            │
│       │                                                     │
│       ▼                                                     │
│   SUCCESS (stale but available)                             │
│       │                                                     │
│       ▼                                                     │
│   Return with warning: "Data may be outdated"               │
│                                                              │
└─────────────────────────────────────────────────────────────┘

Self-Delegation for Retry

Use delegation to retry with a different approach:

json
{
  "task": "Retry: Get weather data using alternative source",
  "context": "Attempt: 2/3
Error: Primary weather API timeout
Previous approach: OpenWeatherMap API
New approach: Try WeatherAPI.com or use cached forecast
Original request: Weather for New York"
}

Graceful Degradation

When full success isn't possible, return partial results:

┌─────────────────────────────────────────────────────────────┐
│                 GRACEFUL DEGRADATION                         │
├─────────────────────────────────────────────────────────────┤
│                                                              │
│   Request: "Get user profile with posts and followers"      │
│                                                              │
│   ┌─────────────┐  ┌─────────────┐  ┌─────────────┐        │
│   │   Profile   │  │    Posts    │  │  Followers  │        │
│   │   SUCCESS   │  │   FAILED    │  │   SUCCESS   │        │
│   └─────────────┘  └─────────────┘  └─────────────┘        │
│                                                              │
│   Response:                                                  │
│   {                                                          │
│     "profile": { ... },      // Full data                   │
│     "posts": null,           // Unavailable                 │
│     "posts_error": "Service temporarily unavailable",       │
│     "followers": [ ... ],    // Full data                   │
│     "partial": true,         // Indicates degraded response │
│     "degraded_fields": ["posts"]                            │
│   }                                                          │
│                                                              │
└─────────────────────────────────────────────────────────────┘

Code Mode Graceful Degradation

python
import json

def fetch_user_data(user_id):
    """Fetch user data with graceful degradation."""
    result = {
        "user_id": user_id,
        "partial": False,
        "errors": []
    }

    # Try to get profile (required)
    try:
        result["profile"] = get_profile(user_id)
    except Exception as e:
        # Profile is required - cannot degrade
        return {
            "success": False,
            "error": f"Cannot fetch required profile: {e}"
        }

    # Try to get posts (optional, can degrade)
    try:
        result["posts"] = get_posts(user_id)
    except Exception as e:
        result["posts"] = None
        result["errors"].append(f"posts: {e}")
        result["partial"] = True

    # Try to get followers (optional, can degrade)
    try:
        result["followers"] = get_followers(user_id)
    except Exception as e:
        result["followers"] = None
        result["errors"].append(f"followers: {e}")
        result["partial"] = True

    return {"success": True, "data": result}

# Simulated functions
def get_profile(uid): return {"name": "John", "email": "john@example.com"}
def get_posts(uid): raise Exception("Service unavailable")
def get_followers(uid): return [{"id": 1, "name": "Jane"}]

output = fetch_user_data("user_123")
print(json.dumps(output, indent=2))

Error Recovery in Agentic Loops

When an iteration fails in an agentic loop:

┌─────────────────────────────────────────────────────────────┐
│              LOOP ERROR RECOVERY                             │
├─────────────────────────────────────────────────────────────┤
│                                                              │
│   Iteration 2: FAILED                                       │
│       │                                                     │
│       ▼                                                     │
│   Classify Error                                            │
│       │                                                     │
│       ├──▶ Transient? ──▶ Retry same iteration             │
│       │                                                     │
│       ├──▶ Recoverable? ──▶ Try alternative approach       │
│       │                                                     │
│       └──▶ Permanent? ──▶ Skip or report                   │
│                                                              │
│   Continue to Iteration 3 with updated context:            │
│   "Iteration 2 failed: [reason]. Proceeding with           │
│    partial results from Iteration 1."                       │
│                                                              │
└─────────────────────────────────────────────────────────────┘

Delegation with Error Context

json
{
  "task": "Continue: Process remaining items (skip failed)",
  "context": "Iteration: 3/5
Progress: Processed items 1-5, item 3 failed (invalid format)
State: Results for items [1,2,4,5] available
Error handling: Skipping item 3, continuing with remaining
Next: Process items 6-10"
}

Error Reporting Best Practices

What to Include

┌─────────────────────────────────────────────────────────────┐
│                 ERROR REPORT STRUCTURE                       │
├─────────────────────────────────────────────────────────────┤
│                                                              │
│   1. WHAT failed                                            │
│      "Failed to send WhatsApp message"                      │
│                                                              │
│   2. WHY it failed                                          │
│      "Recipient phone number not registered on WhatsApp"    │
│                                                              │
│   3. WHAT was tried                                         │
│      "Attempted 3 times with exponential backoff"           │
│                                                              │
│   4. WHAT can be done                                       │
│      "Try a different contact method (SMS, email) or        │
│       verify the phone number is correct"                   │
│                                                              │
│   5. PARTIAL results (if any)                               │
│      "Message was prepared but not delivered"               │
│                                                              │
└─────────────────────────────────────────────────────────────┘

Example Error Response

json
{
  "success": false,
  "error": {
    "type": "delivery_failed",
    "message": "Failed to send WhatsApp message",
    "reason": "Recipient not on WhatsApp",
    "attempts": 3,
    "recovery_attempted": true,
    "partial_result": {
      "message_prepared": true,
      "recipient_validated": false
    }
  },
  "suggestions": [
    "Verify the phone number format (+1234567890)",
    "Try sending via SMS instead",
    "Check if recipient has WhatsApp installed"
  ]
}

Anti-Patterns to Avoid

1. Silent Failures

// Never do this
try:
    result = risky_operation()
except:
    pass  // Error swallowed silently

// Always report
try:
    result = risky_operation()
except Exception as e:
    return {"success": False, "error": str(e)}

2. Infinite Retry

// Never do this
while True:
    try:
        result = operation()
        break
    except:
        continue  // Infinite loop

// Always limit attempts
for attempt in range(MAX_ATTEMPTS):
    ...

3. Retry Permanent Errors

// Never retry these
- 404 Not Found
- 403 Forbidden
- 401 Unauthorized
- 400 Bad Request

// Only retry these
- 429 Too Many Requests
- 503 Service Unavailable
- 504 Gateway Timeout
- Connection errors

4. Lose Context on Error

// Never do this
except Exception:
    return "An error occurred"

// Preserve context
except Exception as e:
    return f"Failed at step {step}: {e}. Progress: {progress}"

Domande frequenti

Cosa fa la skill IA Error Recovery Skill?

Handle errors gracefully with retry strategies and fallback patterns

Perché usare Error Recovery Skill su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Error Recovery Skill è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che la skill smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Error Recovery Skill in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/zeenie-ai/OpenCompany/tree/main/server/skills/autonomous/error-recovery-skill. TypingMind legge il file SKILL.md e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Error Recovery Skill?

Qualsiasi modello che colleghi a TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Error Recovery Skill?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Error Recovery Skill: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Error Recovery Skill è gratuita?

Sì. È pubblicata su GitHub da zeenie-ai con licenza MIT. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, template o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Elenco completo

Crea subito il tuo spazio di lavoro AI

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇