npx skills add https://github.com/astrolicious/agent-skills --skill astro请始终查阅 docs.astro.build 以获取代码示例和最新的 API 信息。
Astro 是为内容驱动型网站设计的 Web 框架。
CLI 会在 ./ 目录下查找 astro.config.js、astro.config.mjs、astro.config.cjs 和 astro.config.ts 文件。使用 --config 参数指定自定义路径。
npx astro dev - 启动开发服务器。npx astro build - 构建你的项目并写入磁盘。广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
npx astro check - 检查项目中的错误。npx astro add - 添加集成。npmx astro sync - 为所有 Astro 模块生成 TypeScript 类型。添加/更改插件后请重新运行。
Astro 为你的项目采用了一种约定俗成的文件夹布局。每个 Astro 项目的根目录都应包含以下目录和文件。请参考 项目结构文档。
src/* - 你的项目源代码(组件、页面、样式、图片等)。src/pages - Astro 项目中必需的子目录。没有它,你的网站将没有页面或路由!src/components - 通常将所有项目组件分组并组织在这个文件夹中。这是 Astro 项目中常见的约定,但不是必需的。你可以随意按自己喜欢的方式组织组件!src/layouts - 与 src/components 类似,这个目录是常见的约定,但不是必需的。src/styles - 通常将 CSS 或 Sass 文件存储在这里,但这也不是必需的。只要你的样式文件位于 src/ 目录下的某个位置并被正确导入,Astro 就会处理和优化它们。public/* - 你的非代码、未处理的资源(字体、图标等)。此文件夹中的文件将被原样复制到构建文件夹中,然后你的网站将被构建。package.json - 项目清单文件。astro.config.{js,mjs,cjs,ts} - Astro 配置文件。(推荐)tsconfig.json - TypeScript 配置文件。(推荐)| 选项 | 说明 |
|---|---|
site | 你最终部署的 URL。Astro 使用这个完整的 URL 在最终构建中生成你的站点地图和规范 URL。 |
通过构建适配器,可以部署到你喜欢的服务器、无服务器或边缘主机。使用适配器可以在你的 Astro 项目中启用按需渲染。
使用 astro add 添加 Node.js 适配器:
npx astro add node --yes
使用 astro add 添加 Cloudflare 适配器:
npx astro add cloudflare --yes
使用 astro add 添加 Netlify 适配器:
npx astro add netlify --yes
使用 astro add 添加 Vercel 适配器:
npx astro add vercel --yes
每周安装量
1.9K
仓库
GitHub 星标
1
首次出现
2026 年 1 月 22 日
安全审计
安装于
opencode1.7K
gemini-cli1.7K
codex1.6K
github-copilot1.6K
kimi-cli1.4K
amp1.4K
Always consultdocs.astro.build for code examples and latest API.
Astro is the web framework for content-driven websites.
CLI looks for astro.config.js, astro.config.mjs, astro.config.cjs, and astro.config.ts in: ./. Use --config for custom path.
npx astro dev - Start the development server.npx astro build - Build your project and write it to disk.npx astro check - Check your project for errors.npx astro add - Add an integration.npmx astro sync - Generate TypeScript types for all Astro modules.Re-run after adding/changing plugins.
Astro leverages an opinionated folder layout for your project. Every Astro project root should include some directories and files. Reference project structure docs.
src/* - Your project source code (components, pages, styles, images, etc.)src/pages - Required sub-directory in your Astro project. Without it, your site will have no pages or routes!src/components - It is common to group and organize all of your project components together in this folder. This is a common convention in Astro projects, but it is not required. Feel free to organize your components however you like!src/layouts - Just like src/components, this directory is a common convention but not required.src/styles - It is a common convention to store your CSS or Sass files here, but this is not required. As long as your styles live somewhere in the src/ directory and are imported correctly, Astro will handle and optimize them.public/* - Your non-code, unprocessed assets (fonts, icons, etc.). The files in this folder will be copied into the build folder untouched, and then your site will be built.package.json - A project manifest.| Option | Notes |
|---|---|
site | Your final, deployed URL. Astro uses this full URL to generate your sitemap and canonical URLs in your final build. |
Deploy to your favorite server, serverless, or edge host with build adapters. Use an adapter to enable on-demand rendering in your Astro project.
AddNode.js adapter using astro add:
npx astro add node --yes
AddCloudflare adapter using astro add:
npx astro add cloudflare --yes
AddNetlify adapter using astro add:
npx astro add netlify --yes
AddVercel adapter using astro add:
npx astro add vercel --yes
Weekly Installs
1.9K
Repository
GitHub Stars
1
First Seen
Jan 22, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode1.7K
gemini-cli1.7K
codex1.6K
github-copilot1.6K
kimi-cli1.4K
amp1.4K
99,500 周安装
astro.config.{js,mjs,cjs,ts} - An Astro configuration file. (recommended)tsconfig.json - A TypeScript configuration file. (recommended)