opencode-effect
Skill2 starsChanged todayApache-2.0View on GitHub
Develop and migrate OpenCode V2 plugins, clients, SDK hosts, and HTTP API integrations. Use for the OpenCode plugin API, `@opencode/client`, `@opencode/sdk`, server API, Effect entrypoints, or V1-to-V2 API migration.
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 4 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
Use OpenCode V2 and its Effect-native APIs unless the user explicitly asks for a Promise-only integration or hybrid compatibility.
- Distinctive: line 14
Read the relevant current V2 guide before writing code:
- Distinctive: line 21
Treat moving tags in installation examples as discovery inputs, not package constraints.
- Very specific: line 22
Do not infer V2 contracts from V1 docs or from https://opencode.ai/config.json.
- Very specific: line 26
Write plugins with @opencode/plugin/effect, Plugin.define, and an effect function.
- Very specific: line 30
Keep decoded branded values such as AbsolutePath, Location.Ref, and resource IDs.
- Very specific: line 31
Keep expected client failures in the Effect error channel.
- Very specific: line 72
Use Stream operators for client.event.subscribe() and other streaming operations.
- Very specific: line 97
Use @opencode/client, @opencode/client/service, or the Promise SDK only inside that documented exception.
- Distinctive: line 98
Treat V1 plugin and server APIs as migration inputs only.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
OpenCode V2 Development
Use OpenCode V2 and its Effect-native APIs unless the user explicitly asks for a Promise-only integration or hybrid compatibility.
Source Rule
- Read the relevant current V2 guide before writing code:
- plugins: https://opencode.ai/v2/docs/build/plugins/effect
- network client: https://opencode.ai/v2/docs/build/client/effect
- embedded SDK: https://opencode.ai/v2/docs/build/sdk/effect
- HTTP API: https://opencode.ai/v2/docs/api
- V1 migration inputs: https://opencode.ai/v2/docs/migrate-v1
- Check the target project's exact pinned OpenCode and Effect package versions. Inspect both published metadata and the installed
package.jsonexportsmap before using a subpath. Confirm that every OpenCode package resolves to a mutually compatible release and that Effect platform packages use the same Effect release channel. - Treat moving tags in installation examples as discovery inputs, not package constraints. Resolve and lock exact versions. Do not assume separately moving plugin, client, and SDK tags form a compatible set, or replace a missing Effect export with a Promise/root entrypoint.
- Do not infer V2 contracts from V1 docs or from
https://opencode.ai/config.json.
Defaults
- Write plugins with
@opencode/plugin/effect,Plugin.define, and aneffectfunction. Use the pluginScopefor registrations, finalizers, and scoped fibers instead of manual Promise cleanup. - Connect applications with
@opencode/client/effect. Compose operations withEffect, consume subscriptions asStreamvalues, and use@opencode/client/effect/servicefor the Node background service. - Embed OpenCode with
@opencode/sdk/effect. Own the host withEffect.scopedor provide it throughOpenCode.layer(). - Use the generated client instead of hand-written HTTP calls when an endpoint is available. For direct API work, verify the operation and schema in the V2 API reference or the running server's
/openapi.json, use Effect'sHttpClient, and decode request and response boundaries withSchema. - Keep decoded branded values such as
AbsolutePath,Location.Ref, and resource IDs. Do not cast plain strings or untrusted responses into them. - Keep expected client failures in the Effect error channel. Use
Effect.orDieonly when the surrounding application deliberately treats that failure as a defect.
Plugin Example
import { Plugin } from "@opencode/plugin/effect"
import { Effect } from "effect"
export default Plugin.define({
id: "example",
effect: (ctx) =>
Effect.gen(function* () {
yield* ctx.storage.set("loaded", true)
yield* Effect.addFinalizer(() => ctx.storage.remove("loaded"))
}),
})Plugin hook callbacks and registered command, tool, integration, or websearch executors return Effect values. Tool inputs and outputs use Effect Schema rather than unchecked JSON Schema casts.
Client Example
import { AbsolutePath, Location, OpenCode } from "@opencode/client/effect"
import { Effect } from "effect"
import { FetchHttpClient } from "effect/unstable/http"
const program = Effect.gen(function* () {
const client = yield* OpenCode.make({ baseUrl: "http://localhost:4096" })
return yield* client.session.create({
location: Location.Ref.make({
directory: AbsolutePath.make("/workspace"),
}),
})
})
const session = await Effect.runPromise(
program.pipe(Effect.provide(FetchHttpClient.layer)),
)Use Stream operators for client.event.subscribe() and other streaming operations. Provide the required HTTP, filesystem, and platform layers at the application boundary, not inside reusable workflows.
SDK Example
import { AbsolutePath, Location, OpenCode } from "@opencode/sdk/effect"
import { Effect } from "effect"
const program = Effect.scoped(
Effect.gen(function* () {
const opencode = yield* OpenCode.create()
return yield* opencode.sessions.create({
location: Location.Ref.make({
directory: AbsolutePath.make("/workspace"),
}),
})
}),
)
const session = await Effect.runPromise(program)Promise And V1 Exceptions
- Retain Promise plugin, client, or SDK code only when documenting migration input, maintaining a concrete Promise-only consumer, or providing an explicitly labelled hybrid compatibility path. Keep the Effect result as the recommended V2 output.
- Use
@opencode/client,@opencode/client/service, or the Promise SDK only inside that documented exception. Do not present them as the default V2 starting point. - Treat V1 plugin and server APIs as migration inputs only. V1 plugins do not run on V2, and V1 server integrations must move to the V2 API.
- Preserve supported V1 configuration only when compatibility is the goal; new native V2 configuration and code should use V2 shapes and entrypoints.
Verification
Typecheck examples against the target project's exact locked package set after verifying every imported subpath in published and installed package metadata. Exercise plugin load and cleanup, and run one real client or SDK operation. For direct HTTP work, verify the same operation with opencode2 api or the Effect-native generated client.
In this repository56 other files it gives its agents.
- AGENTS.mdAGENTS.md
- agentic-workflowsSkill
- asking-questionsSkill
- broSkill
- browser-accessSkill
- change-review-handoffSkill
- changeset-scopeSkill
- check-skill-updatesSkill
- chillSkill
- ci-loopSkill
- cleanup-unnecessary-variablesSkill
- code-reviewSkill
- decision-modelsSkill
- diagnoseSkill
- effect-principlesSkill
- evidence-firstSkill
- gh-stackSkill
- git-contextSkill
- github-development-rulesetsSkill
- github-repository-setupSkill
- grillingSkill
- handoffSkill
- herdr-workflowsSkill
- home-assistant-frontendSkill
- home-assistant-lit-renderingSkill
- human-step-guideSkill
- import-external-skillSkill
- inbox-reportingSkill
- issue-loopSkill
- lit-renderingSkill
- maintain-docsSkill
- npm-jsr-first-publishSkill
- pitchfork-dev-serversSkill
- pkexec-rootSkill
- planSkill
- release-oxlint-rulesSkill
- remote-change-diffSkill
- remove-single-use-functionsSkill
- researchSkill
- retroSkill
- review-stagesSkill
- review-steeringSkill
- safe-process-signalsSkill
- session-coordinationSkill
- shared-workflowsSkill
- show-meSkill
- skill-prefixesSkill
- staged-implementationSkill
- task-focusSkill
- task-runnersSkill
- testingSkill
- to-questionnaireSkill
- types-enforce-tsSkill
- wranglerSkill
- writing-dot-skillsSkill
- writing-styleSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

