Phase 1b: Rename all ~94 commands across 12 plugins to /<noun> <action> sub-command pattern. Git-flow consolidated from 8→5 commands (commit variants absorbed into --push/--merge/--sync flags). Dispatch files, name: frontmatter, and cross-reference updates for all plugins. Phase 2: Design documents for 8 new plugins in docs/designs/. Phase 3: Scaffold 8 new plugins — saas-api-platform, saas-db-migrate, saas-react-platform, saas-test-pilot, data-seed, ops-release-manager, ops-deploy-pipeline, debug-mcp. Each with plugin.json, commands, agents, skills, README, and claude-md-integration. Marketplace grows from 12→20. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
95 lines
3.2 KiB
Markdown
95 lines
3.2 KiB
Markdown
---
|
|
name: orm-detection
|
|
description: Detect Alembic, Prisma, or raw SQL migration tools and locate configuration files
|
|
---
|
|
|
|
# ORM Detection
|
|
|
|
## Purpose
|
|
|
|
Identify the database migration tool in use and map its configuration. This skill is loaded by the `migration-planner` agent during setup and migration generation to ensure tool-appropriate output.
|
|
|
|
---
|
|
|
|
## Detection Rules
|
|
|
|
### Alembic Detection
|
|
|
|
| Indicator | Location | Confidence |
|
|
|-----------|----------|------------|
|
|
| `alembic.ini` file | Project root | High |
|
|
| `alembic/` directory with `env.py` | Project root | High |
|
|
| `alembic/versions/` directory | Within alembic dir | High |
|
|
| `sqlalchemy` + `alembic` in requirements | `requirements.txt`, `pyproject.toml` | Medium |
|
|
| `from alembic import op` in Python files | `*.py` in versions dir | High |
|
|
|
|
**Alembic Configuration Files:**
|
|
- `alembic.ini` — Main config (database URL, migration directory)
|
|
- `alembic/env.py` — Migration environment (model imports, target metadata)
|
|
- `alembic/versions/` — Migration files directory
|
|
|
|
**Model Location:**
|
|
- Look for `Base = declarative_base()` or `class Base(DeclarativeBase)` in Python files
|
|
- Check `target_metadata` in `env.py` to find the models module
|
|
- Common locations: `app/models/`, `models/`, `src/models/`
|
|
|
|
### Prisma Detection
|
|
|
|
| Indicator | Location | Confidence |
|
|
|-----------|----------|------------|
|
|
| `prisma/schema.prisma` file | Project root | High |
|
|
| `@prisma/client` in package.json | `package.json` | High |
|
|
| `prisma/migrations/` directory | Within prisma dir | High |
|
|
| `npx prisma` in scripts | `package.json` scripts | Medium |
|
|
|
|
**Prisma Configuration Files:**
|
|
- `prisma/schema.prisma` — Schema definition (models, datasource, generator)
|
|
- `prisma/migrations/` — Migration directories (timestamp-named)
|
|
- `.env` — `DATABASE_URL` connection string
|
|
|
|
### Raw SQL Detection
|
|
|
|
| Indicator | Location | Confidence |
|
|
|-----------|----------|------------|
|
|
| `migrations/` dir with numbered `.sql` files | Project root | Medium |
|
|
| `flyway.conf` | Project root | High (Flyway) |
|
|
| `knexfile.js` or `knexfile.ts` | Project root | High (Knex) |
|
|
| `db/migrate/` directory | Project root | Medium (Rails-style) |
|
|
|
|
**Raw SQL Configuration:**
|
|
- Migration directory location
|
|
- Naming pattern (sequential numbers, timestamps)
|
|
- Tracking table name (if database-tracked)
|
|
|
|
---
|
|
|
|
## Database Connection Detection
|
|
|
|
Look for connection strings in this order:
|
|
|
|
1. `DATABASE_URL` environment variable
|
|
2. `.env` file in project root
|
|
3. `alembic.ini` `sqlalchemy.url` setting
|
|
4. `prisma/schema.prisma` `datasource` block
|
|
5. Application config files (`config.py`, `config.js`, `settings.py`)
|
|
|
|
**Database Type Detection:**
|
|
- `postgresql://` or `postgres://` — PostgreSQL
|
|
- `mysql://` — MySQL
|
|
- `sqlite:///` — SQLite
|
|
- `mongodb://` — MongoDB (not supported for SQL migrations)
|
|
|
|
---
|
|
|
|
## Version Detection
|
|
|
|
**Alembic**: Parse from `pip show alembic` or `requirements.txt` pin
|
|
**Prisma**: Parse from `package.json` `@prisma/client` version
|
|
**SQLAlchemy**: Parse from requirements; important for feature compatibility (1.4 vs 2.0 API)
|
|
|
|
---
|
|
|
|
## Ambiguous Projects
|
|
|
|
If multiple migration tools are detected (e.g., Alembic for backend + Prisma for a separate service), ask the user which one to target. Store selection in `.db-migrate.json`.
|