Run WordPress SQL Queries

VerifiedCaution

Run SQL queries against the WordPress development database via docker compose, handling multiple WordPress table prefixes.

Sby Skills Guide Bot
Data & AIBeginner
9/21/2026
Claude Code
#sql#wordpress#mariadb#docker-compose#database-debugging

Recommended for

Automated summary

Runs SQL queries against the WordPress development database through `docker compose exec mariadb mysql`, pulling credentials from `CLAUDE.local.md`.

Strengths

  • Gives the exact command pattern to run from the docker-compose project directory
  • Documents table prefixes for each WordPress install (nightly, versions 6.0 through 6.6, multisite, PHP 7.4, subfolder)
  • Explicitly points to the Simple History tables (`wp_simple_history` and `wp_simple_history_contexts`)
  • Reminds the agent to confirm with the user before running UPDATE or DELETE statements

Limitations

  • Assumes credentials are already filled in `CLAUDE.local.md` and that docker-compose services are running
  • Only covers MySQL/MariaDB reached through the `mariadb` service, not other engines or remote databases
  • Protection against destructive queries is a written instruction only, with no technical safeguard
When to use it

When you need to inspect or debug data in a local WordPress install, such as reviewing Simple History events or checking a table's structure.

When not to use it

Avoid it against a production database, or when credentials and Docker containers are not available in the environment.

Security analysis

Caution
Quality score85/100

The skill uses Docker and database commands for legitimate development database querying. It does not instruct destructive or exfiltrating actions by default, but the use of `docker compose exec` with credentials on the command line and arbitrary SQL execution warrants caution.

Findings
  • •Uses `docker compose exec` to run SQL queries with credentials passed on the command line, which may expose passwords in process listings.
  • •Instructs reading database credentials from `CLAUDE.local.md`, relying on a local file that could contain sensitive information.
  • •Allows arbitrary SQL execution, including UPDATE/DELETE, though it requires user confirmation for those.
How this analysis is made

Examples

Recent Simple History events
Show me the 20 most recent rows in wp_simple_history, newest first.
Inspect a table structure
Describe the columns of the wp_simple_history_contexts table.
Count posts
How many rows are in wp_posts in the main WordPress install?

name: sql description: Run SQL queries against the WordPress development database. Use when querying database tables, inspecting Simple History events, checking WordPress data, or debugging database issues.

Run SQL Queries

You are tasked with running SQL queries against the WordPress development database.

Prerequisites

  • Database credentials are stored in CLAUDE.local.md under "Database Access"
  • Docker compose services must be running
  • Commands must be run from the docker-compose project directory

Command Pattern

docker compose exec mariadb mysql -u<USER> -p<PASSWORD> <DATABASE> -e "YOUR_SQL_HERE"

Refer to CLAUDE.local.md for the actual credentials and connection details.

Examples

Show all tables

docker compose exec mariadb mysql -u<USER> -p<PASSWORD> <DATABASE> -e "SHOW TABLES;"

Query Simple History events

docker compose exec mariadb mysql -u<USER> -p<PASSWORD> <DATABASE> -e "SELECT * FROM wp_simple_history ORDER BY id DESC LIMIT 10;"

Describe a table structure

docker compose exec mariadb mysql -u<USER> -p<PASSWORD> <DATABASE> -e "DESCRIBE wp_simple_history;"

Count records

docker compose exec mariadb mysql -u<USER> -p<PASSWORD> <DATABASE> -e "SELECT COUNT(*) FROM wp_posts;"

Table Prefixes

The database contains multiple WordPress installations with different prefixes:

| Prefix | Installation | |--------|--------------| | wp_ | Main install (wordpress_mariadb) | | wp_nightly_ | Nightly build | | wp_6_0_ to wp_6_6_ | Version-specific installs | | wp_multisite_ | Multisite install | | wp_php74_ | PHP 7.4 install | | wp_subfolder_ | Subfolder install |

Simple History Tables

The main Simple History tables (using wp_ prefix):

  • wp_simple_history - Main events table
  • wp_simple_history_contexts - Event context/metadata

Instructions

  1. Read credentials from CLAUDE.local.md
  2. Ask the user what SQL query they want to run (if not specified)
  3. Run the query using the command pattern above
  4. Display the results
  5. Offer to run follow-up queries if needed

Notes

  • For complex queries, consider using \G at the end for vertical output
  • Be careful with UPDATE/DELETE queries - always confirm with user first

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/run-wordpress-sql-queries-muar2zf6/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/run-wordpress-sql-queries-muar2zf6' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/run-wordpress-sql-queries-muar2zf6/download' --output '.skill-downloads/run-wordpress-sql-queries-muar2zf6/SKILL.md.part' && mv '.skill-downloads/run-wordpress-sql-queries-muar2zf6/SKILL.md.part' '.skill-downloads/run-wordpress-sql-queries-muar2zf6/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Original excerpt: Prerequisites
  • Database credentials are stored in CLAUDE.local.md under "Database Access"
  • Docker compose services must be running
  • Commands must be run from the docker-compose project directory

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/run-wordpress-sql-queries-muar2zf6/SKILL.md' && test -s '.skill-downloads/run-wordpress-sql-queries-muar2zf6/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/sql' && cp -R '.skill-downloads/run-wordpress-sql-queries-muar2zf6' '.claude/skills/sql'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/run-wordpress-sql-queries-muar2zf6'

openskills read 'run-wordpress-sql-queries-muar2zf6'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/run-wordpress-sql-queries-muar2zf6/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills