More screenshots

    Works with the AI tools you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseOpenClawOpenClaw+21 more

    Repair Compression & Content Encoding Bugs

    1

    Repair Compression & Content Encoding Bugs is a bounded ToolForge Labs workflow.

    $8.99

    Secure checkout via Stripe

    30-day refund guarantee

    Converts to your local currency at checkout

    Security scanned
    Repair Compression & Content Encoding Bugs

    Repair Compression & Content Encoding Bugs

    Example session with this skill installed

    Our Node.js proxy is intermittently truncating gzipped responses from an upstream service. Here is the middleware snippet. Fix the Content-Length and streaming logic.

    • Read your context and instructions
    • Compiled the repair compression

    I have analyzed the middleware snippet. The issue stems from the proxy attempting to calculate Content-Length on the compressed stream before the flush is complete, leading to premature socket closure.

    Streaming Compression Repair

    const zlib = require('zlib');
    const { pipeline } = require('stream');
    
    // REPAIR: Remove manual Content-Length setting for dynamic streams.
    // Use Transfer-Encoding: chunked to avoid truncation risks.
    function proxyMiddleware(req, res, upstreamResponse) {
      const acceptEncoding = req.headers['accept-encoding'] || '';
      
      // Ensure we handle multiple encodings or lack thereof
      if (acceptEncoding.includes('gzip')) {
        res.setHeader('Content-Encoding', 'gzip');
        res.setHeader('Transfer-Encoding', 'chunked');
        res.removeHeader('Content-Length');
    
        const gzip = zlib.createGzip({
          flush: zlib.constants.Z_SYNC_FLUSH,
          finishFlush: zlib.constants.Z_STREAM_END
        });
    
        pipeline(upstreamResponse, gzip, res, (err) => {
          if (err) {
            console.error('Pipeline failed:', err);
            if (!res.headersSent) {
              res.statusCode = 500;
              res.end();
            } else {
              res.destroy(); // Terminate corrupted stream
            }
          }
        });
      } else {
        upstreamResponse.pipe(res);
      }
    }
    

    Invariants Applied

    ComponentResponsibilityStrategy
    Header ManagementState AuthorityRemove Content-Length when re-compressing to prevent mismatch.
    Stream LifecycleError HandlingUse pipeline for proper cleanup of all descriptors on failure.
    Flush PolicyWire CompatibilityUse Z_SYNC_FLUSH to ensure data reaches the client without buffering delays.

    Next steps

    1. Deploy to staging and verify the Transfer-Encoding: chunked header is present in browser dev tools.
    2. Run a load test with payloads larger than 64KB to ensure the buffer doesn't overflow.
    3. Check upstream logs to confirm the connection is not being reset by the proxy's timeout.

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

    What you get

    Resolve Content-Length mismatches in streaming proxies.Fix corrupted UTF-8 and charset encoding boundaries.Implement safe brotli/gzip negotiation for microservices.Prevent decompression bomb vulnerabilities in file uploads.

    About this skill

    Repair Compression & Content Encoding Bugs is a bounded ToolForge Labs workflow. Repair compression and content-encoding failures across gzip/deflate/brotli, charsets, byte-to-text boundaries, content length, streaming bodies, and decompression. Works from repositories or partial headers/payloads. Produces bounded repairs and deterministic fixtures while preserving wire compatibility, resource limits, and security safeguards. It works from a full repository or partial evidence such as snippets, logs, configuration, traces, tickets, and architecture notes. The skill preserves existing product and security policy, separates verified facts from assumptions, avoids invented execution claims, and produces concrete repair or review steps with focused deterministic validation or traceable evidence.

    How to install

    Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.

    ~30 seconds
    1. 1

      Download the ZIP

      Free skills download straight away. Paid skills unlock right after purchase.

    2. 2

      Unzip into your skills folder

      Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.

    3. 3

      Ask your agent to use it

      Restart the agent if it was already running. It picks the skill up automatically - no config needed.

    Skills folder by agent

    Click the path to copy it. Create the folder if it does not exist yet.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    30-day refund

    Not a fit? Get your money back

    Trust & safety

    Security scanned

    Verified clean 21 days ago

    • Passed all security checks, Safe to install

    Listed21 days ago

    What's inside

    Frequently Asked Questions