effect-ai-prompt

Constructs type-safe prompts and conversation history for Effect AI language models.

3|Updated Apr 1, 2026
One-click install
npx skills add https://github.com/mpsuesser/opencode-effect-enforcer --skill effect-ai-prompt-mpsuesser
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: effect-ai-prompt
Source: https://github.com/mpsuesser/opencode-effect-enforcer/tree/main/skills/effect-ai-prompt
Command: npx skills add https://github.com/mpsuesser/opencode-effect-enforcer --skill effect-ai-prompt-mpsuesser

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building multi-turn conversations for language models in Effect requires correctly assembling messages, parts, tool calls, and history without mutating state or mishandling streaming responses. This Skill provides the complete Prompt API reference so agents construct, merge, and serialize prompts correctly on the first attempt. ## Core Features & Use Cases - Message and Part Construction: Create system, user, assistant, and tool messages with text, reasoning, file, tool-call, tool-result, and tool-approval parts using typed constructors. - Prompt Composition and History: Merge prompts with Prompt.concat, manage system messages with setSystem/prependSystem/appendSystem, and convert streaming responses into history via Prompt.fromResponseParts. - Serialization and Provider Options: Encode prompts to JSON with Schema codecs and attach provider-specific options such as OpenAI prompt cache breakpoints or Anthropic cache control. - Use Case: When building a chat interface with LanguageModel.generateText, use this Skill to maintain conversation history in a SubscriptionRef, append user input, and fold model responses back into the prompt. ## Quick Start Use the effect-ai-prompt skill to build a multi-turn conversation with a system message and pass it to LanguageModel.generateText.

Frequently Asked Questions about effect-ai-prompt

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

FAQPage Schema
How do I build a multi-turn conversation prompt in Effect AI?▼

Use Prompt.make with an array of encoded messages covering system, user, and assistant roles, or compose prompts with Prompt.concat. Shorthand constructors like Prompt.systemMessage and Prompt.userMessage create individual messages with typed parts.

How to convert streaming AI responses into prompt history?▼

Use Prompt.fromResponseParts to fold streaming text and reasoning deltas into complete messages. It places tool calls and approval requests in assistant messages, skips preliminary tool results, and keeps provider-executed results in the assistant message.

Does Effect AI Prompt support multimodal file attachments?▼

Yes, file parts accept data as a URL, Uint8Array, or base64 data string along with mediaType and fileName. For OpenAI, strings are treated as provider file IDs only when they match configured fileIdPrefixes.

How do I serialize an Effect AI prompt to JSON?▼

Use Schema.fromJsonString(Prompt.Prompt) to create a JSON codec, then encode or decode with Schema.encodeEffect and Schema.decodeUnknownEffect. There is no Prompt.FromJson export in Effect v4.

Why should I avoid mutating prompt content directly?▼

Prompt content is readonly, so pushing messages into the array fails. Use Prompt.concat to append messages and Prompt.setSystem, prependSystem, or appendSystem to modify system instructions immutably.