Install the WP Debug Toolkit (WPDT) skill by running npx skills add WP-Debug-Toolkit/wpdt-cli from your project directory. This gives AI coding assistants, including Claude Code, Cursor, Codex, Gemini CLI, Windsurf, and GitHub Copilot, the ability to profile REST API endpoints, discover and annotate routes, manage debug settings, and analyze database queries via natural conversation, without needing you to configure anything extra.
Run the install command from your project’s root directory, the same location where your agent already operates:
bash
# Run from your project directory
npx skills add WP-Debug-Toolkit/wpdt-cliThis single command installs three things:
wp dbtk commands exist and when to use each oneOnce installed, you do not need to configure anything else in addition. Your AI coding assistant reads the skill automatically the next time a relevant question or task comes up. You do not need to tell it which commands to run or how to invoke WP-CLI.
Once the skill is installed, your agent translates plain requests into the correct wp dbtk commands and runs them for you. This makes it easy so that even if you do not know any CLI syntax, you can still get started:
This workflow uses iterative profiling to measure the database impact of a code change in real time.
You: “Profile /wc/v3/products and show me the queries it runs.”
Your agent runs:
bash
wp dbtk api call GET /wc/v3/products --profile=queriesIt reports back the query count, total time, and any slow or duplicate queries it found.
You: Edit your code yourself (for example, add a transient cache around a product lookup). Once that’s done, ask the agent to: “Profile that endpoint again and compare it to the last run.”
Your agent runs the same command a second time and compares the new query count and timing against the first result, telling you whether the change reduced database load.
For full details on what each profiling mode captures, see Profiling Endpoint Performance.
After your agent investigates an endpoint, you can ask it to record what it learned so future sessions don’t have to rediscover it.
You: “That /wc/v3/orders POST endpoint creates a new order and writes to the database. Annotate it so we remember that, and flag it as something that needs confirmation before calling.”
Your agent runs:
bash
wp dbtk api edit /wc/v3/orders --method=POST \
--description="Creates a new WooCommerce order" \
--safety=mutates-data \
--verification=verified-runtimeThis annotation persists across discovery runs. The next time you or your agent run wp dbtk api discover, wp dbtk api list, wp dbtk api show, or wp dbtk api search, this endpoint shows up with its description and safety level already attached, eliminating the need for any rediscovery.
For the full --safety and --verification classification system, see Annotating Routes with Custom Metadata.
When you make a request, your AI coding assistant follows the same four-step flow every time:
wp dbtk commands are available and when to use them.wp dbtk command through the wrapper.You’ll see the command in your agent’s tool output. When you run a command with –profile, the response includes both the API data and the performance profile; otherwise, it includes only the API data.
AI agents run in a regular terminal session, not inside a site-specific shell like Local by Flywheel’s. That means they often lack access to the correct PHP binary or MySQL socket for your site. The wrapper script, installed at .agents/skills/wpdt-cli/scripts/wp, detects your environment and automatically constructs the correct WP-CLI invocation. It currently supports Local by Flywheel and standard WP-CLI installations. For the underlying detection logic and manual configuration options, see CLI Environment Setup.
Likely cause: The wrapper script could not automatically detect your local environment.
Fix: Run bash .agents/skills/wpdt-cli/scripts/wp --probe to see what environment the wrapper detected. If it doesn’t match your setup, follow the manual configuration steps in CLI Environment Setup.
Likely cause: The skill wasn’t installed in the current project, or your agent’s session started before installation.
Fix: Re-run npx skills add WP-Debug-Toolkit/wpdt-cli from your project directory, then start a new agent session.
Likely cause: WP-CLI commands run with no authenticated user by default, so any endpoint requiring specific capabilities rejects the request until you specify which WordPress user to run as.
Fix: Ask your agent to add --user=1 (or the relevant admin user ID) to the command. This tells WP-CLI which WordPress user identity to assume, so the endpoint’s permission checks evaluate against that user’s capabilities.
Likely cause: The endpoint returned a cached response, or the request genuinely triggers no database queries.
Fix: Try a different endpoint, or ask your agent to force a fresh lookup by adding query parameters that bypass caching.
Likely cause: The schema store hasn’t been populated for that source yet.
Fix: Run wp dbtk api discover first. This populates the schema store that bootstrap, export, and list --annotated-only all read from.
WP Debug Toolkit’s CLI skill works with Claude Code, Cursor, VS Code Copilot, Codex, Gemini CLI, Windsurf, and any agent that supports the open Agent Skills standard for .agents/skills/ directories. Compatibility comes from following that shared convention, not from a WPDT-specific integration with each tool.
Your agent is instructed to treat endpoints annotated --safety=mutates-data or --safety=destructive as requiring your explicit confirmation before calling them. However, wp dbtk api call makes a real request with no separate dry-run mode for arbitrary endpoints. The --dry-run flag exists only for wp dbtk api import, which applies to annotation packs, not live API calls. You’d want to be deliberate about asking your agent to call an endpoint annotated as destructive.
CLI Environment Setup – Run the --probe command and get an environment it doesn’t recognize? This guide walks you through configuring the wrapper script manually for your setup.
Profiling Endpoint Performance – Want to know exactly what your agent measures when it profiles an endpoint? This article breaks down all three profiling modes and what each one reveals.
Annotating Routes with Custom Metadata – Teach your agent which endpoints are safe to call and which ones need your sign-off first. This guide covers wp dbtk api edit and the full --safety classification system.