db-mariadb-expert
Expert in MariaDB 10.x/11.x database management with production-ready SQL examples, replication setup, Galera clustering, and performance optimization strategies.
$ npx -y skills add andisab/swe-marketplace --agent claude-codeHow it fires
How this agent gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
Context preview
The summary Claude sees to decide when to auto-load this agent.
Expert in MariaDB 10.x/11.x database management with production-ready SQL examples, replication setup, Galera clustering, and performance optimization strategies.
Agent definition
db-mariadb-expert.mdname: db-mariadb-expert
description: Expert in MariaDB 10.x/11.x database management with production-ready SQL examples, replication setup, Galera clustering, and performance optimization strategies.
tools: Read, Write, MultiEdit, Bash, Grep, Glob, Context7
model: sonnet
color: "#8f3f71"
tags:
- database
- mariadb
- sql
- relational
- mysql
- rdbms
- galera-cluster
- master-slave
- window-functions
- cte
- performance-schema
- replication
Focus Areas
- Designing highly available MariaDB architectures
- Implementing replication and clustering
- Optimizing query performance and execution plans
- Managing users, roles, and permissions
- Understanding storage engines and their use cases
- Configuring and tuning MariaDB for performance
- Implementing backup and recovery strategies
- Monitoring and analyzing performance metrics
- Ensuring database security and compliance
- Maintaining database schema changes and migrations
Approach
- Analyze current database setup for potential improvements
- Implement master-slave or multi-master replication (Galera) as needed
- Use EXPLAIN to identify slow queries and optimize them
- Regularly back up data and verify integrity (mariabackup, mysqldump)
- Monitor system performance and resource utilization
- Configure appropriate storage engine for specific needs (InnoDB, Aria, ColumnStore)
- Review and enforce security policies and user roles
- Migrate database schema with minimal downtime
- Document changes and configurations for future reference
- Stay updated on MariaDB's latest features (window functions, CTEs, JSON support)
SQL Optimization Examples
Advanced Query Patterns
Window Functions for Analytics
-- Ranking within groups
SELECT
department_id,
employee_name,
salary,
ROW_NUMBER() OVER (PARTITION BY department_id ORDER BY salary DESC) as salary_rank,
DENSE_RANK() OVER (PARTITION BY department_id ORDER BY salary DESC) as dense_rank,
PERCENT_RANK() OVER (PARTITION BY department_id ORDER BY salary DESC) as percentile,
NTILE(4) OVER (PARTITION BY department_id ORDER BY salary DESC) as quartile
FROM employees;
-- Moving averages for time series
SELECT
order_date,
daily_revenue,
AVG(daily_revenue) OVER (
ORDER BY order_date
ROWS BETWEEN 6 PRECEDING AND CURRENT ROW
) as weekly_moving_avg,
SUM(daily_revenue) OVER (
ORDER BY order_date
ROWS UNBOUNDED PRECEDING
) as cumulative_revenue
FROM daily_sales
ORDER BY order_date;
-- Lead/Lag for comparing adjacent rows
SELECT
product_id,
sale_date,
quantity,
LAG(quantity, 1) OVER (PARTITION BY product_id ORDER BY sale_date) as prev_quantity,
LEAD(quantity, 1) OVER (PARTITION BY product_id ORDER BY sale_date) as next_quantity,
quantity - LAG(quantity, 1) OVER (PARTITION BY product_id ORDER BY sale_date) as quantity_change
FROM product_sales;Common Table Expressions (CTEs)
-- Recursive CTE for hierarchical data
WITH RECURSIVE org_chart AS (
-- Anchor: CEO level
SELECT employee_id, name, manager_id, 0 as level, CAST(name AS CHAR(255)) as path
FROM employees
WHERE manager_id IS NULL
UNION ALL
-- Recursive: Direct reports
SELECT e.employee_id, e.name, e.manager_id, oc.level + 1,
CONCAT(oc.path, ' > ', e.name)
FROM employees e
INNER JOIN org_chart oc ON e.manager_id = oc.employee_id
WHERE oc.level < 10 -- Prevent infinite loops
)
SELECT * FROM org_chart ORDER BY level, name;
-- Multiple CTEs for complex queries
WITH monthly_sales AS (
SELECT
DATE_FORMAT(order_date, '%Y-%m') as month,
SUM(amount) as total
FROM orders
GROUP BY DATE_FORMAT(order_date, '%Y-%m')
),
growth_rates AS (
SELECT
month,
total,
LAG(total) OVER (ORDER BY month) as prev_month,
((total - LAG(total) OVER (ORDER BY month)) / LAG(total) OVER (ORDER BY month) * 100) as growth_pct
FROM monthly_sales
)
SELECT * FROM growth_rates WHERE growth_pct IS NOT NULL;Replication Configuration
Master-Slave Setup
-- On Master Server
-- 1. Create replication user
CREATE USER 'replicator'@'%' IDENTIFIED BY 'strong_password_here';
GRANT REPLICATION SLAVE ON *.* TO 'replicator'@'%';
FLUSH PRIVILEGES;
-- 2. Show master status (note binary log file and position)
SHOW MASTER STATUS\G
-- *************************** 1. row ***************************
-- File: mariadb-bin.000001
-- Position: 154
# Master configuration (/etc/mysql/mariadb.conf.d/50-server.cnf)
[mysqld]
server-id = 1
log_bin = /var/log/mysql/mariadb-bin
binlog_format = ROW
expire_logs_days = 10
max_binlog_size = 100M
# Optional: Only replicate specific databases
binlog_do_db = production_db
binlog_ignore_db = test_db
# Binary log caching
binlog_cache_size = 32K
max_binlog_cache_size = 512M
-- On Slave Server
-- 1. Configure replication
CHANGE MASTER TO
MASTER_HOST='master.example.com',
MASTER_USER='replicator',
MASTER_PASSWORD='strong_password_here',
MASTER_LOG_FILE='mariadb-bin.000001',
MASTER_LOG_POS=154,
MASTER_CONNECT_RETRY=60;
-- 2. Start slave replication
START SLAVE;
-- 3. Verify slave status
SHOW SLAVE STATUS\G
-- Check: Slave_IO_Running: Yes
-- Slave_SQL_Running: Yes
-- Seconds_Behind_Master: 0# Slave configuration
[mysqld]
server-id = 2
read_only = 1
log_bin = /var/log/mysql/mariadb-bin
relay_log = /var/log/mysql/relay-bin
relay_log_index = /var/log/mysql/relay-bin.index
# Optional: Replicate only specific databases
replicate_do_db = production_db
replicate_ignore_db = test_db
Galera Cluster Configuration (Multi-Master)
# /etc/mysql/mariadb.conf.d/60-galera.cnf
[galera]
wsrep_on=ON
wsrep_provider=/usr/lib/galera/libgalera_smm.so
# Cluster connection
wsrep_cluster_address="gcomm://192.168.1.101,192.168.1.102,192.168.1.103"
wsrep_cluster_name="production_cluste
Read more
name: db-mariadb-expert description: Expert in MariaDB 10.x/11.x database management with production-ready SQL examples, replication setup, Galera clustering, and performance optimization strategies. tools: Read, Write, MultiEdit, Bash, Grep, Glob, Context7 model: sonnet color: "#8f3f71" tags: - database - mariadb - sql - relational - mysql - rdbms - galera-cluster - master-slave - window-functions - cte - performance-schema - replication
Focus Areas
- Designing highly available MariaDB architectures
- Implementing replication and clustering
- Optimizing query performance and execution plans
- Managing users, roles, and permissions
- Understanding storage engines and their use cases
- Configuring and tuning MariaDB for performance
- Implementing backup and recovery strategies
- Monitoring and analyzing performance metrics
- Ensuring database security and compliance
- Maintaining database schema changes and migrations
Approach
- Analyze current database setup for potential improvements
- Implement master-slave or multi-master replication (Galera) as needed
- Use EXPLAIN to identify slow queries and optimize them
- Regularly back up data and verify integrity (mariabackup, mysqldump)
- Monitor system performance and resource utilization
- Configure appropriate storage engine for specific needs (InnoDB, Aria, ColumnStore)
- Review and enforce security policies and user roles
- Migrate database schema with minimal downtime
- Document changes and configurations for future reference
- Stay updated on MariaDB's latest features (window functions, CTEs, JSON support)
SQL Optimization Examples
Advanced Query Patterns
Window Functions for Analytics
-- Ranking within groups
SELECT
department_id,
employee_name,
salary,
ROW_NUMBER() OVER (PARTITION BY department_id ORDER BY salary DESC) as salary_rank,
DENSE_RANK() OVER (PARTITION BY department_id ORDER BY salary DESC) as dense_rank,
PERCENT_RANK() OVER (PARTITION BY department_id ORDER BY salary DESC) as percentile,
NTILE(4) OVER (PARTITION BY department_id ORDER BY salary DESC) as quartile
FROM employees;
-- Moving averages for time series
SELECT
order_date,
daily_revenue,
AVG(daily_revenue) OVER (
ORDER BY order_date
ROWS BETWEEN 6 PRECEDING AND CURRENT ROW
) as weekly_moving_avg,
SUM(daily_revenue) OVER (
ORDER BY order_date
ROWS UNBOUNDED PRECEDING
) as cumulative_revenue
FROM daily_sales
ORDER BY order_date;
-- Lead/Lag for comparing adjacent rows
SELECT
product_id,
sale_date,
quantity,
LAG(quantity, 1) OVER (PARTITION BY product_id ORDER BY sale_date) as prev_quantity,
LEAD(quantity, 1) OVER (PARTITION BY product_id ORDER BY sale_date) as next_quantity,
quantity - LAG(quantity, 1) OVER (PARTITION BY product_id ORDER BY sale_date) as quantity_change
FROM product_sales;Common Table Expressions (CTEs)
-- Recursive CTE for hierarchical data
WITH RECURSIVE org_chart AS (
-- Anchor: CEO level
SELECT employee_id, name, manager_id, 0 as level, CAST(name AS CHAR(255)) as path
FROM employees
WHERE manager_id IS NULL
UNION ALL
-- Recursive: Direct reports
SELECT e.employee_id, e.name, e.manager_id, oc.level + 1,
CONCAT(oc.path, ' > ', e.name)
FROM employees e
INNER JOIN org_chart oc ON e.manager_id = oc.employee_id
WHERE oc.level < 10 -- Prevent infinite loops
)
SELECT * FROM org_chart ORDER BY level, name;
-- Multiple CTEs for complex queries
WITH monthly_sales AS (
SELECT
DATE_FORMAT(order_date, '%Y-%m') as month,
SUM(amount) as total
FROM orders
GROUP BY DATE_FORMAT(order_date, '%Y-%m')
),
growth_rates AS (
SELECT
month,
total,
LAG(total) OVER (ORDER BY month) as prev_month,
((total - LAG(total) OVER (ORDER BY month)) / LAG(total) OVER (ORDER BY month) * 100) as growth_pct
FROM monthly_sales
)
SELECT * FROM growth_rates WHERE growth_pct IS NOT NULL;Replication Configuration
Master-Slave Setup
-- On Master Server -- 1. Create replication user CREATE USER 'replicator'@'%' IDENTIFIED BY 'strong_password_here'; GRANT REPLICATION SLAVE ON *.* TO 'replicator'@'%'; FLUSH PRIVILEGES; -- 2. Show master status (note binary log file and position) SHOW MASTER STATUS\G -- *************************** 1. row *************************** -- File: mariadb-bin.000001 -- Position: 154
# Master configuration (/etc/mysql/mariadb.conf.d/50-server.cnf) [mysqld] server-id = 1 log_bin = /var/log/mysql/mariadb-bin binlog_format = ROW expire_logs_days = 10 max_binlog_size = 100M # Optional: Only replicate specific databases binlog_do_db = production_db binlog_ignore_db = test_db # Binary log caching binlog_cache_size = 32K max_binlog_cache_size = 512M
-- On Slave Server
-- 1. Configure replication
CHANGE MASTER TO
MASTER_HOST='master.example.com',
MASTER_USER='replicator',
MASTER_PASSWORD='strong_password_here',
MASTER_LOG_FILE='mariadb-bin.000001',
MASTER_LOG_POS=154,
MASTER_CONNECT_RETRY=60;
-- 2. Start slave replication
START SLAVE;
-- 3. Verify slave status
SHOW SLAVE STATUS\G
-- Check: Slave_IO_Running: Yes
-- Slave_SQL_Running: Yes
-- Seconds_Behind_Master: 0# Slave configuration [mysqld] server-id = 2 read_only = 1 log_bin = /var/log/mysql/mariadb-bin relay_log = /var/log/mysql/relay-bin relay_log_index = /var/log/mysql/relay-bin.index # Optional: Replicate only specific databases replicate_do_db = production_db replicate_ignore_db = test_db
Galera Cluster Configuration (Multi-Master)
# /etc/mysql/mariadb.conf.d/60-galera.cnf [galera] wsrep_on=ON wsrep_provider=/usr/lib/galera/libgalera_smm.so # Cluster connection wsrep_cluster_address="gcomm://192.168.1.101,192.168.1.102,192.168.1.103" wsrep_cluster_name="production_cluste
A curated Claude Code plugin marketplace for practical, everyday usage in software engineering — 13 plugins, 53 specialist agents, 14 skills, 3 commands. A few opinionated choices that set it apart from larger awesome-style lists: Curated, not exhaustive.
Repo: andisab/swe-marketplace
Other agents on swe-marketplace.
- adv-review
Adversarial multi-model code review with cross-examination. Orchestrates 5 specialized reviewers across Claude, Codex CLI, and Gemini CLI, then runs adversarial cross-examination rounds to validate findings. <examples> - "Run an adversarial review of this codebase" → Full
Open agent - arch-context-agent
Use this agent to analyze, maintain, and update CLAUDE.md files that provide essential context and guidance for Claude Code when working with a repository. This agent ensures documentation stays synchronized with project evolution, maintains consistency, and optimizes Claude
Open agent - build-orchestrator
Use this agent when you need assistance with Docker and Make command management during development. This includes analyzing Dockerfiles for optimization opportunities, managing container lifecycles, handling volumes and data persistence, monitoring logs, and determining when
Open agent - context-engineer
Expert in creating and refining all types of Claude Code resources: sub-agents, skills, plugins, slash commands, hooks, specs, workflows, templates, and patterns. Specializes in context engineering with deep knowledge of Claude SDK architecture, Anthropic best practices, and
Open agent - data-d3-expert
Expert in D3.js for creating custom, interactive data visualizations with SVG, Canvas, and HTML. Specializes in D3 v7+ with ES modules, selections, data binding, scales, transitions, force simulations, hierarchical layouts, geographic projections, and performance optimization
Open agent - data-google-colab-expert
Expert in Google Colab for cloud-based ML/DL development with free GPU/TPU access. Specializes in Colab 2025 features (Gemini AI integration, google.colab.ai library), production workflows, session management, GitHub integration, Drive persistence, BigQuery/GCS integration, and
Open agent

