added AskUserQuestion in commands

This commit is contained in:
Shayan Rais
2025-11-04 16:30:34 +05:00
parent bf5966a4aa
commit f33ee14a4b
3 changed files with 72 additions and 13 deletions
+5 -3
View File
@@ -9,11 +9,13 @@ Fetch the current temperature for Karachi, Pakistan and apply transformations.
## Workflow ## Workflow
1. Use the weather-fetcher agent to retrieve the current temperature from wttr.in API 1. Use the AskUserQuestion tool to ask the user whether they want the temperature in Celsius or Fahrenheit
2. Use the weather-transformer agent to read transformation rules from input/input.md and apply them to the temperature 2. Use the weather-fetcher agent to retrieve the current temperature from wttr.in API in the requested unit
3. Write the results to output/output.md 3. Use the weather-transformer agent to read transformation rules from input/input.md and apply them to the temperature
4. Write the results to output/output.md
Launch the agents sequentially (not in parallel) and provide a clear summary showing: Launch the agents sequentially (not in parallel) and provide a clear summary showing:
- Temperature unit requested
- Original temperature - Original temperature
- Transformation applied - Transformation applied
- Final result - Final result
+49 -5
View File
@@ -1,8 +1,5 @@
# Prompts # COMPARISION
commands, agents, skill
# Creating Agents and Commands
create a claude agent and command. the agent will first use tool to call weather api to fetch karachi weather in degree centigrade and then read instructions from @input/input.md to transform the result and update the @output/output.md
# Invocation Patterns Reference # Invocation Patterns Reference
@@ -263,6 +260,53 @@ Use the Skill tool to process the PDF:
Skill(command="pdf") Skill(command="pdf")
``` ```
## Core Differences Between Commands and Agents
While commands and agents share similar invocation patterns, they have fundamental architectural differences:
### Key Architectural Differences
**1. Purpose & Complexity**
- **Commands**: Reusable prompt templates that expand into instructions. Best for **procedural workflows** with predefined steps.
- **Agents**: Autonomous subprocesses with their own tool access. Best for **complex, multi-step tasks** requiring independent decision-making.
**2. Execution Model**
- **Commands**: Expand into prompts that Claude executes in the main conversation context
- **Agents**: Run as separate subprocesses with isolated execution environments
**3. Tool Access**
- **Commands**: Execute within the main Claude context and inherit available tools
- **Agents**: Have explicitly defined tool subsets specified in their configuration (e.g., `tools: Read, Grep, Bash`)
**4. Autonomy Level**
- **Commands**: Provide instructions for Claude to follow. Can interact with users via AskUserQuestion tool to gather preferences or clarify requirements.
- **Agents**: Act autonomously to complete tasks and return final reports. **Should NOT ask questions** - they run independently and must work with the information provided in their prompt.
**5. Model Selection**
- **Commands**: Can specify which model to use for executing the command
- **Agents**: Can specify which model runs the agent subprocess (e.g., `model: haiku` for cost efficiency)
### When to Choose Each
**Choose Commands when:**
- You have a reusable prompt/workflow
- Steps are mostly predefined
- You want users to trigger via `/slash` syntax
- You need a simple procedural template
**Choose Agents when:**
- Task requires autonomous multi-step problem solving
- You need isolated tool access for security/organization
- Task should run as independent subprocess
- You want specialized capabilities (like code review, test running)
**Example from this repository:**
- `/weather-karachi` command: Orchestrates the workflow
- `weather-fetcher` agent: Autonomous subprocess that fetches temperature
- `weather-transformer` agent: Autonomous subprocess that transforms data
The command coordinates, while agents execute their specialized tasks independently.
## Summary ## Summary
- **Agents**: **Both automatic and explicit invocation** - **Agents**: **Both automatic and explicit invocation**
+18 -5
View File
@@ -1,13 +1,26 @@
# Weather Transformation Results # Weather Transformation Results
**Original Temperature:** 26°C **Original Temperature:** 309.15 K (Kelvin)
**Conversion to Celsius:** 309.15 K - 273.15 = 36°C
**Transformation Applied:** Add +10 to the result **Transformation Applied:** Add +10 to the result
**Final Result:** 36°C **Calculation:** 36°C + 10 = 46°C
**Final Result in Celsius:** 46°C
**Final Result in Kelvin:** 319.15 K
## Detailed Summary
- Input: 309.15 K
- Intermediate (Celsius): 36°C
- After Transformation: 46°C
- Output: 319.15 K
## Calculation Details ## Calculation Details
- Starting value: 26°C - Starting value: 309.15 K (equal to 36°C)
- Operation: +10 - Operation: Add +10
- Result: 26 + 10 = 36°C - Result: 36 + 10 = 46°C (equal to 319.15 K)