xiaohongshu
xiaohongshu
Build and execute multi-step prompt chains for complex tasks
Full skill instructions
The Chain Builder skill helps you design and execute multi-step prompt chains where the output of one prompt becomes the input to the next. This enables complex, multi-stage processing that would be difficult to accomplish in a single prompt, while maintaining clarity, modularity, and debuggability.
This skill guides you through chain design, identifying optimal breakpoints, managing data flow between steps, handling errors, and validating outputs at each stage. It's particularly valuable for tasks that involve multiple distinct phases like research → analysis → synthesis → formatting, or ideation → planning → implementation → review.
Use this skill when you have complex tasks that benefit from sequential processing, when you need intermediate validation between steps, or when different parts of a task require different specialized prompts or tools.
| Action | Command/Trigger |
|---|---|
| Design new chain | "Design a prompt chain for [goal]" |
| Execute chain | "Run this chain: [chain spec]" |
| Debug chain failure | "Debug this chain: [error details]" |
| Optimize chain | "Optimize this chain: [chain spec]" |
| Validate chain design | "Review this chain design: [spec]" |
| Add stage to chain | "Add stage for [purpose] to this chain" |
| Parallelize stages | "Which stages can run in parallel?" |
Keep Stages Focused: Each stage should have one clear purpose
Make Outputs Explicit: Define exactly what each stage produces
Validate Between Stages: Catch errors early
Handle Errors Gracefully: Plan for failures
Maintain State Carefully: Track what you need, discard what you don't
Optimize Data Passing: Minimize token usage
Document Thoroughly: Make chains maintainable
Test Incrementally: Build confidence stage by stage
Stage 1: Collect → Stage 2: Process → Stage 3: Format → Output
Use when: Each stage depends on previous stage's complete output Example: Web scraping → Data cleaning → Analysis → Report generation
Stage 1: Analyze →
If condition A: Stage 2a → Merge
If condition B: Stage 2b → Merge
→ Stage 3: Synthesize
Use when: Different processing paths based on criteria Example: File type detection → [JSON parser | CSV parser | XML parser] → Normalize
Input →
[Stage 1a, Stage 1b, Stage 1c] (parallel) →
Stage 2: Combine →
Output
Use when: Independent analyses that merge later Example: [Syntax check, Type check, Lint] → Aggregate results → Report
Stage 1: Generate →
Stage 2: Critique →
If quality met: Output
If not: Refine → back to Stage 1 (max N iterations)
Use when: Output quality improves through iteration Example: Write → Review → [Good? → Done | Revise → Write]
Stage 1: Split →
[Process chunk 1, Process chunk 2, ..., Process chunk N] →
Stage 2: Merge →
Output
Use when: Large input needs parallel processing Example: Split document → [Analyze sections] → Synthesize findings
Stage 1 → Validate → Stage 2 → Validate → Stage 3 → Validate → Output
Use when: Quality gates needed between stages Example: Generate → Check syntax → Transform → Check schema → Deploy → Verify
chain:
name: "Chain Name"
description: "What this chain accomplishes"
version: "1.0.0"
stages:
- id: "stage_1"
name: "Stage Name"
prompt: "Prompt template with {{placeholders}}"
inputs:
- name: "input_name"
source: "user_input | previous_stage | context"
required: true
outputs:
- name: "output_name"
format: "json | markdown | text"
schema: "Optional JSON schema"
validation:
- type: "format | content | schema"
rule: "Validation rule"
on_fail: "retry | skip | abort"
on_error:
action: "retry | fallback | abort"
max_retries: 3
- id: "stage_2"
name: "Next Stage"
prompt: "Use {{stage_1.output_name}} to..."
# ... rest of stage definition
execution:
mode: "sequential | parallel | conditional"
timeout_per_stage: 300
max_total_time: 1800
**Chain**: Research Report Generator
**Stage 1**: Web Research
- Prompt: "Research [topic] using web search. Find 5-10 authoritative sources."
- Output: List of sources with summaries
- Validation: At least 5 sources, each with URL and summary
**Stage 2**: Content Analysis
- Input: Sources from Stage 1
- Prompt: "Analyze these sources and extract key themes, findings, and insights."
- Output: Structured analysis (JSON)
- Validation: JSON schema with required fields
**Stage 3**: Report Writing
- Input: Analysis from Stage 2
- Prompt: "Write executive report based on analysis. Include summary, findings, recommendations."
- Output: Markdown report
- Validation: Contains required sections
**Stage 4**: Formatting
- Input: Report from Stage 3
- Prompt: "Format report for [platform] with proper structure and styling."
- Output: Platform-ready document
**Chain**: Tested Code Generator
**Stage 1**: Generate Code
- Prompt: "Generate [component] with [requirements]"
- Output: Code file(s)
- Validation: Valid syntax, includes all required functions
**Stage 2**: Code Review
- Input: Code from Stage 1
- Prompt: "Review code for bugs, performance issues, best practices"
- Output: Review findings (JSON)
- Validation: Categorized by severity
**Stage 3**: Apply Fixes
- Input: Code and Review findings
- Prompt: "Fix high and medium severity issues"
- Output: Revised code
- Validation: Addresses all high-severity issues
**Stage 4**: Generate Tests
- Input: Final code
- Prompt: "Generate unit tests with >80% coverage"
- Output: Test file(s)
- Validation: Tests run and pass
**Stage 5**: Verify
- Input: Code and tests
- Action: Run tests
- Output: Test results
- Validation: All tests pass
**Chain**: Blog Post Creator
**Stage 1**: Research & Ideation
- Prompt: "Research [topic] and generate 5 article angles"
- Output: List of angles with brief descriptions
**Stage 2**: Select & Outline
- Input: Angles from Stage 1
- Prompt: "Select best angle and create detailed outline"
- Output: Article outline
**Stage 3**: Draft Content
- Input: Outline from Stage 2
- Prompt: "Write full article following outline"
- Output: Article draft (markdown)
**Stage 4**: Edit & Polish
- Input: Draft from Stage 3
- Prompt: "Edit for clarity, flow, grammar, and engagement"
- Output: Polished article
**Stage 5**: Generate Metadata
- Input: Article from Stage 4
- Prompt: "Generate title variations, meta description, tags"
- Output: SEO metadata
**Stage 6**: Format for Platform
- Input: Article and metadata
- Prompt: "Format for [CMS] with proper structure"
- Output: Platform-ready post
When a chain fails:
Track these metrics:
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience