/fuse-astro:astro-actionsfrom fuse-astro
Handles type-safe form submissions, mutations, and server-side logic in Astro via `defineAction()` and `astro:actions`, with Zod validation, standardized errors, and progressive enhancement.
Ships in fuse-astro. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Covers the full action lifecycle from src/actions/index.ts structure through error handling and redirect patterns. Does not cover Astro DB integration in depth (astro-db handles the database layer) or Content Layer schemas (astro-content) — this skill focuses on the request/validation/response boundary.
Type-safe server functions with automatic validation, standardized errors, and progressive enhancement.
Before ANY implementation, spawn 3 agents in parallel, one Agent call each with a name:
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 inreferences/defining-actions.md (opens in a new tab)references/error-handling.md (opens in a new tab)references/forms.md (opens in a new tab)references/overview.md (opens in a new tab)references/progressive-enhancement.md (opens in a new tab)references/templates/contact-form.md (opens in a new tab)references/templates/json-action.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub fusengine/claude-plugins --plugin fuse-astro14 skills in this plugin
/astro-7Use when building Astro 7 sites, choosing an output mode (static/server, hybrid via per-route prerender), configuring middleware, or upgrading from Astro 5/6./astro-assetsUse when optimizing images or other assets in Astro — <Image />, <Picture />, getImage(), Fonts API, or OG image generation./astro-contentUse when managing structured content, blog posts, or typed data collections in Astro via the Content Layer API (content.config.ts)./astro-dbUse when doing database operations in an Astro project via Astro DB (defineDb, defineTable, db/config.ts, Turso)./astro-deploymentUse when deploying an Astro 7 app to Cloudflare, Vercel, Netlify, or Node.js — adapter setup, ISR patterns, edge middleware./astro-i18nUse when implementing i18n in Astro — locale routing strategies, getRelativeLocaleUrl/getAbsoluteLocaleUrl, Astro.currentLocale, or hreflang with sitemap.Other plugins' skills for the same job