scan-effect-solutions
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseEffect Solutions Compliance Audit
Effect Solutions合规审计
Scan repository against Effect TypeScript best practices from effect.solutions. Use this skill to perform systematic audits of Effect code compliance.
对照effect.solutions提供的Effect TypeScript最佳实践扫描代码仓库。使用此Skill对Effect代码合规性进行系统化审计。
Prerequisites
前置条件
Before scanning, load current recommendations:
bash
effect-solutions listRead targeted references:
text
references/error-handling.md
references/testing-layers.mdLoad the effect-ts skill for best practices context:
skill({ name: "effect-ts" })扫描前,请加载当前推荐配置:
bash
effect-solutions list阅读指定参考文档:
text
references/error-handling.md
references/testing-layers.md加载effect-ts Skill以获取最佳实践上下文:
skill({ name: "effect-ts" })Audit Checklist
审计检查清单
1. TypeScript Configuration
1. TypeScript配置
Check (or ) for:
tsconfig.base.jsontsconfig.jsonexactOptionalPropertyTypes: truestrict: truenoUnusedLocals: truedeclarationMap: truesourceMap: true- Effect Language Service plugin configured
- Correct setting for project type (preserve/bundler for apps, NodeNext for libraries)
module
Run:
effect-solutions show tsconfig检查(或)是否包含:
tsconfig.base.jsontsconfig.jsonexactOptionalPropertyTypes: truestrict: truenoUnusedLocals: truedeclarationMap: truesourceMap: true- 已配置Effect语言服务插件
- 针对项目类型设置正确的(应用使用preserve/bundler,库使用NodeNext)
module
运行命令:
effect-solutions show tsconfig2. Services & Layers Pattern
2. 服务与分层模式
Search for Effect services and check:
- Are services defined with ?
Context.Tag - Do tag identifiers use pattern?
@path/ServiceName - Are layers defined with or
Layer.effect?Layer.sync - Is there a single at entry point?
Effect.provide
Run:
effect-solutions show services-and-layers搜索Effect服务并检查:
- 是否使用定义服务?
Context.Tag - 标签标识符是否采用格式?
@path/ServiceName - 是否使用或
Layer.effect定义分层?Layer.sync - 入口点是否仅有一个?
Effect.provide
运行命令:
effect-solutions show services-and-layers3. Data Modeling
3. 数据建模
Check for:
- Use of for records
Schema.Class - Use of for variants
Schema.TaggedClass - Branded types for primitives (IDs, emails, etc.)
- Pattern matching with
Match.valueTags
Run:
effect-solutions show data-modeling检查是否:
- 使用定义记录
Schema.Class - 使用定义变体
Schema.TaggedClass - 为原始类型(ID、邮箱等)使用品牌类型
- 使用进行模式匹配
Match.valueTags
运行命令:
effect-solutions show data-modeling4. Error Handling
4. 错误处理
Check for:
- Use of for domain errors
Schema.TaggedError - Proper error recovery with /
catchTagcatchTags - Appropriate use of defects vs typed errors
Run:
effect-solutions show error-handling检查是否:
- 使用定义领域错误
Schema.TaggedError - 使用/
catchTag进行正确的错误恢复catchTags - 合理区分缺陷与类型化错误
运行命令:
effect-solutions show error-handling5. Configuration
5. 配置
Check for:
- Use of for validation
Schema.Config - Config service layer pattern
- for secrets
Config.redacted
Run:
effect-solutions show config检查是否:
- 使用进行验证
Schema.Config - 采用配置服务分层模式
- 使用处理敏感信息
Config.redacted
运行命令:
effect-solutions show config6. Testing
6. 测试
Check for:
- Use of
@effect/vitest - for Effect tests
it.effect() - Test layer composition patterns
Run:
effect-solutions show testing检查是否:
- 使用
@effect/vitest - 使用编写Effect测试
it.effect() - 采用测试分层组合模式
运行命令:
effect-solutions show testing7. Runtime Usage Anti-Pattern (Effect.runPromise
in Production)
Effect.runPromise7. 运行时使用反模式(生产环境中的Effect.runPromise
)
Effect.runPromiseSearch for in production code (exclude , , ).
Effect.runPromise__tests__/*.test.tsagent-tools/Effect.runPromiseEffect.fnEffect.withSpan- Production code MUST use (from
runtime.runPromiseinManagedRuntime) which includeseffect-runtime.tswithAppLayerSentryTracingLive - If is not possible (circular deps), the code MUST add
runtime.runPromiseto the pipe chainEffect.provide(SentryTracingLive) - Test files are exempt (they provide their own layers)
Search patterns:
- in
Effect.runPromise((excludingapps/web-app/src/)__tests__/ - in
Effect.runSync((excludingapps/web-app/src/)__tests__/
Report each occurrence with:
- File path and line
- Whether it's using (✅) or bare
runtime.runPromise(❌)Effect.runPromise - Whether is provided in the pipe chain (fallback ✅)
SentryTracingLive
Run:
effect-solutions show services-and-layers在生产代码中搜索(排除、、目录)。
Effect.runPromise__tests__/*.test.tsagent-tools/Effect.runPromiseEffect.fnEffect.withSpan- 生产代码必须使用(来自
runtime.runPromise中的effect-runtime.ts),它包含带有ManagedRuntime的SentryTracingLiveAppLayer - 如果无法使用(存在循环依赖),代码必须在管道链中添加
runtime.runPromiseEffect.provide(SentryTracingLive) - 测试文件可豁免(它们会提供自己的分层)
搜索模式:
- 目录下的
apps/web-app/src/(排除Effect.runPromise()__tests__/ - 目录下的
apps/web-app/src/(排除Effect.runSync()__tests__/
报告每个匹配项的:
- 文件路径和行号
- 是否使用(✅)或原生
runtime.runPromise(❌)Effect.runPromise - 管道链中是否提供了(备选✅)
SentryTracingLive
运行命令:
effect-solutions show services-and-layers8. Option/Either Internal Tag Anti-Patterns
8. Option/Either内部标签反模式
Check for direct branching on / in production code and tests.
_tagOptionEither- Production code: report all direct usage as findings with replacement recommendation
_tag - Tests: allow assertions for domain error identity, but flag control-flow branching patterns that should use helpers
_tag - Prefer:
- ,
Either.match,Either.isLeftEither.isRight - ,
Option.match,Option.isSome,Option.isNoneOption.getOrElse
Search patterns to include:
if (.*\._tag === "Left")if (.*\._tag === "Right")if (.*\._tag === "Some")if (.*\._tag === "None")expect\(.*\._tag\)
Run:
effect-solutions show error-handling检查生产代码和测试中是否直接对/的进行分支判断。
OptionEither_tag- 生产代码:将所有直接使用的情况作为问题记录,并给出替代方案建议
_tag - 测试:允许使用断言领域错误的标识,但标记应使用辅助工具的控制流分支模式
_tag - 推荐使用:
- 、
Either.match、Either.isLeftEither.isRight - 、
Option.match、Option.isSome、Option.isNoneOption.getOrElse
需包含的搜索模式:
if (.*\._tag === "Left")if (.*\._tag === "Right")if (.*\._tag === "Some")if (.*\._tag === "None")expect\(.*\._tag\)
运行命令:
effect-solutions show error-handlingOutput Format
输出格式
Provide a structured report with:
-
Summary: Overall compliance score (e.g., 7/10)
-
What's Working Well: List patterns that follow best practices
-
Improvements Needed: List specific issues with:
- File location
- Current pattern
- Recommended pattern
- Priority (high/medium/low)
- Scope label: or
productiontest
-
Quick Wins: Easy fixes that can be done immediately
-
Next Steps: Recommended order of improvements
提供结构化报告,包含:
-
摘要:整体合规得分(例如:7/10)
-
合规项:符合最佳实践的模式列表
-
待改进项:列出具体问题,包含:
- 文件位置
- 当前模式
- 推荐模式
- 优先级(高/中/低)
- 范围标签:或
productiontest
-
快速修复项:可立即完成的简单修复
-
后续步骤:推荐的改进顺序
Related Skills
相关Skill
- — Effect services, layers, error handling, config patterns
effect-ts - — Vitest and @effect/vitest test patterns
testing-patterns - — General code review methodology (includes Effect section)
code-review
- — Effect服务、分层、错误处理、配置模式
effect-ts - — Vitest和@effect/vitest测试模式
testing-patterns - — 通用代码审查方法论(包含Effect章节)
code-review