— No reviews yet
0 installs
5 views
0.0% view→install
Install
$ agentstack add skill-aps08-fullstack-clean-architecture-database-management ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Are you the author of Database Management? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claimAbout
Database Management Skill
1. SQLAlchemy Base Class & Models
All database models (except system/internal models where not applicable) must inherit from BaseModel defined in server/app/models/base.py.
Automatically Handled by BaseModel
- Table Names: Automatically converted from
PascalCaseclass names tosnake_case(e.g.,Todos->todos,Attachments->attachments). - Primary Keys: Defined as a native PostgreSQL UUID using
PG_UUID(as_uuid=True)with database-side generatorserver_default=text("gen_random_uuid()"). - Audit Fields: All models inherit these auditing and metadata fields:
id: Mapped[UUID] primary key.is_active: Boolean status defaulting totrueon the server.is_deleted: Soft-delete status defaulting tofalseon the server.created_at/updated_at: Timezone-aware UTC timestamps withserver_default=func.now()(andonupdate=func.now()for updates).created_by/updated_by: VARCHAR(100) auditing fields.
Best Practices for Custom Models
- Inheritance: Always subclass
BaseModel. - Use Database Defaults: Lean on PostgreSQL for default values as much as possible using
server_default(e.g.server_default=text("true")rather than Python-leveldefault=True). - Type Annotations: Use SQLAlchemy 2.0
Mapped[...]andmapped_column()syntax. - Foreign Keys:
- Explicitly define
ondeletebehavior (e.g.ondelete="CASCADE"). - Add
index=Truefor foreign key columns to ensure performant joins. - Timezones: Use timezone-aware datetime objects (
TIMESTAMP(timezone=True)) or Pydantic UTC validation. - Relationships: Define back-populates and lazy loading modes explicitly (e.g.,
lazy="selectin"for eager loading without Cartesian products).
2. Database Queries & Transactions
- Async execution: All database interactions must be executed asynchronously using
AsyncSession. - Eager Loading: Always declare eager relationships where expected to avoid N+1 queries. Specify
eagerslist on models if supported by the service repository. - Optimistic Concurrency: Use auditing columns or version fields if concurrent updates are expected on highly mutated resources.
3. Migrations (Alembic)
- Autogeneration: Generate migrations via
alembic revision --autogenerate -m "description". - Review Migrations: Always review autogenerated migration scripts before applying them. Pay special attention to constraints, indexes, and type alterations.
- Reversible Migrations: Ensure all migrations implement both
upgrade()anddowngrade()functions.
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: aps08
- Source: aps08/fullstack-clean-architecture
- License: Apache-2.0
- Homepage: https://aps08.medium.com
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.