effect-command-executor

Spawn and manage child processes with Effect's ChildProcess module and scoped cleanup.

1|Updated Aug 24, 2026
One-click install
npx skills add https://github.com/lambdasolver2/opencode-effect-harness --skill effect-command-executor-lambdasolver2
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: effect-command-executor
Source: https://github.com/lambdasolver2/opencode-effect-harness/tree/main/packages/module-typescript/assets/skills/effect-command-executor
Command: npx skills add https://github.com/lambdasolver2/opencode-effect-harness --skill effect-command-executor-lambdasolver2

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires effect, @effect/platform-node.

What problem does it solve? Running shell commands and external programs from TypeScript often leads to leaked processes, unhandled exit codes, and untyped errors. This Skill provides type-safe, composable child process execution using Effect v4's ChildProcess module with automatic resource cleanup via Scope. ## Core Features & Use Cases - Command Construction: Build commands with template literals, array forms, options (cwd, env, stdio), and combinators like setCwd, setEnv, and prefix. - Output Capture: Capture output as strings, lines, or streams; spawn handles for interactive control with stdin/stdout/stderr access. - Piping & Lifecycle: Pipe commands together (stdout, stderr, or combined), stream long-running process output, and manage lifecycles with Effect.scoped and force-kill timeouts. - Use Case: Build a DevTools service that runs git diff to list changed TypeScript files, streams bun lint output line-by-line, and fails with a typed domain error when the exit code is non-zero. ## Quick Start Use the effect-command-executor skill to run a shell command with Effect's ChildProcess module and capture its output as trimmed lines with scoped cleanup.

Frequently Asked Questions about effect-command-executor

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run a shell command in Effect TypeScript?

Use ChildProcess.make to build the command, then call spawner.string or spawner.lines from the ChildProcessSpawner service to execute it and capture output. These helpers manage Scope internally, so no explicit Effect.scoped is needed.

How do I capture command output as string or lines in Effect?

Use spawner.string for raw stdout as a single string and spawner.lines for an array of output lines. For per-chunk processing, use spawner.spawn and consume handle.all as a Stream with Stream.decodeText and Stream.splitLines.

Does Effect ChildProcess support piping commands together?

Yes, ChildProcess.pipeTo connects one command's output to another's stdin, equivalent to a shell pipeline. Options let you pipe stderr or combined stdout+stderr instead of the default stdout.

Why does my spawned process leak in Effect?

spawner.spawn returns a handle that requires a Scope for cleanup. Wrap the program in Effect.scoped so the process is terminated when the scope closes, or use spawner.string/lines which handle scoping internally.

How do I handle child process errors in Effect?

Child process operations fail with PlatformError, which you can catch with Effect.catchTag or map into typed domain errors using Effect.mapError with a Schema.TaggedError class. Avoid exposing PlatformError in your service API.

When should I use spawn instead of string or lines?

Use spawn when you need the process handle for interactive control: writing to stdin, streaming output while the process runs, checking isRunning, or killing with a custom signal. For simple output capture, string and lines are sufficient.