Storybook 模板创建
create-template
在 CoreAI Design System Storybook 中创建新的可复制粘贴模板。当被要求在 Storybook 的 Templates/ 目录下添加新模板、模式或页面脚手架时使用。务必先阅读 apps/storybook/README.md 的 "Creating a template" 章节。编辑 ./apps/prototype 时请忽略且不要使用此技能。
- License 许可
- CC-BY-4.0
- 最近更新
- 2026-11-14
- Stars
- ★ 2
- Forks
- 1
01 前言 Front Matter
- name
- create-template
- description
- Create a new copy-paste template in the CoreAI Design System Storybook. Use when asked to add a new template, pattern, or page scaffold under Templates/ in Storybook. ALWAYS read apps/storybook/README.md's "Creating a template" section first. IGNORE and DO NOT use when editing ./apps/prototype
- argument-hint
- e.g. "create a Detail Page template"
03 SKILL.md 正文
Creating a Storybook template
Before writing any files, read
apps/storybook/README.md#creating-a-template —
it's the source of truth for the file convention ({Name}.tsx +
{Name}.stories.tsx + generated {Name}.mdx), the CSF3 story rules, the
JSDoc→MCP mapping, and the quality checklist. Follow it exactly; don't
improvise a different file layout.
Steps
- Create
{Name}.tsxunderapps/storybook/src/stories/templates/— the self-contained copy-paste component (no Storybook imports). - Create
{Name}.stories.tsxnext to it — minimal meta +Defaultstory + JSDoc, per the README convention. - Run
npm --workspace apps/storybook run docs:templates(or just save — the dev-server watcher regenerates it) to produce{Name}.mdx. Never hand-author or edit that file. - Work through the Quality checklist in the README section before committing.
Commit and PR conventions
Commits
One commit per logical unit:
feat(storybook): add {Name} copy-paste template
Fix commits that arise during review:
fix(storybook): {short description}
refactor(storybook): {short description}
PR title
feat(storybook): {Name} copy-paste template
PR body sections
Closes #{issue}
## What
One paragraph — what was built and why.
## Changes
### Storybook — {Name}
- `{Name}.tsx` — the copy-paste component (single source of truth)
- `{Name}.stories.tsx` — Storybook meta, stories, JSDoc for MCP
## Features
### {Key decision 1}
Explain the non-obvious design choice and why it was made.
Reference the existing templates (EmptyState, FilterableList,
ShellAndNavigation) as style examples. See also the
create-pr skill for changelog/reviewer conventions
once the template is ready to ship.
04 同仓库更多 Skills
CoreAI React 组件开发
coreai-ds-fluentui-react
文档/技能 v0.1.1;包 v0.12.0。使用 @coreai-ds/react-components 构建、设置样式、审查或调试 React UI 时使用。通过 HTTPS 获取 CoreAI Markdown 文档,了解组件、API、默认值、模板、设计 token 和无障碍指南。
前端查询状态管理
state-management
CoreAI Sandbox 的简化版 TanStack Query + mock-JSON 数据层。使用场景:编辑数据获取 hooks(`app/hooks/use*.ts`)、在 `app/data/` 中添加模拟数据,或将组件接入查询状态。
开发服务器启动
start-app
启动 CoreAI Sandbox 开发服务器,并使用可用的浏览器工具将其打开。适用场景:用户要求“启动应用”、“运行开发服务器”、“打开应用”或“启动 CoreAI Sandbox”时。
React Router 路由配置
routing
本 SPA 的 React Router v7 路由约定。适用场景:编辑 `app/routes.ts`、添加/删除路由或更改导航时。
React 组件使用与导入
react-components
CoreAI Sandbox 组件使用:导入边界、CoreAI MCP 文档以及本地适配器检查。适用场景:编辑任意 `*.tsx` 文件、选择组件或编写组件导入语句时。
新建设计变体
new-variant
使用内置的功能/变体系统为页面创建新的设计变体或备选方案。使用场景:设计师想尝试不同的布局、创建“方案 B”或“版本 2”、并排对比设计、添加 A/B 备选方案,或探索替代版本。不要构建自定义的切换方案。