From 9470a961f920fb5cef6314ec07ac9cc6d32495f1 Mon Sep 17 00:00:00 2001 From: rcmerci Date: Wed, 7 Oct 2026 22:55:14 +0800 Subject: [PATCH 1/2] Add concise read-only OCaml review skill --- .agents/skills/ocaml-review/SKILL.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .agents/skills/ocaml-review/SKILL.md diff --git a/.agents/skills/ocaml-review/SKILL.md b/.agents/skills/ocaml-review/SKILL.md new file mode 100644 index 0000000..cff82a9 --- /dev/null +++ b/.agents/skills/ocaml-review/SKILL.md @@ -0,0 +1,14 @@ +--- +name: ocaml-review +description: 在请求 OCaml 代码审查时检查读写放大、集合性能与接口类型约束,并简短报告问题。 +--- + +# OCaml Review + +只读审查请求范围内的代码,只报告问题,不修改代码或其他文件。 + +1. 检查读写放大:单次操作是否重复全量读取、遍历或重写,结合数据量与调用频率判断影响。 +2. `List` 仅用于明确小于 1000 项的数据;数量未知或可能 >= 1000 时指出应替换为 `rrbvec`,尤其检查高频 `List.length`、`List.nth`、`List.append` 等低性能调用。 +3. 检查 `spec/` 下的 `.mli` 类型能否加强约束,以排除非法状态、区分身份与生命周期并限制构造权限。 + +仅报告有证据的问题,每点尽量一句,包含严重度、位置、触发条件与影响,并标明实证或推断;无发现时明确说明。 From 235baaf5aeaf218f0607a426a80bc7acb314fdc4 Mon Sep 17 00:00:00 2001 From: rcmerci Date: Wed, 7 Oct 2026 23:12:44 +0800 Subject: [PATCH 2/2] Move List performance guidance into OCaml review skill --- .agents/skills/ocaml-review/SKILL.md | 4 ++-- AGENTS.md | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.agents/skills/ocaml-review/SKILL.md b/.agents/skills/ocaml-review/SKILL.md index cff82a9..021ac75 100644 --- a/.agents/skills/ocaml-review/SKILL.md +++ b/.agents/skills/ocaml-review/SKILL.md @@ -1,6 +1,6 @@ --- name: ocaml-review -description: 在请求 OCaml 代码审查时检查读写放大、集合性能与接口类型约束,并简短报告问题。 +description: review ocaml时使用 --- # OCaml Review @@ -8,7 +8,7 @@ description: 在请求 OCaml 代码审查时检查读写放大、集合性能与 只读审查请求范围内的代码,只报告问题,不修改代码或其他文件。 1. 检查读写放大:单次操作是否重复全量读取、遍历或重写,结合数据量与调用频率判断影响。 -2. `List` 仅用于明确小于 1000 项的数据;数量未知或可能 >= 1000 时指出应替换为 `rrbvec`,尤其检查高频 `List.length`、`List.nth`、`List.append` 等低性能调用。 +2. `List` 仅用于明确小于 1000 项的数据,数量未知或可能 >= 1000 时应改用 `rrbvec`(已有依赖时使用 `Rrbvec` 向量),重点检查高频 `List.length`、`List.nth`、`List.append`、`List.concat` 等线性调用及重复拼接造成的 O(n²)。 3. 检查 `spec/` 下的 `.mli` 类型能否加强约束,以排除非法状态、区分身份与生命周期并限制构造权限。 仅报告有证据的问题,每点尽量一句,包含严重度、位置、触发条件与影响,并标明实证或推断;无发现时明确说明。 diff --git a/AGENTS.md b/AGENTS.md index 176df74..3516e9e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -8,4 +8,3 @@ - If development is blocked because the `.mli` definitions under `spec/` are unclear or unreasonable, stop development immediately and report the specific spec issue, suggested changes, and rationale. - Do not modify any ocaml files in bonsai_flutter repo - Prefer native bonsai-ui/SwiftUI components and their built-in layout, scrolling, and animation behavior. Do not recreate these behaviors using per-row geometry tracking, shared observable geometry state, or repeated collection scans during scrolling. If native APIs cannot satisfy a requirement, explain the limitation and obtain explicit approval before implementing custom UI coordination. -- Avoid O(n²) `List` patterns such as `List.concat` and repeated `List.append` on large sequences; when the project already depends on the `rrbvec` package, use `Rrbvec` vectors instead.