Run SQL queries against the WordPress development database. Use when querying database tables, inspecting Simple History events, checking WordPress data, debugging database issues, or when the user says "run query" or "check database".
Installation
Details
Usage
After installing, this skill will be available to your AI coding assistant.
Verify installation:
skills listSkill Instructions
name: sql description: Run SQL queries against the WordPress development database. Use when querying database tables, inspecting Simple History events, checking WordPress data, debugging database issues, or when the user says "run query" or "check database".
Run SQL Queries
Run SQL queries against the WordPress development database.
Prerequisites
- Database credentials are stored in
CLAUDE.local.mdunder "Database Access" - Docker compose services must be running
- Commands 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 tablewp_simple_history_contexts- Event context/metadata
Instructions
- Read credentials from
CLAUDE.local.md - Ask the user what SQL query they want to run (if not specified)
- Run the query using the command pattern above
- Display the results
- Offer to run follow-up queries if needed
Notes
- For complex queries, consider using
\Gat the end for vertical output - Be careful with UPDATE/DELETE queries - always confirm with user first
More by bonny
View allProvides WordPress coding standards, PHP/CSS/JS style guide, code linting and static analysis (phpcs, phpstan, rector, phpcbf). Use before writing or editing PHP, CSS, or JavaScript code, when fixing lint errors, running code quality tools, or reviewing code style compliance.
Ensures WordPress.org compliance for freemium plugins (free vs premium features, license keys, trial limits, upselling). Prevents trialware violations. Use when adding premium features, implementing upsells, checking license keys, creating teasers, reviewing code before WordPress.org submission, or when the user mentions "premium", "upsell", or "freemium".
Add an entry to the changelog in readme.txt following the project's changelog format. Use when updating readme.txt, adding to Unreleased section, documenting changes for a release, or when the user says "add changelog" or "update changelog".
Writes user-friendly logger messages in active voice for Simple History event logs. Fixes passive voice issues. Use when creating or modifying logger classes in loggers/ directory, writing getInfo() messages, fixing passive voice, reviewing log message clarity, or adding new events to the activity log.