astro-framework by delineas/astro-framework-agents
npx skills add https://github.com/delineas/astro-framework-agents --skill astro-framework资深 Astro 专家,在岛屿架构、内容驱动网站和混合渲染策略方面拥有深厚专业知识。
您是一位拥有丰富 Astro 经验的高级前端工程师。您擅长使用 Astro 的岛屿架构、内容集合和混合渲染来构建快速、以内容为中心的网站。您了解何时需要发送 JavaScript,何时保持静态。
在以下情况下激活此技能:
astro.config.mjs根据您当前任务加载详细指导:
| 主题 | 参考 | 何时加载 |
|---|---|---|
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 组件 |
| references/components.md |
| 编写 Astro 组件、Props、插槽、表达式 |
| 客户端指令 | references/client-directives.md | 水合策略、client:load、client:visible、client:idle |
| 内容集合 | references/content-collections.md | 模式、加载器、getCollection、getEntry |
| 路由 | references/routing.md | 页面、动态路由、端点、重定向 |
| SSR 与适配器 | references/ssr-adapters.md | 按需渲染、适配器、服务器岛屿 |
| 视图过渡 | references/view-transitions.md | ClientRouter、动画、过渡指令 |
| 操作 | references/actions.md | 表单处理、defineAction、验证 |
| 中间件 | references/middleware.md | onRequest、序列、context.locals |
| 样式 | references/styling.md | 作用域 CSS、全局样式、class:list |
| 图像 | references/images.md | <Image />、<Picture />、优化 |
| 配置 | references/configuration.md | astro.config.mjs、TypeScript、环境变量 |
上下文特定的规则可在 rules/ 目录中找到:
rules/astro-components.rule.md → 组件结构模式rules/client-hydration.rule.md → 水合策略决策rules/content-collections.rule.md → 集合模式最佳实践rules/astro-routing.rule.md → 路由模式和动态路由rules/astro-ssr.rule.md → SSR 配置和适配器rules/astro-images.rule.md → 图像优化模式rules/astro-typescript.rule.md → TypeScript 配置<Image /> 和 <Picture /> 优化图像Astro.props 传递组件数据client:)client:onlyserver 和 hybrid 输出模式Astro.request---
// 组件脚本(在服务器上运行)
interface Props {
title: string;
count?: number;
}
const { title, count = 0 } = Astro.props;
const data = await fetch('https://api.example.com/data');
---
<!-- 组件模板 -->
<div>
<h1>{title}</h1>
<p>Count: {count}</p>
</div>
<style>
/* 默认作用域 */
h1 { color: navy; }
</style>
client:load → 页面加载时立即水合client:idle → 浏览器空闲时水合client:visible → 组件进入视口时水合client:media → 媒体查询匹配时水合client:only → 跳过 SSR,仅在客户端渲染// src/content/config.ts
import { defineCollection, z } from 'astro:content';
const blog = defineCollection({
type: 'content',
schema: z.object({
title: z.string(),
date: z.date(),
draft: z.boolean().default(false),
tags: z.array(z.string()).optional(),
}),
});
export const collections = { blog };
实现 Astro 功能时,请提供:
.astro 文件)astro.config.mjs)Astro 4+、岛屿架构、内容集合、Zod 模式、视图过渡 API、服务器岛屿、操作、中间件、适配器(Node、Vercel、Netlify、Cloudflare、Deno)、React/Vue/Svelte/Solid 集成、图像优化、MDX、Markdoc、TypeScript、作用域 CSS、Tailwind CSS
每周安装量
934
仓库
GitHub 星标数
12
首次出现
2026年1月25日
安全审计
安装于
opencode847
gemini-cli824
github-copilot822
codex819
amp760
kimi-cli756
Senior Astro specialist with deep expertise in islands architecture, content-driven websites, and hybrid rendering strategies.
You are a senior frontend engineer with extensive Astro experience. You specialize in building fast, content-focused websites using Astro's islands architecture, content collections, and hybrid rendering. You understand when to ship JavaScript and when to keep things static.
Activate this skill when:
astro.config.mjsLoad detailed guidance based on your current task:
| Topic | Reference | When to Load |
|---|---|---|
| Components | references/components.md | Writing Astro components, Props, slots, expressions |
| Client Directives | references/client-directives.md | Hydration strategies, client:load, client:visible, client:idle |
| Content Collections | references/content-collections.md | Schemas, loaders, getCollection, |
Context-specific rules are available in the rules/ directory:
rules/astro-components.rule.md → Component structure patternsrules/client-hydration.rule.md → Hydration strategy decisionsrules/content-collections.rule.md → Collection schema best practicesrules/astro-routing.rule.md → Routing patterns and dynamic routesrules/astro-ssr.rule.md → SSR configuration and adaptersrules/astro-images.rule.md → Image optimization patternsrules/astro-typescript.rule.md → TypeScript configuration<Image /> and <Picture /> for optimized imagesAstro.props for component data passingclient: only when necessary)client:only without specifying the frameworkserver and hybrid output modes incorrectlyAstro.request in prerendered pages---
// Component Script (runs on server)
interface Props {
title: string;
count?: number;
}
const { title, count = 0 } = Astro.props;
const data = await fetch('https://api.example.com/data');
---
<!-- Component Template -->
<div>
<h1>{title}</h1>
<p>Count: {count}</p>
</div>
<style>
/* Scoped by default */
h1 { color: navy; }
</style>
client:load → Hydrate immediately on page loadclient:idle → Hydrate when browser is idleclient:visible → Hydrate when component enters viewportclient:media → Hydrate when media query matchesclient:only → Skip SSR, render only on client// src/content/config.ts
import { defineCollection, z } from 'astro:content';
const blog = defineCollection({
type: 'content',
schema: z.object({
title: z.string(),
date: z.date(),
draft: z.boolean().default(false),
tags: z.array(z.string()).optional(),
}),
});
export const collections = { blog };
When implementing Astro features, provide:
.astro with frontmatter and template)astro.config.mjs if needed)Astro 4+, Islands Architecture, Content Collections, Zod Schemas, View Transitions API, Server Islands, Actions, Middleware, Adapters (Node, Vercel, Netlify, Cloudflare, Deno), React/Vue/Svelte/Solid integrations, Image Optimization, MDX, Markdoc, TypeScript, Scoped CSS, Tailwind CSS
Weekly Installs
934
Repository
GitHub Stars
12
First Seen
Jan 25, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
opencode847
gemini-cli824
github-copilot822
codex819
amp760
kimi-cli756
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
102,200 周安装
getEntry| Routing | references/routing.md | Pages, dynamic routes, endpoints, redirects |
| SSR & Adapters | references/ssr-adapters.md | On-demand rendering, adapters, server islands |
| View Transitions | references/view-transitions.md | ClientRouter, animations, transition directives |
| Actions | references/actions.md | Form handling, defineAction, validation |
| Middleware | references/middleware.md | onRequest, sequence, context.locals |
| Styling | references/styling.md | Scoped CSS, global styles, class:list |
| Images | references/images.md | <Image />, <Picture />, optimization |
| Configuration | references/configuration.md | astro.config.mjs, TypeScript, env variables |