ARTICLE · INTELLIGENCE

战地情报 · 详情页

来自尧图项目组的一线实战观察与深度解析

Vibe Cording/AGENTS.md 协作规则说明书

Vibe Cording/AGENTS.md 协作规则说明书 AGENTS.md包含内容的原则是仅包含每次任务都须要的常驻约束和基本信息。例如・项目结构和关键目录・怎么运行项目・build、test、lint命令・工程约定・review预期・不要做什么・什么叫改完了初次定义的rules条数控制在约15条以内(全文60行)通常须包含 技术栈构建命令禁止行为主要的项目结构。而代码风格命名规范测试相关的可在某个问题常出现后再追加。参见AGENTS.md Best Practices: Template and Guide (2026)GitHub Flavored Markdown Spec前后端工程的各自包含内容以Vue为例的前端工程以SpringBoot为例的Java后端工程## 项目- 概览电商单页应用(SPA)通过无状态Token认证调用RESTful JSON API。遵循SoC原则。负责渲染视图层管理UI状态用户交互及展示格式处理。- 技术栈vue 3.4.30, vite 5.3.1, typescript 5.2.2, element-plus 2.8.7, pinia 2.2.2, vue-router 4.4.5, axios 1.7.7, sass 1.77.8, vee-validate 4.7.4, dayjs 1.11.13, echarts 5.5.1, eslint 8.57.1, prettier 3.3.3, fortawesome 6.6.0, vueuse 13.1.0, vue-i18n 9.14.1- 应用入口src/main.ts- 路由配置src/router/index.vue- API封装src/api/(基于axios.ts)## 项目- 概览基于AWS微服务的电商后台采用Lambda,API Gateway,S3,RESTful API和JPA构建。系统设计遵循SOLID原则具备松耦合高并发高性能及高可用性等特点。- 技术栈Java 17, Spring Boot 3.5, Spring Data JPA, Maven 3.9.6, Guava 33.6.0-jre, Logback 1.5.18, MySQL 8.4, MyBatis-Plus, Redis 8.6- 应用入口src/main/java/com/example/login.java- 接口层src/main/java/com/example/controller/- 业务层src/main/java/com/example/service及impl/- 实体层src/main/java/com/example/entity/## 目标- 以最小改动完成当前任务- 优先保证可读性、可验证性和边界清晰## 修改边界- 只修改与当前任务直接相关的文件- 不要顺带重构无关代码- 如果发现潜在问题先说明再决定是否处理## 沟通规则- 动手前先说明关键假设- 需求模糊时先确认- 如果有多种实现方案先给出权衡## 代码要求- 保持现有代码风格- 复杂逻辑加注释简单代码自解释即可。- 不要为了抽象而抽象## 依赖管理- 新增依赖前先确认是否已有类似功能的库- 优先使用项目已有技术栈内的方案## 验证要求- 改完后运行相关自动化测试- 如无相关测试用例则执行最小验证包括但不限于 构建/编译是否通过类型检查接口能否正常响应启动服务有无报错- 如果没有运行测试要明确说明原因- 回复里写清楚改了什么、怎么验证、还有什么风险下一步建议## 回滚策略- 修改导致功能损坏时优先回滚到上次可用状态- 不要在损坏状态上修修补补- 多文件改动是确保能独立撤销## 禁止事项- 不要修改无关文件- **不要使用破坏性命令**,包括但不限于含有 rm / delete / DROP / TRUNCATE / -f / --force 的命令执行前须停下来确认目标- 不要泄露密钥凭证或真实用户数据Java样例# Project - **Overview**: AWS-hosted microservices e-commerce backend build with Lambda, API Gateway, S3, Caching, RESTful APIs and JPA. Designed with loose coupling, high concurrency, performance and availability. following SOLID principles. - **Tech Stack**:Java 17, Spring Boot 3.5, Spring Data JPA, Maven 3.9.6, Guava 33.6.0-jre, Logback 1.5.18, MySQL 8.4, MyBatis-Plus, Redis 8.6 ## Build/test commands **Always use the Maven Wrapper (mvnw). Never use system-installed Maven.** - **Build**: ./mvnw clean package -DskipTests - **Test**: ./mvnw test - **Run locally**: ./mvnw spring-boot:run -Dspring-boot.run.profileslocal - **Format**: ./mvnw spotless:apply(Enforce pre-commit checks) ## Architecture - **Layered architecture**: Controller - Service(Interface/Impl) - Mapper - Entity. Use DTOs for requests and VOs for responses. Entities must never leak into the Controller layer. ## Boundaries - **Dependencies**: Strictly prohibit upgrading major versions or importing unapproved third-party dependecies. Prompt for approval before installing any new package. - **NO SECRETS**: Never hardcode credentials, API keys, or tokens. Use environment variables or reference application.yml. - **Security**: Comply with OWASP Top10 standards. Prevent such as SQL Injection, XSS and CSRF etc. - **Constants**: Avoid hardcoding business constants. Centralize all shared values in dedicated Constant classes. - **Validation**: Use Bean Validation(NotNULL,Size) on DTOs. No manual if-else checks for nulls or lengths. - **No business logic in Controllers**: Amount calculation, inventory validation, etc. All business logic must be delegated to the Service layer. ## Exceptions Logging - **Error Handling**: NEVER catch generic Exception for silent failure;empty cath blocks are forbidden. NEVER use e.printStackTrace(), ALWAYS log via Logger.error(Context, e). ## Git - Squash merge only. - **Comments**:Commit messages must follow Conventional Commits.feat(order):add cancel logic,fix(inventory):correct stock deduction. - **Branch Format**: type/short-description(e.g., feat/user-auth). --- *Note: Code style (Checkstyle) and specific naming conventions are enforced by CI. Focus on logic and architecture.*Vue样例#Project - **Overview**: E-commerce SPA: Consumes RESTful JSON APIs with stateless token auth. Strict SoC: Acts as a View-Modle layer. manages UI state, user interactions, and presentaion formatting only. - **Tech Stack**: vue 3.4.30, vite 5.3.1, typescript 5.2.2, element-plus 2.8.7, pinia 2.2.2, vue-router 4.4.5, axios 1.7.7, sass 1.77.8, vee-validate 4.7.4, dayjs 1.11.13, echarts 5.5.1, eslint 8.57.1, prettier 3.3.3, fortawesome 6.6.0, vueuse 13.1.0, vue-i18n 9.14.1 #Build/test commands
RELATED READING

延伸阅读

更多一线实战笔记与深度复盘,助您持续精进