From 199a14daeaa91deb4573bd03727138e8c1d0b432 Mon Sep 17 00:00:00 2001 From: "zhiye.sun" Date: Thu, 3 Sep 2026 17:12:33 +0800 Subject: [PATCH] =?UTF-8?q?feat(language):=20=E5=A2=9E=E5=8A=A0=20Java=20?= =?UTF-8?q?=E4=B8=8E=20Python=20=E6=8A=80=E6=9C=AF=E6=8F=90=E4=BE=9B?= =?UTF-8?q?=E6=96=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/java/.codex-plugin/plugin.json | 16 +++++++++++++ plugins/java/skills/profile/SKILL.md | 22 +++++++++++++++++ .../java/skills/profile/agents/openai.yaml | 4 ++++ .../profile/references/backend/design.md | 7 ++++++ .../profile/references/commands/index.md | 6 +++++ .../skills/profile/references/fallback.md | 3 +++ .../skills/profile/references/manifest.json | 18 ++++++++++++++ .../skills/profile/references/review/index.md | 6 +++++ plugins/python/.codex-plugin/plugin.json | 16 +++++++++++++ plugins/python/skills/profile/SKILL.md | 22 +++++++++++++++++ .../python/skills/profile/agents/openai.yaml | 4 ++++ .../profile/references/backend/design.md | 7 ++++++ .../references/backend/implementation.md | 7 ++++++ .../profile/references/commands/index.md | 6 +++++ .../skills/profile/references/fallback.md | 3 +++ .../skills/profile/references/manifest.json | 20 ++++++++++++++++ .../skills/profile/references/review/index.md | 7 ++++++ .../profile/references/testing/index.md | 6 +++++ plugins/python/skills/review-python/SKILL.md | 24 +++++++++++++++++++ .../skills/review-python/agents/openai.yaml | 4 ++++ 20 files changed, 208 insertions(+) create mode 100644 plugins/java/.codex-plugin/plugin.json create mode 100644 plugins/java/skills/profile/SKILL.md create mode 100644 plugins/java/skills/profile/agents/openai.yaml create mode 100644 plugins/java/skills/profile/references/backend/design.md create mode 100644 plugins/java/skills/profile/references/commands/index.md create mode 100644 plugins/java/skills/profile/references/fallback.md create mode 100644 plugins/java/skills/profile/references/manifest.json create mode 100644 plugins/java/skills/profile/references/review/index.md create mode 100644 plugins/python/.codex-plugin/plugin.json create mode 100644 plugins/python/skills/profile/SKILL.md create mode 100644 plugins/python/skills/profile/agents/openai.yaml create mode 100644 plugins/python/skills/profile/references/backend/design.md create mode 100644 plugins/python/skills/profile/references/backend/implementation.md create mode 100644 plugins/python/skills/profile/references/commands/index.md create mode 100644 plugins/python/skills/profile/references/fallback.md create mode 100644 plugins/python/skills/profile/references/manifest.json create mode 100644 plugins/python/skills/profile/references/review/index.md create mode 100644 plugins/python/skills/profile/references/testing/index.md create mode 100644 plugins/python/skills/review-python/SKILL.md create mode 100644 plugins/python/skills/review-python/agents/openai.yaml diff --git a/plugins/java/.codex-plugin/plugin.json b/plugins/java/.codex-plugin/plugin.json new file mode 100644 index 0000000..0a39ead --- /dev/null +++ b/plugins/java/.codex-plugin/plugin.json @@ -0,0 +1,16 @@ +{ + "name": "java", + "version": "0.1.0", + "description": "Java、JDK、构建工具和 Spring 技术能力资料。", + "author": { "name": "CraftKit" }, + "skills": "./skills/", + "interface": { + "displayName": "Java", + "shortDescription": "Java 与 Spring 技术能力资料", + "longDescription": "按项目 Java、构建工具和 Spring 版本提供设计、命令与专项审查资料。", + "developerName": "CraftKit", + "category": "Productivity", + "capabilities": ["Read"], + "defaultPrompt": ["帮我按当前项目版本获取 Java 技术约束。"] + } +} diff --git a/plugins/java/skills/profile/SKILL.md b/plugins/java/skills/profile/SKILL.md new file mode 100644 index 0000000..6810385 --- /dev/null +++ b/plugins/java/skills/profile/SKILL.md @@ -0,0 +1,22 @@ +--- +name: profile +description: 根据项目中的 Java、JDK、Maven、Gradle 和 Spring 证据提供版本匹配的设计、命令和专项审查资料。适用于核心工作流请求 Java 技术能力;通用业务实现或无法确认 Java 项目时不应触发。 +--- + +# Java Profile + +读取自身[能力清单](references/manifest.json),根据目标模块的构建文件和项目画像返回匹配能力。 + +## 工作流 + +1. 从 `pom.xml`、Gradle 文件、Wrapper、工具链配置和 `.craftkit/project.json` 提取 Java 与 Spring 版本证据。 +2. 只选择版本范围匹配的 Profile;版本未知时只使用 `java/default`。 +3. 按请求能力读取对应资料,返回逻辑资料标识、适用版本和证据。 +4. 项目已有命令优先于[命令规则](references/commands/index.md)。 +5. 缺失能力或版本不匹配时返回明确状态,不写项目文件。 + +## 边界 + +- 不默认最新 JDK、Spring 或构建插件版本。 +- 不安装 JDK、Maven、Gradle 或项目依赖。 +- 不调用 `dev`,最终设计、实现和审查由核心 Skill 负责。 diff --git a/plugins/java/skills/profile/agents/openai.yaml b/plugins/java/skills/profile/agents/openai.yaml new file mode 100644 index 0000000..a7483dc --- /dev/null +++ b/plugins/java/skills/profile/agents/openai.yaml @@ -0,0 +1,4 @@ +interface: + display_name: "Java Profile(java:profile)" + short_description: "按项目版本提供 Java 与 Spring 技术资料" + default_prompt: "使用 $profile 获取当前项目适用的 Java 技术能力。" diff --git a/plugins/java/skills/profile/references/backend/design.md b/plugins/java/skills/profile/references/backend/design.md new file mode 100644 index 0000000..d9e8c70 --- /dev/null +++ b/plugins/java/skills/profile/references/backend/design.md @@ -0,0 +1,7 @@ +# Java 后端设计资料 + +- 先从构建文件确认 Java、Spring 和持久化框架精确版本。 +- 领域服务、协议入口和持久化实现保持明确边界,事务范围围绕业务一致性定义。 +- Spring 代理、事务传播和异步边界必须以当前项目版本及真实调用路径为依据。 +- DTO、领域对象和持久化对象分别承担各自边界,转换位置遵循项目现有结构。 +- 并发、幂等和失败恢复必须说明数据库约束、条件更新或锁的真实落点。 diff --git a/plugins/java/skills/profile/references/commands/index.md b/plugins/java/skills/profile/references/commands/index.md new file mode 100644 index 0000000..01793a3 --- /dev/null +++ b/plugins/java/skills/profile/references/commands/index.md @@ -0,0 +1,6 @@ +# Java 命令选择 + +1. 优先使用仓库中的 Maven Wrapper 或 Gradle Wrapper。 +2. 其次使用项目文档和 CI 中已经验证的命令。 +3. 没有 Wrapper 或项目命令时只给出待确认建议,不假定全局工具存在。 +4. Profile 返回命令建议不代表已经获得执行、安装或修改依赖的授权。 diff --git a/plugins/java/skills/profile/references/fallback.md b/plugins/java/skills/profile/references/fallback.md new file mode 100644 index 0000000..8964880 --- /dev/null +++ b/plugins/java/skills/profile/references/fallback.md @@ -0,0 +1,3 @@ +# Java 回退 + +版本未知时只使用 Java 版本中性的设计和审查原则。Spring 或构建工具无法确认时不加载对应专属规则,并说明缺少的证据。 diff --git a/plugins/java/skills/profile/references/manifest.json b/plugins/java/skills/profile/references/manifest.json new file mode 100644 index 0000000..c730310 --- /dev/null +++ b/plugins/java/skills/profile/references/manifest.json @@ -0,0 +1,18 @@ +{ + "schemaVersion": 1, + "provider": { "id": "java", "kind": "language", "displayName": "Java" }, + "profiles": [ + { + "id": "java/default", + "version": { "scheme": "java-feature", "range": "*" }, + "priority": 10, + "detect": { "manifests": ["pom.xml", "build.gradle", "build.gradle.kts"], "wrappers": ["mvnw", "gradlew"] }, + "capabilities": { + "backend-design": "references/backend/design.md", + "language-review": "references/review/index.md", + "command-resolution": "references/commands/index.md" + }, + "fallback": "references/fallback.md" + } + ] +} diff --git a/plugins/java/skills/profile/references/review/index.md b/plugins/java/skills/profile/references/review/index.md new file mode 100644 index 0000000..5f9bb0c --- /dev/null +++ b/plugins/java/skills/profile/references/review/index.md @@ -0,0 +1,6 @@ +# Java 专项审查资料 + +- 检查 Java 版本、编译选项和预览特性是否匹配。 +- 检查资源关闭、异常传播、空值、泛型、并发可见性和序列化边界。 +- Spring 项目额外检查代理失效、事务边界、Bean 生命周期和线程上下文。 +- 只报告有调用上下文和明确影响的问题,避免把个人风格作为缺陷。 diff --git a/plugins/python/.codex-plugin/plugin.json b/plugins/python/.codex-plugin/plugin.json new file mode 100644 index 0000000..cdf6a62 --- /dev/null +++ b/plugins/python/.codex-plugin/plugin.json @@ -0,0 +1,16 @@ +{ + "name": "python", + "version": "0.1.0", + "description": "Python、包管理、FastAPI 和测试技术能力资料。", + "author": { "name": "CraftKit" }, + "skills": "./skills/", + "interface": { + "displayName": "Python", + "shortDescription": "Python 与 FastAPI 技术能力资料", + "longDescription": "按项目 Python、包管理和 FastAPI 版本提供设计、实现、测试与审查资料。", + "developerName": "CraftKit", + "category": "Productivity", + "capabilities": ["Read"], + "defaultPrompt": ["帮我按当前项目版本获取 Python 技术约束。"] + } +} diff --git a/plugins/python/skills/profile/SKILL.md b/plugins/python/skills/profile/SKILL.md new file mode 100644 index 0000000..179591f --- /dev/null +++ b/plugins/python/skills/profile/SKILL.md @@ -0,0 +1,22 @@ +--- +name: profile +description: 根据项目中的 Python、包管理、FastAPI 和测试工具证据提供版本匹配的设计、实现、测试和审查资料。适用于核心工作流请求 Python 技术能力;通用业务实现或无法确认 Python 项目时不应触发。 +--- + +# Python Profile + +读取自身[能力清单](references/manifest.json),根据目标模块的项目清单、锁文件和项目画像返回匹配能力。 + +## 工作流 + +1. 从 `pyproject.toml`、依赖文件、锁文件、版本文件和 `.craftkit/project.json` 提取证据。 +2. 只选择版本范围匹配的 Profile;版本未知时只使用版本中性资料。 +3. Ruff、mypy、pyright、Black 等工具只有在项目配置或依赖中存在时才作为可用命令。 +4. 按请求能力读取对应资料并返回逻辑资料标识、适用版本和证据。 +5. 缺失能力或版本不匹配时返回明确状态,不写项目文件。 + +## 边界 + +- 不默认最新 Python、FastAPI 或 Pydantic 版本。 +- 不安装解释器、包管理器、质量工具或项目依赖。 +- 不调用 `dev`,最终设计、实现、测试和审查由核心 Skill 负责。 diff --git a/plugins/python/skills/profile/agents/openai.yaml b/plugins/python/skills/profile/agents/openai.yaml new file mode 100644 index 0000000..c19811b --- /dev/null +++ b/plugins/python/skills/profile/agents/openai.yaml @@ -0,0 +1,4 @@ +interface: + display_name: "Python Profile(python:profile)" + short_description: "按项目版本提供 Python 与 FastAPI 技术资料" + default_prompt: "使用 $profile 获取当前项目适用的 Python 技术能力。" diff --git a/plugins/python/skills/profile/references/backend/design.md b/plugins/python/skills/profile/references/backend/design.md new file mode 100644 index 0000000..4c42de4 --- /dev/null +++ b/plugins/python/skills/profile/references/backend/design.md @@ -0,0 +1,7 @@ +# Python 后端设计资料 + +- 从项目清单和锁文件确认 Python、框架、Pydantic 与数据访问工具版本。 +- 协议模型、领域输入输出和 ORM 模型保持边界,避免框架对象扩散到核心业务。 +- 同步与异步调用链必须一致;阻塞 I/O 不能未经处理进入异步请求路径。 +- 事务、幂等和外部调用失败恢复需要明确数据库约束与提交顺序。 +- 配置和依赖通过项目已有机制注入,不能在模块导入时连接真实外部资源。 diff --git a/plugins/python/skills/profile/references/backend/implementation.md b/plugins/python/skills/profile/references/backend/implementation.md new file mode 100644 index 0000000..87eca48 --- /dev/null +++ b/plugins/python/skills/profile/references/backend/implementation.md @@ -0,0 +1,7 @@ +# Python 后端实现资料 + +- 遵循项目现有包结构、类型标注和异常边界。 +- 资源使用上下文管理器或项目已有生命周期机制可靠释放。 +- 不混用不兼容的 Pydantic、FastAPI 或 ORM 版本写法。 +- 新增依赖前确认项目包管理工具、锁文件和用户授权。 +- 实现后运行项目已有的聚焦测试与检查命令。 diff --git a/plugins/python/skills/profile/references/commands/index.md b/plugins/python/skills/profile/references/commands/index.md new file mode 100644 index 0000000..3416859 --- /dev/null +++ b/plugins/python/skills/profile/references/commands/index.md @@ -0,0 +1,6 @@ +# Python 命令选择 + +1. 从锁文件和 `pyproject.toml` 确定 uv、Poetry、PDM、Pipenv 或 pip。 +2. 优先使用项目脚本、任务入口和 CI 已执行命令。 +3. Ruff、mypy、pyright、Black 只有存在配置或依赖证据时才返回。 +4. Profile 不安装工具,也不把建议命令视为执行授权。 diff --git a/plugins/python/skills/profile/references/fallback.md b/plugins/python/skills/profile/references/fallback.md new file mode 100644 index 0000000..1e6c895 --- /dev/null +++ b/plugins/python/skills/profile/references/fallback.md @@ -0,0 +1,3 @@ +# Python 回退 + +版本未知时只使用 Python 版本中性规则。FastAPI、Pydantic、测试插件或包管理工具无法确认时不加载其专属写法,并说明缺少的项目证据。 diff --git a/plugins/python/skills/profile/references/manifest.json b/plugins/python/skills/profile/references/manifest.json new file mode 100644 index 0000000..256b9ae --- /dev/null +++ b/plugins/python/skills/profile/references/manifest.json @@ -0,0 +1,20 @@ +{ + "schemaVersion": 1, + "provider": { "id": "python", "kind": "language", "displayName": "Python" }, + "profiles": [ + { + "id": "python/default", + "version": { "scheme": "pep440", "range": ">=3.9,<3.14" }, + "priority": 10, + "detect": { "manifests": ["pyproject.toml", "requirements.txt"], "lockFiles": ["uv.lock", "poetry.lock", "pdm.lock", "Pipfile.lock"] }, + "capabilities": { + "backend-design": "references/backend/design.md", + "backend-implementation": "references/backend/implementation.md", + "backend-testing": "references/testing/index.md", + "language-review": "references/review/index.md", + "command-resolution": "references/commands/index.md" + }, + "fallback": "references/fallback.md" + } + ] +} diff --git a/plugins/python/skills/profile/references/review/index.md b/plugins/python/skills/profile/references/review/index.md new file mode 100644 index 0000000..4744775 --- /dev/null +++ b/plugins/python/skills/profile/references/review/index.md @@ -0,0 +1,7 @@ +# Python 专项审查资料 + +- 检查类型与空值、异常边界、资源生命周期、可变默认值和导入副作用。 +- 检查同步与异步混用、任务泄漏、取消处理和阻塞 I/O。 +- FastAPI 项目检查依赖生命周期、请求模型、响应序列化和后台任务边界。 +- ORM 代码检查事务所有权、会话生命周期、延迟加载和查询数量。 +- 只报告有代码证据和明确影响的问题。 diff --git a/plugins/python/skills/profile/references/testing/index.md b/plugins/python/skills/profile/references/testing/index.md new file mode 100644 index 0000000..2d72cd1 --- /dev/null +++ b/plugins/python/skills/profile/references/testing/index.md @@ -0,0 +1,6 @@ +# Python 后端测试资料 + +- 优先使用项目已配置的 pytest 或 unittest,不自行引入测试框架。 +- 异步代码只有在项目已配置对应插件和事件循环策略时使用异步测试写法。 +- 测试客户端、依赖覆盖和数据库隔离方式必须匹配当前 FastAPI 及相关依赖版本。 +- 外部依赖使用项目已有替身或隔离边界,不连接真实生产资源。 diff --git a/plugins/python/skills/review-python/SKILL.md b/plugins/python/skills/review-python/SKILL.md new file mode 100644 index 0000000..9629b2b --- /dev/null +++ b/plugins/python/skills/review-python/SKILL.md @@ -0,0 +1,24 @@ +--- +name: review-python +description: 按项目 Python、框架和工具版本审查类型、异常、资源、异步、生命周期、事务和测试隔离问题。适用于 Python 专项代码审查;通用审查、直接实现或无法确认 Python 项目时不应触发。 +--- + +# Python 专项审查 + +先从项目清单、锁文件、源码和 `.craftkit/project.json` 确认 Python、框架及数据访问工具版本。 + +## 工作流 + +1. 确认审查范围、目标模块、Python 版本、框架、包管理工具和相关测试。 +2. 请求 `python:profile` 的 `language-review`;当前会话未发现提供方时说明缺口并使用本 Skill 的最小检查项。 +3. 检查类型与空值、异常边界、资源生命周期、可变默认值、导入副作用和公开契约。 +4. 异步代码检查阻塞 I/O、任务生命周期、取消处理及同步/异步边界。 +5. 框架和 ORM 代码按已确认版本检查依赖、请求、会话与事务生命周期。 +6. 只报告可复现、有代码证据且影响明确的问题,按严重度给出最小修复建议。 +7. 未运行静态检查或测试时明确说明,不自动修改代码。 + +## 边界 + +- 不默认最新 Python、FastAPI、Pydantic 或 ORM 行为。 +- 项目未配置 Ruff、mypy、pyright 或 Black 时,不把缺少这些工具本身报告为缺陷。 +- 不安装工具、修改依赖或连接真实外部资源。 diff --git a/plugins/python/skills/review-python/agents/openai.yaml b/plugins/python/skills/review-python/agents/openai.yaml new file mode 100644 index 0000000..46a01fa --- /dev/null +++ b/plugins/python/skills/review-python/agents/openai.yaml @@ -0,0 +1,4 @@ +interface: + display_name: "Python Review(python:review-python)" + short_description: "按项目版本专项审查 Python 代码" + default_prompt: "使用 $review-python 按当前项目版本审查这段 Python 代码。"