add-admin-entity

Scaffolds a full-stack CRUD entity across database schema, API routes, and admin UI.

Updated Mar 28, 2026
One-click install
npx skills add https://github.com/po4yka/blog --skill add-admin-entity-po4yka
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-admin-entity
Source: https://github.com/po4yka/blog/tree/main/.agents/skills/add-admin-entity
Command: npx skills add https://github.com/po4yka/blog --skill add-admin-entity-po4yka

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Adding a new data type to the admin panel requires touching seven or more files across the database, backend, and frontend, and missing any one of them breaks the stack. This Skill walks through every layer in order so the new entity compiles and works end to end. ## Core Features & Use Cases - Full-stack scaffolding: Generates the D1 SQL table, TypeScript domain type, row mapper, CRUD functions, Zod validation schema, API routes, admin API client, TanStack Query hooks, and admin page. - Convention enforcement: Encodes project patterns such as snake_case columns, JSON arrays stored as TEXT, UPSERT with ON CONFLICT, optimistic delete with rollback, and mandatory prerender = false on API routes. - Use Case: You want to add a certifications section to your portfolio admin. Invoke the Skill with the entity name and it produces the schema, types, endpoints, hooks, and page following the same patterns as projects and experience. ## Quick Start Ask the assistant to add a new admin entity named certifications using the add-admin-entity skill.

Frequently Asked Questions about add-admin-entity

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new CRUD entity to an Astro admin panel?

Add the table to db/schema.sql, define the TypeScript type, write row mappers and CRUD functions in the data access layer, add a Zod schema, create API routes, then wire up the admin API client, query hooks, and admin page. This Skill walks through each step in order.

How do I create API routes in Astro with Cloudflare D1?

Export prerender = false, then define GET, POST, or DELETE handlers that access D1 via locals.runtime.env. Authenticate with requireAuth before any data access and validate request bodies with a Zod schema, returning validationError on failure.

Why does my Astro API route run at build time instead of request time?

Astro prerenders endpoints by default, so the route is evaluated during the build. Add export const prerender = false at the top of the file to force server-side rendering per request.

How do I store arrays and booleans in a Cloudflare D1 SQLite database?

SQLite has no native array or boolean types. Store arrays as JSON strings in TEXT columns with DEFAULT '[]' and parse them in the row mapper, and store booleans as INTEGER with 0 or 1, converting in the mapper.

How do I implement optimistic delete with TanStack Query?

In the mutation's onMutate, cancel in-flight queries, snapshot the current cache, and remove the item with setQueryData. On error, restore the snapshot from context; on settled, invalidate the query key to refetch.