Get the FREE Ultimate OpenClaw Setup Guide →

graceful-degradation

npx machina-cli add skill parcadei/Continuous-Claude-v3/graceful-degradation --openclaw
Files (1)
SKILL.md
2.2 KB

Graceful Degradation with Helpful Messages

When optional services are unavailable, degrade gracefully with actionable fallback messages.

Pattern

Check availability at the start, cache the result, and provide helpful messages that explain what's missing and how to fix it.

DO

  • Check service availability early (before wasting compute)
  • Cache health check results for the session (e.g., 60s TTL)
  • Provide actionable fallback messages:
    • What service is missing
    • What features are degraded
    • How to enable the service
  • Continue with reduced functionality when possible

DON'T

  • Silently fail or return empty results
  • Check availability on every call (cache it)
  • Assume the user knows how to start missing services

Example: LMStudio Check Pattern

let lmstudioAvailable: boolean | null = null;
let lastCheck = 0;
const CACHE_TTL = 60000; // 60 seconds

async function checkLMStudio(): Promise<boolean> {
  const now = Date.now();
  if (lmstudioAvailable !== null && now - lastCheck < CACHE_TTL) {
    return lmstudioAvailable;
  }

  try {
    const response = await fetch('http://localhost:1234/v1/models', {
      signal: AbortSignal.timeout(2000)
    });
    lmstudioAvailable = response.ok;
  } catch {
    lmstudioAvailable = false;
  }
  lastCheck = now;
  return lmstudioAvailable;
}

// Usage
if (!await checkLMStudio()) {
  return {
    result: 'continue',
    message: `LMStudio not available at localhost:1234.

To enable Godel-Prover tactic suggestions:
1. Install LMStudio from https://lmstudio.ai/
2. Load "Goedel-Prover-V2-8B" model
3. Start the local server on port 1234

Continuing without AI-assisted tactics...`
  };
}

Fallback Message Template

[Service] not available at [endpoint].

To enable [feature]:
1. [Step to install/start]
2. [Configuration step if needed]
3. [Verification step]

Continuing without [degraded feature]...

Source Sessions

  • This session: LMStudio availability check with 60s caching and helpful fallback
  • 174e0ff3: Environment variable debugging - print computed paths for troubleshooting

Source

git clone https://github.com/parcadei/Continuous-Claude-v3/blob/main/.claude/skills/graceful-degradation/SKILL.mdView on GitHub

Overview

Graceful Degradation with Helpful Messages improves resilience by checking optional services at the start, caching the health status for the session, and returning actionable fallback messages when a service is unavailable. This keeps workflows moving while clearly showing what’s missing and how to restore full functionality.

How This Skill Works

At the start of an operation, it checks the availability of optional services and caches the result (e.g., 60s TTL). If a service is unavailable, it returns a structured fallback message detailing what’s missing, what features are degraded, and how to enable the service, then proceeds with reduced functionality.

When to Use It

  • When an optional/local service (e.g., LMStudio) is unavailable.
  • When you want to avoid wasting compute by rechecking each call.
  • When you need to provide users with clear steps to fix the issue.
  • When continuing with reduced functionality is acceptable.
  • When coordinating health checks for multiple services within a session.

Quick Start

  1. Step 1: Check optional service availability at startup and cache the result (e.g., 60s TTL).
  2. Step 2: If unavailable, return a structured fallback message with steps to enable the service.
  3. Step 3: Continue with reduced functionality and rely on cached health status for subsequent calls.

Best Practices

  • Check availability early in the workflow.
  • Cache health check results for the session (e.g., 60s TTL).
  • Provide actionable fallback messages: what’s missing, degraded features, how to enable.
  • Do not silent fail or return empty results.
  • Avoid checking availability on every call; rely on cached results.

Example Use Cases

  • LMStudio availability check pattern with a 60-second cache TTL.
  • Fallback message guiding LMStudio installation and startup steps.
  • Template fallback message showing missing service and steps to enable.
  • Continue with degraded functionality when the service is unavailable.
  • Template includes a structured fallback and steps to verify service status.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers