effect
Skill này làm gì
Skill này hướng dẫn viết code TypeScript với thư viện Effect, bao gồm service, schema, lỗi có kiểu và workflow nhiều bước. Dành cho lập trình viên dùng Effect và muốn code chính xác, cập nhật.
Khi nào nên dùng
- ✓Khi bạn đang viết hoặc thay đổi code TypeScript dùng Effect.
- ✓Khi bạn cần lỗi có kiểu, schema hoặc service xây bằng Effect.
- ✓Khi bạn muốn các mẫu Effect v4 hiện tại được đối chiếu với mã nguồn thư viện.
Liên kết skill
https://github.com/Kilo-Org/kilocode/blob/main/.opencode/skills/effect/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Tôi cần một service trong backend TypeScript của mình dùng Effect với lỗi có kiểu và một schema cho dữ liệu yêu cầu.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent kiểm tra mã nguồn thư viện Effect hiện tại để lấy API và ví dụ chính xác, theo các mẫu có sẵn của dự án, rồi viết code. Nó giữ các handler HTTP gọn và đặt quy tắc nghiệp vụ trong service.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Effect
This codebase uses Effect for typed, composable TypeScript services, schemas, and workflows.
Source Of Truth
Use the current Effect v4 / effect-smol source, not memory or older Effect v2/v3 examples.
- If
.opencode/references/effect-smolis missing, clonehttps://github.com/Effect-TS/effect-smolthere. Do this in the project, not in the skill folder. - Search
.opencode/references/effect-smolfor exact APIs, examples, tests, and naming patterns before answering or implementing Effect-specific code. - Also inspect existing repo code for local house style before introducing new patterns.
- Prefer answers and implementations backed by specific source files or nearby repo examples.
Guidelines
- Prefer current Effect v4 APIs and project-local patterns over old blog posts, examples, or package-memory guesses.
- Use
Effect.gen(function* () { ... })for multi-step workflows. - Use
Effect.fn("Name")orEffect.fnUntraced(...)for named effects when adding reusable service methods or important workflows. - Prefer Effect
Schemafor API and domain data shapes. Use branded schemas for IDs andSchema.TaggedErrorClassfor typed domain errors when modeling new error surfaces. - Keep HTTP handlers thin: decode input, read request context, call services, and map transport errors. Put business rules in services.
- In Effect service code, prefer Effect-aware platform abstractions and dependencies over ad hoc promises where the surrounding code already does so.
- Keep layer composition explicit. Avoid broad hidden provisioning that makes missing dependencies hard to see.
- In tests, prefer the repo's existing Effect test helpers and live tests for filesystem, git, child process, locks, or timing behavior.
- Do not introduce
any, non-null assertions, unchecked casts, or older Effect APIs just to satisfy types. - Do not answer from memory. Verify against
.opencode/references/effect-smolor nearby code first.
Testing Patterns
- Use
testEffect(...)frompackages/opencode/test/lib/effect.tsfor tests that exercise Effect services, layers, runtime context, scoped resources, or platform integrations. - Use
it.live(...)for filesystem, git repositories, HTTP servers, sockets, child processes, locks, real time, and other live platform behavior. - Run tests from package directories such as
packages/opencode; never run package tests from the repo root. - Prefer explicit test layers over ad hoc managed runtimes. Keep dependency provisioning visible in the test file.
- Use scoped fixtures and finalizers for resources that must be cleaned up, including temporary directories, flags, databases, fibers, servers, and global state.
Câu hỏi thường gặp
Nó nhắm đến phiên bản Effect nào?
Nó nhắm đến Effect v4, còn gọi là effect-smol, chứ không phải các ví dụ v2 hay v3 cũ hơn.
Nó tra cứu API ở đâu?
Nó tìm trong một bản sao cục bộ của mã nguồn effect-smol, và clone nếu bản đó không có.
Lỗi được xử lý thế nào?
Lỗi nghiệp vụ dùng các lớp lỗi có tag để có thể xử lý theo kiểu.
Chi tiết
Mô tả gốc của tác giả
Work with Effect v4 / effect-smol TypeScript code in this repo
repo: Kilo-Org/kilocode
Độ phổ biến
- Sao GitHub
- 28k
- Vị trí xếp hạng
- #9874
- Giấy phép
- MIT
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
chart
28kCho phép agent của bạn vẽ biểu đồ cột, đường, tròn, phân tán hoặc tương tự khi bạn yêu cầu, bằng một công cụ biểu đồ hiển thị dữ liệu.
jetbrains-sandbox
28kCho phép agent của bạn cài IntelliJ trong sandbox đám mây Linux, có chế độ xem trên trình duyệt và công cụ điều khiển IDE.
rtl-aware-development
28kDạy agent của bạn xây dựng giao diện hoạt động cho các ngôn ngữ viết từ phải sang trái, dùng bố cục logic và văn bản hỗn hợp chiều được cô lập.
Skill tương tự
api-connector-builder
280kGiúp agent của bạn xây dựng kết nối API mới theo đúng mẫu đã có, dùng khi bạn cần thêm một tích hợp mà không tạo cách làm mới.
api-design
280kGiúp agent của bạn thiết kế REST API theo các thực hành tốt nhất, hữu ích để định nghĩa cách API giao tiếp, hiển thị lỗi và tổ chức dữ liệu.
backend-patterns
280kGiúp agent của bạn với các mẫu kiến trúc phía máy chủ và tối ưu cơ sở dữ liệu, hữu ích khi xây dựng hoặc rà soát code chạy trên máy chủ.