Overview
Thegenerate command uses an LLM (Large Language Model) to automatically generate trigger test cases for a skill. It reads the SKILL.md file and creates comprehensive test cases across all four trigger types.
Usage
Arguments
Path to the skill directory. Defaults to current directory if not specified.
Options
Alias:
-mAnthropic model ID to use for generation. Defaults to claude-haiku-4-5-20251001.Can also be set via SKLAB_MODEL environment variable.Overwrite existing
triggers.yaml file without prompting.Prerequisites
Install anthropic package
Theanthropic package is an optional dependency:
Set API key
Set theANTHROPIC_API_KEY environment variable:
Examples
Generate tests for current directory
Generate tests with specific model
Force overwrite existing tests
Generate for specific skill
Output
Generates.skill-lab/tests/triggers.yaml with approximately 10-12 test cases:
- 2-3 explicit tests (direct invocation with $ prefix)
- 2-3 implicit tests (scenario descriptions)
- 2-3 contextual tests (realistic prompts with noise)
- 2-3 negative tests (should not trigger)
Example Output
Configuration Priority
Model selection follows this priority:--modelflagSKLAB_MODELenvironment variable- Default:
claude-haiku-4-5-20251001
Token Usage and Cost
The command displays token usage after generation:- Input tokens (skill content)
- Output tokens (generated tests)
- Total tokens
- Estimated cost (if available for the model)
Cost estimates are based on Anthropic’s published pricing and may not reflect actual charges. Check your Anthropic dashboard for accurate billing.
Generated Test Structure
The generatedtriggers.yaml file follows this structure:
Exit Codes
- 0: Tests generated successfully or user aborted
- 1: Error occurred (missing API key, invalid path, etc.)
Error Handling
Missing anthropic package
Missing API key
Existing file (without —force)
Notes
The LLM generates test cases based on the skill’s description and content. Review and edit the generated tests to ensure they match your testing requirements.
Generation typically takes 5-15 seconds depending on the model and skill complexity.
Related Commands
- sklab trigger - Run the generated trigger tests
- sklab evaluate - Run static analysis checks