---
name: frontend-stack
description: 用于 React 前端开发、页面与组件实现、前端技术选型和代码检查。统一 React、Vite、Tailwind CSS v4、shadcn/ui（Base UI + Nova）技术栈，优先复用成熟组件，限制重复依赖。独立使用，不依赖其他 Skill 或工作流。
title: frontend-stack
canonical_url: https://skilld.dev/gh/alicedel66/frontend-stack-guardrails
last_updated: 2026-11-01T14:45:58.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [guard/check-deps.mjs](https://skilld.dev/api/skills-raw/alicedel66/frontend-stack-guardrails/frontend-stack/guard/check-deps.mjs), [guard/eslint-restricted.js](https://skilld.dev/api/skills-raw/alicedel66/frontend-stack-guardrails/frontend-stack/guard/eslint-restricted.js), [guard/fe-stack.json](https://skilld.dev/api/skills-raw/alicedel66/frontend-stack-guardrails/frontend-stack/guard/fe-stack.json), [references/frontend-rules.md](https://skilld.dev/api/skills-raw/alicedel66/frontend-stack-guardrails/frontend-stack/references/frontend-rules.md).
>
> If the user asked to install this Skill, run `npx skilld install alicedel66/frontend-stack-guardrails/frontend-stack`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/frontend-stack`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/alicedel66/frontend-stack-guardrails/frontend-stack) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/frontend-stack`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/frontend-stack --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/frontend-stack --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# 前端技术栈与实现规范

## 使用方式

处理前端开发任务时，先阅读 [前端规范](https://skilld.dev/api/skills-raw/alicedel66/frontend-stack-guardrails/frontend-stack/references/frontend-rules.md)，再开展实现。规则、检查器与依赖清单均在本 Skill 目录内，不需要外部 Skill、全局配置或专用服务。

## 执行要求

1. **先了解项目**：读取项目说明、现有 AI 指令、`package.json`、`components.json` 及 ESLint 配置。明确任务的验收条件，只改需求所需部分。
2. **判断适用性**：本规范默认面向 React + Vite 的内部工具和数据看板。已有项目的明确约束优先；若已有技术栈与此冲突，说明冲突并由项目维护者决定，不擅自迁移框架、更换组件库或批量删除依赖。
3. **先复用后实现**：检查 shadcn/ui 和规范指定库是否已有能力。已有组件通过组合、`className` 或组件源码定制，不另造平行组件。
4. **遵守边界**：统一 Tailwind 与主题变量；HTTP 请求通过 `src/lib/api.ts` 中的 Axios 封装，接口缓存与重试交给 TanStack Query，客户端共享状态交给 Zustand；只使用白名单中的依赖。新增依赖或例外须经项目维护者确认并在清单中记录理由。
5. **检查按需接入**：`guard/check-deps.mjs` 和 `guard/fe-stack.json` 是依赖检查器；`guard/eslint-restricted.js` 是 ESLint flat config 片段。接入前检查项目已有配置，按包内 README 合并，不覆盖原配置。这些工具不会因 Skill 被加载而自动运行。
6. **验证后交付**：运行项目已配置的 lint、依赖检查、测试及构建；涉及界面时验证交互和相关布局。缺少命令先说明并按任务范围接入，不虚构通过结果。交付时列出实际检查结果、未验证项及已确认的例外。

## 资源与检查边界

- [完整规范](https://skilld.dev/api/skills-raw/alicedel66/frontend-stack-guardrails/frontend-stack/references/frontend-rules.md)
- [依赖清单](https://skilld.dev/api/skills-raw/alicedel66/frontend-stack-guardrails/frontend-stack/guard/fe-stack.json)
- [依赖检查器](https://skilld.dev/api/skills-raw/alicedel66/frontend-stack-guardrails/frontend-stack/guard/check-deps.mjs)
- [ESLint 导入规则](https://skilld.dev/api/skills-raw/alicedel66/frontend-stack-guardrails/frontend-stack/guard/eslint-restricted.js)

依赖检查器检查当前项目 `package.json` 的 dependencies 与 devDependencies，不检查传递依赖或版本兼容性。ESLint 片段仅约束 `src/**/*.ts`、`src/**/*.tsx` 中配置覆盖的导入；它不能自动保证所有架构、样式与复用要求。其余条款仍需代码审查与测试。
