Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/congwa/mobile-agent/frontend-component-designnpx skills add congwa/mobile-agent --skill frontend-component-designgit clone --depth 1 https://github.com/congwa/mobile-agentWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/congwa/mobile-agent/frontend-component-design)<a href="https://agentmods.dev/skills/congwa/mobile-agent/frontend-component-design"><img src="https://agentmods.dev/badge/skills/congwa/mobile-agent/frontend-component-design.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00095 | $0.00997 |
| Opus 5 | $0.00048 | $0.00498 |
| Sonnet 5 | $0.00019 | $0.00199 |
| Haiku 4.5 | $0.00010 | $0.00100 |
Grade A, and why
frontend-component-design scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 121 lines — stays where its author put it; the contents beside it link to each section on GitHub.
前端组件设计规范
确保前端代码的复用性、封装性和可维护性。
核心原则
1. 单一职责原则
- 每个文件只包含一个组件
- 每个组件只负责一个业务功能
- 组件代码不超过 500 行,超过则拆分
2. 组件拆分规则
# 拆分时机判断
if 组件 > 500 行:
拆分为子组件
if 相同代码出现 >= 2 次:
抽取为公共组件
if 业务逻辑复杂:
抽取为 hooks
if 配置数据多:
抽取为配置文件
3. 目录结构规范
frontend/
├── components/ # 公共组件
│ ├── ui/ # shadcn 基础组件
│ └── admin/ # 业务公共组件
├── app/ # 页面
│ └── admin/
│ └── [feature]/
│ ├── page.tsx # 主页面(协调逻辑)
│ └── components/ # 页面私有组件(可选)
├── lib/
│ ├── api/ # API 请求函数
│ ├── config/ # 配置和映射
│ └── hooks/ # 公共 hooks
├── hooks/ # 全局 hooks
└── types/ # 类型定义
4. 配置外置原则
将以下内容抽取到 lib/config/ 目录:
- 标签映射 →
labels.ts(英文→中文) - 枚举常量 →
constants.ts - 表单配置 →
forms.ts - 主题配置 →
theme.ts
示例:
// lib/config/labels.ts
export const MIDDLEWARE_LABELS = {
MemoryOrchestration: { label: "记忆编排", desc: "..." },
// ...
};
export function getMiddlewareLabel(name: string) {
return MIDDLEWARE_LABELS[name] || { label: name, desc: "" };
}
5. Hooks 抽取规则
抽取为 hook 的时机:
- 状态逻辑复杂(>5 个 useState)
- 数据获取逻辑
- 副作用逻辑复杂
- 相同逻辑在多处使用
命名规范:use[业务名][动作]
// lib/hooks/use-agents.ts
export function useAgentDetail({ agentId }: { agentId: string }) {
const [agent, setAgent] = useState<Agent | null>(null);
// ...
return { agent, isLoading, error, refresh };
}
6. 导入路径规范
始终使用 @/ 别名,避免相对路径:
// ✅ 正确
import { Button } from "@/components/ui/button";
import { getAgentEffectiveConfig } from "@/lib/api/agents";
// ❌ 错误
import { Button } from "../../components/ui/button";
编码前规划清单
编写前端代码前,必须回答:
- 组件边界:这个组件的职责是什么?是否单一?
- 复用性:是否有已存在的类似组件可复用?
- 配置外置:是否有硬编码的中文/配置需要抽取?
- 文件大小:预估代码行数,是否需要拆分?
- 命名规范:组件/文件命名是否清晰表达业务含义?
代码审查要点
完成编码后,检查:
- 单文件不超过 500 行
- 无重复代码(相同代码不超过 2 处)
- 所有中文标签来自配置文件
- 使用
@/路径别名 - 组件职责单一
- 复杂逻辑已抽取为 hooks
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 4d ago First seen · 121 lines · 95 tokens per session scan A 9bc63b7f066f
frontend-component-design is a skill published in the GitHub repository congwa/mobile-agent (44 stars, last pushed 6mo ago), licensed Apache-2.0. It adds 95 tokens to every session and 997 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
chakra-ui-builder
Build responsive, accessible UI components and layouts using Chakra UI v3, install or configure Chakra UI in new and existing projects, and design scalable themes using tokens, semantic tokens, recipes, and slot recipes. Use this skill whenever a user asks to build, create, or generate any UI component, page, form…
material-ui-tailwind
Integrates Material UI with Tailwind CSS v4 using cascade layers (enableCssLayer, @layer order) and documents Tailwind v3 interoperability (preflight, important, injectFirst, portals). Use when combining MUI with Tailwind utilities, slotProps className, or theme token bridges.
verify
Use when you want to validate changes before committing, or when you need to check all React contribution requirements.
fix
Use when you have lint errors, formatting issues, or before committing code to ensure it passes CI.
extract-errors
Use when adding new error messages to React, or seeing "unknown error code" warnings.
saas-builder
Clone, verify, map, and build on top of ixartz/SaaS-Boilerplate for a user's SaaS idea. Use when a user wants to reuse SaaS Boilerplate, evaluate how their product fits it, or build product-specific pages, database schema, roles, permissions, MVP features, and launch scope on top of the boilerplate.