From 3b96006e8905ad74b8ddfeb5a3a54be00ea9537d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=97=A5=E5=A4=A9?= Date: Sat, 12 Jul 2025 23:14:42 +0800 Subject: [PATCH 01/64] =?UTF-8?q?=F0=9F=A4=96=20[claude]=20add=20.claude/?= =?UTF-8?q?=20to=20.gitignore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 1b25cb077..d92c4cedf 100644 --- a/.gitignore +++ b/.gitignore @@ -71,3 +71,6 @@ logs ### Customs ### TODO.* + +### AI Coder ### +/.claude/ From 4e257cfa5ca1bb92eb252721cf3008bc5ef99ef8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=97=A5=E5=A4=A9?= Date: Sat, 12 Jul 2025 23:16:23 +0800 Subject: [PATCH 02/64] =?UTF-8?q?=F0=9F=94=A7=20[ci]=20=E4=BB=85=E5=9C=A8?= =?UTF-8?q?=20main=20=E5=88=86=E6=94=AF=E4=B8=8A=E8=A7=A6=E5=8F=91=20CI=20?= =?UTF-8?q?=E6=B5=81=E6=B0=B4=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb07d12fe..c95b7322f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,9 +2,9 @@ name: CI on: push: - branches: [ main, dev ] + branches: [ main ] pull_request: - branches: [ main, dev ] + branches: [ main ] jobs: test: From c6f0f0c43bc546439009feab5fd486ce1a2e9c72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=97=A5=E5=A4=A9?= Date: Sat, 12 Jul 2025 23:39:23 +0800 Subject: [PATCH 03/64] =?UTF-8?q?=E2=9C=A8=20[docs]=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=20GLOBAL=5FCLAUDE.md=EF=BC=8C=E6=B7=BB=E5=8A=A0=E6=A0=B8?= =?UTF-8?q?=E5=BF=83=E5=B7=A5=E4=BD=9C=E5=8E=9F=E5=88=99=E3=80=81=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E8=A7=84=E8=8C=83=E5=92=8C=E5=AE=89=E5=85=A8=E7=BC=96?= =?UTF-8?q?=E7=A8=8B=E6=8C=87=E5=8D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/GLOBAL_CLAUDE.md | 102 ++++++++++++------ ...46\344\270\216\345\256\211\345\205\250.md" | 2 +- 2 files changed, 69 insertions(+), 35 deletions(-) diff --git a/docs/GLOBAL_CLAUDE.md b/docs/GLOBAL_CLAUDE.md index 537d40f41..3ae33a36d 100644 --- a/docs/GLOBAL_CLAUDE.md +++ b/docs/GLOBAL_CLAUDE.md @@ -1,34 +1,68 @@ -# Claude Code 专用 AI 规则(2025-07 版) - -## 通用规范 -- 所有回复必须使用简体中文。 - -## SQL 规范 -- SQL 语句全部小写(关键字、标识符)。 -- 命名风格统一使用下划线命名法(snake_case)。 -- 严禁拼接 SQL 字符串,必须使用参数化查询,防止 SQL 注入。 -- 表、字段、索引等命名需简洁明了,避免缩写。 -- 禁止在代码中硬编码数据库连接信息,需使用配置文件或安全管理方式。 -- 建议为重要业务表和字段添加注释,便于维护。 - -## 通用代码规范 -- 文档注释必须由英文书写。 -- 优先采用提前返回(early return),减少嵌套。 -- 禁止行尾注释,注释需单独成行。 -- 统一使用 2 空格缩进,仅用空格,不用 Tab。 -- 禁止全量 import,必须显式导入所需内容。 -- 编程语言优先选择编译型语言,避免动态语言,以便尽早发现错误。 -- 应积极采用日志记录方式协助诊断问题,并合理控制日志级别,避免无效或过量日志输出。 - -## markdown 规范 -- Markdown 文件需扁平、紧凑,严禁嵌套列表。 -- 采用分级标题+扁平条目归类结构,避免多层嵌套,整体风格清晰、紧凑、分组明确。 -- 内容应准确、简明,避免歧义和冗余。 -- 结构应清晰,分组合理,便于查阅。 -- 统一术语和表达风格,避免同义词混用。 -- 注重可读性,适当分段,避免长段落堆砌。 -- 人类以阅读为主,AI 需确保文档对人类友好、易于理解。 - -## 依赖与技术规范 -- 仅推荐和采用最新技术,所有建议和代码实现前必须查阅最新官方文档,确保内容为 2025 年及以后主流方案。 -- 禁止试图通过降级依赖版本来解决问题,遇到依赖或兼容性问题时,必须优先查阅最新技术文档或最佳实践,积极采用主流和前沿方案。 +## Core Working Principles + +## Communication Efficiency Optimization +- All responses must be concise and direct +- Prioritize answering core questions, avoid redundant explanations +- Batch process related tasks to reduce interaction rounds + +## Token Saving Strategies +- Avoid repeating known information +- Use concise technical terms instead of lengthy explanations +- Merge multiple related modifications into single operations +- Omit obvious step descriptions +- Use code examples instead of text descriptions + +# General Code Standards + +## Programming Principles +- Prefer early return to reduce nesting +- Single responsibility for functions, limit parameters to 5 or fewer +- Prohibit hardcoded constants, use configuration or constant definitions +- Clear error handling, avoid silent failures + +## Code Style Consistency +- Follow existing project code style and conventions +- Maintain consistent indentation format with project +- Organize import statements according to project standards +- Match comment style with language ecosystem + +## Security Programming Guidelines +- Strictly prohibit exposing sensitive information in code (keys, passwords, etc.) +- Use parameterized queries to prevent injection attacks +- Input validation and output escaping +- Permission checks and boundary condition handling + +# Database Standards + +## SQL Writing Standards +- Use lowercase keywords and identifiers consistently +- Use snake_case naming convention +- Must use parameterized queries, strictly prohibit string concatenation +- Table names and field names should be concise and clear, avoid abbreviations +- Add comments for important fields + +# Documentation and Comments + +## Comment Standards +- API documentation comments use English +- Code logic comments use local language or English +- Comments explain "why" not "what" +- Avoid obvious comments + +## Document Structure +- Use flat structure, avoid deep nesting +- Content should be accurate and concise, eliminate ambiguity +- Use consistent terminology, avoid synonym confusion + +# Quality Assurance + +## Code Review Points +- Logic correctness and boundary conditions +- Performance impact and resource usage +- Security vulnerabilities and data leak risks +- Code readability and maintainability + +## Technology Selection Principles +- Prioritize mature and stable technology solutions +- Avoid over-engineering and unnecessary complexity +- Consider team technology stack and maintenance costs diff --git "a/docs/\350\257\201\344\271\246\344\270\216\345\256\211\345\205\250.md" "b/docs/\350\257\201\344\271\246\344\270\216\345\256\211\345\205\250.md" index 35900aec5..06ea10077 100644 --- "a/docs/\350\257\201\344\271\246\344\270\216\345\256\211\345\205\250.md" +++ "b/docs/\350\257\201\344\271\246\344\270\216\345\256\211\345\205\250.md" @@ -14,4 +14,4 @@ apt update && apt install -y certbot ```shell certbot certonly --standalone -d domain.com --email truenine304520@gmail.com --agree-tos --no-eff-email --force-renewal -``` +``` From beb4f3c3035333b8ce3f2ea61e9a036895b8bd9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=97=A5=E5=A4=A9?= Date: Sun, 13 Jul 2025 00:53:30 +0800 Subject: [PATCH 04/64] =?UTF-8?q?=E2=9C=A8=20[docs]=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=20GLOBAL=5FCLAUDE.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/GLOBAL_CLAUDE.md | 145 ++++++++++++++++++++++-------------------- 1 file changed, 77 insertions(+), 68 deletions(-) diff --git a/docs/GLOBAL_CLAUDE.md b/docs/GLOBAL_CLAUDE.md index 3ae33a36d..a6becf34f 100644 --- a/docs/GLOBAL_CLAUDE.md +++ b/docs/GLOBAL_CLAUDE.md @@ -1,68 +1,77 @@ -## Core Working Principles - -## Communication Efficiency Optimization -- All responses must be concise and direct -- Prioritize answering core questions, avoid redundant explanations -- Batch process related tasks to reduce interaction rounds - -## Token Saving Strategies -- Avoid repeating known information -- Use concise technical terms instead of lengthy explanations -- Merge multiple related modifications into single operations -- Omit obvious step descriptions -- Use code examples instead of text descriptions - -# General Code Standards - -## Programming Principles -- Prefer early return to reduce nesting -- Single responsibility for functions, limit parameters to 5 or fewer -- Prohibit hardcoded constants, use configuration or constant definitions -- Clear error handling, avoid silent failures - -## Code Style Consistency -- Follow existing project code style and conventions -- Maintain consistent indentation format with project -- Organize import statements according to project standards -- Match comment style with language ecosystem - -## Security Programming Guidelines -- Strictly prohibit exposing sensitive information in code (keys, passwords, etc.) -- Use parameterized queries to prevent injection attacks -- Input validation and output escaping -- Permission checks and boundary condition handling - -# Database Standards - -## SQL Writing Standards -- Use lowercase keywords and identifiers consistently -- Use snake_case naming convention -- Must use parameterized queries, strictly prohibit string concatenation -- Table names and field names should be concise and clear, avoid abbreviations -- Add comments for important fields - -# Documentation and Comments - -## Comment Standards -- API documentation comments use English -- Code logic comments use local language or English -- Comments explain "why" not "what" -- Avoid obvious comments - -## Document Structure -- Use flat structure, avoid deep nesting -- Content should be accurate and concise, eliminate ambiguity -- Use consistent terminology, avoid synonym confusion - -# Quality Assurance - -## Code Review Points -- Logic correctness and boundary conditions -- Performance impact and resource usage -- Security vulnerabilities and data leak risks -- Code readability and maintainability - -## Technology Selection Principles -- Prioritize mature and stable technology solutions -- Avoid over-engineering and unnecessary complexity -- Consider team technology stack and maintenance costs +# claude code 核心工作规则 + +## 沟通效率优化 +- 批量处理相关任务以减少交互轮次 +- 将多个相关修改合并为单次操作 + +# 通用代码标准 + +## 编程原则 +- 函数参数限制在5个以内 +- 禁止硬编码常量,使用配置或常量定义 +- 避免静默失败 + +## 代码风格一致性 +- 强制使用大括号包围代码块,即使只有一行代码(防止类似苹果 goto fail 的安全漏洞) + +## 注释标准 +- API 文档注释使用英文 +- 注释解释"为什么"而非"是什么" + +## 安全编程指南 +- 严格禁止在代码中暴露敏感信息(密钥、密码等) +- 使用参数化查询防止注入攻击 + +# 语言特定标准 + +## SQL +- 必须使用参数化查询,严格禁止字符串拼接 +- 使用 snake_case 命名约定 + +## Markdown +- 代码块必须指定语言类型 +- 避免标题层级跳跃 + +## Java/Kotlin +- 强制使用大括号包围所有代码块 +- 优先使用 final(Java)或 val(Kotlin) +- Kotlin 中使用空安全操作符,避免 !! 操作符 + +## Rust 标准 +- 避免使用 unwrap(),使用 expect() 或模式匹配 +- 优先使用迭代器而非索引循环 + +## TypeScript 标准 +- 启用严格模式(strict: true) +- 避免使用 any 类型,使用 unknown 或具体类型 +- 函数参数和返回值必须有类型注解 + +## Vue 标准 +- 使用 Composition API 和