effect-review

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Effect-TS Code Review

Effect-TS代码审查

Orchestrate a multi-agent review of code changes against Effect-TS best practices.
协调多Agent对代码变更进行审查,确保符合Effect-TS最佳实践。

Workflow

工作流

Step 1: Discover Changed Files

步骤1:识别变更文件

Run
git diff --name-only main...HEAD
to find all changed files on the current branch. If that fails (e.g., on main), fall back to
git diff --name-only HEAD~1
or
git diff --name-only
for unstaged changes.
List the changed files for the user.
运行
git diff --name-only main...HEAD
查找当前分支的所有变更文件。如果执行失败(例如在main分支上),则回退到
git diff --name-only HEAD~1
,或者使用
git diff --name-only
获取未暂存的变更。
向用户列出所有变更文件。

Step 2: Categorize Files

步骤2:文件分类

Split files into categories:
  • Backend Effect files:
    .ts
    files NOT ending in
    .test.ts
    , NOT config files (
    .config.ts
    ,
    tsconfig
    , etc.), NOT UI component library directories
  • Test files:
    .test.ts
    files
  • UI files:
    .tsx
    files
  • Skip:
    .md
    ,
    .json
    ,
    .yml
    ,
    .css
    , config files, generated files
将文件划分为以下类别:
  • 后端Effect文件:不以
    .test.ts
    结尾、不属于配置文件(
    .config.ts
    tsconfig
    等)、不属于UI组件库目录的
    .ts
    文件
  • 测试文件
    .test.ts
    文件
  • UI文件
    .tsx
    文件
  • 跳过
    .md
    .json
    .yml
    .css
    、配置文件、自动生成的文件

Step 3: Launch Sub-Agents in Parallel

步骤3:并行启动子Agent

Based on which categories have files, launch the appropriate agents using the Agent tool. Launch all applicable agents in a single message for maximum parallelism.
If backend Effect files exist, launch these 4 agents in parallel:
  • effect-primitives-reviewer
    — checks Effect primitives (Array, Match, Option, forEach, no try/catch, no async/await, Layer not Effect.provide)
  • branded-types-reviewer
    — checks branded type usage for all entity IDs
  • otel-reviewer
    — checks tracing setup (Effect.fn trace names, annotateCurrentSpan, structured logging)
  • error-reviewer
    — checks error definitions and handling (Schema.TaggedError, catchTag, rich context)
If test files exist, launch:
  • test-coverage-reviewer
    — checks @effect/vitest patterns and assesses coverage gaps
If UI files exist, launch:
  • ui-reviewer
    — checks component library usage, accessibility, layout, brand consistency
