frontend-component-design — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited frontend-component-design (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
确保前端代码的复用性、封装性和可维护性。
# 拆分时机判断
if 组件 > 500 行:
拆分为子组件
if 相同代码出现 >= 2 次:
抽取为公共组件
if 业务逻辑复杂:
抽取为 hooks
if 配置数据多:
抽取为配置文件frontend/
├── components/ # 公共组件
│ ├── ui/ # shadcn 基础组件
│ └── admin/ # 业务公共组件
├── app/ # 页面
│ └── admin/
│ └── [feature]/
│ ├── page.tsx # 主页面(协调逻辑)
│ └── components/ # 页面私有组件(可选)
├── lib/
│ ├── api/ # API 请求函数
│ ├── config/ # 配置和映射
│ └── hooks/ # 公共 hooks
├── hooks/ # 全局 hooks
└── types/ # 类型定义将以下内容抽取到 lib/config/ 目录:
labels.ts (英文→中文)constants.tsforms.tstheme.ts示例:
// lib/config/labels.ts
export const MIDDLEWARE_LABELS = {
MemoryOrchestration: { label: "记忆编排", desc: "..." },
// ...
};
export function getMiddlewareLabel(name: string) {
return MIDDLEWARE_LABELS[name] || { label: name, desc: "" };
}抽取为 hook 的时机:
命名规范:use[业务名][动作]
// lib/hooks/use-agents.ts
export function useAgentDetail({ agentId }: { agentId: string }) {
const [agent, setAgent] = useState<Agent | null>(null);
// ...
return { agent, isLoading, error, refresh };
}始终使用 @/ 别名,避免相对路径:
// ✅ 正确
import { Button } from "@/components/ui/button";
import { getAgentEffectiveConfig } from "@/lib/api/agents";
// ❌ 错误
import { Button } from "../../components/ui/button";编写前端代码前,必须回答:
完成编码后,检查:
@/ 路径别名~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.