From bb-spec-frontend
Hard stack and toolchain constraints for frontend projects — the default stack is unified as Vue 3 + TypeScript + Vite + Tailwind CSS; bun is the default package manager (mandatory for new projects), while existing projects with another lockfile (e.g. package-lock.json) keep their current manager without forced migration. TRIGGER when creating a frontend project, editing package.json / vite.config.* / tailwind.config.* / tsconfig.json / .vue / .ts / .tsx, running a frontend build or install command, or the user mentions frontend / vue / vite / tailwind / npm install / yarn add / pnpm. | 前端项目技术栈与工具链强制约束——默认技术栈统一为 Vue 3 + TypeScript + Vite + Tailwind CSS;包管理器默认 bun(新项目强制),既有项目若已存在其它 lockfile(如 package-lock.json)则跟随现有工具,不强制迁移。TRIGGER when:新建前端项目、编辑 package.json / vite.config.* / tailwind.config.* / tsconfig.json / .vue / .ts / .tsx 文件、运行前端构建或安装命令、用户提到"前端"/"vue"/"vite"/"tailwind"/"npm install"/"yarn add"/"pnpm" 等场景。
How this skill is triggered — by the user, by Claude, or both
Slash command
/bb-spec-frontend:vue-constraintsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
适用于:**所有前端项目**——含新建项目、为既有项目添加功能、升级或迁移工具链。
适用于:所有前端项目——含新建项目、为既有项目添加功能、升级或迁移工具链。
核心理念:统一技术栈降低跨项目认知负担。 偏离默认栈必须有明确业务理由并经用户确认,不接受"个人偏好"作为偏离依据。
TRIGGER(命中任一即应应用本约束):
package.json、bun.lock(旧版 bun 为 bun.lockb)vite.config.ts / vite.config.jstailwind.config.ts / tailwind.config.jstsconfig.json / tsconfig.*.json*.vue、*.ts、*.tsx(前端项目内)index.html(Vite 项目根入口)SKIP(以下情况本约束不适用):
新建前端项目,统一使用以下技术栈,不接受个人偏好替代:
| 维度 | 默认选择 |
|---|---|
| 框架 | Vue 3 |
| 语言 | TypeScript |
| 构建工具 | Vite |
| CSS | Tailwind CSS |
| 包管理器 | bun(新项目强制;既有项目见第 3 节判定规则) |
<script setup>)作为默认风格.js / .jsx)作为前端源文件strict: true(含 strictNullChecks、noImplicitAny 等)*.vue 文件 <script> 必须带 lang="ts"@apply 堆叠以下替代方案禁止使用,除非有明确业务必要并经用户确认:
| 不得使用 | 应使用 | 原因 |
|---|---|---|
| Vue 2 | Vue 3 | Vue 2 已 EOL,Composition API 是主流 |
| 纯 JavaScript(无类型) | TypeScript | 类型安全、IDE 体验、重构友好 |
| webpack / rollup 直配 | Vite | HMR 速度、配置复杂度、开箱即用 |
| styled-components / emotion / 手写 SCSS 体系 | Tailwind CSS | 设计系统一致性、原子类心智模型 |
| Vuex | Pinia | Vue 3 官方推荐,TS 支持更好 |
| npm / yarn / pnpm(新项目) | bun | 速度、统一工具链;既有项目跟随现有 lockfile(详见第 3 节) |
如确需引入额外方案,必须先与用户确认,并在 PR 描述中写明:
| 项目状态 | 包管理器 |
|---|---|
| 新建项目 | bun(强制) |
既有项目,有 bun.lock / bun.lockb | bun(强制) |
| 既有项目,无任何 lockfile | bun(默认) |
既有项目,有 package-lock.json | npm(跟随,不强制迁移) |
既有项目,有 yarn.lock | yarn(跟随,不强制迁移) |
既有项目,有 pnpm-lock.yaml | pnpm(跟随,不强制迁移) |
bun add,会产生第二份 lockfile)。在 bun 管理的项目(含新建项目)中,npm / yarn / pnpm 一律禁止:
npm install <pkg> / npm run <script> / npx <cmd>yarn add <pkg> / yarn <script> / yarn dlx <cmd>pnpm add <pkg> / pnpm <script> / pnpm dlx <cmd>| 操作 | bun 命令 |
|---|---|
| 安装所有依赖 | bun install |
| 添加依赖 | bun add <pkg> |
| 添加 dev 依赖 | bun add -d <pkg> |
| 移除依赖 | bun remove <pkg> |
| 升级依赖 | bun update <pkg> |
| 运行脚本 | bun run <script> |
| 执行临时命令 | bunx <cmd>(等价于 npx) |
| 跑测试 | bun test(Bun 内置)或 bun run test |
bun.lock(旧版 bun 为 bun.lockb)进版本控制,禁止混存 package-lock.json / yarn.lock / pnpm-lock.yaml(发现立即删除)bun.lock在 bun 管理的项目中,当用户说 "npm install X" / "yarn add X" / "pnpm add X" 时,Agent 应:
bun add X 执行在跟随既有 lockfile 的项目(npm / yarn / pnpm)中,直接按项目现有工具执行,不做纠正。
version-policy skill(先查官方最新版本,不凭记忆填写)。git-workflow skill(分支策略、PR 三段式等)。新建项目时推荐使用 Vite 官方脚手架:
# 创建 Vue 3 + TS 项目
bun create vite@latest <project-name> -- --template vue-ts
# 进入项目并安装依赖
cd <project-name>
bun install
# 添加 Tailwind CSS(按官方 Vite 集成指南)
bun add -d tailwindcss @tailwindcss/vite
# 后续配置 vite.config.ts 与全局 css,详见 https://tailwindcss.com/docs/installation/using-vite
# 启动 dev server
bun run dev
⚠️ 实际依赖版本号必须按
version-policyskill 要求先查官方最新版本再写入,不要凭记忆。
新建前端项目或为前端项目添加依赖前,对照以下清单:
bun.lock 已提交;非 bun 既有项目保留原 lockfile 未被替换Provides UI/UX resources: 50+ styles, color palettes, font pairings, guidelines, charts for web/mobile across React, Next.js, Vue, Svelte, Tailwind, React Native, Flutter. Aids planning, building, reviewing interfaces.
Fetches up-to-date documentation from Context7 for libraries and frameworks like React, Next.js, Prisma. Use for setup questions, API references, and code examples.
npx claudepluginhub 0xbb2b/bb-spec --plugin bb-spec-frontend