Agent skill
db-migrate
[DevOps] Run or create database migrations
Install this agent skill to your Project
npx add-skill https://github.com/duc01226/EasyPlatform/tree/main/.claude/skills/db-migrate
SKILL.md
[IMPORTANT] Use
TaskCreateto break ALL work into small tasks BEFORE starting — including tasks for each file read. This prevents context loss from long files. For simple tasks, AI MUST ask user whether to skip.
Prerequisites: MUST READ before executing:
Understand Code First — Search codebase for 3+ similar implementations BEFORE writing any code. Read existing files, validate assumptions with grep evidence, map dependencies via graph trace. Never invent new patterns when existing ones work. MUST READ
.claude/skills/shared/understand-code-first-protocol.mdfor full protocol and checklists.
docs/project-reference/domain-entities-reference.md— Domain entity catalog, relationships, cross-service sync (read when task involves business entities/models) (content auto-injected by hook — check for [Injected: ...] header before reading)
Quick Summary
Goal: Create or run database migrations (EF Core migrations, MongoDB data migrations) following platform patterns.
Workflow:
- Identify — Determine migration type (EF schema vs data migration)
- Create — Generate migration using
dotnet efor project data migration executor (see docs/project-reference/backend-patterns-reference.md) - Verify — Run migration and confirm schema/data changes
Key Rules:
- Follow platform migration patterns from CLAUDE.md
- Always backup data before destructive migrations
- Use project data migration executor for MongoDB data migrations (see docs/project-reference/backend-patterns-reference.md)
Be skeptical. Apply critical thinking, sequential thinking. Every claim needs traced proof, confidence percentages (Idea should be more than 80%).
Database migration: $ARGUMENTS
Instructions
-
Parse arguments:
add <name>→ Create new EF Core migrationupdate→ Apply pending migrationslist→ List all migrations and statusrollback→ Revert last migration- No argument → Show migration status
-
Identify database provider from project:
- SQL Server: Search for
*.Persistenceprojects - PostgreSQL: Search for
*.Persistence.PostgreSqlprojects - MongoDB: Uses project Mongo migration executor (code-based, see docs/project-reference/backend-patterns-reference.md)
- SQL Server: Search for
-
For EF Core (SQL Server/PostgreSQL):
Add migration:
bashcd src/{ExampleApp}/{ExampleApp}.TextSnippet.Persistence dotnet ef migrations add <MigrationName> --startup-project ../{ExampleApp}.TextSnippet.ApiUpdate database:
bashdotnet ef database update --startup-project ../{ExampleApp}.TextSnippet.ApiList migrations:
bashdotnet ef migrations list --startup-project ../{ExampleApp}.TextSnippet.Api -
For MongoDB migrations:
- MongoDB uses code-based migrations via project Mongo migration executor (see docs/project-reference/backend-patterns-reference.md)
- Location:
*.Persistence.Mongo/Migrations/ - Migrations run automatically on application startup
- To create: Generate new migration class following existing patterns
-
Safety checks:
- Warn before applying migrations to production
- Show what changes will be applied
- Recommend backup before destructive operations
Closing Reminders
- MUST break work into small todo tasks using
TaskCreateBEFORE starting - MUST search codebase for 3+ similar patterns before creating new code
- MUST cite
file:lineevidence for every claim (confidence >80% to act) - MUST add a final review todo task to verify work quality MANDATORY IMPORTANT MUST READ the following files before starting:
- MUST READ
.claude/skills/shared/understand-code-first-protocol.mdbefore starting
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
fix-parallel
[Implementation] Analyze & fix issues with parallel fullstack-developer agents
ask
[Utilities] Answer technical and architectural questions.
claude-code
[Utilities] Claude Code CLI setup, configuration, troubleshooting, and feature guidance. Triggers on claude code setup, hook not firing, MCP connection, context limit, skill creation, slash command setup.
workflow-deployment
[Workflow] Trigger Deployment & Infrastructure workflow — CI/CD pipelines, Docker, Kubernetes setup and deployment.
workflow-idea-to-pbi
[Workflow] Trigger Idea to PBI workflow — po/ba workflow: capture idea, refine to pbi, create stories, prioritize.
easy-claude-help
[Utilities] Configuration guide for the easy-claude framework — explain settings, guide users through configuring .ck.json.
Didn't find tool you were looking for?