用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/diegosouzapw/awesome-omni-skill --skill astro-dev命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | astro-dev |
| description | Comprehensive Astro development with React, Tailwind v4, and Cloudflare Workers deployment |
Comprehensive guide for building modern web applications with Astro, React, Tailwind CSS v4, and Cloudflare Workers deployment.
For Cloudflare Workers deployment (recommended):
./scripts/init_astro_cloudflare.sh my-app
Creates:
For standard static site:
./scripts/init_astro_standard.sh my-site
python scripts/setup_content_collection.py blog
Creates:
src/content/blog/ directorysrc/content/config.tsCollection types:
blog - Blog posts with frontmatterdocs - Documentation pagesproducts - Product data (JSON)python scripts/add_view_transitions.py
Automatically adds View Transitions API to all layouts in src/layouts/.
# Initialize project
./scripts/init_astro_cloudflare.sh my-blog
cd my-blog
# Set up content collections
python ../scripts/setup_content_collection.py blog
# Add View Transitions
python ../scripts/add_view_transitions.py
# Start development
npm run dev
# Deploy to Cloudflare Workers
npx wrangler deploy
See references/cloudflare-d1.md for:
See references/react-integration.md for:
See references/tailwind-setup.md for:
# One-time setup
npm install -g wrangler
wrangler login
# Deploy
npm run build
npx wrangler deploy
Key points:
wrangler.jsonc configuration./dist/_worker.js./distSee references/cloudflare-workers.md for:
See references/github-actions.md for:
// astro.config.mjs
// Server-Side Rendering (all pages on-demand)
export default defineConfig({
output: 'server',
});
// Hybrid (static by default, opt-in to SSR)
export default defineConfig({
output: 'hybrid',
});
// Static (pre-rendered at build time)
export default defineConfig({
output: 'static',
});
my-astro-app/
├── src/
│ ├── pages/ # File-based routing
│ │ ├── index.astro
│ │ ├── blog/
│ │ │ └── [...slug].astro
│ │ └── api/ # API endpoints
│ │ └── data.ts
│ ├── layouts/ # Page layouts
│ │ └── BaseLayout.astro
│ ├── components/ # Astro components
│ │ └── Card.astro
│ ├── components/ # React components
│ │ └── Button.tsx
│ ├── content/ # Content collections
│ │ ├── config.ts
│ │ └── blog/
│ ├── styles/ # Global CSS
│ │ └── global.css
│ └── env.d.ts # TypeScript types
├── public/ # Static assets
│ └── .assetsignore # Workers asset config
├── astro.config.mjs # Astro configuration
├── wrangler.jsonc # Cloudflare Workers config
├── package.json
└── tsconfig.json
Control when React components hydrate:
<!-- Hydrate immediately -->
<Counter client:load />
<!-- Hydrate when idle -->
<SocialShare client:idle />
<!-- Hydrate when visible -->
<Comments client:visible />
<!-- Hydrate on specific media query -->
<MobileMenu client:media="(max-width: 768px)" />
<!-- Client-only (no SSR) -->
<BrowserWidget client:only="react" />
Access Workers APIs in pages and API routes:
---
// In .astro files
const { env, cf, ctx } = Astro.locals.runtime;
// Use KV
const data = await env.MY_KV.get('key');
// Use D1
const { results } = await env.DB.prepare('SELECT * FROM users').all();
// Request properties
const country = cf.country;
---
<Image /> componentplatformProxy for bindings in devwrangler types after binding changeswrangler tail for debuggingBuild Errors:
npx astro check for TypeScript errors.astro cache and rebuildHydration Issues:
client:* directiveclient:only if component can't be server-renderedDeployment Issues:
wrangler.jsonc configurationCLOUDFLARE_API_TOKEN permissionswrangler tail logsTailwind Not Working:
global.css in layoutastro.config.mjs@import "tailwindcss" at top of CSScloudflare-workers.md - Workers deployment guidecloudflare-d1.md - D1 database setupreact-integration.md - React patternstailwind-setup.md - Tailwind v4 configcontent-collections.md - Content managementview-transitions.md - Page animationsgithub-actions.md - CI/CD workflowsAstro and its ecosystem evolve rapidly. To update:
This skill is current as of:
Last updated: October 2024