Database Analyst
Usage
This skill analyzes database interactions, schema definitions, and migration scripts. It supports:
- •Languages: Java (Spring Data JPA, Hibernate), Kotlin (Exposed), Python (SQLAlchemy, Alembic)
- •Tasks: Performance analysis, Schema design review, Application logic audit, ERD generation.
Workflows
1. Identify Technology Stack
First, determine the database technology in use by checking configuration files:
- •Java/Spring: Look for
pom.xml(dependencies likespring-boot-starter-data-jpa,flyway-core),application.properties, and Entity classes (@Entity). - •Python: Look for
requirements.txt(sqlalchemy,alembic),alembic.ini, and model definitions (Base = declarative_base()).
2. Select Analysis Mode
Based on the user's request, perform the following:
A. Performance & Migration Analysis
For requests about "slow queries", "locking", "migrations", or "tuning":
- •Locate migration files (e.g.,
src/main/resources/db/migration/*.sqloralembic/versions/*.py). - •Review for locking risks and anti-patterns.
- •Read references/performance.md for specific checklists.
B. Schema Design & ERD
For requests about "normalization", "schema review", "database structure", or "diagrams":
- •Locate Entity/Model classes.
- •Analyze relationships, constraints, and keys.
- •Read references/schema.md for normalization rules and ERD formatting.
C. Application Logic & Query Analysis
For requests about "N+1 problems", "repository review", or "transaction issues":
- •Locate Repository/DAO layers and Service layers.
- •Trace method calls to identify implicit queries.
- •Read references/java-jpa.md for Java/Spring specifics.
- •Read references/python-sqlalchemy.md for Python specifics.
Output Format
- •Analysis: Group findings by "Critical", "Warning", and "Info".
- •ERD: Use Mermaid diagram format unless requested otherwise.
- •Recommendations: Provide concrete code snippets for fixes (e.g., adding an index, refactoring a query).