一键导入
create-astro-component
Scaffold a new reusable .astro component following project conventions. Use when user wants to create, build, or add a new Astro component.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Scaffold a new reusable .astro component following project conventions. Use when user wants to create, build, or add a new Astro component.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Create a new blog post in the Astro content collection with proper frontmatter, slug, and conventions. Use when user wants to add, write, create, or publish a new blog post.
Add a speaking event to the content collection. Handles one-time collection setup if missing. Use when user wants to add, schedule, or log a speaking event.
Add a project to the content collection. Handles one-time collection setup if missing. Use when user wants to add, create, or showcase a new project.
| name | create-astro-component |
| description | Scaffold a new reusable .astro component following project conventions. Use when user wants to create, build, or add a new Astro component. |
From existing components in src/components/:
| Convention | Rule |
|---|---|
| Filename | PascalCase, .astro extension |
| Props | export interface Props { ... } |
| Destructure | const { ... } = Astro.props; with defaults |
| Optional elements | {condition && <element>} |
| Lists | {array.map(item => ...)} |
| Style | Scoped <style> block, kebab-case classes |
| Tokens | CSS custom properties from src/styles/global.css |
| No imports | Components don't import global.css (layout handles it) |
---
export interface Props {
title: string;
subtitle?: string;
}
const { title, subtitle } = Astro.props;
---
<div class="component-name">
<h3>{title}</h3>
{subtitle && <p class="subtitle">{subtitle}</p>}
<slot />
</div>
<style>
.component-name {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
padding: 28px;
display: flex;
flex-direction: column;
gap: var(--gap-sm);
}
.component-name:hover {
box-shadow: 0 4px 24px rgba(0, 0, 0, 0.05);
}
.subtitle {
font-family: var(--font-mono);
font-size: 12px;
color: var(--muted);
letter-spacing: 0.04em;
text-transform: uppercase;
}
</style>
MyNewFeature.astro)src/components/Props interface matching data shape<style> with CSS custom properties.btn, .pill, .tag, .card from global.css for common patterns