Skill站外收录 @skilllib/skill-2014279414844960769
designer-skills
面向 AI 应用开发的浏览器端工作台,支持配置编辑、对话测试、数据集管理、RAG 设置与模型选择,基于 React 18 构建,集成 TanStack Query 管理服务状态、TailwindCSS 实现响应式样式、Radix UI 提供可访问组件,并通过 Vite 支持高效开发与测试。
软件开发 AI 技能
Skills.MD
# Designer Skills for LlamaFarm
Framework-specific patterns and checklists for the Designer subsystem (React 18 + TanStack Query + TailwindCSS + Radix UI).
## Overview
The Designer is a browser-based project workbench for building AI applications. It provides config editing, chat testing, dataset management, RAG configuration, and model selection.
## Tech Stack
| Technology | Version | Purpose |
|------------|---------|---------|
| React | 18.2 | UI framework with StrictMode |
| TypeScript | 5.2+ | Type safety |
| TanStack Query | v5 | Server state management |
| TailwindCSS | 3.3 | Utility-first CSS |
| Radix UI | 1.x | Accessible component primitives |
| Vite | 6.x | Build tooling and dev server |
| React Router | v7 | Client-side routing |
| Vitest | 1.x | Testing framework |
| axios | 1.x | HTTP client |
| framer-motion | 12.x | Animations |
## Directory Structure
```
designer/src/
api/ # API service modules (axios-based)
assets/ # Static assets and icons
components/ # Feature-organized React components
ui/ # Radix-based primitive components
contexts/ # React Context providers
hooks/ # Custom hooks (TanStack Query wrappers)
lib/ # Utilities (cn, etc.)
types/ # TypeScript type definitions
utils/ # Helper functions
test/ # Test utilities, factories, mocks
```
## Prerequisites: Shared Skills
Before applying Designer-specific patterns, ensure compliance with:
- [TypeScript Skills](../typescript-skills/SKILL.md) - Strict typing, patterns, security
- [React Skills](../react-skills/SKILL.md) - Component patterns, hooks, state management
## Framework-Specific Guides
| Guide | Description |
|-------|-------------|
| [tanstack-query.md](./tanstack-query.md) | Query/Mutation patterns, caching, invalidation |
| [tailwind.md](./tailwind.md) | TailwindCSS patterns, theming, responsive design |
| [radix.md](./radix.md) | Radix UI component patterns, accessibility |
| [performance.md](./performance.md) | Frontend optimizations, bundle size, lazy loading |
## Key Patterns
### API Client Configuration
```typescript
// Centralized client with interceptors
export const apiClient = axios.create({
baseURL: API_BASE_URL,
headers: { 'Content-Type': 'application/json' },
timeout: 60000,
})
// Error handling interceptor
apiClient.interceptors.response.use(
response => response,
(error: AxiosError) => {
if (error.response?.status === 422) {
throw new ValidationError('Validation error', error.response.data)
}
throw new NetworkError('Request failed', error)
}
)
```
### Query Client Configuration
```typescript
const queryClient = new QueryClient({
defaultOptions: {
queries: {
staleTime: 60_000,
gcTime: 5 * 60_000,
retry: 2,
retryDelay: attemptIndex => Math.min(1000 * 2 ** attemptIndex, 30_000),
refetchOnWindowFocus: false,
},
mutations: { retry: 1 },
},
})
```
### Class Merging Utility
```typescript
// lib/utils.ts - Always use cn() for Tailwind classes
import { clsx, type ClassValue } from 'clsx'
import { twMerge } from 'tailwind-merge'
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
```
### Theme Provider Pattern
```typescript
const ThemeContext = createContext<ThemeContextType | undefined>(undefined)
export function useTheme() {
const context = useContext(ThemeContext)
if (!context) throw new Error('useTheme must be used within ThemeProvider')
return context
}
// Apply via Tailwind dark mode class strategy
useEffect(() => {
document.documentElement.classList.toggle('dark', theme === 'dark')
}, [theme])
```
## Component Conventions
### Feature Components
- Located in `components/{Feature}/` directories
- One component per file, named after the component
- Co-located with feature-specific types and utilities
### UI Primitives
- Located in `components/ui/`
- Wrap Radix UI primitives with Tailwind styling
- Use `forwardRef` for ref forwarding
- Set `displayName` for DevTools
### Icons
- Located in `assets/icons/`
- Functional components accepting SVG props
- Use `lucide-react` for standard icons
## Testing
```typescript
// Use MSW for API mocking
import { server } from '@/test/mocks/server'
import { renderWithProviders } from '@/test/utils'
beforeAll(() => server.listen())
afterEach(() => server.resetHandlers())
afterAll(() => server.close())
test('renders with query data', async () => {
renderWithProviders(<MyComponent />)
await screen.findByText('Expected text')
})
```
## Checklist Summary
| Category | Critical | High | Medium | Low |
|----------|----------|------|--------|-----|
| TanStack Query | 3 | 4 | 3 | 2 |
| TailwindCSS | 2 | 3 | 4 | 2 |
| Radix UI | 3 | 3 | 2 | 1 |
| Performance | 2 | 4 | 3 | 2 |
评论 0
还没有评论,来抢沙发。
相关内容
同类或同场景的收录内容
building-with-kafka-strimzi
在 Kubernetes 上构建基于 Apache Kafka 的事件驱动系统,支持高可靠的消息传递、事务性处理与精确一次语义,结合 Strimzi 运营商实现集群自动化管理,利用 Schema Registry 保障事件模式演进,适用于微服务间解耦通信与实时数据流处理场景。
站外数据与分析
609 0.0
personal-tool-builder
专注于从个人真实痛点出发快速构建实用工具,涵盖命令行程序、本地优先应用和自动化脚本的开发与演进,强调先满足自身需求再逐步扩展,通过持续自用打磨功能,避免过度设计,确保工具简洁有效且长期可维护。
站外商业与营销
196 0.0
threejs-lighting
实现三维场景中的光照与阴影控制,支持多种光源类型及环境光照明,提供从基础布光到高级阴影优化的完整方案,适用于需要真实感渲染或性能平衡的可视化项目。
站外效率工具
442 0.0
aggregation-helper
提供数据聚合场景的自动化辅助能力,涵盖 SQL 查询编写、统计分析建模、可视化方案设计及商业智能配置,支持从需求理解到生产级代码生成的全流程指导。
站外效率工具数据与分析
217 0.0
举报「designer-skills」
举报信息仅审核团队可见,同一资产 24 小时内仅可举报一次