$npx -y skills add managedcode/dotnet-skills --skill astro-developerComprehensive guide for developing in the Astro monorepo. Covers architecture, debugging, testing, and critical constraints. Use when working on features, fixes, tests, or understanding the codebase structure.
| 1 | # Astro Developer Skill |
| 2 | |
| 3 | Context-loading skill for AI agents and developers working in the Astro monorepo. Loads relevant documentation based on your task. |
| 4 | |
| 5 | ## Quick Decision Matrix |
| 6 | |
| 7 | **What are you doing?** → **Read these files:** |
| 8 | |
| 9 | | Task | Primary Docs | Supporting Docs | |
| 10 | | -------------------------- | -------------------------------------------------------------------- | ---------------------------------- | |
| 11 | | Adding a core feature | [architecture.md](architecture.md), [constraints.md](constraints.md) | [testing.md](testing.md) | |
| 12 | | Fixing a bug | [debugging.md](debugging.md) | [architecture.md](architecture.md) | |
| 13 | | Writing/fixing tests | [testing.md](testing.md) | [constraints.md](constraints.md) | |
| 14 | | Creating an integration | Explore `packages/integrations/` for examples | [testing.md](testing.md) | |
| 15 | | Understanding architecture | [architecture.md](architecture.md) | - | |
| 16 | | Dealing with errors | [debugging.md](debugging.md), [constraints.md](constraints.md) | [testing.md](testing.md) | |
| 17 | | Understanding constraints | [constraints.md](constraints.md) | [architecture.md](architecture.md) | |
| 18 | |
| 19 | ## Critical Warnings |
| 20 | |
| 21 | **Before you start, be aware of these common pitfalls:** |
| 22 | |
| 23 | 1. **Prefer Unit Tests**: Write unit-testable code by default. Use integration tests only when necessary → [testing.md](testing.md) |
| 24 | 2. **Node.js API Restrictions**: Cannot use Node.js APIs in `runtime/` code → [constraints.md](constraints.md) |
| 25 | 3. **Test Isolation**: Must set unique `outDir` for each integration test → [testing.md](testing.md) |
| 26 | 4. **Runtime Boundaries**: Core vs Vite vs Browser execution contexts → [architecture.md](architecture.md) |
| 27 | 5. **Prerelease Mode**: Changesets target `origin/next` branch (check `.changeset/config.json`) |
| 28 | |
| 29 | ## Quick Command Reference |
| 30 | |
| 31 | ```bash |
| 32 | # Development |
| 33 | pnpm install # Install (root only) |
| 34 | pnpm run build # Build all packages |
| 35 | pnpm run dev # Watch mode |
| 36 | pnpm run lint # Lint codebase |
| 37 | |
| 38 | # Testing |
| 39 | pnpm -C packages/astro exec astro-scripts test "test/**/*.test.js" # All tests |
| 40 | pnpm -C packages/astro exec astro-scripts test -m "pattern" # Filter tests |
| 41 | pnpm run test:e2e # E2E tests |
| 42 | node --test test/file.test.js # Single test |
| 43 | |
| 44 | # Examples |
| 45 | pnpm --filter @example/minimal run dev # Run example |
| 46 | |
| 47 | # Changesets |
| 48 | pnpm exec changeset --empty # Create changeset, no interactive mode |
| 49 | ``` |
| 50 | |
| 51 | ## Key File Paths |
| 52 | |
| 53 | ``` |
| 54 | packages/astro/src/ |
| 55 | ├── core/ # Node.js execution context (build/dev commands) |
| 56 | ├── runtime/ |
| 57 | │ ├── server/ # Vite SSR execution context |
| 58 | │ └── client/ # Browser execution context |
| 59 | ├── virtual-modules/ # Virtual module entry points |
| 60 | ├── content/ # Content layer system |
| 61 | ├── vite-plugin-*/ # Vite plugins |
| 62 | └── types/ # Centralized TypeScript types |
| 63 | |
| 64 | packages/integrations/ # Official integrations |
| 65 | examples/ # Test your changes here |
| 66 | test/fixtures/ # Test fixtures |
| 67 | ``` |
| 68 | |
| 69 | **Note**: Error stack traces in `node_modules/` map to source in `packages/`. See [architecture.md](architecture.md) for details. |
| 70 | |
| 71 | ## Usage |
| 72 | |
| 73 | This skill loads relevant context—it doesn't orchestrate workflows. After loading appropriate docs: |
| 74 | |
| 75 | 1. Read the recommended files for your task |
| 76 | 2. Apply the patterns and constraints described |
| 77 | 3. Use the commands and file paths provided |
| 78 | 4. Search docs for error messages if you encounter issues |
| 79 | |
| 80 | ## Architecture Quick Summary |
| 81 | |
| 82 | **Three Execution Contexts:** |
| 83 | |
| 84 | - **core/** → Node.js, build/dev commands, avoid Node APIs except in Vite plugins |
| 85 | - **runtime/server/** → Vite SSR, CANNOT use Node APIs |
| 86 | - **runtime/client/** → Browser, CANNOT use Node APIs at all |
| 87 | |
| 88 | **Five Pipeline Types:** |
| 89 | |
| 90 | - **RunnablePipeline** → `astro dev` with Vite loader system |
| 91 | - **NonRunnablePipeline** → `astro dev` without runtime module loading (Cloudflare adapter) |
| 92 | - **BuildPipeline** → `astro build` + prerendering |
| 93 | - **AppPipeline** → Production serverless/SSR |
| 94 | - **ContainerPipeline** → Container API |
| 95 | |
| 96 | See [architecture.md](architecture.md) for complete details. |
| 97 | |
| 98 | ## Testing Quick Summary |
| 99 | |
| 100 | **Philosophy**: Prefer unit tests over integration tests. Write unit-testable code by default. |
| 101 | |
| 102 | **Unit tests** (fast, preferred): |
| 103 | |
| 104 | - Test pure functions and business logic |
| 105 | - Ext |