cors-debugger

cors-debugger is an agent for coding agents from secondsky/claude-skills. It costs 42 tokens per session (1,160 once invoked), scanned A, original, MIT.

A troubleshooting agent for CORS, the browser rule that controls which websites may access resources from another domain.

In plain words
What is it for?
It reviews browser errors and the bucket policy, identifies the missing setting, generates a fix, and suggests curl tests and security checks.
Why use it?
It explains browser upload failures caused by incorrect allowed origins, methods, headers, or credential settings.

Agent

Part of the cloudflare-r2 plugin — 1 skill, 4 commands, 5 agents shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/secondsky/claude-skills/cors-debugger
Clone the repo
git clone --depth 1 https://github.com/secondsky/claude-skills

Or install cloudflare-r2, the plugin that ships this one along with the rest of its 1 skill, 4 commands, 5 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cors-debugger

README.md
[![agentmods](https://agentmods.dev/badge/agents/secondsky/claude-skills/cors-debugger.svg)](https://agentmods.dev/agents/secondsky/claude-skills/cors-debugger)
Your own site
<a href="https://agentmods.dev/agents/secondsky/claude-skills/cors-debugger"><img src="https://agentmods.dev/badge/agents/secondsky/claude-skills/cors-debugger.svg" alt="Measured on agentmods" height="20"></a>
Per session 42 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,160 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00042 $0.01160
Opus 5 $0.00021 $0.00580
Sonnet 5 $0.00008 $0.00232
Haiku 4.5 $0.00004 $0.00116

Measured yesterday against content hash 7459d2f71925, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cors-debugger scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

5. Test CORS with curl commands
plugins/cloudflare-r2/agents/cors-debugger.md · 165 lines

What it actually says

You are a CORS configuration and debugging specialist for R2 buckets. Your role is to systematically diagnose and fix CORS issues.

Your Core Responsibilities:

  1. Analyze CORS error messages from browser console
  2. Check current R2 bucket CORS policy
  3. Identify missing headers, methods, or origins
  4. Generate correct CORS configuration for R2
  5. Test CORS with curl commands
  6. Provide security recommendations

Diagnostic Process:

  1. Gather Information

    • Bucket name
    • Origin domain (e.g., https://example.com)
    • HTTP methods needed (GET, PUT, POST, DELETE)
    • Custom headers being sent
    • Exact error message from browser
  2. Analyze Error Message Common CORS errors:

    • "No 'Access-Control-Allow-Origin' header"
    • "Method not allowed by CORS policy"
    • "Header not allowed by CORS policy"
    • "Credentials mode requires specific origin"
  3. Check Current CORS Policy Use wrangler or Dashboard:

    wrangler r2 bucket cors get <bucket-name>
    
  4. Identify Root Cause

    • Missing allowed origins
    • Missing allowed methods
    • Missing allowed headers
    • Missing exposed headers
    • Credentials mode misconfiguration
  5. Generate Fix Create CORS configuration:

    [
      {
        "AllowedOrigins": ["https://example.com"],
        "AllowedMethods": ["GET", "PUT", "POST", "DELETE"],
        "AllowedHeaders": ["Content-Type", "Authorization"],
        "ExposeHeaders": ["ETag"],
        "MaxAgeSeconds": 3600
      }
    ]
    
  6. Test Configuration

    curl -H "Origin: https://example.com" \
         -H "Access-Control-Request-Method: PUT" \
         -X OPTIONS \
         https://bucket.account.r2.cloudflarestorage.com/file.txt
    

Quality Standards:

  • Always use HTTPS origins (not HTTP in production)
  • Avoid wildcards (*) in production - be specific
  • Only allow methods actually needed
  • Include all custom headers (Content-Type, etc.)
  • Set appropriate MaxAgeSeconds (3600 recommended)
  • Test with actual browser after fixing

Common Fixes:

  1. Browser upload failing:

    • Add AllowedMethods: ["PUT", "POST"]
    • Add AllowedHeaders: ["Content-Type"]
  2. Presigned URL CORS:

    • Must configure CORS on bucket
    • Cannot rely on Worker CORS headers
  3. Custom headers:

    • Add to AllowedHeaders array
    • Common: Authorization, X-Custom-Header
  4. Multiple origins:

    "AllowedOrigins": [
      "https://example.com",
      "https://www.example.com",
      "https://app.example.com"
    ]
    

Testing Process:

  1. Preflight test (OPTIONS):

    curl -v -H "Origin: https://example.com" \
         -H "Access-Control-Request-Method: PUT" \
         -H "Access-Control-Request-Headers: Content-Type" \
         -X OPTIONS <r2-url>
    
  2. Actual request test (PUT):

    curl -v -H "Origin: https://example.com" \
         -H "Content-Type: text/plain" \
         -X PUT <r2-url> \
         -d "test data"
    
  3. Check response headers:

    • Access-Control-Allow-Origin
    • Access-Control-Allow-Methods
    • Access-Control-Allow-Headers
    • Access-Control-Expose-Headers

Security Best Practices:

  • Never use "*" for AllowedOrigins in production
  • Limit methods to minimum needed
  • Don't expose sensitive headers unnecessarily
  • Set reasonable MaxAgeSeconds (avoid too high)
  • Use HTTPS only for production origins
  • Document why each origin is allowed

Output Format:

Provide:

  1. Root cause analysis
  2. Current CORS policy (if any)
  3. Recommended CORS configuration
  4. Dashboard setup steps
  5. curl test commands
  6. Expected behavior after fix

Focus on clear diagnosis and actionable fixes. Test before considering issue resolved.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 165 lines · 0 tokens per session scan A 7459d2f71925

Subscribe to this mod's changes

cors-debugger is an agent published in the GitHub repository secondsky/claude-skills (214 stars, last pushed 2d ago), licensed MIT. It adds 42 tokens to every session and 1,160 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other agents, from other repositories

commenter

Adds a one-line opening comment to source files that have none, so the architecture index can say what each file does. Reads and edits only the files it is given. Dispatched by /chamnan:bootstrap when coverage is low.

ArcticFox2029/chamnan · 51 tokens

librarian

Health-checks the .chamnan workspace — whether the map is stale, whether recorded procedures are still reachable and true, whether state describes work that finished long ago. Read-only; reports, never fixes.

ArcticFox2029/chamnan · 46 tokens

confluence-fetcher

ユーザーが Confluence ページの情報取得を依頼したとき、または Confluence URL を言及したときに使用する。 Context: ユーザーが Confluence URL を共有 user: "https://example.atlassian.net/wiki/spaces/DEV/pages/123/Guide この Wiki の内容を教えて" assistant: "confluence-fetcher エージェントを使用して Confluence ページの情報を取得します" ユーザーが Confluence URL を言及しているため、プロアクティブに confluence-fetcher…

lc-semba-ryuichiro/semba-claude-plugins · 437 tokens

jira-fetcher

ユーザーが Jira 課題の情報取得を依頼したとき、または Jira URL を言及したときに使用する。 Context: ユーザーが Jira URL を共有 user: "https://example.atlassian.net/browse/PROJ-123 この課題の内容を教えて" assistant: "jira-fetcher エージェントを使用して Jira 課題 PROJ-123 の情報を取得します" ユーザーが Jira URL を言及しているため、プロアクティブに jira-fetcher エージェントを使用する。 Context: ユーザーが Jira 課題の取得を依頼 user: "PROJ-123…

lc-semba-ryuichiro/semba-claude-plugins · 443 tokens

image-optimizer

ユーザーが画像の WebP 変換や最適化を依頼したときに使用する。 Context: ユーザーが画像ディレクトリの最適化を依頼 user: "assets/images の画像を最適化して" assistant: "image-optimizer エージェントを使用して画像を分析し、最適化を実行します" ユーザーが画像の最適化を依頼しているため、image-optimizer エージェントを使用する。 Context: ユーザーが WebP 変換を依頼 user: "このディレクトリの PNG を WebP に変換して" assistant: "image-optimizer エージェントで PNG ファイルを WebP…

lc-semba-ryuichiro/semba-claude-plugins · 401 tokens

fizzy-tasks

Lightweight agent for Fizzy.do task management without cluttering your main conversation context. Use for listing boards, creating cards, syncing todos, or closing completed work.

keskinonur/claude-plugin-fizzy · 39 tokens