home / skills / proxiblue / claude-skills / database-query-analysis

database-query-analysis skill

/database-query-analysis

This skill executes Magento 2 data queries for catalog, orders, configurations, and performance, delivering rapid insights and exportable results.

npx playbooks add skill proxiblue/claude-skills --skill database-query-analysis

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
2.3 KB
---
name: database-query-analysis
description: Rapid database query execution skill for common Magento 2 data analysis tasks. Leverages database and magento2-dev MCP servers for catalog, order, configuration, and system data retrieval.
---

This skill provides efficient database query execution for Magento 2 data analysis.

## What This Skill Does

1. **Catalog Data Queries**
   - Product counts by type, status, visibility
   - Category hierarchy and product assignments
   - Inventory levels and stock status
   - Attribute usage and EAV data analysis
   - Price analysis and tier pricing

2. **Order & Sales Queries**
   - Order volume and revenue analysis by period
   - Payment method distribution and success rates
   - Shipping method usage and costs
   - Customer purchase patterns and lifetime value
   - Refund and credit memo analysis

3. **Configuration Queries**
   - System configuration by scope (default/website/store)
   - Module status and version information
   - Store view hierarchy and relationships
   - Admin user and role analysis
   - Cron job status and history

4. **Performance Queries**
   - Index status and update times
   - Cache tag analysis
   - Database table sizes and growth
   - Slow query identification
   - Customer session analysis

## MCP Integration

Utilizes:
- **database MCP**: Direct SQL query execution
- **magento2-dev MCP**: Magento-specific data retrieval functions
  - `mcp__magento2-dev__db-query`
  - `mcp__magento2-dev__sys-store-list`
  - `mcp__magento2-dev__config-show`

## Usage

When invoked, this skill can:

1. Execute predefined common queries for rapid insights
2. Build dynamic queries based on analysis requirements
3. Format results for business stakeholder reporting
4. Provide data export in CSV or JSON format
5. Generate comparative analysis across time periods

## Output

The skill provides:
- Structured data results with clear labeling
- Statistical summaries and aggregations
- Trend analysis and period comparisons
- Actionable insights and recommendations
- Executive summaries for business stakeholders

## When to Use

- Initial catalog health assessment
- Order performance analysis
- Configuration audits and validation
- Database optimization planning
- Business intelligence reporting
- Troubleshooting data-related issues

Overview

This skill provides rapid database query execution tailored for Magento 2 data analysis. It delivers ready-made and dynamic SQL queries to extract catalog, order, configuration, and performance metrics. Results are formatted for analysts and business stakeholders, with CSV/JSON export and executive summaries.

How this skill works

The skill runs predefined or on-demand SQL queries against Magento 2 databases via a database MCP and leverages a magento2-dev MCP for Magento-specific helpers. It inspects EAV tables, sales/order tables, config scopes, and system tables to produce aggregations, counts, and trend analyses. Outputs include structured result sets, statistical summaries, and exportable CSV/JSON files ready for reporting.

When to use it

  • Perform an initial catalog health assessment and inventory check
  • Analyze order volume, revenue trends, and payment/shipping distributions
  • Audit system configuration, module statuses, and store view relationships
  • Identify slow queries, large tables, and index or cache issues for optimization planning
  • Prepare BI extracts or CSV/JSON exports for stakeholder reports

Best practices

  • Run queries against a read replica or backup to avoid production load
  • Limit row counts and use pagination for large exports
  • Filter by scope (store/website) when querying config or catalog data
  • Schedule heavy queries during low-traffic windows and use indexes for large table scans
  • Validate results by sampling and cross-checking with Magento admin reports

Example use cases

  • Count active products by type and visibility to prioritize catalog clean-up
  • Compare monthly order revenue and average order value for trend reporting
  • List modules and versions plus system config per store for compliance audits
  • Identify top slow queries and largest tables for database capacity planning
  • Export customer lifetime value summaries to CSV for marketing segmentation

FAQ

Can this run direct SQL on a production database?

Yes, but prefer read replicas or maintenance windows. Heavy queries can impact performance so test on staging first.

What export formats are available?

Results can be exported as CSV or JSON, and outputs include labeled columns and summary statistics.