d1-debugger

d1-debugger is an agent for Claude Code from secondsky/claude-skills. It costs 65 tokens per session (4,255 once invoked), scanned A, original, MIT.

An automated diagnostic agent for Cloudflare D1, a serverless SQLite database. It examines configuration, migrations, queries, bindings, errors, limits, performance, and recovery features to identify likely causes.

In plain words
What is it for?
Use it for query errors, failed migrations, missing Worker bindings, slow responses, quota errors, full databases, and Time Travel restore issues.
Why use it?
D1 problems can come from several parts of an application at once. The agent provides a structured investigation instead of leaving you to guess whether the issue is in the database, code, or deployment settings.

Agent for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the cloudflare-d1 plugin — 1 skill, 2 commands, 2 agents shipped together

Good fit Use it for query errors, failed migrations, missing Worker bindings, slow responses, quota errors, full databases, and Time Travel restore issues.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/secondsky/claude-skills/d1-debugger
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.

Clone the repo
git clone --depth 1 https://github.com/secondsky/claude-skills

Made for: Claude Code.

Or install cloudflare-d1, the plugin that ships this one along with the rest of its 1 skill, 2 commands, 2 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 d1-debugger

README.md
[![agentmods](https://agentmods.dev/badge/agents/secondsky/claude-skills/d1-debugger/github.svg)](https://agentmods.dev/agents/secondsky/claude-skills/d1-debugger)
Your own site
<a href="https://agentmods.dev/agents/secondsky/claude-skills/d1-debugger"><img src="https://agentmods.dev/badge/agents/secondsky/claude-skills/d1-debugger/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for d1-debugger

Your own site · 80×15
<a href="https://agentmods.dev/agents/secondsky/claude-skills/d1-debugger"><img src="https://agentmods.dev/badge/agents/secondsky/claude-skills/d1-debugger.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 65 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 4,255 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00065 $0.04255
Opus 5.5 $0.00026 $0.01702
Sonnet 5.5 $0.00013 $0.00851
Haiku 4.5 $0.00006 $0.00426

Measured 1mo ago against content hash 307307821b31, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

d1-debugger scanned grade A with 0 findings 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 1mo ago.

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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/cloudflare-d1/agents/d1-debugger.md · 573 lines

How it starts

The opening of the file, as written. The whole thing — 573 lines — stays where its author put it; the contents beside it link to each section on GitHub.

D1 Debugger Agent

Role

Autonomous diagnostic specialist for Cloudflare D1 databases. Systematically investigate configuration, schema, queries, and runtime issues to identify root causes and provide actionable recommendations.

Triggering Conditions

Activate this agent when the user reports:

  • D1 query errors or timeouts
  • Migration failures or schema issues
  • Worker binding problems (env.DB undefined)
  • Performance degradation or high latency
  • Limit/quota errors (429, database full)
  • Time Travel restore issues
  • General D1 troubleshooting requests

Diagnostic Process

Execute all 9 phases sequentially. Do not ask user for permission to read files or run commands (within allowed tools). Log each phase start/completion for transparency.


Phase 1: Configuration Validation

Objective: Verify D1 setup and bindings in wrangler configuration

Steps:

  1. Locate configuration file:

    find . -name "wrangler.jsonc" -o -name "wrangler.toml" | head -1
    
  2. Read configuration and check:

    • d1_databases array exists
    • Each binding has required fields: binding, database_name, database_id
    • database_id format is valid UUID (36 characters)
    • compatibility_date is present and >= 2023-05-18
    • Optional fields: replicate, jurisdiction (if present, validate format)
  3. Check for common issues:

    • Duplicate binding names
    • Missing database_id
    • Invalid JSON/TOML syntax
    • Outdated compatibility_date

Load: references/setup-guide.md for configuration examples

Output Example:

✓ Configuration valid
  - Binding: DB
  - Database: my-database (abc123-def456-...)
  - Compatibility Date: 2025-01-15
  - Replication: Enabled (WEUR, ENAM)

✗ Issue: compatibility_date outdated (2022-01-01)
  → Recommendation: Update to 2025-01-15 for 40-60% performance improvement

Phase 2: Schema & Migration Analysis

Objective: Validate database schema and migration history

Steps:

  1. Find migrations directory:
    find . -type d -name "migrations" | head -1
    

Read the full file on GitHub · 573 lines

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. 1mo ago First seen · 573 lines · 65 tokens per session scan A 307307821b31

Subscribe to this mod's changes

d1-debugger is an agent published in the GitHub repository secondsky/claude-skills (231 stars, last pushed today), licensed MIT. It adds 65 tokens to every session and 4,255 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.