thiepdientu/LS-Wedding / .agents/skills/mysql-database
mysql-database
VerifiedDesigns and implements MySQL schemas for Laravel 12 using migrations, Eloquent relationships, factories, seeders, constraints, indexes, transactions, and query optimization. Use for persistence and database work.
MySQL Database Engineering
Role
Act as a senior Laravel + MySQL database engineer.
Workflow
- Inspect current migrations, models, factories, seeders, and query patterns.
- Identify entities and cardinality.
- Define ownership and lifecycle.
- Choose column types and nullability deliberately.
- Add constraints and indexes based on actual access patterns.
- Implement migration.
- Update models/relationships/casts.
- Update factories/seeders when relevant.
- Add tests.
- Review query performance.
Migration rules
- Migrations are version control for schema.
- Do not rewrite old migrations that may have run in shared environments; create a new migration.
- Keep
upanddowncoherent where practical. - Use foreign keys for referential integrity.
- Define nullability/defaults intentionally.
- Never drop/rename production data structures without explicit approval and a rollout plan.
MySQL design
- Use appropriate numeric/string/date/json types.
- Prefer
foreignIdconventions where compatible with the existing schema. - Add unique constraints where the business rule requires uniqueness.
- Index columns based on real filtering/join/order patterns.
- Avoid indexing every column.
- Consider composite indexes for common multi-column queries.
Eloquent relationships
Use the correct relationship type:
- belongsTo
- hasOne
- hasMany
- belongsToMany
- polymorphic relationships only when genuinely needed
Performance
Check for:
- N+1 queries
- SELECT * on large records
- unbounded queries
- missing indexes
- excessive eager loading
- expensive LIKE patterns
- inefficient OFFSET pagination
Prefer eager loading, pagination/cursor pagination, aggregates, scopes, and targeted selects when appropriate.
Integrity
Application validation is not a replacement for database constraints. Use unique keys, foreign keys, nullability, and other supported constraints where appropriate.
Factories/seeders
Factories should produce valid realistic data. Seeders should be safe for local/dev use and must not contain secrets or production-sensitive data.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| deprecation-and-migrationaddyosmani/agent-skillsManages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when migrating a database schema in production, such as renaming or dropping a column without downtime (expand/contract). Use when deciding whether to maintain or sunset existing code. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |
| performance-optimizationaddyosmani/agent-skillsOptimizes application performance across frontend, backend, queries, and databases. Use when performance requirements exist, when you suspect performance regressions, when Core Web Vitals or load times need improvement, when N+1 query patterns need fixing, or when profiling reveals bottlenecks. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |
| Agent Cost Reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json. | Stars: 117k | Updated | Claude CodeCodex | Verified | Install |
| Agent Cost Reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json. | Stars: 117k | Updated | Claude CodeCodex | Verified | Install |