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.
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/CDdevelopment
Use when optimizing entity-based / semantic SEO 2026. Covers entity maps, Google Knowledge Graph resolution, salience scoring, passage-level ranking, about/sameAs/knowsAbout schema, Cloud Natural Language API validation.
development
Use when running SEO, GEO, schema, Core Web Vitals, sitemap, hreflang, E-E-A-T, AI Overviews, technical SEO, or structured data tasks. Covers full-site audits, single-page analysis, schema markup, content quality, AI search optimization, local SEO, sitemap/robots, internal linking, semantic clustering, and search experience.
development
Use when optimizing search experience (SXO). Covers intent matching, user personas, user stories, page-type analysis, dwell time, scroll depth, pogo-sticking prevention.
development
Use when optimizing local SEO. Covers Google Business Profile, NAP consistency, citations, reviews acquisition, Local Pack ranking, location pages, LocalBusiness schema.