plugins/astro-expert/skills/astro-db/SKILL.md
Astro DB — defineDb, defineTable, column types, CRUD with db.select/insert/update/delete, db/config.ts, db/seed.ts, Turso for production, type-safety, integration with Astro Actions. Use for any database operation in an Astro project.
npx skillsauth add fusengine/agents astro-dbInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Type-safe SQL database built into Astro, powered by libSQL/Turso. Use for structured data without external backend services.
⚠️ Deprecation notice:
@astrojs/dbis deprecated and no longer actively maintained (still published on npm, currently v0.21.3 — it has not been removed from Astro 7). For new projects, prefer Drizzle, Kysely, or a direct libSQL client instead. Existing projects can keep using it, but should plan a migration.
Before ANY implementation, use TeamCreate to spawn 3 agents:
After implementation, run fuse-ai-pilot:sniper for validation.
db/
├── config.ts # Schema definition (defineDb, defineTable)
└── seed.ts # Development data seeding
Define tables in db/config.ts using defineDb and defineTable. Export tables for use in pages and actions. Column types: column.text(), column.number(), column.boolean(), column.date(), column.json().
Import db and table from astro:db. All operations are async and type-safe based on your schema definition.
Set ASTRO_DB_REMOTE_URL and ASTRO_DB_APP_TOKEN environment variables. Run astro db push to sync schema to Turso. Use astro db execute to run seed scripts against remote DB.
Combine with astro:actions for end-to-end type safety: Zod input validation → DB operation → typed response.
| Topic | Reference | When to Consult | |-------|-----------|-----------------| | Schema Definition | schema-definition.md | Table structure, column types | | CRUD Operations | crud-operations.md | select, insert, update, delete | | Seed Data | seed-data.md | db/seed.ts, remote seeding | | Turso Production | turso-production.md | Deployment, env vars, push | | Actions Integration | actions-integration.md | Type-safe form → DB flow |
| Template | When to Use | |----------|-------------| | db-config.md | Complete db/config.ts + seed.ts | | crud-example.md | Full CRUD with Actions |
.returning() after insert - Get back inserted rowsastro db push in CI/CD@astrojs/db is deprecated and unmaintained; still usable for existing projects, but not recommended as a starting pointtesting
Copy self-audit and ban-lists — filler verbs/hype adjectives, slop placeholder names, fake-precise numbers, Title Case headlines, humor in error copy ('Oops!'), em-dash crutch, one copy register per page.
development
Logged-in web apps — dashboards, auth flows, settings, onboarding, data tables, command palettes, modals, toasts. Register `product`: density and glance-speed over marketing polish, no hero/CTA-tricks, every data surface covers empty/loading/error explicitly, tables and dataviz follow preattentive-processing rules.
development
Marketing sites, landing pages, campaign pages — register `brand` (design IS the product). Structure comes from the register's POV + a macrostructure pick, never from copying an inspiration site's section flow. Hero discipline, deviated section order, asymmetric grids, and a silhouette lookalike-test gate before ship.
development
Token-strategy core — OKLCH color rules, neutral tinting, accent-commitment levels, type scale, 8pt spacing grid, touch targets, and the canonical output format of design-system.md (the file the harness gates on). This is routing step 1 of design-method/SKILL.md — read it before design-web/design-webapp/design-ios/design-android, before picking or auditing a single color/type/spacing value.