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 indevelopment
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.