{
  "patterns": {
    "pat-2026-03-20-001": {
      "name": "多模块Maven项目构建",
      "confidence": 0.95,
      "applications": 1,
      "created": "2026-03-20",
      "category": "workflow",
      "pattern": "子模块修改后必须执行 mvn install",
      "problem": "修改子模块代码后启动类不加载新代码",
      "solution": "执行 mvn install -pl {module} -am -DskipTests",
      "quality_rules": [
        "修改子模块后重新构建",
        "启动前确认模块已安装"
      ]
    },
    "pat-2026-03-20-002": {
      "name": "Spring Security自动配置冲突",
      "confidence": 0.95,
      "applications": 1,
      "created": "2026-03-20",
      "category": "backend",
      "pattern": "前后端分离项目需排除Security自动配置",
      "problem": "自定义SecurityConfig不生效，被默认配置覆盖",
      "solution": "在application.yml排除SecurityFilterAutoConfiguration",
      "quality_rules": [
        "前后端分离项目禁用CSRF",
        "使用JWT认证"
      ]
    },
    "pat-2026-03-20-003": {
      "name": "前端登录状态判断",
      "confidence": 0.95,
      "applications": 1,
      "created": "2026-03-20",
      "category": "frontend",
      "pattern": "路由守卫需同时检查localStorage和store",
      "problem": "token存储在localStorage但store初始化时为空",
      "solution": "isLoggedIn()优先读取localStorage",
      "quality_rules": [
        "登录状态判断检查localStorage",
        "Pinia store初始化时机可能晚于路由守卫"
      ]
    },
    "pat-2026-03-20-004": {
      "name": "调试代码清理",
      "confidence": 0.95,
      "applications": 1,
      "created": "2026-03-20",
      "category": "code_style",
      "pattern": "上线前移除所有调试代码和日志",
      "problem": "生产环境日志过多或泄露调试信息",
      "solution": "移除console.log，敏感日志改为debug级别",
      "quality_rules": [
        "上线前清理console.log",
        "生产日志使用debug级别"
      ]
    },
    "pat-2026-03-20-005": {
      "name": "测试账号密码管理",
      "confidence": 0.95,
      "applications": 1,
      "created": "2026-03-20",
      "category": "workflow",
      "pattern": "密码使用BCrypt格式并同步到文档",
      "problem": "测试账号密码修改后忘记更新文档",
      "solution": "使用BCryptPasswordEncoder生成，同步到test-users.sql",
      "quality_rules": [
        "密码必须BCrypt加密",
        "修改密码后更新文档"
      ]
    },
    "pat-2026-03-21-006": {
      "name": "Spring Security 6 JWT认证实现",
      "confidence": 0.95,
      "applications": 1,
      "created": "2026-03-21",
      "category": "backend",
      "pattern": "Spring Security 6的SessionCreationPolicy.STATELESS模式与JWT认证的冲突",
      "problem": "使用STATELESS时SecurityContextHolderFilter会清空SecurityContext，导致JWT认证被覆盖返回403",
      "solution": "使用SessionCreationPolicy.IF_REQUIRED + HttpSessionSecurityContextRepository，JWT Filter放在AuthorizationFilter之前",
      "quality_rules": [
        "Spring Security 6 JWT认证不要使用STATELESS模式",
        "JWT Filter必须放在AuthorizationFilter之前",
        "使用HttpSessionSecurityContextRepository保存认证上下文",
        "从JWT claims中解析用户角色而非硬编码"
      ]
    }
  }
}