Agent skill
trigger-migration
Manually triggers the migration Lambda for deployed environments. Use when migrations need to be run outside of CI/CD.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/trigger-migration
SKILL.md
Trigger Migration Lambda
Manually triggers database migrations in deployed environments.
When to Use
- After manual SST deployment (without CI/CD)
- To re-run failed migrations
- Emergency migration fixes
Commands
Development
aws lambda invoke --function-name template-saas-api-migrate-lambda-dev /dev/null
Production
aws lambda invoke --function-name template-saas-api-migrate-lambda-prod /dev/null
Prerequisites
- AWS CLI configured with correct profile/credentials
- Lambda function deployed (via SST)
- Database accessible from Lambda
How It Works
The Migration Lambda:
- Connects to PostgreSQL using
DbConnStrsecret - Runs Alembic migrations via
migration.sh - Returns success/failure status
Lambda Naming Convention
{project}-api-migrate-lambda-{stage}
For this project: template-saas-api-migrate-lambda-{dev|prod}
Checking Migration Status
View Lambda Logs
aws logs tail /aws/lambda/template-saas-api-migrate-lambda-dev --follow
Check Current Migration
# Via Docker locally
docker compose exec back uv run alembic current
# In production, check Lambda logs
CI/CD Integration
Normally, migrations run automatically in CI/CD:
- Backend deploy job completes
- Migrate job triggers Migration Lambda
- Pipeline fails if migration fails
See .github/workflows/deploy-backend.yml.
Manual Production Migration
For production migrations outside of CI/CD:
- Use
.github/workflows/migrate-production.yml - Requires typing "migrate-production" to confirm
- Creates audit trail in GitHub Actions
Troubleshooting
Lambda Timeout
- Check database connectivity
- Verify
DbConnStrsecret is set - Check Lambda has VPC access if needed
Migration Errors
- Check Lambda CloudWatch logs
- Verify migration files are correct
- Test locally first with Docker
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?