Skip to main content

Overview

The trigger command runs trigger tests to verify that a skill activates correctly for different types of prompts. It tests whether the skill is properly discovered and invoked by the agent runtime.

Usage

sklab trigger [SKILL_PATH] [OPTIONS]

Arguments

SKILL_PATH
Path
Path to the skill directory. Defaults to current directory if not specified.

Options

--type
string
Alias: -tOnly run tests of a specific trigger type. Filters test execution.Options:
  • explicit - Skill named directly with $ prefix
  • implicit - Describes exact scenario without naming skill
  • contextual - Realistic noisy prompt with domain context
  • negative - Should NOT trigger (catches false positives)
sklab trigger --type explicit
--output
Path
Alias: -oOutput file path for JSON report.
sklab trigger --output trigger-report.json
--format
string
default:"console"
Alias: -fOutput format for the report.Options:
  • console - Human-readable terminal output with table formatting
  • json - Machine-readable JSON output
sklab trigger --format json

Trigger Types

The command tests four types of skill activation:

Explicit

Skill named directly with $ prefix in the prompt:
Use $my-skill to analyze this data

Implicit

Describes the exact scenario without naming the skill:
Analyze this customer feedback data for sentiment patterns

Contextual

Realistic prompt with domain context and noise:
Our support team received 500 tickets this week. Can you help me understand
the main themes and customer sentiment trends?

Negative

Should NOT trigger the skill (prevents false positives):
Show me the sales report from last quarter

Examples

Run all trigger tests

sklab trigger

Run only explicit trigger tests

sklab trigger --type explicit

Run tests with JSON output

sklab trigger --format json --output results.json

Test specific skill

sklab trigger ./skills/sentiment-analysis

Output Format

Console Output

Displays a formatted table with:
  • Test name
  • Trigger type
  • Pass/fail status (✓ or ✗)
  • Summary statistics by type
  • Overall pass rate and duration
Trigger Test Report: sentiment-analysis
Runtime: claude │ Duration: 12.3s │ 8/10 passed

┌─────────────────────────┬────────────┬────────┐
│ Test                    │ Type       │ Status │
├─────────────────────────┼────────────┼────────┤
│ direct-invocation       │ explicit   │   ✓    │
│ scenario-description    │ implicit   │   ✓    │
│ real-world-request      │ contextual │   ✓    │
│ unrelated-request       │ negative   │   ✗    │
└─────────────────────────┴────────────┴────────┘

By type: explicit: 3/3 (100%) │ implicit: 2/3 (67%) │ contextual: 2/3 (67%) │ negative: 1/1 (100%)

JSON Output

Includes:
  • skill_name: name of the skill tested
  • runtime: runtime used (e.g., “claude”)
  • tests_run: total number of tests
  • tests_passed: number of passed tests
  • overall_pass: boolean
  • duration_ms: execution time in milliseconds
  • results: array of test results
  • summary_by_type: statistics grouped by trigger type

Test Definition Files

Trigger tests must be defined in YAML files located at:
  • .skill-lab/tests/scenarios.yaml (legacy)
  • .skill-lab/tests/triggers.yaml (recommended)
If no test files are found, the command suggests using sklab generate to create them automatically.

Exit Codes

  • 0: All trigger tests passed
  • 1: One or more tests failed or error occurred

Notes

Trigger tests require test definitions in .skill-lab/tests/triggers.yaml. Use sklab generate to auto-generate tests.
The Claude runtime requires the Claude CLI to be properly configured. Ensure you have access to Claude’s API.

Build docs developers (and LLMs) love