Skip to main content
rule CX Codex

astro · przeprogramowani — Claude Code rule: what it does, how to install

Guidelines for Claude Code to generate server-side pages and endpoints in Astro. Ensures type safety, middleware handling, and request validation.

AGPL-3.0 ★ 267 updated 2026-02-20

Install into Cursor · Manually: put the files in place All methods and platforms ↓
.cursor/rules/astro.mdc
Open on GitHub

What astro does

This rule teaches Claude Code how to structure Astro projects with hybrid rendering and server-side endpoints. The assistant enforces uppercase method names such as GET and POST, marks API handlers with export const prerender = false, and verifies incoming payloads using Zod schemas.

Content collections receive strict TypeScript schemas for documentation or blog posts. Environment flags read from import.meta.env, while cookie operations route through Astro.cookies. For unprotected routes, the assistant must edit src/middleware/index.ts so anonymous traffic does not get blocked.

What it helps with

  • validate API route payloads using Zod schemas
  • configure server endpoints with disabled prerendering
  • build type-safe content collections for markdown articles
  • read and write server cookies with Astro.cookies

Example prompts for the agent

  • Create a POST server endpoint to accept feedback with Zod schema validation.
  • Set up a type-safe content collection for the documentation section.
  • Update src/middleware/index.ts to allow anonymous access to the landing page.

How to install astro

Manually: put the files in place

.cursor/rules/astro.mdc

Frontmatter: description, globs, alwaysApply

Step by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules

Questions about astro

How to install astro in Claude Code?

Place the rule configuration at .claude/rules/astro.md inside your repository.

What does the astro rule do?

It guides Claude Code on building hybrid Astro apps, enforcing uppercase HTTP methods, Zod validations, content collections, and cookie handling.

How does the rule handle public routes?

It directs the assistant to modify src/middleware/index.ts whenever generating public pages to allow unauthenticated access.

Similar IDE rules

All IDE rules for Frontend and UI →

astro by other authors comes first.

astro official github A Copilot rule that sets Astro 7 conventions: islands architecture, the Content Layer API, TypeScript, and server-first rendering by default. CX Codex +1 ★ 41,430repo stars astro sanjeed5 Opinionated Cursor guide for Astro projects focusing on island architecture, zero JavaScript by default, strict TypeScript, and selective hydration. CX Codex +1 ★ 3,589repo stars astro-sites-manager ft.ia.br astro-sites-manager is a Claude Code skill for setting up and updating Astro v7 projects, configuring background dev servers for AI workflows, and querying the astro-docs MCP server. CX Codex +1 ★ 141repo stars clerk-astro-patterns clerk clerk-astro-patterns — a skill for Claude Code that guides Clerk authentication patterns in Astro 5. Sets up middleware, server-rendered views, client islands, and API endpoints. CX Codex +1 15,000installs integration-astro-ssr PostHog integration-astro-ssr adds PostHog analytics to server-rendered Astro setups with API endpoints. Connects frontend tracking with backend routes. CX Codex +1 109installs astro-framework delineas astro-framework — a skill that turns your coding agent into a senior Astro engineer. Useful once a content site needs islands, server rendering or the Content Layer API. CX Codex +1 2,200installs astro-expert 0xfurai astro-expert is a Claude Code subagent for planning Astro architecture, organizing content collections, and optimizing static site performance. CX Codex ★ 1,029repo stars custom-pages-and-apis eventcatalog custom-pages-and-apis generates Astro pages and TypeScript API routes inside an EventCatalog project so catalog data shows up in your own layout. CX Codex +1 488installs

From the same set24

The whole set →
shadcn-init The shadcn-init command sets up shadcn/ui in a project and adds a defined set of components. Use it when you want the UI files placed in the expected directory with the new-york theme. CX Codex +1 ★ 267repo stars shadcn-status-checkpoint shadcn-status-checkpoint — a command that documents implementation progress for UI components in a structured markdown file. Keeps your work history clear when developing complex views across multiple AI conversations. CX Codex +1 ★ 267repo stars playwright-e2e-testing Enforces Playwright E2E testing standards: Page Object Model, locators, browser context isolation, and parallel runs. CX Codex +1 ★ 267repo stars react-development react-development sets coding standards for React components inside an Astro app: hooks over classes, memoization, Tailwind-driven responsiveness. CX Codex +1 ★ 267repo stars github-action Guides Claude Code in generating GitHub Actions workflows with scoped secrets, composite steps, and upstream version checks. CX Codex +1 ★ 267repo stars shadcn-resume-implementation shadcn-resume-implementation is a Claude Code command that resumes frontend work from a saved status. It uses the implementation plan, frontend rules, and type definitions. CX Codex +1 ★ 267repo stars shadcn-plan-summary shadcn-plan-summary — a command that captures decisions from UI architecture sessions. Extracts choices about layout, flows, API integration, and state management, then compiles them into a structured report for the next development phase. CX Codex +1 ★ 267repo stars test-plan test-plan is a Claude Code rule that builds a project-specific test plan from the codebase and tech stack. It writes the result in Polish as Markdown. CX Codex +1 ★ 267repo stars

Project sponsors

Companies that keep this analytics open