More screenshots

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    repair api error mapping status bugs

    1

    Diagnose and repair HTTP/gRPC status code mappings, error redaction, and retry logic.

    $1

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    repair api error mapping status bugs

    repair api error mapping status bugs

    Example session with this skill installed

    Fix the error handling in our Express user controller. It currently returns a 500 when a username is taken, and I'm worried it might be leaking the raw MongoDB error object to the frontend.

    • Read your context and instructions
    • Compiled the repair api error

    I analyzed controllers/userController.js and confirmed the catch block passes the raw MongoServerError to the client. This results in a 500 status and exposes internal collection names. I have remapped this to a 409 Conflict and added a redaction layer.

    API Error Mapping Repair

    Internal FailureProtocol StatusPublic CodeRetryableChanges Made
    MongoServerError (11000)409 ConflictUSER_ALREADY_EXISTSNoMapped specific code to 409, sanitized body.
    ValidationError400 Bad RequestINVALID_INPUTNoExtracted error messages into safe list.
    Generic / Unknown500 Internal Server ErrorINTERNAL_ERRORNoReplaced raw message with opaque trace ID.
    // controllers/userController.js - Refactored catch block
    try {
      const user = await User.create(req.body);
      res.status(201).json(user);
    } catch (err) {
      const correlationId = logger.error(err); // Log full error internally
    
      if (err.name === 'MongoServerError' && err.code === 11000) {
        return res.status(409).json({
          code: 'USER_ALREADY_EXISTS',
          message: 'The requested username is unavailable.',
          correlationId
        });
      }
    
      if (err.name === 'ValidationError') {
        return res.status(400).json({
          code: 'INVALID_INPUT',
          message: 'Validation failed.',
          details: Object.values(err.errors).map(e => e.message),
          correlationId
        });
      }
    
      // Final fallback to prevent information leakage
      res.status(500).json({
        code: 'INTERNAL_ERROR',
        message: 'An unexpected error occurred.',
        correlationId
      });
    }
    

    Next steps

    1. Run the new integration tests in tests/userErrors.test.js to verify the 409 and 400 paths.
    2. Check your frontend error handling to ensure it correctly parses the new USER_ALREADY_EXISTS code.
    3. Review the logs to confirm the correlationId is correctly linking public errors to internal stack traces.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    The problem

    APIs often leak sensitive internal stack traces, return generic 500 errors for client-side validation failures, or incorrectly mark terminal errors as retryable. These mapping defects break client resilience logic and create security vulnerabilities.

    What it does

    • Identifies incorrect HTTP/gRPC status code mappings from internal domain failures.
    • Audits error envelopes to ensure sensitive data and secrets are redacted before reaching the public boundary.
    • Distinguishes between retryable transient failures and terminal logic errors to prevent infinite loop bugs.
    • Generates deterministic test cases to verify error classification and correlation ID propagation.
    • Standardizes error taxonomies across validation, auth, conflict, and timeout scenarios.

    Frameworks & tools

    Works with any API framework using HTTP or gRPC protocols. Supports testing via deterministic mocks and fixtures.

    Why this beats prompting it yourself

    Writing error handlers is tedious and prone to edge-case leaks. This skill enforces a strict contract reconstruction process, ensuring you don't accidentally weaken auth checks or expose raw dependency errors while trying to fix a status code.

    Use cases

    • Fixing a Node.js API that returns 500 Internal Server Error for duplicate key conflicts.
    • Implementing gRPC status code standards for a Go microservice.
    • Redacting database connection strings from production error responses.
    • Correcting client retry logic by properly flagging idempotent versus non-idempotent failures.

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for APIs & Backend.

    Does not modify authorization or security policies unless explicitly requested. Requires clear visibility into internal error sources for full repository mode.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 2 months ago

    Permissions

    Terminal / Shell
    Listed2 months ago
    Updated9 days ago

    What's inside

    Frequently Asked Questions

    This skill audits your API boundary to ensure internal failures (like database conflicts) map to the correct public status codes while redacting sensitive stack traces and secrets that could lead to security vulnerabilities.

    It is designed for any AI agent capable of code analysis and refactoring; it provides the logic to identify misclassifications in both REST (HTTP) and gRPC frameworks regardless of the specific programming language.

    The skill differentiates between transient network glitches and terminal logic errors, allowing your agent to implement accurate retry headers and logic that prevent costly infinite loops in client applications.

    You receive the core logic for status mapping diagnostics, a set of deterministic test case generators for error verification, and a standardized taxonomy for handling validation, auth, and timeout scenarios.

    Yes, the skill includes logic specifically for auditing error envelopes to ensure PII, database connection strings, and internal system paths are stripped before the response leaves your boundary.

    Setup involves importing the skill into your agent's library and providing access to your API's error handling middleware or status mapping configuration files for analysis.

    New in APIs & Backend