agentleFS
blackbenjaminblackbenjamin/etps/.claude/skills/sqlalchemy-database/SKILL.md

sqlalchemy-database

Skill1 starsChanged 11 months agoMITView on GitHub

Work with SQLAlchemy ORM, define models, implement relationships, and manage database schema. Use when modifying backend/db/models.py, creating schemas, or working with database entities.

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 6 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Update docs/DATA_MODEL.md with new fields

    line 59
  2. Distinctive:

    Update JSON schema examples

    line 60
  3. Distinctive:

    Test with both SQLite and PostgreSQL

    line 62
  4. Distinctive:

    Always use ORM, never raw SQL

    line 65
  5. Distinctive:

    Use relationships for foreign keys

    line 66
  6. Distinctive:

    Add indexes on frequently queried columns

    line 67
  7. Very specific:

    Document changes in DATA_MODEL.md

    line 68
  8. Distinctive:

    Use parameterized queries (ORM handles this)

    line 69

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

SQLAlchemy Database Models

ETPS Data Model

  • Reference: docs/DATA_MODEL.md (current version)
  • Dev: SQLite (default)
  • Prod: PostgreSQL (Railway)

Key Models

User
├── id, email, name, candidate_profile (JSON)
└── Experiences[]
    ├── employer_name, job_title, dates
    ├── Engagements[] (consulting roles)
    │   └── Bullets[]
    └── Bullets[] (direct roles)

JobProfile
├── id, user_id, job_title, company_name
├── extracted_skills[], must_have[], nice_to_have[]
├── selected_skills[], key_skills[]
└── capability_clusters[]

CompanyProfile
├── id, name, website, industry
├── culture_signals[], data_ai_maturity
└── embedding (384-dim vector)

Model Pattern

from sqlalchemy import Column, String, Integer, ForeignKey, JSON
from sqlalchemy.orm import relationship
from db.base import Base

class MyModel(Base):
    __tablename__ = "my_table"

    id = Column(Integer, primary_key=True, index=True)
    name = Column(String(255), nullable=False)
    parent_id = Column(Integer, ForeignKey("parent_table.id"))
    data = Column(JSON, default=dict)

    # Relationships
    parent = relationship("ParentModel", back_populates="children")

PostgreSQL Notes

  • B-tree indexes cannot be on JSON columns (use GIN if needed)
  • Railway's postgres:// URL auto-converts to postgresql://
  • DATABASE_URL env var configures connection

After Changing Models

  1. Update docs/DATA_MODEL.md with new fields
  2. Update JSON schema examples
  3. Increment version number
  4. Test with both SQLite and PostgreSQL

Best Practices

  1. Always use ORM, never raw SQL
  2. Use relationships for foreign keys
  3. Add indexes on frequently queried columns
  4. Document changes in DATA_MODEL.md
  5. Use parameterized queries (ORM handles this)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.