withastro/astro

astro-developer

Comprehensive guide for developing in the Astro monorepo.

ソースを見る

使い方

  1. インストールコマンドをコピーし、自分の環境へ導入する前にソースを確認します。
  2. 必要なツール、認証情報、対応環境を原文で確認します。
  3. 入力と成果物を指定し、出力を資料と照合します。
npx skills add https://github.com/withastro/astro --skill astro-developer

開始前の確認

  • 導入にはモデル契約、API枠、ファイルへのアクセス許可は含まれません。
  • スター数や導入数は活動の指標であり、独立した品質・安全性試験ではありません。
リポジトリの原文

見出し、例、コード、表、リンク、参照画像を含む原文を表示しています。

Astro Developer Skill

Context-loading skill for AI agents and developers working in the Astro monorepo. Loads relevant documentation based on your task.

Quick Decision Matrix

What are you doing? → Read these files:

TaskPrimary DocsSupporting Docs
Adding a core featurearchitecture.md, constraints.mdtesting.md
Fixing a bugdebugging.mdarchitecture.md
Writing/fixing teststesting.mdconstraints.md
Creating an integrationExplore packages/integrations/ for examplestesting.md
Understanding architecturearchitecture.md-
Dealing with errorsdebugging.md, constraints.mdtesting.md
Understanding constraintsconstraints.mdarchitecture.md

Critical Warnings

Before you start, be aware of these common pitfalls:

  1. Prefer Unit Tests: Write unit-testable code by default. Use integration tests only when necessary → testing.md
  2. Node.js API Restrictions: Cannot use Node.js APIs in runtime/ code → constraints.md
  3. Test Isolation: Must set unique outDir for each integration test → testing.md
  4. Runtime Boundaries: Core vs Vite vs Browser execution contexts → architecture.md
  5. Prerelease Mode: Changesets target origin/next branch (check .changeset/config.json)

Quick Command Reference

bash
# Development
pnpm install                                    # Install (root only)
pnpm run build                                  # Build all packages
pnpm run dev                                    # Watch mode
pnpm run lint                                   # Lint codebase

# Testing
pnpm -C packages/astro exec astro-scripts test "test/**/*.test.js"  # All tests
pnpm -C packages/astro exec astro-scripts test -m "pattern"         # Filter tests
pnpm run test:e2e                               # E2E tests
node --test test/file.test.js                   # Single test

# Examples
pnpm --filter @example/minimal run dev          # Run example

# Changesets
pnpm exec changeset --empty                     # Create changeset, no interactive mode

Key File Paths

packages/astro/src/
├── core/              # Node.js execution context (build/dev commands)
├── runtime/
│   ├── server/        # Vite SSR execution context
│   └── client/        # Browser execution context
├── virtual-modules/   # Virtual module entry points
├── content/           # Content layer system
├── vite-plugin-*/     # Vite plugins
└── types/             # Centralized TypeScript types

packages/integrations/  # Official integrations
examples/              # Test your changes here
test/fixtures/         # Test fixtures

Note: Error stack traces in node_modules/ map to source in packages/. See architecture.md for details.

Usage

This skill loads relevant context—it doesn't orchestrate workflows. After loading appropriate docs:

  1. Read the recommended files for your task
  2. Apply the patterns and constraints described
  3. Use the commands and file paths provided
  4. Search docs for error messages if you encounter issues

Architecture Quick Summary

Three Execution Contexts:

  • core/ → Node.js, build/dev commands, avoid Node APIs except in Vite plugins
  • runtime/server/ → Vite SSR, CANNOT use Node APIs
  • runtime/client/ → Browser, CANNOT use Node APIs at all

Five Pipeline Types:

  • RunnablePipeline → astro dev with Vite loader system
  • NonRunnablePipeline → astro dev without runtime module loading (Cloudflare adapter)
  • BuildPipeline → astro build + prerendering
  • AppPipeline → Production serverless/SSR
  • ContainerPipeline → Container API

See architecture.md for complete details.

Testing Quick Summary

Philosophy: Prefer unit tests over integration tests. Write unit-testable code by default.

Unit tests (fast, preferred):

  • Test pure functions and business logic
  • Extract business logic from infrastructure
  • Use dependency injection

Integration tests (slow, use sparingly):

  • Only for features that cannot be unit tested (virtual modules, full build pipeline)
  • Always set unique outDir to avoid cache pollution

See testing.md for complete patterns and examples.

When NOT to Use This Skill

  • Bug triage: Use the triage skill instead
  • GitHub Actions analysis: Use the analyze-github-action-logs skill
  • Simple questions: Just ask directly, don't load this skill

Related Documentation

  • Root: /AGENTS.md
  • Root: /CONTRIBUTING.md
  • Astro docs: https://docs.astro.build/
  • Package: packages/astro/src/core/README.md
  • Build plugins: packages/astro/src/core/build/plugins/README.md
同じリポジトリから

関連する Skills

すべての Skills
withastro
コミュニティ

analyze-github-action-logs

Analyze recent GitHub Actions workflow runs to identify patterns, mistakes, and improvements. Use when asked to "analyze workflow logs", "review action runs", or "analyze GitHub Actions".

導入数
4
GitHub Stars
6.3万
更新日
10月23日
withastro
コミュニティ

astro-adversary-blue

Independently implement and validate an alternative solution for an Astro pull request. Use only for Factory's adversary blue team.

導入数
4
GitHub Stars
6.3万
更新日
10月23日
withastro
コミュニティ

astro-adversary-purple

Qualify and compare red and blue solutions for an Astro pull request using Astro-specific merge and tie-break criteria. Use only for Factory's adversary purple team.

導入数
4
GitHub Stars
6.3万
更新日
10月23日
withastro
コミュニティ

astro-code-review

Perform a static, read-only code review of an Astro pull request or of a local branch, commit range, diff, patch, or working tree being prepared as a pull request. Determine whether the change satisfies its stated business requirements and is good enough to merge, using the PR description, linked requirement issues and roadmap items, and PR or issue discussions when available. Use this skill only for PR review or self-review, not issue triage or bug investigation. It reports only merge-relevant

導入数
4
GitHub Stars
6.3万
更新日
10月23日