agentleFS
aiqadamaiqadam/qadam-flow/.agents/skills/add-entity/SKILL.md

add-entity

Skill5 starsChanged 39 days agoMITView on GitHub

Use when creating a new database table, entity, or data model. ALWAYS use for any new TypeORM EntitySchema creation.

3 other projects use a version of this, 1 of them edited.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 1 is distinctive, and 7 are very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 7

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Create entity for $ARGUMENTS.

    line 8
  2. Very specific:

    Use EntitySchema (NOT decorators)

    line 15
  3. Very specific:

    Use ApIdSchema for foreign key columns ({ ...ApIdSchema, nullable: false })

    line 17
  4. Very specific:

    Add projectId column + relation to project (CASCADE delete)

    line 18
  5. Very specific:

    Add foreignKeyConstraintName on all join columns

    line 19
  6. Very specific:

    Register entity: Import and add to getEntities() array in packages/server/api/src/app/database/database-connection.ts.

    line 22
  7. Very specific:

    Read the migration playbook first: .agents/skills/db-migration/SKILL.md (skill /db-migration)

    line 25
  8. Very specific:

    Add to getMigrations() array (chronological order)

    line 28

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “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

Add Database Entity

Create entity for $ARGUMENTS.

Steps

  1. Read the pattern: Open packages/server/api/src/app/tables/table/table.entity.ts as reference.
  2. Create entity file at packages/server/api/src/app/{module}/{name}.entity.ts:
    • Use EntitySchema (NOT decorators)
    • Include ...BaseColumnSchemaPart (id, created, updated)
    • Use ApIdSchema for foreign key columns ({ ...ApIdSchema, nullable: false })
    • Add projectId column + relation to project (CASCADE delete)
    • Add foreignKeyConstraintName on all join columns
    • Array columns: { type: String, array: true, nullable: false }
  3. Register entity: Import and add to getEntities() array in packages/server/api/src/app/database/database-connection.ts. This is REQUIRED — TypeORM does NOT auto-discover.
  4. Create migration:
    • Read the migration playbook first: .agents/skills/db-migration/SKILL.md (skill /db-migration)
    • Name: {Timestamp}{PascalCaseDescription} (e.g., AddMyFeature1774500000000)
    • Import in packages/server/api/src/app/database/postgres-connection.ts
    • Add to getMigrations() array (chronological order)
    • Set transaction = false when using CONCURRENTLY.
  5. Create repository: const myRepo = repoFactory(MyEntity) — call as myRepo() or myRepo(entityManager) for transactions.
  6. Verify: npm run lint-dev

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.