# How to Handle User Input and Context in Claude Plugin Requests: A Complete Guide

> Master Claude plugin requests by handling user input and context effectively. Learn to use SKILL.md, AskUserQuestion tool, and plan-first workflow to prevent errors.

- Repository: [Anthropic/claude-plugins-community](https://github.com/anthropics/claude-plugins-community)
- Tags: how-to-guide
- Published: 2026-09-10

---

**Claude plugins use declarative [`SKILL.md`](https://github.com/anthropics/claude-plugins-community/blob/main/SKILL.md) files to extract user context via media references, enforce confirmation gates through the `AskUserQuestion` tool, and manage execution state through a plan-first workflow that prevents costly errors.**

Claude plugins in the `anthropics/claude-plugins-community` repository handle user input and context through skill markdown files that encode conversational flows, validation rules, and context-management policies without hard-coded logic. This declarative architecture allows the Claude runtime to automatically enforce safety constraints directly from markdown documentation, ensuring that ambiguous requests are resolved explicitly and expensive operations are user-approved before execution.

## The Skill-Driven Architecture

Every Claude plugin ships with a master **skill definition file** that serves as the single source of truth for handling user interactions. In [`quickdesign/skills/quickdesign/SKILL.md`](https://github.com/anthropics/claude-plugins-community/blob/main/quickdesign/skills/quickdesign/SKILL.md), the plugin defines **cardinal rules** and decision trees that govern how the model processes requests.

The skill file mandates specific architectural patterns:

- **Validation rules** that determine when user input requires clarification
- **Context extraction** policies for handling media references
- **Confirmation gates** that pause execution before credit-spending operations
- **Plan-first requirements** that generate cost estimates before invocation

By keeping logic in declarative markdown rather than code, plugins can update their behavior without redeployment, and the Claude runtime automatically enforces these constraints during request processing.

## Extracting Media Context from User Input

When users provide media inputs such as images, audio, or video, the plugin references these via **context tokens** rather than embedding raw bytes in the prompt. The skill mandates using `@ImageN`, `@AudioN`, and `@VideoN` references (where N is the index) to maintain concise, deterministic prompts.

According to the [`SKILL.md`](https://github.com/anthropics/claude-plugins-community/blob/main/SKILL.md) specification, every media reference must be passed to the underlying CLI tool to ensure the model's prompt remains lightweight. For example, when processing a video generation request with reference images:

```bash
quickdesign video generate \
  --provider seedance \
  --reference-image avatar.jpg \
  --reference-audio seg1-audio.mp3 \
  --duration 12 \
  -p 'Script content here' \
  -o output.mp4

```

This approach extracts the context from the conversational turn and binds it to specific CLI arguments, allowing the model to reason about the content without bloating the context window with base64-encoded media.

## Enforcing Confirmation Gates with AskUserQuestion

Before any operation that consumes credits or generates external resources, the plugin must pause and request explicit user confirmation. This is implemented through the **`AskUserQuestion`** tool, defined in [`quickdesign/skills/quickdesign/references/confirmation-rules.md`](https://github.com/anthropics/claude-plugins-community/blob/main/quickdesign/skills/quickdesign/references/confirmation-rules.md).

The tool presents structured choices to resolve ambiguity. For example, when a user requests an ambiguous "UGC video," the skill mandates calling `AskUserQuestion` to determine if the output should be spoken or silent:

```json
{
  "tool": "AskUserQuestion",
  "args": {
    "question": "Do you want a spoken video or a silent video?",
    "options": [
      {"label":"Spoken (recommended)","value":"spoken"},
      {"label":"Silent (no voice)","value":"silent"}
    ],
    "default":"spoken"
  }
}

```

This confirmation gate ensures that the model does not assume intent for ambiguous requests, preventing costly regeneration cycles when the initial output does not match user expectations.

## The Plan-First Execution Workflow

To handle user input safely, the plugin implements a **plan-first workflow** that generates a complete execution summary before invoking any Bash commands. This plan includes the model selection, duration, estimated cost, and script content, which is presented to the user via `AskUserQuestion` for approval.

The workflow begins with a plan generation command:

```bash
quickdesign video plan \
  --provider seedance \
  --duration 12 \
  --aspect-ratio 9:16 \
  --resolution 108p \
  -p '@Image2 in @Image3, holds @Image1. She says: "Hello world!" No music score.' \
  --output-plan plan.json

```

The model posts the generated [`plan.json`](https://github.com/anthropics/claude-plugins-community/blob/main/plan.json) and waits for the user's "go" confirmation. Only after explicit approval does the plugin invoke the actual generation command. This pattern, enforced by the skill definition, prevents accidental execution of expensive operations and ensures users understand the cost implications before rendering begins.

## Persisting Context Across Multi-Segment Operations

For complex workflows like multi-segment video generation, the plugin maintains **context persistence** across discrete execution steps. Rather than rendering all segments simultaneously—which risks a costly cascade if the first segment is incorrect—the skill mandates a sequential approach with reuse capabilities.

The first segment is rendered and its URL posted to the user:

```bash

# 1️⃣ Render segment 1

quickdesign video generate --provider seedance \
  --reference-image avatar.jpg \
  --duration 12 -p '...' -o seg1.mp4 --wait

# 2️⃣ Extract audio for continuity

ffmpeg -y -i seg1.mp4 -vn -acodec libmp3lame -q:a 2 seg1-audio.mp3

```

The extracted audio from segment 1 is then reused as `--reference-audio` for subsequent segments to preserve voice continuity. Before fanning out to parallel generation of remaining segments, the plugin invokes `AskUserQuestion` again to gate the remaining work, ensuring the user approves the style and content of the initial segment before committing to the full render.

This pattern is codified in [`quickdesign/skills/quickdesign/pipelines/ugc-video.md`](https://github.com/anthropics/claude-plugins-community/blob/main/quickdesign/skills/quickdesign/pipelines/ugc-video.md), which orchestrates the multi-segment pipeline after user approvals.

## Summary

- **Skill definitions** in [`SKILL.md`](https://github.com/anthropics/claude-plugins-community/blob/main/SKILL.md) files encode validation rules and context-management policies in declarative markdown, allowing the Claude runtime to enforce constraints without code changes.
- **Media context** is extracted using `@ImageN`, `@AudioN`, and `@VideoN` tokens and passed to CLI tools to keep prompts concise and deterministic.
- **Confirmation gates** via the `AskUserQuestion` tool prevent execution of ambiguous or expensive requests without explicit user approval, as defined in [`confirmation-rules.md`](https://github.com/anthropics/claude-plugins-community/blob/main/confirmation-rules.md).
- **Plan-first workflows** generate cost and content summaries before invoking Bash commands, ensuring users understand the implications before generation begins.
- **Context persistence** across multi-segment operations reuses extracted assets like audio files to maintain continuity while gating each phase with user confirmation to prevent costly errors.

## Frequently Asked Questions

### How do Claude plugins validate user input before execution?

Claude plugins validate input through declarative rules defined in [`SKILL.md`](https://github.com/anthropics/claude-plugins-community/blob/main/SKILL.md) and auxiliary files like [`confirmation-rules.md`](https://github.com/anthropics/claude-plugins-community/blob/main/confirmation-rules.md). The skill mandates specific validation triggers—such as ambiguous media requests or credit-spending operations—that force the model to invoke the `AskUserQuestion` tool before proceeding. This creates a hard stop where the user must confirm or clarify their intent, preventing invalid inputs from reaching the execution stage.

### What is the AskUserQuestion tool and when should it be used?

The `AskUserQuestion` tool is a structured confirmation mechanism that presents the user with specific options or open-ended questions before the plugin proceeds with costly or irreversible actions. According to the source code analysis, it must be used before any credit-spending operation and when resolving ambiguous inputs—such as choosing between spoken versus silent video formats. The tool outputs structured JSON that the model uses to branch the conversation flow based on user selection.

### How does context persistence work in multi-segment video generation?

Context persistence is achieved by extracting reusable assets from initial segments and referencing them in subsequent operations. For example, after rendering the first video segment in a UGC workflow, the plugin runs `ffmpeg` to extract the audio track, then passes that file as `--reference-audio` to subsequent `quickdesign video generate` commands. This preserves voice continuity across segments while allowing the user to approve the initial output before committing to parallel generation of remaining segments.

### Where are the validation and context rules defined in a Claude plugin?

The validation rules, context extraction policies, and execution workflows are defined in markdown files within the skill directory. The primary definitions reside in [`quickdesign/skills/quickdesign/SKILL.md`](https://github.com/anthropics/claude-plugins-community/blob/main/quickdesign/skills/quickdesign/SKILL.md), with specific guidance on confirmation gates in [`references/confirmation-rules.md`](https://github.com/anthropics/claude-plugins-community/blob/main/references/confirmation-rules.md), model specifications in [`models/seedance-2.0-r2v.md`](https://github.com/anthropics/claude-plugins-community/blob/main/models/seedance-2.0-r2v.md), and multi-segment pipelines in [`pipelines/ugc-video.md`](https://github.com/anthropics/claude-plugins-community/blob/main/pipelines/ugc-video.md). The root [`.claude-plugin/plugin.json`](https://github.com/anthropics/claude-plugins-community/blob/main/.claude-plugin/plugin.json) registers these skill files with the Claude runtime, exposing their rules as enforceable constraints during request processing.