From f33ee14a4b13101a08bd0bdd708b1f76e1c22ab1 Mon Sep 17 00:00:00 2001 From: Shayan Rais Date: Tue, 4 Nov 2025 16:30:34 +0500 Subject: [PATCH] added AskUserQuestion in commands --- .claude/commands/weather-karachi.md | 8 +++-- docs/{PROMPTS.md => COMPARISION.md} | 54 ++++++++++++++++++++++++++--- output/output.md | 23 +++++++++--- 3 files changed, 72 insertions(+), 13 deletions(-) rename docs/{PROMPTS.md => COMPARISION.md} (83%) diff --git a/.claude/commands/weather-karachi.md b/.claude/commands/weather-karachi.md index 571e7c3..ebeff1e 100644 --- a/.claude/commands/weather-karachi.md +++ b/.claude/commands/weather-karachi.md @@ -9,11 +9,13 @@ Fetch the current temperature for Karachi, Pakistan and apply transformations. ## Workflow -1. Use the weather-fetcher agent to retrieve the current temperature from wttr.in API -2. Use the weather-transformer agent to read transformation rules from input/input.md and apply them to the temperature -3. Write the results to output/output.md +1. Use the AskUserQuestion tool to ask the user whether they want the temperature in Celsius or Fahrenheit +2. Use the weather-fetcher agent to retrieve the current temperature from wttr.in API in the requested unit +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: +- Temperature unit requested - Original temperature - Transformation applied - Final result diff --git a/docs/PROMPTS.md b/docs/COMPARISION.md similarity index 83% rename from docs/PROMPTS.md rename to docs/COMPARISION.md index e7a8642..0fa2f14 100644 --- a/docs/PROMPTS.md +++ b/docs/COMPARISION.md @@ -1,8 +1,5 @@ -# Prompts - - -# 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 +# COMPARISION +commands, agents, skill # Invocation Patterns Reference @@ -263,6 +260,53 @@ Use the Skill tool to process the 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 - **Agents**: **Both automatic and explicit invocation** diff --git a/output/output.md b/output/output.md index 179be7b..41f394e 100644 --- a/output/output.md +++ b/output/output.md @@ -1,13 +1,26 @@ # 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 -**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 -- Starting value: 26°C -- Operation: +10 -- Result: 26 + 10 = 36°C +- Starting value: 309.15 K (equal to 36°C) +- Operation: Add +10 +- Result: 36 + 10 = 46°C (equal to 319.15 K)