docs: 完成所有文档的中文翻译并应用到项目

This commit is contained in:
xuxiang
2026-01-28 00:12:54 +08:00
parent 0ced59a26b
commit e133f58e1c
76 changed files with 6808 additions and 6170 deletions

View File

@@ -1,58 +1,58 @@
# Example Project CLAUDE.md
# 项目示例 CLAUDE.md
This is an example project-level CLAUDE.md file. Place this in your project root.
这是一个项目级 CLAUDE.md 文件的示例。请将其放置在项目根目录下。
## Project Overview
## 项目概览
[Brief description of your project - what it does, tech stack]
[简要描述您的项目 - 功能、技术栈]
## Critical Rules
## 核心规则
### 1. Code Organization
### 1. 代码组织
- Many small files over few large files
- High cohesion, low coupling
- 200-400 lines typical, 800 max per file
- Organize by feature/domain, not by type
- 倾向于使用多个小文件,而非少数大文件
- 高内聚,低耦合
- 通常为 200-400 行,单文件最大不超过 800 行
- 按功能/领域Feature/Domain)组织,而非按类型组织
### 2. Code Style
### 2. 代码风格
- No emojis in code, comments, or documentation
- Immutability always - never mutate objects or arrays
- No console.log in production code
- Proper error handling with try/catch
- Input validation with Zod or similar
- 代码、注释或文档中不得使用表情符号Emoji
- 始终坚持不可变性(Immutability - 严禁直接修改对象或数组
- 生产代码中严禁使用 `console.log`
- 使用 try/catch 进行妥善的错误处理
- 使用 Zod 或类似工具进行输入验证
### 3. Testing
### 3. 测试
- TDD: Write tests first
- 80% minimum coverage
- Unit tests for utilities
- Integration tests for APIs
- E2E tests for critical flows
- 测试驱动开发TDD先写测试
- 最低 80% 的覆盖率
- 为工具函数编写单元测试
- 为 API 编写集成测试
- 为核心流程编写端到端E2E测试
### 4. Security
### 4. 安全
- No hardcoded secrets
- Environment variables for sensitive data
- Validate all user inputs
- Parameterized queries only
- CSRF protection enabled
- 严禁硬编码秘钥Secrets
- 敏感数据使用环境变量
- 验证所有用户输入
- 仅使用参数化查询(Parameterized queries
- 启用跨站请求伪造CSRF防护
## File Structure
## 文件结构
```
src/
|-- app/ # Next.js app router
|-- components/ # Reusable UI components
|-- hooks/ # Custom React hooks
|-- lib/ # Utility libraries
|-- types/ # TypeScript definitions
|-- app/ # Next.js 应用路由
|-- components/ # 可复用的 UI 组件
|-- hooks/ # 自定义 React hooks
|-- lib/ # 工具库
|-- types/ # TypeScript 定义
```
## Key Patterns
## 关键模式
### API Response Format
### API 响应格式
```typescript
interface ApiResponse<T> {
@@ -62,39 +62,39 @@ interface ApiResponse<T> {
}
```
### Error Handling
### 错误处理
```typescript
try {
const result = await operation()
return { success: true, data: result }
} catch (error) {
console.error('Operation failed:', error)
return { success: false, error: 'User-friendly message' }
console.error('操作失败:', error)
return { success: false, error: '用户友好提示信息' }
}
```
## Environment Variables
## 环境变量
```bash
# Required
# 必填
DATABASE_URL=
API_KEY=
# Optional
# 选填
DEBUG=false
```
## Available Commands
## 可用命令
- `/tdd` - Test-driven development workflow
- `/plan` - Create implementation plan
- `/code-review` - Review code quality
- `/build-fix` - Fix build errors
- `/tdd` - 测试驱动开发TDD工作流
- `/plan` - 创建实现方案
- `/code-review` - 代码质量评审
- `/build-fix` - 修复构建错误
## Git Workflow
## Git 工作流
- Conventional commits: `feat:`, `fix:`, `refactor:`, `docs:`, `test:`
- Never commit to main directly
- PRs require review
- All tests must pass before merge
- 约定式提交(Conventional commits`feat:`, `fix:`, `refactor:`, `docs:`, `test:`
- 严禁直接提交到 main 分支
- 合并请求PRs必须经过评审
- 所有测试必须通过后方可合并