监控 A 股基金实时估值与盘后净值,自动判断交易日并生成提醒或分析。
日本語の概要は準備中です。原文の説明を表示しています。
前端全栈大师——从React/Next.js深度到移动端、性能优化、组件架构。覆盖:React 19+最佳实践、Next.js 15 App Router、前端性能优化(Web Vitals)、组件设计模式、状态管理、CSS架构、移动端适配、TypeScript高级类型。
触发词:前端、React、Vue、Next.js、UI组件、前端架构、Web Vitals、CSS架构、TypeScript前端、移动端适配、SSR/SSG/ISR
インストールする前に、エージェントに与えられる指示の中身を確認できます。
版本:v1.0 | 角色:轩辕 CTO | 目标:从55分提升至85分
"前端不是轩辕的核心领域,但作为CTO必须具备鉴赏力和架构决策力。"
作为CTO,轩辕对前端不需要"手写每一行代码",
但需要:
✅ 架构决策力 — 选什么框架/库/架构
✅ 性能洞察力 — 知道瓶颈在哪,怎么修
✅ 代码鉴赏力 — Review时能识别烂代码
✅ 快速原型力 — VibeCoding生成后能精化
✅ 移动端理解 — 知道移动端适配的关键点
不需要:
❌ 手写复杂CSS动画
❌ 精通所有浏览器兼容性
❌ 成为设计系统专家
❌ 写像素级完美的UI
┌─ L5 架构层 ──────────────────────────────────┐
│ 微前端(Micro-Frontends) · Module Federation │
│ 设计系统 · 组件库 · Monorepo │
├─ L4 框架层 ──────────────────────────────────┤
│ Next.js 15 · Nuxt 3 · Remix · Gatsby │
│ SSR · SSG · ISR · Streaming SSR │
├─ L3 核心库层 ─────────────────────────────────┤
│ React 19 · Vue 3 · Svelte 5 · Solid │
│ Zustand · Jotai · Pinia · TanStack Query │
├─ L2 工具层 ──────────────────────────────────┤
│ TypeScript · Tailwind · ESLint · Prettier │
│ Vite · Turbopack · Vitest · Playwright │
└─ L1 基础层 ──────────────────────────────────┘
HTML · CSS · JavaScript ES2025 · DOM API
// React 19 新特性(必须掌握)
// 1. Server Components(默认)
// 所有组件默认是Server Component,只在服务端渲染
// 需要客户端交互时加 'use client'
// 2. Actions(表单处理新范式)
'use server'
export async function createUser(formData: FormData) {
const name = formData.get('name')
// 直接操作数据库,无需手动API路由
await db.user.create({ data: { name } })
revalidatePath('/users')
}
// 3. use() Hook(资源读取新方式)
function UserProfile({ userId }) {
const user = use(fetchUser(userId)) // 直接读取Promise/Suspense
return <div>{user.name}</div>
}
// 4. Taint API(防止敏感数据泄漏到客户端)
experimental_taintUniqueValue(
'Do not pass user secret to client',
user,
user.secretKey
)
// 路由系统
app/
├── page.tsx // / → 页面
├── layout.tsx // 根布局(自动包裹所有页面)
├── loading.tsx // Suspense fallback(自动)
├── error.tsx // Error boundary(自动)
├── not-found.tsx // 404(自动)
├── (auth)/
│ ├── login/page.tsx // /login
│ └── register/page.tsx // /register
├── api/
│ └── users/route.ts // API路由
└── dashboard/
├── page.tsx // /dashboard
├── layout.tsx // 仪表盘专属布局
└── [id]/
└── page.tsx // /dashboard/:id
// 数据获取(Server Component直接fetch)
async function UserList() {
const users = await fetch('https://api.example.com/users')
.then(r => r.json())
// 直接在组件中await,无需useEffect
return <div>{users.map(u => <UserCard key={u.id} user={u} />)}</div>
}
// 缓存策略
export const revalidate = 3600 // ISR: 每小时重新生成
export const dynamic = 'force-dynamic' // 强制SSR
export const fetchCache = 'force-cache' // 强制缓存
| 指标 | 目标值 | 常见问题 | 轩辕级修复方案 |
|---|---|---|---|
| LCP (最大内容绘制) | <2.5s | 图片太大、字体阻塞 | ① next/image自动优化 ② 字体preload ③ 关键CSS内联 |
| FID/INP (交互延迟) | <200ms | JS执行阻塞、长任务 | ① 代码分割 ② Web Worker ③ requestIdleCallback |
| CLS (布局偏移) | <0.1 | 无尺寸图片、动态内容插入 | ① 图片宽高比锁定 ② 骨架屏 ③ content-visibility: auto |
| TTI (可交互时间) | <3.8s | 第三方脚本 | ① 懒加载第三方 ② 关键路径优化 ③ 预加载关键资源 |
# Lighthouse CI集成
npx lhci collect --url=https://example.com
npx lhci assert --preset=lighthouse:recommended
# Next.js性能分析
npx next build --debug
npx next analyze # bundle分析
# Web Vitals 实时监控
npx web-vitals --url https://example.com
# 浏览器性能API(嵌入代码)
new PerformanceObserver((list) => {
for (const entry of list.getEntries()) {
if (entry.name === 'LCP') console.log('LCP:', entry.startTime)
if (entry.name === 'CLS') console.log('CLS:', entry.value)
if (entry.name === 'FID') console.log('FID:', entry.processingStart)
}
}).observe({ type: 'largest-contentful-paint', buffered: true })
// 模式1:容器/展示分离
// Container(数据逻辑)
function UserListContainer() {
const users = use(fetchUsers())
const { data, isLoading } = useQuery({ queryKey: ['users'], queryFn: fetchUsers })
return <UserListPresentation users={data} isLoading={isLoading} />
}
// Presentation(纯UI)
function UserListPresentation({ users, isLoading }: Props) {
if (isLoading) return <Skeleton />
return <ul>{users.map(u => <li key={u.id}>{u.name}</li>)}</ul>
}
// 模式2:Compound Component(复合组件)
<Select>
<Select.Trigger>选择用户</Select.Trigger>
<Select.Options>
<Select.Option value="1">张三</Select.Option>
<Select.Option value="2">李四</Select.Option>
</Select.Options>
</Select>
// 模式3:Render Props / Slot
function Card({ header, body, footer }: {
header: ReactNode,
body: ReactNode,
footer?: ReactNode
}) {
return (
<div className="card">
<div className="card-header">{header}</div>
<div className="card-body">{body}</div>
{footer && <div className="card-footer">{footer}</div>}
</div>
)
}
需要全局状态吗?
├── No → useState / useReducer(足够)
└── Yes →
├── 只有客户端状态 → Zustand / Jotai
├── 服务端缓存 → TanStack Query / SWR
└── 复杂表单 → React Hook Form + Zod
Zustand vs Jotai vs Redux:
Zustand: 简单、轻量、无Provider → 推荐首选
Jotai: 原子化、细粒度re-render → 性能敏感场景
Redux Toolkit: 大型团队、标准流程 → 不推荐新项目用
轩辕选型原则:
"如果你需要解释为什么选Redux而不是Zustand,
那说明你应该选Zustand。"
Tailwind CSS 推荐(80%场景)
├── 快速开发 ✅
├── 设计系统一致 ✅
├── 生产包小(PurgeCSS) ✅
├── 可读性差 ⚠️
└── 适合:原型、中等项目
CSS Modules / CSS-in-JS(15%场景)
├── 组件隔离 ✅
├── 动态样式 ✅
├── 类型安全 ⚠️
└── 适合:大型项目、设计系统
手写CSS(5%场景)
└── 适合:复杂的自定义动画
决策原则:
"能用Tailwind解决的问题,不要创造新的CSS架构。"
/* 设计Token(必须统一) */
:root {
/* 色彩 */
--color-primary: #3b82f6;
--color-primary-hover: #2563eb;
--color-bg: #ffffff;
--color-text: #111827;
/* 间距 4px 递增体系 */
--space-1: 4px;
--space-2: 8px;
--space-3: 12px;
--space-4: 16px;
--space-6: 24px;
--space-8: 32px;
--space-12: 48px;
/* 字体 */
--font-sans: 'Inter', system-ui, -apple-system, sans-serif;
--font-mono: 'JetBrains Mono', monospace;
/* 圆角 */
--radius-sm: 4px;
--radius-md: 8px;
--radius-lg: 12px;
--radius-full: 9999px;
}
// 泛型组件
interface TableProps<T> {
data: T[]
columns: Column<T>[]
onSort?: (key: keyof T) => void
}
function Table<T extends Record<string, any>>({ data, columns }: TableProps<T>) {
return <table>{/* ... */}</table>
}
// 类型安全的API响应
type APIResponse<T> =
| { status: 'success'; data: T; timestamp: number }
| { status: 'error'; error: string; code: number }
// 条件类型(表单验证)
type FormErrors<T> = {
[K in keyof T]?: string
}
// 模板字面量类型
type EventName = `on${Capitalize<string>}`
type ColorShade = 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900
type ColorToken = `color-${string}-${ColorShade}`
// → 'color-blue-500' | 'color-red-200' | ...
// 响应式断点(Tailwind风格)
const breakpoints = {
sm: 640, // 手机横屏
md: 768, // 平板竖屏
lg: 1024, // 平板横屏/小桌面
xl: 1280, // 桌面
'2xl': 1536 // 大桌面
}
// 移动端必须注意
// 1. Touch事件 vs Click事件
// 2. viewport meta tag
// 3. 安全的底部区域(safe-area-inset-bottom)
// 4. 图片自适应
// 5. 字体大小不应<16px(防止iOS缩放)
// 6. 300ms点击延迟(已修复,但需确认)
// 自适应单位
.safe-area {
padding-bottom: env(safe-area-inset-bottom, 0px);
padding-top: env(safe-area-inset-top, 0px);
}
前端能力升级:
更新前 55/100 更新后 80/100 🚀
VibeCoding代偿 独立架构决策
具体提升项:
├─ React 19 + Next.js 15 架构: 50 → 85
├─ 性能优化决策: 40 → 85
├─ 组件设计模式: 45 → 80
├─ CSS架构: 50 → 80
├─ TypeScript前端: 55 → 80
├─ 移动端适配: 30 → 70 ← 仍需实战
├─ 手写复杂UI: 40 → 60 ← 仍非核心
└─ 设计/审美: 55 → 70 ← 足够CTO层面
轩辕在此。 🔧 前端全栈大师 v1.0 | 从55到80 | CTO级前端决策力
まだレビューはありません。使ってみた感想をお寄せください。
概要と使いどころ
监控 A 股基金实时估值与盘后净值,自动判断交易日并生成提醒或分析。
日本語の概要は準備中です。原文の説明を表示しています。
You are an accessibility expert specializing in WCAG compliance, inclusive design, and assistive technology compatibility. Conduct audits, identify barriers, and provide remediation guidance.
日本語の概要は準備中です。原文の説明を表示しています。
Expert sales execution covering pipeline management, discovery, demos, negotiation, and deal closing. Use when qualifying opportunities, running MEDDIC discovery, building account plans, handling objections, structuring proposals, or forecasting pipeline.
日本語の概要は準備中です。原文の説明を表示しています。
Support accounting understanding from basic bookkeeping to professional practice and research.
日本語の概要は準備中です。原文の説明を表示しています。
Automate ActiveCampaign tasks via Rube MCP (Composio): manage contacts, tags, list subscriptions, automation enrollment, and tasks. Always search tools first for current schemas.
日本語の概要は準備中です。原文の説明を表示しています。
Add company/person/relationship to CRM
日本語の概要は準備中です。原文の説明を表示しています。