For each agent, provide the prompt:
Review the following files for [agent's specialty]. Read each file and produce a structured report with Critical/Warning/Info findings.
Files to review:
  • [list of file paths]
Also review the reference guide at
references/[relevant-reference].md
(relative to this skill) for the detailed checklist.
根据存在文件的类别,使用Agent工具启动对应的Agent。为了实现最大并行度,请在单条消息中启动所有适用的Agent。
如果存在后端Effect文件,请并行启动以下4个Agent:
  • effect-primitives-reviewer
    — 检查Effect原语(Array、Match、Option、forEach、不使用try/catch、不使用async/await、使用Layer而非Effect.provide)
  • branded-types-reviewer
    — 检查所有实体ID的branded type使用情况
  • otel-reviewer
    — 检查链路追踪配置(Effect.fn trace名称、annotateCurrentSpan、结构化日志)
  • error-reviewer
    — 检查错误定义与处理(Schema.TaggedError、catchTag、丰富上下文)
如果存在测试文件,启动:
  • test-coverage-reviewer
    — 检查@effect/vitest使用模式,评估覆盖率缺口
如果存在UI文件,启动:
  • ui-reviewer
    — 检查组件库使用、可访问性、布局、品牌一致性
为每个Agent提供如下提示:
针对[Agent的专长领域]审查以下文件。阅读每个文件并输出结构化报告,包含严重/警告/信息级别的发现。
待审查文件:
  • [文件路径列表]
同时请参考本技能相对路径下的
references/[相关参考文件].md
指南获取详细检查清单。

Step 4: Unified Report

步骤4:统一报告

After all agents complete, compile results into a single report:
undefined
所有Agent执行完成后,将结果整合为单份报告:
undefined

Effect Review Report

Effect Review Report

Effect Primitives

Effect Primitives

[agent output]
[agent output]

Branded Types

Branded Types

[agent output]
[agent output]

OTEL / Observability

OTEL / Observability

[agent output]
[agent output]

Error Handling

Error Handling

[agent output]
[agent output]

Test Coverage

Test Coverage

[agent output]
[agent output]

UI Quality

UI Quality

[agent output]

[agent output]

Summary

Summary

CategoryCriticalWarningInfo
PrimitivesXYZ
Branded TypesXYZ
OTELXYZ
ErrorsXYZ
TestsXYZ
UIXYZ
TotalXYZ
Verdict: PASS / NEEDS WORK / FAIL
Score: X/10

- **PASS**: 0 critical findings
- **NEEDS WORK**: 1-3 critical findings
- **FAIL**: 4+ critical findings
CategoryCriticalWarningInfo
PrimitivesXYZ
Branded TypesXYZ
OTELXYZ
ErrorsXYZ
TestsXYZ
UIXYZ
TotalXYZ
Verdict: PASS / NEEDS WORK / FAIL
Score: X/10

- **PASS**:0个严重问题
- **NEEDS WORK**:1-3个严重问题
- **FAIL**:4个及以上严重问题

Scoring (0-10)

评分规则(0-10分)

After compiling all findings, assign an overall score from 0 to 10:
  • 10: Perfect — no findings at all, exemplary Effect-TS code
  • 9: Excellent — only minor info-level suggestions
  • 8: Great — a few warnings, no criticals
  • 7: Good — several warnings but no criticals
  • 6: Acceptable — 1 critical or many warnings
  • 5: Needs work — 2-3 criticals
  • 4: Below standard — 4-5 criticals
  • 3: Poor — 6+ criticals or fundamental pattern violations
  • 2: Very poor — majority of code ignores Effect patterns
  • 1: Minimal compliance — almost no Effect patterns followed
  • 0: No compliance — entirely non-Effect code submitted as Effect code
Display the score prominently at the end of the report.
汇总所有发现后,给出0到10的综合评分:
  • 10分:完美 — 无任何问题,是Effect-TS代码的典范
  • 9分:优秀 — 仅有次要的信息级建议
  • 8分:很好 — 少量警告,无严重问题
  • 7分:良好 — 若干警告但无严重问题
  • 6分:合格 — 1个严重问题或大量警告
  • 5分:需要改进 — 2-3个严重问题
  • 4分:低于标准 — 4-5个严重问题
  • 3分:较差 — 6个及以上严重问题或存在基础模式违反
  • 2分:很差 — 大部分代码未遵循Effect模式
  • 1分:最低限度合规 — 几乎未遵循任何Effect模式
  • 0分:不合规 — 提交的所谓Effect代码完全不使用Effect相关能力
请在报告末尾显著位置展示评分。

Reference Files

参考文件

Detailed checklists with codebase-specific examples:
  • references/effect-primitives.md
    — Effect Array, Match, Option, forEach, Schema, Layer
  • references/branded-types.md
    — Branded type usage and known types list
  • references/otel-patterns.md
    — Tracing, span annotations, structured logging
  • references/error-patterns.md
    — Schema.TaggedError, catchTag, error context
  • references/test-patterns.md
    — @effect/vitest, it.layer, coverage assessment
  • references/effect-atom-patterns.md
    — Effect-Atom React patterns, queries, mutations, Result.builder
包含代码库特定示例的详细检查清单:
  • references/effect-primitives.md
    — Effect Array、Match、Option、forEach、Schema、Layer
  • references/branded-types.md
    — Branded type用法与已知类型列表
  • references/otel-patterns.md
    — 链路追踪、span注解、结构化日志
  • references/error-patterns.md
    — Schema.TaggedError、catchTag、错误上下文
  • references/test-patterns.md
    — @effect/vitest、it.layer、覆盖率评估
  • references/effect-atom-patterns.md
    — Effect-Atom React模式、查询、变更、Result.builder