Files
xiaowang 46e724334c docs: 建立项目级 Agent Skills 体系与开发规范
- AGENTS.md 扩充:项目概述、技术栈版本、架构、目录/数据库/API/开发验证/安全规范
- .agents/skills 新增 5 个项目技能:jayu-domain、jayu-database、jayu-api、jayu-devflow、jayu-release
- docs/agent 新增 4 份文档:PROJECT_CONTEXT、PROJECT_CONSTRAINTS、SKILLS_CATALOG、AGENT_SKILLS_GUIDE
- .gitignore 收窄 .agents 忽略规则,保留镜像忽略意图、纳入项目技能版本管理
2026-11-06 10:34:40 +08:00

14 KiB
Raw Permalink Blame History

GitNexus — Code Intelligence

This project is indexed by GitNexus as JayuCloud (36096 symbols, 76216 relationships, 1267 execution flows).

Index stale? Run node .gitnexus/run.cjs analyze --index-only from the project root — it auto-selects an available runner. No .gitnexus/run.cjs yet? Bootstrap with npx, bunx, or pnpm dlx — e.g. bunx gitnexus@latest analyze (npm 11 npx crash; #1939).

Always Do

  • MUST run impact before editing. Use impact({target: "symbolName", direction: "upstream"}) or node .gitnexus/run.cjs impact "symbolName" --direction upstream --repo .; report callers, processes, and risk. Never substitute grep for graph analysis.
  • MUST analyze graph changes before committing. Use detect_changes({scope: "all"}) (MCP) or node .gitnexus/run.cjs detect-changes --scope all --repo . (CLI fallback). partial: true or truncated: true is not a clean check — a zero means unseen, not unaffected; re-run it. For regression review: detect_changes({scope: "compare", base_ref: "prod"}) or node .gitnexus/run.cjs detect-changes --scope compare --base-ref "prod" --repo ..
  • MUST warn on HIGH/CRITICAL risk pre-edit; never use riskSharedAxes to waive a HIGH/CRITICAL risk warning. Compare File/symbol: MCP File omits axes; Graph-RAG expands File.
  • MUST treat risk: UNKNOWN as unresolved, not as low. An empty caller set is not evidence the symbol is unused — it can also mean the callers are not resolvable by the index (plain-object property access, dynamic dispatch, cross-language calls). impact pairs UNKNOWN with a riskNote saying so. Confirm with a text search before treating the symbol as safe to change or delete; do not proceed on the strength of a zero.
  • MUST use query({search_query: "concept"}) for concepts/flows, context({name: "symbolName"}) for a named symbol, or impact for blast radius, on read-only callers, dependencies, imports, or execution flow. Graph first; text search only for empty/UNKNOWN/literals.
  • For security review, explain({target: "fileOrSymbol"}) lists taint findings (source→sink flows; needs analyze --pdg).

Never Do

  • NEVER edit a function, class, or method before MCP/CLI impact analysis.
  • NEVER ignore HIGH or CRITICAL risk warnings from impact analysis, and never read UNKNOWN as an all-clear — it means the walk could not answer, which is the one verdict that requires confirming by other means.
  • NEVER rename symbols with find-and-replace — use rename which understands the call graph.
  • NEVER commit before MCP/CLI graph change analysis.

Resources

Resource Use for
gitnexus://repo/JayuCloud/context Codebase overview, check index freshness
gitnexus://repo/JayuCloud/clusters All functional areas
gitnexus://repo/JayuCloud/processes All execution flows
gitnexus://repo/JayuCloud/process/{name} Step-by-step execution trace

CLI

Task Read this skill file
Understand architecture / "How does X work?" .claude/skills/gitnexus-exploring/SKILL.md
Blast radius / "What breaks if I change X?" .claude/skills/gitnexus-impact-analysis/SKILL.md
Trace bugs / "Why is X failing?" .claude/skills/gitnexus-debugging/SKILL.md
Rename / extract / split / refactor .claude/skills/gitnexus-refactoring/SKILL.md
Tools, resources, schema reference .claude/skills/gitnexus-guide/SKILL.md
Index, status, clean, wiki CLI commands .claude/skills/gitnexus-cli/SKILL.md

Project Workflow Rules

  • 用户未明确要求设计文档或方案确认时,实施类请求直接基于现有代码修改,不额外编写设计文档,也不以设计确认流程阻塞实现。
  • 修改前如工作区已有未提交改动,先创建中文 Git 回溯提交,再开始本次任务;提交后只暂存和提交本次任务涉及的文件,保留其他新产生或并行改动。
  • 每次任务中发现的问题、原因和处理方式都需要记录下来,并在后续相关任务中回顾,避免重复发生。
  • 后端修改如果涉及 SQL,默认新增版本变更 SQL;只有负责人明确要求重整初始化基线时,才将已存在的变更合并到初始化 SQL。
  • 版本变更 SQL 文件名必须使用中文,体现功能和日期,并且 SQL 内容必须是完整可执行脚本。
  • Salon Core 的数据库变更必须放在 JC-Salon-Core/src/main/resources/db/migration/ 下,使用递增的 Flyway 版本文件(如 V2__功能说明_20261024.sql);已在任一环境成功执行的迁移文件不得修改或删除。
  • DEV、SIT、PROD 的数据库迁移由 Core 启动时的 Flyway 自动执行,Gitea 工作流不得直接连接数据库或绕过 Flyway 执行 SQL;合并到 SIT 前必须先在 DEV 验证迁移。
  • 应用回退不会自动回滚数据库;需要撤销或修正时,必须新增向前兼容的补偿迁移,禁止依赖 Flyway clean、自动 baseline 或重新执行初始化 SQL。
  • 如果修改涉及配置,必须提供说明文档;说明文档同样按 SQL 文件命名规则使用中文命名、体现功能和日期,并放在 scripts/ 目录下。
  • 当前代码、脚本、配置、SQL 和文档已固定为 0.0.1 基线;两个端侧初始化 SQL 仅作为空库首次初始化入口,后续 SQL 变更默认使用版本迭代文件,负责人明确要求整合基线时除外。
  • 后续涉及脚本、配置、SQL 的任务,必须优先阅读 docs/scripts/运行与发布配置总说明.md,并在任务记录中写明新增或调整的版本化文件。
  • 每次修改代码或者完成任务后,必须整理本次任务相关改动并创建 git 提交;提交信息必须使用中文。

Browser MCP Preference

  • For any browser-related operation, including opening, navigating, clicking, typing, inspecting pages/devtools, taking screenshots, testing pages, or automating local/remote web targets, use the edgedev MCP server first.
  • Do not use other browser automation providers such as Browser, browser-use, Chrome, Playwright MCP, or generic web browsing for browser operations unless edgedev is unavailable or the user explicitly requests a different browser/MCP in that turn.

项目概述

JayuCloud 是甲屿云双产品线仓库,包含两条业务线,各自拥有完整的端侧矩阵:

  • Salon(店务 / 指尖管理师):面向美甲门店经营的管理系统——门店与员工管理、排班规划、预约、订单履约、注册审核、协议与隐私合规。模块:JC-Salon-Core(后端)、JC-Salon-Gateway(网关)、JC-Salon-Frontend(Vue 管理端)、JC-Salon-WeChat(指尖管理师小程序)。
  • ArtList(指尖设计师):面向用户的设计师作品电商平台——作品浏览、购物车、下单、评价、VIP、优惠券。模块:JC-ArtList-Core、JC-ArtList-Gateway、JC-ArtList-Frontend(Vue 用户端+管理端)、JC-ArtList-WeChat(用户小程序)。
  • 支撑目录:nacos/(各环境 Nacos 配置副本)、scripts/ 与 docs/scripts/(部署脚本与中文配置说明)、docs/(文档)、.gitea/(Gitea Actions 工作流)。

项目背景、模块职责与关键业务流程详见 docs/agent/PROJECT_CONTEXT.md;不可违反的约束见 docs/agent/PROJECT_CONSTRAINTS.md。

技术栈与版本(已核实)

层 技术 版本
后端语言 Java 17
后端框架 Spring Boot / Spring Cloud / Spring Cloud Alibaba 2.7.18 / 2021.0.8 / 2021.0.5.0
ORM / 连接池 MyBatis-Plus / Druid 3.5.3.1 / 1.2.23
认证 jjwt 0.11.5
数据库 / 迁移 MySQL / Flyway 迁移文件在各 Core 的 src/main/resources/db/migration/
缓存 / 消息 Redis / RabbitMQ 版本以 Nacos infra.yaml 为准
注册与配置中心 Nacos 命名空间按端侧划分(jayucloud-salon / jayucloud-artlist)
对象存储 MinIO → 七牛 Kodo → 阿里云 OSS 三副本编排 读取渠道优先级可配置
网关 Spring Cloud Gateway + Reactive Redis AuthGlobalFilter 负责白名单与 JWT 初筛
前端 Vue 3 + Vite + Element Plus + Ant Design Vue(双组件库)+ Pinia + Vue Router + Axios Vue 3.5.x
小程序 微信原生小程序(非 Taro/uni-app) 基础库 3.15.2 基线
构建 Maven(各模块独立构建,非聚合工程)/ npm Maven 3.9.x
CI/CD Gitea Actions(dev Nacos 自动发布、prod 部署工作流) 见 .gitea/workflows/

不得把未经确认的目标版本写成当前使用版本;升级版本属于迁移任务,需单独方案。

项目架构

  • 调用链:各端 → Gateway(路由、白名单、Token 初筛)→ Core(业务)→ MySQL / Redis / RabbitMQ / 对象存储;服务间内部接口走 /internal/**。
  • Core 分层:modules.<业务域> 下 controller / service / mapper / entity / dto / vo;公共能力在 common 与 config;统一响应包装为 common 包的 Result<T>。
  • Salon Core 业务域:analytics、artist、auth、content、file、integration、inventory、manager、marketing、message、order、payment、planning、privacy、product、registration、security、shop、system、user;ArtList Core 为其收敛子集(已清理 inventory/manager/analytics 等)。
  • 配置体系:本地 application.yaml/bootstrap.yaml 只保留 Nacos 引导参数;运行配置在 Nacos 的 core.yaml、gateway.yaml、infra.yaml、secret.yaml、logging.yaml;secret.yaml 与 infra.yaml 的覆盖关系以实际加载顺序为准,敏感配置只放 Nacos,不入仓库。
  • 路由与权限基线:管理端接口走 /api/admin/** 门禁;小程序业务走 /api/**;匿名白名单逐个端点枚举,禁止宽泛前缀。

目录与代码规范

  • 新业务优先进入现有 modules.<业务域>;跨域引用走对方 Service,不直连他域 Mapper。
  • Gateway 不承载业务写逻辑,只做路由、鉴权初筛与转发。
  • 命名遵循现有风格:Java 包 com.xiaowang.jayucloud.<salon|artlist>.<core|gateway>;前端页面在 src/views/,请求封装在 src/api/;小程序请求封装在 utils/request.js、登录态在 utils/auth.js。
  • 界面文案统一中文;前端保持现有双组件库用法与页面风格,改版式不改业务行为(接口调用、校验、权限逻辑原样保留)。
  • 异常与日志:沿用现有统一异常处理与 Log4j2 配置;日志禁止输出手机号、口令、令牌等敏感明文。

数据库规范

  • 结构变更一律走 Flyway 版本文件(规则见上方 Project Workflow Rules 与 docs/agent/PROJECT_CONSTRAINTS.md):V{n}__中文功能说明_YYYYMMDD.sql,完整可执行,已执行文件不得修改。
  • 空库初始化仅用 docs/scripts/sql/init/jayucloud-salon.sql / jayucloud-artlist.sql;生产已部署库升级必须单独制定迁移方案。
  • 主键与实体:遵循现有实体的主键策略与软删除/审计字段约定;新增实体需同步检查 @MapperScan 包清单与 MyBatis-Plus 自动填充处理器(单例合并)。
  • 新增字段必须同时更新实体与版本迁移,并核对历史数据回填需求。

API 规范

  • 风格:REST 风格 + 统一 Result<T> 包装;URL 使用小写中划线资源名,遵循所在端既有前缀(/api、/api/admin、/internal)。
  • 认证:Bearer JWT,Gateway 初筛 + Core 业务校验;匿名端点必须显式列入白名单并逐个说明理由。
  • 权限:管理端按权限码裁剪菜单与接口;数据属主校验(门店作用域)在 Service 层完成。
  • 敏感数据:手机号/账号等隐私字段默认脱敏返回,明文获取走独立授权端点(如单次拨号取号);不在列表接口返回完整隐私字段。
  • 接口文档:以代码与 docs/ 说明为准;新增对外契约需在任务说明中写明请求/响应/错误语义。

开发与验证要求

  • 后端构建(非聚合工程,进对应模块):mvn -f JC-Salon-Core/pom.xml -DskipTests compile(ArtList 同理);本机 Maven 位于 D:\software\apache-maven-3.9.12\bin\mvn.cmd。
  • 涉及 Bean 装配、事务、拦截器的改动:编译通过后还需启动烟测,编译通过不等于能启动。
  • 前端:JC-Salon-Frontend / JC-ArtList-Frontend 下 npm run build;开发代理 /admin/api 与 /api 指向 VITE_DEV_PROXY_TARGET。
  • 小程序:JS 改动后做 node 语法检查;有条件时用微信开发者工具冒烟。
  • 测试:JUnit 5 + Mockito(spring-boot-starter-test);Mock 参数要么全字面量要么全 matcher。
  • 修改符号前先做 GitNexus impact 分析,提交前做 detect_changes(见文首 GitNexus 规则);修改完成后按改动范围执行上述对应验证,并如实报告结果。

安全与变更保护

  • 不擅自删除业务数据;不擅自操作生产环境(生产部署、Nacos 生产发布、生产 SQL 执行必须先核对环境、备份与凭据注入方式并取得确认)。
  • 不擅自变更数据库结构(必须走 Flyway 版本文件);不覆盖用户已有配置;不将密钥、口令、令牌写入仓库、日志或文档。
  • 重大变更(结构调整、迁移、发布)前先备份;破坏性操作必须先确认。
  • 敏感配置只存放在 Nacos secret.yaml(按环境),仓库中的 nacos/ 副本不得包含真实密钥。

Agent 知识体系

  • 项目级技能位于 .agents/skills/(jayu-domain、jayu-database、jayu-api、jayu-devflow、jayu-release),清单与触发条件见 docs/agent/SKILLS_CATALOG.md,使用说明见 docs/agent/AGENT_SKILLS_GUIDE.md。
  • 通用能力(需求分析、架构设计、TDD、调试、评审、运维等)由全局 Skills 提供,项目级技能只承载本项目专属知识,两者不重复建设。
  • 交接文档入口:docs/handoff/(PROJECT-MAP、CURRENT-STATE 等,部分内容滞后于代码,结论以源码为准);脚本与发布规则入口:docs/scripts/运行与发布配置总说明.md。