plugins/astro-expert/skills/astro-actions/SKILL.md
Expert Astro Server Actions — defineAction, astro:actions, Zod validation, ActionError, HTML form actions, accept form, progressive enhancement, redirect patterns. Use when handling form submissions, mutations, or any server-side logic with type safety.
npx skillsauth add fusengine/agents astro-actionsInstall 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 server functions with automatic validation, standardized errors, and progressive enhancement.
Before ANY implementation, use TeamCreate to spawn 3 agents:
src/actions/After implementation, run fuse-ai-pilot:sniper for validation.
| Feature | Benefit |
|---------|---------|
| defineAction() | Type-safe server function definition |
| Zod validation | Automatic JSON and FormData parsing |
| ActionError | Standardized error codes and messages |
| accept: 'form' | Direct HTML form submission support |
| Progressive enhancement | Works without JavaScript enabled |
| astro:actions | Client import for type-safe calls |
All actions live in src/actions/index.ts and export a server object:
// src/actions/index.ts
import { defineAction } from 'astro:actions';
import { z } from 'astro/zod';
export const server = {
myAction: defineAction({ /* ... */ })
}
| Mode | Description |
|------|-------------|
| accept: 'json' (default) | Parses JSON request body |
| accept: 'form' | Parses HTML FormData directly |
Standard HTTP-aligned codes: UNAUTHORIZED, FORBIDDEN, NOT_FOUND, BAD_REQUEST, INTERNAL_SERVER_ERROR, CONFLICT, TOO_MANY_REQUESTS.
| Need | Reference | |------|-----------| | Concepts & architecture | overview.md | | defineAction patterns | defining-actions.md | | ActionError handling | error-handling.md | | HTML form integration | forms.md | | Progressive enhancement | progressive-enhancement.md | | Contact form template | templates/contact-form.md | | JSON action template | templates/json-action.md |
input schema — Never skip Zod validationActionError for known errors — Standardized codes for client handlingaccept: 'form' for HTML forms — Native form submission supportctx.cookies for auth — Throw UNAUTHORIZED when not logged intesting
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.