$npx -y skills add prakhar1114/ai_mime --skill example_skillFetch the current weather forecast for a specified location and return a structured summary.
| 1 | # Fetch Weather Report Skill |
| 2 | |
| 3 | ## Inputs |
| 4 | - `location` (required, string): The city and state/country to search weather for (e.g. "San Francisco, CA"). |
| 5 | - `units` (optional, string): The unit system to use, either "metric" or "imperial". Default is "metric". |
| 6 | |
| 7 | ## Run |
| 8 | Run via the executable bash script: |
| 9 | ```bash |
| 10 | ./run.sh [path/to/inputs.json] |
| 11 | ``` |
| 12 | |
| 13 | Python runtime contract: |
| 14 | - `run.sh` uses the first available interpreter in this order: skill `.venv/bin/python`, workflow `.venv/bin/python`, then required `$AI_MIME_PYTHON_PATH`. |
| 15 | - If `requirements.txt` exists, include these exact build/repair commands for the developer to set up the virtualenv before packaging or for manual troubleshooting: |
| 16 | ```bash |
| 17 | "$AI_MIME_UV_PATH" venv .venv --python "$AI_MIME_PYTHON_PATH" |
| 18 | "$AI_MIME_UV_PATH" pip install -r requirements.txt --python .venv/bin/python |
| 19 | ``` |
| 20 | - State clearly that the install commands are for skill build or manual repair. The automated runtime does not create or repair `.venv` when executing the skill. |
| 21 | |
| 22 | ## Outputs |
| 23 | - `weather_summary` (dict): |
| 24 | - `location` (string): Resolved location name. |
| 25 | - `temperature` (float): Current temperature. |
| 26 | - `condition` (string): Weather condition description. |
| 27 | |
| 28 | ## Progress logs |
| 29 | The script outputs progress logs on `stderr` to track execution progress. |
| 30 | All logs must be written in clear, natural language suitable for an end-user overlay. Do not use structured JSON logs. |
| 31 | - "Fetching weather from API..." |
| 32 | - "It is sunny with 18.5 C" |
| 33 | - "Error: API timeout" |
| 34 | |
| 35 | ## Fallback |
| 36 | If the weather API fails or is unreachable, the execution falls back to performing a Google search for current weather and scraping the temperature using `browser_harness`. See `references/fallback_plan.md` for manual or automated fallback instructions. |
| 37 | |
| 38 | ## ask_llm decision points |
| 39 | 1. **Weather Condition Parsing**: |
| 40 | If the weather condition string returned by the API is fuzzy, the script calls `ask_llm` to categorize the weather condition into standard types ("Sunny", "Cloudy", "Rainy", "Snowy", "Unknown"). |
| 41 | ```python |
| 42 | from llm_resolver import ask_llm |
| 43 | decision = ask_llm( |
| 44 | prompt=f"Categorize this weather description: '{raw_desc}'", |
| 45 | schema={ |
| 46 | "type": "object", |
| 47 | "properties": { |
| 48 | "category": {"type": "string", "enum": ["Sunny", "Cloudy", "Rainy", "Snowy", "Unknown"]} |
| 49 | }, |
| 50 | "required": ["category"] |
| 51 | } |
| 52 | ) |
| 53 | ``` |
| 54 | |
| 55 | ## References |
| 56 | - [fallback_plan.md](references/fallback_plan.md): Step-by-step instructions for human/UI agent fallback execution. |