Not loaded · from fastmcp-engineering
Engineer SQLAlchemy 2.x persistence behind explicit application transaction boundaries, repositories, unit of work, async lifecycle, concurrency, migrations, and database security.
Claude Code won't load this skill
It ships in fastmcp-engineering at skills/, but Claude Code only loads skills/<name>/SKILL.md and folders listed under skills in plugin.json. Installing the plugin doesn't add it.
Treat persistence as infrastructure. Domain and application code must not depend on SQLAlchemy session mechanics, ORM entities, or database-specific accidental behavior unless explicitly justified.
Scope / When to use: SQLAlchemy 2.x persistence behind explicit application transaction boundaries, repositories, unit of work, async lifecycle, concurrency, migrations, and database security.
Trigger: designing or changing persistence, transaction boundaries, repositories, unit of work, async sessions, concurrency, migrations, or database security.
Upstream / Prerequisite: AGENTS.md and repository contracts read; identified exact versions; evidence recorded before coding.
Mission / Goal: treat persistence as infrastructure; domain and application code must not depend on SQLAlchemy session mechanics, ORM entities, or database-specific accidental behavior unless explicitly justified.
Research / Evidence: read official SQLAlchemy 2.x documentation relevant to the feature, especially asyncio, sessions, transactions, pooling, ORM loading and concurrency; read official migration-tool/database documentation; read relevant FastMCP lifecycle/Context documentation and official examples; inspect SQLAlchemy/FastMCP source/tests where semantics are ambiguous.
Decision / Selection rules: let the application use case own the business transaction boundary and define explicitly who begins, commits, rolls back and closes a transaction; prefer one coherent unit of work per use-case operation; never share an AsyncSession concurrently between independent asyncio tasks — prefer task/request-scoped sessions; choose loading strategy deliberately to prevent N+1 and accidental lazy IO; keep repositories as persistence-oriented ports rather than generic CRUD mirrors; use Unit of Work only where it clarifies coordination; scope retries narrowly; treat schema changes as versioned artifacts; use least-privilege credentials and parameterized queries.
Version / Compatibility: identify exact Python, SQLAlchemy, database driver, database, migration tool and FastMCP versions.
Deliverables / Artifacts: evidence package, persistence decision matrix, transaction/session ownership map, implementation, migration artifacts, repository/UoW tests, database integration tests, concurrency tests, architecture re-check and evidence ledger. Verification / Testing: test repository queries against a real supported database when SQL semantics matter; use unit tests for application/domain behavior with repository ports; test transactions, rollback, constraints, concurrent updates, loading behavior, pagination and migration compatibility; avoid mocks that reproduce ORM behavior inaccurately. Failure / Stop conditions: reject if transaction ownership is ambiguous, sessions are shared unsafely, repositories commit unexpectedly, ORM entities leak across public boundaries without justification, queries create N+1/unbounded loads, migration state is untracked, or retry semantics can duplicate non-idempotent work. Positive scenario: persistence is infrastructure behind explicit transaction boundaries verified against a real supported database. Negative scenario: transaction ownership is ambiguous or sessions are shared unsafely across concurrent tasks.
Before implementation:
FastMCP adapter
↓
Application use case
↓
Repository / Unit of Work ports
↓
Infrastructure adapters
↓
SQLAlchemy AsyncSession
↓
Database
ORM entities are persistence models, not automatically domain entities or MCP DTOs.
The application use case owns the business transaction boundary. Repository methods should not unexpectedly commit. Define explicitly who begins, commits, rolls back and closes a transaction.
Prefer one coherent unit of work per use-case operation unless the domain explicitly requires multiple independent transactions.
Verify exact async semantics for:
expire_on_commit behavior;Never share an AsyncSession concurrently between independent asyncio tasks unless the exact documented semantics and architecture explicitly permit it. Prefer task/request-scoped sessions.
Prevent N+1 and accidental lazy IO. Choose loading strategy deliberately (selectinload, joinedload, explicit queries, etc.) based on verified SQLAlchemy behavior and cardinality. Paginate large collections. Avoid unbounded relationship traversal.
Repositories express persistence-oriented application ports, not generic CRUD for its own sake. Do not create abstractions that merely mirror every SQLAlchemy method. Keep query intent explicit.
Use Unit of Work only where it clarifies transaction coordination. It must not become a service locator or god object. Its lifecycle and ownership must be explicit.
Research and test:
Retries must be narrowly scoped and only applied to errors proven transient and safe to replay.
Schema changes are versioned artifacts. Review forward migration, downgrade strategy where supported, data migration/backfill, locking, deployment ordering and backward compatibility. Never modify production schema manually as an untracked workaround.
Use least-privilege credentials. Parameterize queries through SQLAlchemy APIs. Treat database constraints as a second line of integrity protection, not a replacement for application authorization. If PostgreSQL RLS/multi-tenancy is used, document policy ownership and identity propagation.
Test repository queries against a real supported database when SQL semantics matter. Use unit tests for application/domain behavior with repository ports. Test transactions, rollback, constraints, concurrent updates, loading behavior, pagination and migration compatibility. Avoid mocks that reproduce ORM behavior inaccurately.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
Generated from the plugin's indexed repository (evgenygurin/fastmcp-engineering) — no native marketplace selected
npx claudepluginhub p/evgenygurin-fastmcp-engineering58 skills in this plugin
/pydantic-ai-agent-integrationEngineer PydanticAI agents behind explicit application boundaries and integrate them with FastMCP without leaking agent state, prompts, model concerns, or provider details into domain logic./api-contract-schema-engineeringEvidence-first API and MCP contract engineering with Pydantic v2 and JSON Schema./api-lifecycle-versioningEvidence-first API lifecycle, schema evolution and compatibility engineering for FastMCP/MCP servers./api-tool-engineeringEvidence-first design of production MCP tools, resources and prompts as stable public APIs./application-architecture-usecasesEvidence-first layered application architecture for FastMCP services using explicit use cases, dependency inversion and domain boundaries./application-domain-architectureEvidence-first design of layered Python application/domain architecture for FastMCP and PydanticAI systems, with explicit use cases, ports, adapters, policies, transaction ownership and dependency direction.