Programming · Building & coding
astro
/astro
Astro开发专家助手。当用户需要进行Astro内容驱动网站开发、静态站点生成、岛架构或博客/文档站构建时调用。
- Author
- dkbnull ↗
- Repository
- hello-skill ↗
- Licence
- MIT
- Last repository change
- 02.07.2026
Assessment and security
96/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability21 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
Deprecation
No signals detected. Repository changed on 02.07.2026, without references to retired models or APIs.
Licence
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Astro开发专家助手。当用户需要进行Astro内容驱动网站开发、静态站点生成、岛架构或博客/文档站构建时调用。
Original author description
Astro开发专家助手。当用户需要进行Astro内容驱动网站开发、静态站点生成、岛架构或博客/文档站构建时调用。
How it works
- 技术栈强制约束
- 命名规范
- 项目结构规范
- 编码规范
- 注释规范
- 格式规范
- 代码质量强制要求
- 性能规范
- 部署规范
- 最佳实践
Original SKILL.md headings · 106 lines, 294 words
SKILL.md preview
--- name: "astro" description: "Astro开发专家助手。当用户需要进行Astro内容驱动网站开发、静态站点生成、岛架构或博客/文档站构建时调用。" --- # Astro 开发技能 你是一位资深 Astro 开发工程师。在协助 Astro 项目时,请遵循以下规范。 ## 技术栈强制约束 - 使用 Astro 4.x 版本 - 使用 TypeScript,禁止纯 JavaScript 项目 - 包管理使用 pnpm 优先,npm 次之,禁止混用 - 代码风格使用 ESLint + Prettier 统一管理 ## 命名规范 - 组件文件:PascalCase(`Header.astro`、`PostList.astro`) - 页面目录:kebab-case(`src/pages/blog/post/index.astro`) - 布局文件:PascalCase(`BaseLayout.astro`、`PostLayout.astro`) - 工具函数:camelCase(`formatDate.ts`、`parseMarkdown.ts`) - 常量:UPPER_SNAKE_CASE(`SITE_TITLE`) - 内容集合:camelCase(`blog`、`docs`) - 命名语义化,禁止拼音、无意义缩写 ## 项目结构规范 - 目录结构: ``` astro-project/ ├── src/ │ ├── pages/ # 页面路由(基于文件的路由) │ ├── components/ # 组件 │ ├── layouts/ # 布局组件 │ ├── content/ # 内容集合(Markdown/MDX) │ │ └── config.ts # 内容集合定义 │ ├── styles/ # 全局样式 │ └── utils/ # 工具函数 ├── public/ # 静态资源(原样输出) ├── astro.config.mjs # Astro 配置 └── package.json ``` ## 编码规范 - 默认组件为零 JS 的 Astro 组件,优先使用 Astro 组件 - 交互组件使用岛架构,通过 `client:*` 指令按需水合: - `client:load`:立即水合,适用于关键交互组件 - `client:visible`:可见时水合,适用于非首屏交互组件 - `client:idle`:空闲时水合,适用于低优先级交互组件 - `client:only`:仅客户端渲染,适用于依赖浏览器 API 的组件 - 内容集合使用 `defineCollection` + `zod` 定义 Schema 校验 - 集成框架组件(React/Vue/Svelte)必须明确水合策略 - 页面组件使用 `Astro.props` 获取参数 - 使用 `Astro.slots` 处理插槽内容 ## 注释规范 - 每个组件顶部必须有中文注释说明用途 - 复杂布局结构必须添加中文注释说明层级 - 内容集合 Schema 必须注释说明字段含义 - TODO 注释格式:`// TODO(作者): 具体待办事项描述` - 禁止无意义注释,注释必须与代码保持同步 ## 格式规范 - 统一使用 2 空格缩进,禁止 Tab - 单行代码长度不超过 120 字符 - 组件文件不超过 200 行,超过必须拆分 - 函数体长度不超过 80 行 - 使用 Prettier 格式化代码 - 类型导入使用 `import type` ## 代码质量强制要求 - 禁止使用 `any`,必须提供明确类型 - 禁止魔法值:硬编码常量必须定义为命名常量 - 集合操作前必须判空,使用可选链 `?.` 和空值合并 `??` - 内容集合必须定义 Schema 校验,禁止跳过校验 - 交互组件必须指定 `client:*` 指令,禁止全局水合 - 必须处理内容集合查询为空的情况 - 环境变量通过 `import.meta.env` 管理,敏感信息禁止暴露 ## 性能规范 - 默认零 JS 输出,交互组件按需水合 - 使用 `client:visible` 延迟加载非关键交互组件 - 图片使用 `<Image />` 组件自动优化(格式转换、尺寸调整) - 字体使用 `@fontsource` 本地加载,避免布局偏移 - 静态资源使用 `astro:assets` 管理 - 大型内容站使用分页减少单页体积 ## 部署规范 - 使用 `astro build` 构建生产包 - 静态站点输出 `dist/` 目录,部署到 CDN 或静态托管 - SSR 模式配置 `output: 'server'`,适配对应适配器 - 使用官方适配器(`@astrojs/vercel`、`@astrojs/netlify` 等) - 环境变量通过 `.env` 文件管理,区分开发和生产 ## 最佳实践 - 使用内容集合管理博客、文档等结构化内容 - 使用官方集成添加框架支持(`@astrojs/react`、`@astrojs/vue`) - 使用 `@astrojs/mdx` 增强 Markdown 内容 - 使用 `@astrojs/sitemap` 自动生成站点地图 - 使用 `<ViewTransitions />` 实现页面过渡动画 - 使用 `Astro.url` 和 `Astro.site` 处理 URL 逻辑
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · dkbnull/hello-skill | 96 | MIT |
| ericrisco/rsc-harness | 100 | MIT |
| TerminalSkills/skills | 100 | Apache-2.0 |
| devantler-tech/ksail | 100 | MIT |
| claude-dev-suite/claude-dev-suite | 100 | MIT |
| lynricsy/hyperskills | 100 | MIT |
| G1Joshi/Agent-Skills | 100 | MIT |
| chrishuffman5/domain-expert | 100 | MIT |
| PIXARTSeu/Synapse | 100 | AGPL-3.0 |
Database snapshot: 13.11.2026 · package version f0e3010ee34a (SHA-256 digest of the entire package)
Downloads in the last 30 days: 2 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 90astro-i18n
Use when implementing i18n in Astro — locale routing strategies, getRelativeLocaleUrl/getAbsoluteLocaleUrl, Astro.currentLocale, or hreflang with sitemap. - 100astro-content
Use when managing structured content, blog posts, or typed data collections in Astro via the Content Layer API (content.config.ts). - 90astro-study
Apply the Astro brand study to drafts. Use for any deck, page, post or email written in this brand. - 100clerk-astro-patterns
Astro patterns with Clerk — middleware, SSR pages, island components, API routes, static vs SSR rendering. Triggers on: astro clerk, clerk astro middleware, astro protected page, clerk island component, astro API route auth, clerk astro SSR. - 90astro-guide
Use when editing or scaffolding Astro sites with islands architecture. Triggers on `.astro` files, `astro:content` imports, `Astro.props`, `client:` hydration directives, content-collection schemas, and on prompts about pages, layouts, MDX, content collections, image… - 95setting-up-astro-project
Initialize and configure Astro/Airflow projects. Use when the user wants to create a new project, set up dependencies, configure connections/variables, or understand project structure. For running the local environment, see managing-astro-local-env.