database-designer
Provides expert-level database design with schema analysis, index optimization, and migration generation. Supports PostgreSQL, MySQL, MongoDB, and DynamoDB. Use when designing schemas, optimizing queries, planning migrations, or analyzing database performance.
What this skill does
# Database Designer The agent analyzes SQL schemas for normalization compliance, recommends optimal indexes based on query patterns, and generates safe migration scripts with rollback procedures. It produces Mermaid ERDs, detects redundant indexes, and implements zero-downtime expand-contract migration patterns for PostgreSQL and MySQL. ## Quick Start ```bash # Analyze a schema for normalization issues and generate ERD python schema_analyzer.py --input schema.sql --generate-erd --output-format json # Recommend indexes based on query patterns python index_optimizer.py --schema schema.json --queries queries.json --analyze-existing # Generate migration scripts between schema versions python migration_generator.py --current current.json --target target.json --zero-downtime ``` --- ## Core Workflows ### Workflow 1: Analyze and Optimize a Schema 1. Provide DDL (SQL) or JSON schema definition 2. Run `schema_analyzer.py` to detect normalization violations (1NF-BCNF), missing constraints, and naming issues 3. Review generated Mermaid ERD for relationship visualization 4. Run `index_optimizer.py` with query patterns to get index recommendations 5. **Validation checkpoint:** All 1NF-3NF violations addressed; foreign keys declared; no redundant indexes ```bash python schema_analyzer.py -i schema.sql -f json -e -o report.json python index_optimizer.py -s schema.json -q queries.json -e -p 2 -o index_report.json ``` ### Workflow 2: Generate a Safe Migration 1. Export current and target schemas as JSON 2. Run `migration_generator.py` to produce forward and rollback SQL 3. For large tables (10M+ rows), add `--zero-downtime` for expand-contract pattern 4. Review validation queries that confirm migration success 5. **Validation checkpoint:** Every forward step has a rollback counterpart; validation queries pass on test data ```bash python migration_generator.py -c current.json -t target.json -z --include-validations -f json -o plan.json ``` ### Workflow 3: Index Optimization for Query Patterns 1. Document top 10 query patterns as JSON (WHERE clauses, JOINs, ORDER BY) 2. Run `index_optimizer.py` with `--analyze-existing` to find redundancies 3. Review composite index column ordering (most selective first) 4. Check for covering index opportunities 5. **Validation checkpoint:** Query patterns covered; no overlapping indexes; estimated 40%+ query time reduction --- ## Index Type Selection | Index Type | Best For | Example | |------------|----------|---------| | B-tree | Range queries, sorting, equality | `CREATE INDEX idx ON tasks (status, created_date)` | | Partial | Subset queries on hot data | `CREATE INDEX idx ON users (email) WHERE status = 'active'` | | Covering | Avoiding table lookups | `CREATE INDEX idx ON users (email) INCLUDE (name, status)` | | Hash | Exact match only | Primary keys, cache keys | | GIN | JSONB, array, full-text | `CREATE INDEX idx ON docs USING GIN (data)` | --- ## Anti-Patterns - **Over-indexing** -- every column indexed wastes write performance and storage; index only columns appearing in WHERE, JOIN, and ORDER BY - **Missing foreign keys** -- relying on application-layer referential integrity leads to orphaned records; always declare FK constraints - **VARCHAR(255) everywhere** -- oversized columns waste memory in indexes; right-size columns based on actual data - **Premature denormalization** -- denormalize only when EXPLAIN ANALYZE shows join-related bottlenecks, not preemptively - **Direct ALTER on large tables** -- `ALTER TABLE ... SET NOT NULL` on a 100M-row table locks the table; use expand-contract pattern - **No validation queries in migrations** -- migrations without post-step validation risk silent data corruption ## Troubleshooting | Problem | Cause | Solution | |---------|-------|----------| | Schema analyzer reports false 1NF violations | JSON or array columns detected as multi-valued fields | Review flagged columns; intentional JSONB/array usage is valid for document-style storage patterns | | Index optimizer recommends indexes on low-selectivity columns | Boolean or status columns appear in frequent WHERE clauses | Use partial indexes (`WHERE status = 'active'`) instead of full-column indexes to reduce overhead | | Migration generator produces high-risk steps for column type changes | Direct `ALTER COLUMN ... TYPE` can lock tables and fail on incompatible data | Use the `--zero-downtime` flag to generate expand-contract migration patterns with safe backfill steps | | ERD output missing relationships | Foreign key constraints not declared in DDL or JSON input | Ensure all FK relationships are explicitly defined; the analyzer only detects declared constraints | | Composite index column order seems wrong | Optimizer orders by estimated selectivity, not query clause order | Verify cardinality estimates in the schema JSON; provide `cardinality_estimate` per column for accurate ordering | | Redundancy analysis flags covering indexes as overlapping | Overlap ratio calculation uses Jaccard similarity on column sets | Review flagged pairs manually; covering indexes with INCLUDE columns serve a different purpose than their subsets | | Validation queries fail after migration | Target schema JSON does not match actual post-migration state | Run `--validate-only` before and after migration; ensure the target JSON reflects all intended changes precisely | ## Success Criteria - Schema analysis detects 90%+ of normalization violations (1NF through BCNF) when provided complete DDL input - Index recommendations reduce query execution time by 40%+ for analyzed query patterns (measured via EXPLAIN ANALYZE before/after) - Migration scripts execute with zero data loss and include verified rollback for every forward step - ERD generation produces valid Mermaid diagrams that render correctly for schemas with up to 50 tables - Redundant index detection identifies 95%+ of duplicate and overlapping indexes with less than 5% false positive rate - Zero-downtime migrations maintain full application availability during schema changes on tables with 10M+ rows - Generated SQL statements are syntactically valid and compatible with PostgreSQL 14+ and MySQL 8.0+ ## Scope & Limitations **Covers:** - Schema design analysis for SQL databases (PostgreSQL, MySQL) including normalization, constraints, naming, and data types - Index optimization with selectivity estimation, composite index ordering, covering indexes, and redundancy detection - Migration generation with forward/rollback scripts, zero-downtime patterns, and validation queries - ERD generation in Mermaid format from DDL or JSON schema definitions **Does NOT cover:** - Runtime query performance monitoring or live database profiling (see `performance-profiler` skill) - NoSQL-specific schema design for MongoDB, DynamoDB, or Cassandra (conceptual guidance only in the reference sections) - Database administration tasks such as backup/restore, replication setup, or user/role management - Application-level ORM configuration, connection pool tuning, or driver-specific optimizations (see `database-schema-designer` for ORM-adjacent patterns) ## Integration Points | Skill | Integration | Data Flow | |-------|-------------|-----------| | `migration-architect` | Migration strategy and execution planning for large-scale schema changes | Database Designer generates migration SQL; Migration Architect orchestrates multi-service deployment order and rollback coordination | | `database-schema-designer` | Complementary schema design with focus on application-layer patterns | Database Designer provides normalization analysis; Schema Designer applies ORM mapping and application modeling conventions | | `performance-profiler` | Runtime validation of index and schema optimization recommendations | Database Designer outputs recommended indexes; Performance Profiler measures actual query plan improvements via EXPLAIN ANALYZE | | `api-design-reviewer` | Alignment between database schema and API resou
Related in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.