agentleFS
flisk-shflisk-sh/flisk-skills/skills/flisk-databases/SKILL.md

flisk-databases

Skill4 starsChanged 33 days agoMITView on GitHub

Give a Flisk service a database and migrations - scaffold a backend with `--feature prisma` (adds a `<name>-migrator` resource) or `--feature drizzle`, or run Atlas, Dbmate, TypeORM, MikroORM or another tool as a one-shot migrator job, and connect through the generated `DATABASE_URL`. Use when adding database access, ORM or migration tooling to a service, or when migrations or connections fail. To wipe, seed or snapshot existing data, use flisk-data.

  • Reads credentials

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    Every Flisk project gets one shared Postgres.

    line 13
  2. Distinctive:

    Run migrations in their own migrator resource, never from the API's start script.

    line 23
  3. Very specific:

    Read the connection string from the environment (DATABASE_URL).

    line 24
  4. Very specific:

    If a connection or migration fails, run flisk doctor (it checks DB_PASSWORD and DATABASE_URL in .env) and read the migrator's logs with …

    line 26
  5. Distinctive:

    Do not commit secrets or local data.

    line 32

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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

Databases and migrations

Every Flisk project gets one shared Postgres; you do not add one. Each stack gets its own database, and Compose sets each backend's DATABASE_URL to it.

Workflow

  1. Pick the tool when you scaffold the service:
    flisk resource orders-api --type backend --feature prisma --stack shop --yes   # Prisma schema + orders-api-migrator
    flisk resource orders-api --type backend --feature drizzle --stack shop --yes  # Drizzle client in src/db.ts + /health/db, no migrator
    For an existing service, add "prisma" to featuresEnabled in its service.json once it has a prisma/schema.prisma.
  2. Run migrations in their own migrator resource, never from the API's start script. Prisma gets one generated. For Drizzle, Atlas, Dbmate, TypeORM, MikroORM or Ptah, copy the matching one-shot job from examples/byo-jobs and register it with --type bring-your-own --restart no.
  3. Read the connection string from the environment (DATABASE_URL); do not hard-code one.
  4. flisk up <stack> starts Postgres, then the migrator, then the services that depend on it.
  5. If a connection or migration fails, run flisk doctor (it checks DB_PASSWORD and DATABASE_URL in .env) and read the migrator's logs with flisk logs -s <name>-migrator.

Guardrails

  • A service depends on Postgres through dependsOn; list the migrator instead of postgres when it creates your tables.
  • The Postgres volume keeps the password it was created with; changing DB_PASSWORD later does not change it (see flisk-data to reset).
  • Do not commit secrets or local data.

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.