aurostack-org/stacks/add-model

Claude Code and agent skill by aurostack-org/stacks

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Add a SQLAlchemy model to this Python worker that mirrors one of the API's Prisma tables, so a job handler can read or write it. Use when a handler needs data from a table the worker has no model for, or when asked to "map the X table", "add a model for Y", or after the API's schema changes.

Install

npx vskill@latest install aurostack-org/stacks/add-model

SKILL.md

The same SKILL.md was published earlier as aurostack-org/stacks/add-model.

Mirror an API table

The API owns the table: its Prisma schema is the source of truth and its migrations create it. A model here only describes it. Never create or alter tables, enums or columns from Python.

  1. Read the API's model in its prisma/schema/*.prisma. Note the table

name (@@map("…")), each column's database name (@map("…")), types, nullability, the primary key and its default.

  1. Write the model in models/<name>.py over Base from

models/mixins.py:

```python from __future__ import annotations

from sqlalchemy import Text, ForeignKey from sqlalchemy.orm import Mapped, mapped_column

from models.mixins import Base, TimestampMixin, text_pk

class Report(Base, TimestampMixin): __tablename__ = "reports" # the Prisma @@map

id: Mapped[text_pk] # Prisma cuid() ids are text account_id: Mapped[str] = mapped_column("account_id", Text, ForeignKey("accounts.id")) title: Mapped[str] = mapped_column(Text) summary: Mapped[str | None] = mapped_column(Text, nullable=True) ```

  • Column names are the database names (@map), not the Prisma field names.
  • Use the annotated types in models/mixins.py (text_pk, uuid_pk,

dcml, flt…) and its timestamp mixins where they match.

  • Map only the columns the worker uses; leaving one out is fine, adding

one the table lacks is not.

  • An enum column binds to the existing Postgres type: declare the Python

enum and XEnum = e(X) in models/enums.py, with the values the API's enum.prisma stores.

  • @repr(...) and @to_dict(...) from models/decorators.py are there

for logging and JSON.

  1. Use it in a handler through DB() from utils/db.py:

db.session.execute(select(Report).where(...)).scalars().all(), then db.session.commit() after writes, and util.finalize(db) to close it.

  1. Check against a real database: run a handler that selects from the

table. A wrong column name fails at the first query, not at import.

When the API's schema changes, update the model in the same change as the handler that depends on it; nothing else will notice the drift.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
5

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/aurostack-org/stacks/add-model/badge)](https://verified-skill.com/skills/aurostack-org/stacks/add-model)

Something wrong with this skill or its page? Tell us.