Back to skills
SKILL.md
Data Operations
ASecurityPostgres query optimization and data seeding: EXPLAIN ANALYZE, N+1, cursor pagination, CTEs, factories, fixtures.
- 3 stars
- 0 votes
- 0 copies
- 3 views
- Added November 14, 2026
Works with
Security analysis
100/100Pro scans all 4 files and shows the line behind each finding
npx -y skills add SebastianLuser/claude-code-arcane --skill data-operations --agent claude-codeAre you the author of Data Operations?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/sebastianluser-data-operations)---
name: data-operations
description: "Postgres query optimization and data seeding: EXPLAIN ANALYZE, N+1, cursor pagination, CTEs, factories, fixtures."
category: "database"
argument-hint: "[optimize <query>|seed <env>]"
user-invocable: true
allowed-tools: Read, Glob, Grep, Bash, Write, Edit, Task
---
# data-operations — Query Optimization & Seeding
## Route
| User intent | Mode | Section |
|----------------------|------|---------|
| "slow query", "EXPLAIN", "N+1", "optimize SQL", "OFFSET", "index" | OPTIMIZE | → Section 1: Query Optimization |
| "seed", "fixtures", "demo data", "faker", "factory", "test data", "anonymize" | SEED | → Section 2: Data Seeding |
**Rule:** if the intent is ambiguous, ask before running anything.
---
## When to use
Diagnose/optimize slow queries, create dev/test/staging seeders, anonymize prod dumps.
## 1. Query Optimization
### EXPLAIN first
Always: `EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT) <query>;`. Visualize complex plans: explain.dalibo.com. Top queries: `pg_stat_statements ORDER BY total_exec_time DESC LIMIT 20`.
> → Read references/query-optimization.md for EXPLAIN signal table, common problems (N+1, SELECT *, OFFSET, etc.), CTEs, LATERAL joins, and materialized views
## 2. Data Seeding
4 types: Reference (all envs), Dev fixtures (local), Test fixtures (CI), Demo (staging). Structure: `db/seeds/` with reference/, fixtures/, demo/, anonymize/. Key rules: upserts for idempotency, factory pattern, anti-prod guardrail (`APP_ENV != "production"`).
> → Read references/seeding.md for seeding types, structure, factory patterns, performance tips, and anonymization guide
## Anti-patterns
> → Read references/anti-patterns.md for query (5 items) and seeding (5 items) anti-patterns
## Checklist
### Query optimization
- [ ] EXPLAIN ANALYZE before and after
- [ ] pg_stat_statements top queries reviewed
- [ ] N+1 removed (JOIN/Preload/DataLoader)
- [ ] Cursor pagination, not OFFSET
- [ ] Indexes validated → `/database-setup`
### Seeding
- [ ] Reference data separate from fixtures
- [ ] Idempotent upserts
- [ ] Anti-prod guardrail
- [ ] No real PII in fixtures
- [ ] Factory pattern for random data
- [ ] faker.seed() for deterministic tests
Files in this skill
- SKILL.md
- references/anti-patterns.md
- references/query-optimization.md
- references/seeding.md
Attribution
Related skills
View all in databases →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.