trae-project-setup

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Trae Project Setup

Trae Project Setup

本 Skill 用于快速生成 Trae 项目所需的规范化配置文件,帮助项目实现标准化开发流程。
This Skill is used to quickly generate standardized configuration files required for Trae projects, helping projects implement standardized development processes.

Trae 配置体系概述

Overview of Trae Configuration System

Trae 通过
.trae
目录管理项目配置,支持以下核心文件:
文件路径用途优先级
.trae/USER_PREFERENCES.md
用户偏好设置(语言、技术栈、交互风格)最高
.trae/rules/project_rules.md
项目特定规则(lint、typecheck、构建命令)
.trae/Skills/
自定义 Skill 目录
Trae manages project configurations through the
.trae
directory and supports the following core files:
File PathPurposePriority
.trae/USER_PREFERENCES.md
User preference settings (language, tech stack, interaction style)Highest
.trae/rules/project_rules.md
Project-specific rules (lint, typecheck, build commands)High
.trae/Skills/
Custom Skill directoryMedium

快速开始

Quick Start

初始化项目配置

Initialize Project Configuration

运行初始化脚本,自动创建完整的
.trae
目录结构:
bash
python scripts/init_trae_project.py --path /path/to/project
脚本会自动创建:
  • .trae/USER_PREFERENCES.md
    - 用户偏好模板
  • .trae/rules/project_rules.md
    - 项目规则模板
  • .trae/Skills/
    - Skill 存放目录
Run the initialization script to automatically create the complete
.trae
directory structure:
bash
python scripts/init_trae_project.py --path /path/to/project
The script will automatically create:
  • .trae/USER_PREFERENCES.md
    - User preference template
  • .trae/rules/project_rules.md
    - Project rule template
  • .trae/Skills/
    - Skill storage directory

验证项目配置

Verify Project Configuration

验证现有配置是否符合规范:
bash
python scripts/validate_trae_project.py --path /path/to/project
Verify whether the existing configuration conforms to the specifications:
bash
python scripts/validate_trae_project.py --path /path/to/project

核心配置文件详解

Detailed Explanation of Core Configuration Files

USER_PREFERENCES.md

USER_PREFERENCES.md

用户偏好文件,定义全局行为模式。Trae 会在所有操作中优先遵循此文件的设置。
关键配置项:
markdown
undefined
User preference file that defines global behavior patterns. Trae will prioritize the settings in this file in all operations.
Key configuration items:
markdown
undefined

User Preferences

User Preferences

1. 技术栈偏好 (Tech Stack)

1. 技术栈偏好 (Tech Stack)

  • CSS Framework: Tailwind CSS
  • State Management: Zustand (React), Riverpod (Flutter)
  • Testing: Vitest
  • Language: TypeScript (Strict Mode)
  • CSS Framework: Tailwind CSS
  • State Management: Zustand (React), Riverpod (Flutter)
  • Testing: Vitest
  • Language: TypeScript (Strict Mode)

2. 交互风格 (Communication Style)

2. 交互风格 (Communication Style)

  • Language: 中文回复,技术术语保留英文
  • Detail Level: 资深开发者模式,直接给代码
  • Emoji: 禁用
  • Language: 中文回复,技术术语保留英文
  • Detail Level: 资深开发者模式,直接给代码
  • Emoji: 禁用

3. 角色覆盖 (Role Overrides)

3. 角色覆盖 (Role Overrides)

  • @Backend Developer: 优先使用 FastAPI
  • @Backend Developer: 优先使用 FastAPI

4. 禁令 (Constraints)

4. 禁令 (Constraints)

  • 严禁使用
    any
    类型
  • 严禁创建
    .env
    文件
undefined
  • 严禁使用
    any
    类型
  • 严禁创建
    .env
    文件
undefined

project_rules.md

project_rules.md

项目规则文件,定义项目特定的开发规范。
关键配置项:
markdown
undefined
Project rule file that defines project-specific development specifications.
Key configuration items:
markdown
undefined

Project Rules

Project Rules

构建与验证命令

构建与验证命令

  • Lint: npm run lint
  • TypeCheck: npm run typecheck
  • Test: npm run test
  • Build: npm run build
  • Lint: npm run lint
  • TypeCheck: npm run typecheck
  • Test: npm run test
  • Build: npm run build

代码规范

代码规范

  • 函数注释: 必须添加函数级注释
  • 语言: 中文注释,外链库需在中国可用
  • 函数注释: 必须添加函数级注释
  • 语言: 中文注释,外链库需在中国可用

Git 规范

Git 规范

  • Commit: 遵循 Conventional Commits
  • Branch: feature/, fix/, docs/*
undefined
  • Commit: 遵循 Conventional Commits
  • Branch: feature/, fix/, docs/*
undefined

创建新 Skill

Create New Skill

使用初始化脚本

Use Initialization Script

bash
python scripts/init_trae_skill.py <skill-name> --path .trae/Skills
bash
python scripts/init_trae_skill.py <skill-name> --path .trae/Skills

Skill 目录结构

Skill Directory Structure

skill-name/
├── SKILL.md          # 必需:Skill 主文件
├── scripts/          # 可选:可执行脚本
├── references/       # 可选:参考文档
├── assets/           # 可选:资源文件
└── AGENTS.md         # 可选:Agent 定义
skill-name/
├── SKILL.md          # 必需:Skill 主文件
├── scripts/          # 可选:可执行脚本
├── references/       # 可选:参考文档
├── assets/           # 可选:资源文件
└── AGENTS.md         # 可选:Agent 定义

SKILL.md 格式

SKILL.md Format

markdown
---
name: skill-name
description: Skill 描述,包含触发条件和使用场景
---
markdown
---
name: skill-name
description: Skill 描述,包含触发条件和使用场景
---

Skill Title

Skill Title

Overview

Overview

简要说明 Skill 功能
简要说明 Skill 功能

Workflow

Workflow

  1. 步骤一
  2. 步骤二
undefined
  1. 步骤一
  2. 步骤二
undefined

AGENTS.md 格式

AGENTS.md Format

markdown
---
name: agent-name
description: Agent 描述
---
markdown
---
name: agent-name
description: Agent 描述
---

Agent Title

Agent Title

角色定义

角色定义

  • 专长: 描述专业领域
  • 风格: 描述工作风格
  • 专长: 描述专业领域
  • 风格: 描述工作风格

工作流程

工作流程

  1. 步骤一
  2. 步骤二
undefined
  1. 步骤一
  2. 步骤二
undefined

模板文件

Template Files

完整的模板文件存放在
templates/
目录:
  • USER_PREFERENCES.md.template
    - 用户偏好模板
  • project_rules.md.template
    - 项目规则模板
  • SKILL.md.template
    - Skill 模板
  • AGENTS.md.template
    - Agent 模板
The complete template files are stored in the
templates/
directory:
  • USER_PREFERENCES.md.template
    - User preference template
  • project_rules.md.template
    - Project rule template
  • SKILL.md.template
    - Skill template
  • AGENTS.md.template
    - Agent template

参考文档

Reference Documents

详细规范请参阅:
  • Trae 配置规范
  • Skill 开发指南
For detailed specifications, please refer to:
  • Trae Configuration Specification
  • Skill Development Guide