Chuyển đến nội dung
Skillpedia
API và máy chủ (backend)28k · #9874

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.md

Sao 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

Hãy dùng skill này để giúp tôi: https://github.com/Kilo-Org/kilocode/blob/main/.opencode/skills/effect/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

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.

  1. If .opencode/references/effect-smol is missing, clone https://github.com/Effect-TS/effect-smol there. Do this in the project, not in the skill folder.
  2. Search .opencode/references/effect-smol for exact APIs, examples, tests, and naming patterns before answering or implementing Effect-specific code.
  3. Also inspect existing repo code for local house style before introducing new patterns.
  4. 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") or Effect.fnUntraced(...) for named effects when adding reusable service methods or important workflows.
  • Prefer Effect Schema for API and domain data shapes. Use branded schemas for IDs and Schema.TaggedErrorClass for 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-smol or nearby code first.

Testing Patterns

  • Use testEffect(...) from packages/opencode/test/lib/effect.ts for 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

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự