Install any skill in seconds. Free to start, no credit card required.
Get Started Free →前端组件开发方法论,包括组件设计原则、状态管理、样式实现和性能优化
.claude/skills/echovic-frontend-component-development/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 25% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 2% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 2% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 27% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 53% | 0% |
| 状态类型 | 管理方式 | 适用场景 | |----------|----------|----------| | 本地状态 | useState/ref | 组件内部状态(表单输入、展开/收起) | | 共享状态 | Context/Store | 跨组件共享(用户信息、主题) | | 服务端状态 | Query库/SWR | API 数据缓存和同步 | | URL 状态 | Router | 页面参数、筛选条件 |
ui-design.json > ui-spec.md > 项目现有样式 > 框架默认值当 .boss/<feature>/ui-design.json 存在时:
typescript // 示例:从 tokens 生成 CSS 变量 const colors = uiDesign.tokens.colors; // --color-primary: #007AFF
pages[].frames[] 提取页面组件层级frames[].layout 获取布局约束(宽度、间距、对齐)components[] 识别通用组件(Button、Input、Card)实现前端 API 调用前,必须阅读:
typescript// services/api/users.ts export const userApi = { async getUser(id: string): Promise<User> { const response = await fetch(`/api/users/${id}`); return response.json(); }, async createUser(data: CreateUserRequest): Promise<User> { const response = await fetch('/api/users', { method: 'POST', body: JSON.stringify(data), }); return response.json(); }, };
后端未就绪时,基于 architecture.md §5 创建 Mock:
typescript// services/api/users.mock.ts export const mockUserApi = { async getUser(id: string): Promise<User> { return { id, name: 'Mock User', email: 'mock@example.com' }; }, };
| 测试类型 | 占比 | 工具示例 | |----------|------|----------| | 单元测试 | 70% | Jest + Testing Library | | 集成测试 | 20% | Testing Library | | E2E 测试 | 10% | Playwright/Cypress |
实现组件前:
实现组件后:
Other measured skills in the registry, with their headline benchmark lift.