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.
In this repository7 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- fastapi-backendSkill
- llm-integrationSkill
- nextjs-frontendSkill
- project-documentationSkill
- python-testingSkill
- security-reviewSkill
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
- Very specific: line 59
Update docs/DATA_MODEL.md with new fields
- Distinctive: line 60
Update JSON schema examples
- Distinctive: line 62
Test with both SQLite and PostgreSQL
- Distinctive: line 65
Always use ORM, never raw SQL
- Distinctive: line 66
Use relationships for foreign keys
- Distinctive: line 67
Add indexes on frequently queried columns
- Very specific: line 68
Document changes in DATA_MODEL.md
- Distinctive: line 69
Use parameterized queries (ORM handles this)
≈ “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.
Files
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 topostgresql:// - DATABASE_URL env var configures connection
After Changing Models
- Update
docs/DATA_MODEL.mdwith new fields - Update JSON schema examples
- Increment version number
- Test with both SQLite and PostgreSQL
Best Practices
- Always use ORM, never raw SQL
- Use relationships for foreign keys
- Add indexes on frequently queried columns
- Document changes in DATA_MODEL.md
- Use parameterized queries (ORM handles this)
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
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.

