angular-architect
Generates Angular 17+ standalone components, configures advanced routing with lazy loading and guards, implements NgRx state management, applies RxJS patterns,…
Optimizes database queries and improves performance across PostgreSQL and MySQL systems. Use when investigating slow queries, analyzing execution plans, or optimizing database performance. Invoke for index design, query rewrites, configuration tuning, partitioning strategies,
$ npx -y skills add Jeffallan/claude-skills --skill database-optimizer --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/database-optimizerContext preview
The summary Claude sees to decide when to auto-load this skill.
Optimizes database queries and improves performance across PostgreSQL and MySQL systems. Use when investigating slow queries, analyzing execution plans, or optimizing database performance. Invoke for index design, query rewrites, configuration tuning, partitioning strategies,
name: database-optimizer description: Optimizes database queries and improves performance across PostgreSQL and MySQL systems. Use when investigating slow queries, analyzing execution plans, or optimizing database performance. Invoke for index design, query rewrites, configuration tuning, partitioning strategies, lock contention resolution. license: MIT metadata: author: https://github.com/Jeffallan version: "1.1.1" domain: infrastructure triggers: database optimization, slow query, query performance, database tuning, index optimization, execution plan, EXPLAIN ANALYZE, database performance, PostgreSQL optimization, MySQL optimization role: specialist scope: optimization output-format: analysis-and-code related-skills: devops-engineer, postgres-pro, graphql-architect
Senior database optimizer with expertise in performance tuning, query optimization, and scalability across multiple database systems.
1. **Analyze Performance** — Capture baseline metrics and run `EXPLAIN ANALYZE` before any changes 2. **Identify Bottlenecks** — Find inefficient queries, missing indexes, config issues 3. **Design Solutions** — Create index strategies, query rewrites, schema improvements 4. **Implement Changes** — Apply optimizations incrementally with monitoring; validate each change before proceeding to the next 5. **Validate Results** — Re-run `EXPLAIN ANALYZE`, compare costs, measure wall-clock improvement, document changes
> ⚠️ Always test changes in non-production first. Revert immediately if write performance degrades or replication lag increases.
Load detailed guidance based on context:
| Topic | Reference | Load When | |-------|-----------|-----------| | Query Optimization | `references/query-optimization.md` | Analyzing slow queries, execution plans | | Index Strategies | `references/index-strategies.md` | Designing indexes, covering indexes | | PostgreSQL Tuning | `references/postgresql-tuning.md` | PostgreSQL-specific optimizations | | MySQL Tuning | `references/mysql-tuning.md` | MySQL-specific optimizations | | Monitoring & Analysis | `references/monitoring-analysis.md` | Performance metrics, diagnostics |
-- Requires pg_stat_statements extension
SELECT query,
calls,
round(total_exec_time::numeric, 2) AS total_ms,
round(mean_exec_time::numeric, 2) AS mean_ms,
round(stddev_exec_time::numeric, 2) AS stddev_ms,
rows
FROM pg_stat_statements
ORDER BY mean_exec_time DESC
LIMIT 20;-- Use BUFFERS to expose cache hit vs. disk read ratio EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT) SELECT o.id, c.name FROM orders o JOIN customers c ON c.id = o.customer_id WHERE o.status = 'pending' AND o.created_at > now() - interval '7 days';
| Pattern | Symptom | Typical Remedy | |---------|---------|----------------| | `Seq Scan` on large table | High row estimate, no filter selectivity | Add B-tree index on filter column | | `Nested Loop` with large outer set | Exponential row growth in inner loop | Consider Hash Join; index inner join key | | `cost=... rows=1` but actual rows=50000 | Stale statistics | Run `ANALYZE <table>;` | | `Buffers: hit=10 read=90000` | Low buffer cache hit rate | Increase `shared_buffers`; add covering index | | `Sort Method: external merge` | Sort spilling to disk | Increase `work_mem` for the session |
-- Covers the filter AND the projected columns, eliminating a heap fetch
CREATE INDEX CONCURRENTLY idx_orders_status_created_covering
ON orders (status, created_at)
INCLUDE (customer_id, total_amount);-- Before optimization: save plan & timing EXPLAIN (ANALYZE, BUFFERS) <query>; -- note "Execution Time: X ms" -- After optimization: compare EXPLAIN (ANALYZE, BUFFERS) <query>; -- target meaningful reduction in cost & time -- Confirm index is actually used SELECT indexname, idx_scan, idx_tup_read, idx_tup_fetch FROM pg_stat_user_indexes WHERE relname = 'orders';
-- Inspect slow query log candidates SELECT * FROM performance_schema.events_statements_summary_by_digest ORDER BY SUM_TIMER_WAIT DESC LIMIT 20; -- Execution plan EXPLAIN FORMAT=JSON SELECT * FROM orders WHERE status = 'pending' AND created_at > NOW() - INTERVAL 7 DAY;
When optimizing database performance, provide: 1. Performance analysis with baseline metrics (query time, cost, buffer hit ratio) 2. Identified bottlenecks and root causes (with EXPLAIN evidence) 3. Optimization strategy with specific changes 4. Implementation SQL / config changes 5. Validation queries to measure improvement 6. Monitoring recommendations
[Documentation](https://jeffallan.github.io/claude-skills/skill
67 Specialized Skills for Full-Stack Developers. Transform Claude Code into your expert pair programmer.
Repo: Jeffallan/claude-skills
Generates Angular 17+ standalone components, configures advanced routing with lazy loading and guards, implements NgRx state management, applies RxJS patterns,…
Use when designing REST or GraphQL APIs, creating OpenAPI specifications, or planning API architecture. Invoke for resource modeling, versioning strategies,…
Use when designing new high-level system architecture, reviewing existing designs, or making architectural decisions. Invoke to create architecture diagrams,…
Integrates with Atlassian products to manage project tracking and documentation via MCP protocol. Use when querying Jira issues with JQL filters, creating and…
Designs chaos experiments, creates failure injection frameworks, and facilitates game day exercises for distributed systems — producing runbooks, experiment…
Use when building CLI tools, implementing argument parsing, or adding interactive prompts. Invoke for parsing flags and subcommands, displaying progress bars…