LLM(大規模言語モデル)の操作用に \.prompt ファイルを作成します。出力用SDK(ソフトウェア開発キット)のワークフロー内で使用できます。 次のような場合に使用: - プロンプト(AIへの指示文)を設計する - LLMプロバイダー(提供業者)を設定する - Liquid.js テンプレート(データを埋め込める雛形)を使う
Create .prompt files for LLM operations in Output SDK workflows. Use when designing prompts, configuring LLM providers, or using Liquid.js templating.
This skill documents how to create .prompt files for LLM operations in Output SDK workflows. Prompt files use YAML frontmatter for configuration and Liquid.js templating for dynamic content.
Prompt files are stored INSIDE the workflow folder:
src/workflows/{workflow-name}/
├── workflow.ts
├── steps.ts
├── types.ts
└── prompts/
├── analyzeContent@v1.prompt
├── generateSummary@v1.prompt
└── extractData@v2.prompt
Important: Prompts are workflow-specific and live inside the workflow folder, NOT in a shared location.
{promptName}@v{version}.prompt
Examples:
generateImageIdeas@v1.promptanalyzeContent@v1.promptsummarizeText@v2.promptThe version suffix (@v1, @v2) allows for prompt versioning without breaking existing code.
Picking a model? See
output-dev-model-selectionfor the current decision tree and AI Gateway lookup script. Examples below show concrete IDs as of 2026-05-04 — refresh them with that skill.
---
provider: anthropic
# current as of 2026-05-04 — run output-dev-model-selection for the latest
model: claude-sonnet-4-6
temperature: 0.7
maxTokens: 4096
---
<system>
System instructions go here.
</system>
<user>
User message with {{ variable }} placeholders.
</user>
The body uses exactly one mode:
messages. Use it with generateText, generateTextWithStreaming, streamText, and Agent.instructions. Use it with generateImage or when consuming loadPrompt() results directly:---
provider: openai
model: gpt-image-1
---
Create a cinematic image of {{ subject }}.
Leading whitespace and HTML comments do not affect mode selection. Once plain text selects instruction mode, later tag-shaped text remains part of the instructions.
---
provider: anthropic # LLM provider: anthropic, openai, google-vertex, amazon-bedrock, azure, perplexity
# current as of 2026-05-04 — run output-dev-model-selection for the latest
model: claude-sonnet-4-6
---
All prompt files in a workflow should use the same provider unless the user explicitly requests otherwise. Mixing providers (e.g., some prompts using anthropic and others using openai) requires the user to have API keys for all providers, which causes runtime failures if they don't.
When no existing prompts dictate a provider, default to anthropic. For the model itself, see output-dev-model-selection — it walks priority (reasoning/balance/speed/cost), provider lookup, and produces a current model ID.
---
provider: anthropic
# current as of 2026-05-04 — run output-dev-model-selection for the latest
model: claude-sonnet-4-6
temperature: 0.7 # 0.0 to 1.0, default varies by provider
maxTokens: 4096 # Maximum output tokens
maxSteps: 5 # Tool-loop ceiling when tools or skills are present (default 10)
skills: # Skill file or directory paths, relative to this prompt
- ./skills
providerOptions: # Provider-specific options
thinking:
type: enabled
budgetTokens: 2000
---
Frontmatter is a strict camelCase allowlist. Unknown top-level keys throw Invalid prompt file. A snake_case alias of a known field fails with a suggestion (max_tokens -> use maxTokens). Put provider-specific keys (effort, reasoningEffort, topP) under providerOptions, which stays open. Nested thinking stays open too (budgetTokens is the documented key; extra nested keys are not rejected as unknown top-level config).
Allowed top-level keys: provider, model, temperature, maxTokens, maxSteps, skills, tools, providerOptions, messageOptions, n, maxImagesPerCall, size, aspectRatio, seed.
Call arguments: prompt, promptDir, variables, tools, output, toolChoice, stopWhen, abortSignal on generateText (plus onChunk on generateTextWithStreaming; plus onChunk / onFinish / onError on streamText). generateImage: prompt, promptDir, variables, images, mask, abortSignal.
Each example below pins a model that was current as of 2026-05-04. Run
output-dev-model-selectionwhen picking or refreshing.
---
provider: anthropic
model: claude-sonnet-4-6
temperature: 0.7
maxTokens: 8192
---
---
provider: anthropic
model: claude-sonnet-4-6
temperature: 0.7
maxTokens: 32000
providerOptions:
thinking:
type: enabled
budgetTokens: 2000
---
---
provider: openai
# current as of 2026-05-04 — run output-dev-model-selection for the latest
model: gpt-5-5
temperature: 0.7
maxTokens: 4096
---
---
provider: google-vertex
# current as of 2026-05-04 — run output-dev-model-selection for the latest
model: gemini-3-pro
temperature: 0.7
maxTokens: 8192
---
Message mode uses a small XML-like syntax, not a general HTML or XML parser. The only valid top-level role tags are <system>, <user>, and <assistant>.
Do not author <tool> blocks. AI SDK tool results are structured message parts tied to a preceding tool call; AI SDK creates them during execution, and Agent callers may supply them through messages or messageStore.
Follow these parser rules:
<context> inside <user>, remain message content.<user>example</user>.Array<string>.options attribute is supported. It must have a value naming one or more frontmatter messageOptions sets, for example options="cached fast". Bare options and unknown attributes throw when the prompt loads.<system>
You are an expert at analyzing technical content.
Your responses should be clear and structured.
</system>
<user>
Please analyze the following content:
{{ content }}
</user>
<assistant>
I'll analyze this content step by step...
</assistant>
<user>
Analyze this content about {{ topic }}:
{{ content }}
Generate {{ numberOfIdeas }} ideas.
</user>
<system>
You are an expert content analyzer.
{% if colorPalette %}
**Color Palette Constraints:** {{ colorPalette }}
{% endif %}
{% if artDirection %}
**Art Direction Constraints:** {{ artDirection }}
{% endif %}
</system>
<user>
Analyze each of these items:
{% for item in items %}
- {{ item.name }}: {{ item.description }}
{% endfor %}
</user>
<user>
Generate {{ numberOfIdeas | default: 3 }} ideas for {{ topic }}.
</user>
Based on a real prompt file (generateImageIdeas@v1.prompt):
---
provider: anthropic
# current as of 2026-05-04 — run output-dev-model-selection for the latest
model: claude-sonnet-4-6
temperature: 0.7
maxTokens: 32000
providerOptions:
thinking:
type: enabled
budgetTokens: 2000
---
<system>
You are an expert at creating structured, precise infographic prompts optimized for Gemini's image generation model.
Your task is to generate prompts for informational infographics that illustrate key concepts from the provided content.
CRITICAL RULES you MUST follow:
- Use Markdown dashed lists to specify constraints
- Use ALL CAPS for "MUST" requirements to ensure strict adherence
- Include specific compositional constraints (e.g., rule of thirds, lighting)
- Always include negative constraints to prevent unwanted elements
- Keep each infographic focused on ONE clear concept
{% if colorPalette %}
**Color Palette Constraints:** {{ colorPalette }}
{% endif %}
{% if artDirection %}
**Art Direction Constraints:** {{ artDirection }}
{% endif %}
</system>
<user>
Generate {{ numberOfIdeas }} structured infographic prompts based on key topics from this content.
<content>
{{ content }}
</content>
Each prompt MUST follow this structure:
Create an infographic about [specific topic]. The infographic MUST follow ALL of these constraints:
- The infographic MUST use the reference images as a visual style guide
- The composition MUST follow the rule of thirds for visual balance
- The infographic MUST use clean, minimal design with simple lines and shapes
{% if colorPalette %}- The color palette MUST strictly follow: {{ colorPalette }}{% endif %}
{% if artDirection %}- The art direction MUST strictly follow: {{ artDirection }}{% endif %}
- NEVER include any watermarks, logos, or decorative overlays
- NEVER use generic AI art buzzwords like "hyperrealistic"
Focus on the most important concepts that would benefit from visual explanation.
</user>
The variables field in generateText and Agent accepts scalars, nested objects, and arrays. Pass structured data directly when the prompt benefits from Liquid loops, conditions, or dot notation:
const { output } = await generateText( {
prompt: 'rank@v1',
variables: {
stories: storyArray,
interests: interestArray
}
} );
{% for story in stories %}
- {{ story.title }} (score: {{ story.score }}, by: {{ story.author }})
{% endfor %}
Interests: {{ interests | join: ", " }}
Pre-format data in the step only when the exact rendered text is application logic rather than prompt presentation.
import { generateText, aiSdk } from '@outputai/llm';
import { z } from '@outputai/core';
const { output } = await generateText( {
prompt: 'generateImageIdeas@v1', // References prompts/generateImageIdeas@v1.prompt
variables: {
content: 'Solar panel technology explained...',
numberOfIdeas: 3,
colorPalette: 'blue and green tones',
artDirection: 'minimalist style'
},
output: aiSdk.Output.object( {
schema: z.object( {
ideas: z.array( z.string() )
} )
} )
} );
// output contains { ideas: [...] }
import { generateText } from '@outputai/llm';
const { result } = await generateText( {
prompt: 'summarize@v1',
variables: {
content: 'Long article text...',
maxLength: 200
}
} );
// result contains the generated text string
Prompts can load skill files that provide lazy-loaded instructions to the LLM. Skills keep the initial context small while giving the LLM access to deep expertise on demand. See output-dev-skill-file for the full guide on creating skill files.
Place .md files next to the prompt (commonly in prompts/skills/) and list the path in frontmatter. A sibling skills/ folder is not loaded unless you list it:
src/workflows/{workflow-name}/
└── prompts/
├── writing_assistant@v1.prompt
└── skills/
├── clarity_guidelines.md
└── structure_guide.md
---
provider: anthropic
model: claude-sonnet-4-6
skills:
- ./skills
---
Mention load_skill in the system message so the LLM knows to use it:
<system>
You are an expert technical writing assistant.
Use load_skill to get the full instructions for any skill before applying it.
</system>
List skills: paths in this prompt's frontmatter. See output-dev-skill-file for the file format and path rules.
Prompts work with both generateText and the Agent class. Use Agent for multi-step tool loops and stateful conversations. See output-dev-agent-class for the full guide.
import { Agent, aiSdk } from '@outputai/llm';
const agent = new Agent( {
prompt: 'writing_assistant@v1',
variables: {
content_type: 'documentation',
focus: 'clarity',
content: input.content
},
output: aiSdk.Output.object( { schema: reviewSchema } )
} );
const { output } = await agent.generate();
When a step uses aiSdk.Output.object() with generateText, the Zod schema is automatically sent to the LLM provider as a tool definition. The LLM already knows the exact JSON shape it must return. Do not also specify the schema in the prompt.
This is a best practice documented by multiple LLM providers:
.describe() on fields is how you guide the model's output. The SDK automatically transforms unsupported constraints into field descriptions.Why this matters:
When aiSdk.Output.object() is used, do not include any of these in the prompt:
## Output Format sections describing the JSON shape<!-- WRONG - prompt duplicates what aiSdk.Output.object() already sends -->
<system>
## Output Format
Return a JSON object with this shape:
{
"title": "string",
"summary": "string",
"tags": ["string"]
}
</system>
Use the prompt for quality expectations, domain knowledge, and content guidance -- things the schema cannot express:
<!-- CORRECT - prompt focuses on content quality, not structure -->
<system>
Write a concise, specific title (under 80 characters).
The summary should capture the main argument, not just the topic.
Choose tags from the reader's domain -- avoid generic terms like "technology".
</system>
.describe() on Schema Fields InsteadThe right place to communicate field-level expectations is on the schema itself, using .describe(). LLM providers use these descriptions when generating output:
// In types.ts -- .describe() guides the LLM on each field
const ArticleSummarySchema = z.object( {
title: z.string().describe( 'Concise title under 80 characters' ),
summary: z.string().describe( 'One-sentence summary capturing the main argument' ),
tags: z.array( z.string() ).describe( '3-5 domain-specific tags, avoid generic terms' )
} );
The schema handles structure AND field-level guidance; the prompt handles task framing, methodology, and quality standards.
If generateText is called without aiSdk.Output.object() (plain text output), then including output format instructions in the prompt is appropriate since no schema is sent to the provider.
<system>
CRITICAL RULES you MUST follow:
- Rule 1
- Rule 2
- NEVER do X
- ALWAYS do Y
</system>
<user>
Analyze the following:
<content>
{{ content }}
</content>
<requirements>
{{ requirements }}
</requirements>
</user>
<system>
You analyze sentiment. Return: positive, negative, or neutral.
</system>
<user>
"I love this product!"
</user>
<assistant>
positive
</assistant>
<user>
"{{ text }}"
</user>
When making significant changes, create a new version:
analyzeContent@v1.prompt - OriginalanalyzeContent@v2.prompt - Improved with better examplesUpdate the step to use the new version:
prompt: 'analyzeContent@v2' // Changed from v1
{% if optionalField %}
Additional context: {{ optionalField }}
{% endif %}
The model lines in the patterns below were current as of 2026-05-04. Refresh via
output-dev-model-selectionwhen copying into a new prompt.
---
provider: anthropic
model: claude-sonnet-4-6
temperature: 0.3
---
<system>
You are a content classifier. Categorize content into exactly one category.
Available categories: {{ categories | join: ", " }}
</system>
<user>
Classify this content:
{{ content }}
</user>
---
provider: anthropic
model: claude-sonnet-4-6
temperature: 0.2
---
<system>
You extract structured data from text. Be precise and only include information explicitly stated.
</system>
<user>
Extract the following fields from this text:
{% for field in fields %}
- {{ field }}
{% endfor %}
Text:
{{ text }}
</user>
---
provider: anthropic
# current as of 2026-05-04 — run output-dev-model-selection for the latest
model: claude-sonnet-4-6
temperature: 0.8
---
<system>
You are a creative writer. Generate engaging content based on the given parameters.
</system>
<user>
Generate {{ count }} {{ type }} about {{ topic }}.
Requirements:
{{ requirements }}
</user>
prompts/ folder inside workflow directory{promptName}@v{version}.promptprovider and modeltopP, effort, reasoningEffort, max_tokens)generateImage / direct loadPrompt() consumption<system>, <user>, <assistant>); no authored <tool> blocks<user>...</user>)options="<messageOptions names>"; options is never bare{{ variableName }} syntax{% if %}...{% endif %} syntaxaiSdk.Output.object() (schema handles structure)skills: paths (a sibling skills/ folder is not auto-loaded)maxSteps when the default of 10 is wrongoutput-dev-skill-file - Creating skill files for promptsoutput-dev-agent-class - Using the Agent class with promptsoutput-dev-step-function - Using prompts in step functionsoutput-dev-evaluator-function - Using prompts in evaluatorsoutput-dev-folder-structure - Understanding prompts folder locationoutput-dev-workflow-function - Orchestrating LLM-powered stepsoutput-eval-judge-prompt — Methodology for designing effective LLM judge prompts原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。