frontend-dev
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseFrontend Development Agent
前端开发Agent
Use when creating or modifying Next.js pages, React components, Tailwind CSS styles, API integration, hooks, or i18n.
在创建或修改Next.js页面、React组件、Tailwind CSS样式、API集成、hooks或i18n时使用。
Before Writing Code
编写代码前的准备
- Read for user flow
docs/agent/architecture/frontend-workflow.md - Read for Swiss International Style (REQUIRED)
docs/agent/design/style-guide.md - Read for conventions
docs/agent/coding-standards.md - Check existing components in for patterns
apps/frontend/components/
- 阅读了解用户流程
docs/agent/architecture/frontend-workflow.md - 阅读遵循瑞士国际风格(必须遵守)
docs/agent/design/style-guide.md - 阅读了解编码规范
docs/agent/coding-standards.md - 查看中的现有组件,参考已有模式
apps/frontend/components/
Non-Negotiable Rules
不可协商的规则
- Swiss International Style - ALL UI changes must follow it
- everywhere - no rounded corners, ever
rounded-none - Hard shadows - , never soft shadows
shadow-[4px_4px_0px_0px_#000000] - Run before committing
npm run lint - Run before committing
npm run format - Enter key handling on all textareas
- 瑞士国际风格 - 所有UI变更必须遵循该风格
- 全局使用- 绝对不能有圆角
rounded-none - 硬阴影 - 使用,禁止使用软阴影
shadow-[4px_4px_0px_0px_#000000] - 提交前运行
npm run lint - 提交前运行
npm run format - 所有文本区域需处理回车键事件
Project Structure
项目结构
apps/frontend/
├── app/ # Next.js pages
│ ├── dashboard/ # Main dashboard
│ ├── builder/ # Resume builder
│ ├── tailor/ # AI tailoring
│ ├── print/ # PDF print view
│ └── settings/ # User settings
├── components/ # Reusable UI components
├── lib/ # API client, utilities, i18n
├── hooks/ # Custom React hooks
└── messages/ # i18n translations (en, es, zh, ja)apps/frontend/
├── app/ # Next.js页面
│ ├── dashboard/ # 主控制面板
│ ├── builder/ # 简历生成器
│ ├── tailor/ # AI定制模块
│ ├── print/ # PDF打印视图
│ └── settings/ # 用户设置
├── components/ # 可复用UI组件
├── lib/ # API客户端、工具函数、i18n
├── hooks/ # 自定义React hooks
└── messages/ # i18n翻译文件(en, es, zh, ja)Swiss International Style Quick Reference
瑞士国际风格速查
| Element | Value |
|---|---|
| Canvas bg | |
| Ink text | |
| Hyper Blue | |
| Signal Green | |
| Alert Red | |
| Headers | |
| Body | |
| Labels | |
| Borders | |
| Shadows | |
| Hover | |
| 元素 | 值 |
|---|---|
| 画布背景 | |
| 文本颜色 | |
| 链接蓝色 | |
| 提示绿色 | |
| 警告红色 | |
| 标题字体 | |
| 正文字体 | |
| 标签字体 | |
| 边框 | |
| 阴影 | |
| 悬停效果 | |
Anti-Patterns (NEVER use)
反模式(绝对禁止)
- (except
rounded-*)rounded-none - Gradients or blur shadows
- Colors outside the palette
- Pastel or soft colors
- Decorative icons without function
- 使用(
rounded-*除外)rounded-none - 渐变或模糊阴影
- 调色板外的颜色
- 淡色或柔和色调
- 无功能的装饰性图标
Patterns
代码模式示例
New Component
新组件
tsx
'use client';
interface MyComponentProps {
title: string;
onAction: () => void;
}
export function MyComponent({ title, onAction }: MyComponentProps) {
return (
<div className="bg-white border-2 border-black shadow-[4px_4px_0px_0px_#000000] p-6">
<h3 className="font-serif text-xl mb-4">{title}</h3>
<button
onClick={onAction}
className="rounded-none border-2 border-black px-4 py-2 bg-blue-700 text-white shadow-[2px_2px_0px_0px_#000000] hover:translate-y-[1px] hover:translate-x-[1px] hover:shadow-none transition-all"
>
Action
</button>
</div>
);
}tsx
'use client';
interface MyComponentProps {
title: string;
onAction: () => void;
}
export function MyComponent({ title, onAction }: MyComponentProps) {
return (
<div className="bg-white border-2 border-black shadow-[4px_4px_0px_0px_#000000] p-6">
<h3 className="font-serif text-xl mb-4">{title}</h3>
<button
onClick={onAction}
className="rounded-none border-2 border-black px-4 py-2 bg-blue-700 text-white shadow-[2px_2px_0px_0px_#000000] hover:translate-y-[1px] hover:translate-x-[1px] hover:shadow-none transition-all"
>
执行操作
</button>
</div>
);
}Textarea (Enter key fix)
文本区域(回车键修复)
tsx
const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
if (e.key === 'Enter') e.stopPropagation();
};
<textarea
onKeyDown={handleKeyDown}
className="w-full rounded-none border-2 border-black p-3 font-sans"
/>tsx
const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
if (e.key === 'Enter') e.stopPropagation();
};
<textarea
onKeyDown={handleKeyDown}
className="w-full rounded-none border-2 border-black p-3 font-sans"
/>Bundle Optimization
包体积优化
tsx
// Direct icon import (NOT barrel import)
import FileText from 'lucide-react/dist/esm/icons/file-text';
// Dynamic import for heavy components
import dynamic from 'next/dynamic';
const PDFViewer = dynamic(() => import('./PDFViewer'), { ssr: false });tsx
// 直接导入图标(禁止桶导入)
import FileText from 'lucide-react/dist/esm/icons/file-text';
// 动态导入大型组件
import dynamic from 'next/dynamic';
const PDFViewer = dynamic(() => import('./PDFViewer'), { ssr: false });API Integration
API集成
tsx
import { api } from '@/lib/api';
async function loadResumes() {
// Use Promise.all for independent fetches
const [resumes, jobs] = await Promise.all([
api.get('/api/v1/resumes'),
api.get('/api/v1/jobs'),
]);
return { resumes, jobs };
}tsx
import { api } from '@/lib/api';
async function loadResumes() {
// 对独立请求使用Promise.all
const [resumes, jobs] = await Promise.all([
api.get('/api/v1/resumes'),
api.get('/api/v1/jobs'),
]);
return { resumes, jobs };
}i18n
i18n国际化
tsx
import { useTranslations } from '@/lib/i18n';
export function MyComponent() {
const { t } = useTranslations();
return <h1>{t('dashboard.title')}</h1>;
}tsx
import { useTranslations } from '@/lib/i18n';
export function MyComponent() {
const { t } = useTranslations();
return <h1>{t('dashboard.title')}</h1>;
}Checklist Before Committing
提交前检查清单
- passes
npm run lint - run
npm run format - on all elements
rounded-none - Hard shadows (no soft shadows)
- Swiss color palette only
- Correct typography (serif headers, mono labels, sans body)
- Textareas have Enter key handler
- Icons imported directly (not barrel)
- Heavy components use
next/dynamic - Independent fetches use
Promise.all()
- 检查通过
npm run lint - 已运行格式化代码
npm run format - 所有元素都使用了
rounded-none - 使用硬阴影(无软阴影)
- 仅使用瑞士风格调色板
- 排版正确(标题用衬线字体、标签用等宽字体、正文用无衬线字体)
- 文本区域已添加回车键处理
- 图标采用直接导入(非桶导入)
- 大型组件使用动态导入
next/dynamic - 独立请求使用
Promise.all()