AI interactions are often a one-way street: you give a prompt, and the AI responds. But what if the AI needs your input to clarify instructions, gather preferences, or decide on the next step? This is where Claude's built-in AskUserQuestion tool becomes essential.
This lesson explores this foundational, internal tool that allows the AI to pause its execution and ask the user a series of questions. You'll learn that while you can't build your own version of this tool, you can completely transform its behavior with a custom system prompt. By providing a new persona and instructing the agent to only use AskUserQuestion, you can create highly specialized, interactive tools—turning a generic coding assistant into a life coach, a project planner, or any other guided experience you can imagine.
Workflow demonstrated in this lesson:
- Understand the Tool: Review the
AskUserQuestion.mddefinition to see its purpose and capabilities. - Direct Invocation: Run the
AskUserQuestiontool directly to see its default behavior as a coding assistant. - Custom Persona: Use a system prompt to give the agent a new role, such as "You're a life coach."
- Force Tool Usage: Instruct the agent to only use the
AskUserQuestiontool to fulfill its role. - Interactive Experience: Engage with the new, multi-step questionnaire that the agent creates based on its new persona, demonstrating how to build guided workflows.
Key benefits:
- Create Guided Experiences: Build interactive tools that walk users through a series of choices.
- Clarify Ambiguity: Allow the agent to ask for more information when instructions are unclear.
- Gather User Preferences: Design workflows that adapt based on user input and requirements.
- Build Beyond Code: See how foundational tools can be used for applications outside of software development.
Summary
This lesson teaches you how to use Claude's powerful, built-in AskUserQuestion tool to create interactive, multi-step experiences. You will learn that this tool is a foundational component that allows an AI agent to pause and ask for user input. The video demonstrates how a custom system prompt can completely transform the tool's behavior, turning a generic coding assistant into a specialized "life coach" that guides the user through a series of questions. This showcases the versatility of the tool for building guided workflows and interactive applications beyond just writing code.
Prompts
Terminal Commands
Code Snippets
The AskUserQuestion.md file defines the purpose and usage of this foundational tool.
