roninforge/roninforge-astro/astro-new-action
Claude Code and agent skill by roninforge/roninforge-astro
- community
Checking that the SKILL.md file is still in the repository.
Scaffold a new Astro 6 server action in src/actions/index.ts using defineAction with a zod input schema imported from astro:schema (NOT raw zod), optional accept:'form' for HTML form posts (with multipart enctype example for file uploads), and example call sites: server-side via Astro.callAction(actions.x, input) and client-side via actions.x(input). Refuses defineAction without input schema, refuses import from 'zod' inside src/actions/, refuses action named 'apply' outside index.ts. Pairs with astro-actions-and-forms and astro-anti-patterns rules.
Install
npx vskill@latest install roninforge/roninforge-astro/astro-new-actionSKILL.md
The same SKILL.md was published earlier as roninforge/roninforge-astro/astro-new-action.
Scaffold a New Astro Action
When to use
Use when:
- Adding a server-side mutation (subscribe, login, upload, delete)
- Wiring an HTML form to a typed handler (
accept: 'form') - Migrating a hand-rolled API endpoint to a typed action
Target: astro ^6.3.3. The companion astro-actions-and-forms and astro-anti-patterns rules cover the surrounding patterns.
Output
For a subscribe action plus a uploadAvatar action accepting form data:
src/actions/index.ts
Server-side call (.astro frontmatter)
Client-side call
HTML form with file upload (multipart)
Reading the result on a static page
Astro.callAction requires per-request server rendering. On a static page (no export const prerender = false), read the result of the previous submit with Astro.getActionResult instead:
If the page MUST run server logic in its frontmatter on every submit, add export const prerender = false and switch to Astro.callAction.
Workflow
- Place the action in
src/actions/index.tsunder theservernamespace. - Always declare an
inputschema (anti-pattern #3). Importzfromastro:schema(anti-pattern #46). - For HTML form posts, set
accept: 'form'and usez.instanceof(File)for file inputs. - Throw
ActionErrorwith a code (UNAUTHORIZED,BAD_REQUEST,NOT_FOUND,CONFLICT,INTERNAL_SERVER_ERROR) for typed failures. - Pick the right call site:
- Server frontmatter on an on-demand page:
Astro.callAction(actions.x, input). - Server frontmatter on a static page:
Astro.getActionResult(actions.x)(read-only). - Client island:
await actions.x(input)returns{ data, error }.
Common mistakes
- No
inputschema (anti-pattern #3). import { z } from 'zod'instead ofastro:schema(anti-pattern #46).- File form without
enctype="multipart/form-data"(anti-pattern #31). - Calling
actions.subscribe(input)directly from frontmatter (useAstro.callActionorAstro.getActionResult). - Using
Astro.callActionon a prerendered page withoutexport const prerender = false(dead code at build time). - Action named
applyoutsideindex.ts(anti-pattern #44).
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/astro-new-action/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/roninforge/roninforge-astro/astro-new-action)