extensions/template/commands/example.md
This is an example command that demonstrates how to create commands for Spec Kit extensions.
Describe what this command does and when to use it.
List requirements before using this command:
$ARGUMENTS
Load extension configuration from the project:
``bash config_file=".specify/extensions/my-extension/my-extension-config.yml"
if [ ! -f "$config_file" ]; then echo "❌ Error: Configuration not found at $config_file" echo "Run 'specify extension add my-extension' to install and configure" exit 1 fi
setting_value=$(yq eval '.settings.key' "$config_file")
setting_value="${SPECKIT_MY_EXTENSION_KEY:-$setting_value}"
if [ -z "$setting_value" ]; then echo "❌ Error: Configuration value not set" echo "Edit $config_file and set 'settings.key'" exit 1 fi
echo "📋 Configuration loaded: $setting_value" ``
Describe what this step does:
``markdown Use MCP tools to perform the main action:
This calls the MCP server tool to execute the operation. ``
Process the results and provide output:
bash echo "" echo "✅ Command completed successfully!" echo "" echo "Results:" echo " • Item 1: Value" echo " • Item 2: Value" echo ""
Save results to a file if needed:
``bash output_file=".specify/my-extension-output.json"
cat > "$output_file" <<EOF { "timestamp": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")", "setting": "$setting_value", "results": [] } EOF
echo "💾 Output saved to $output_file" ``
This command uses the following configuration from my-extension-config.yml:
settings.key: Description of what this setting does
"example-value"settings.another_key: Description of another setting
falsetrueConfiguration can be overridden with environment variables:
SPECKIT_MY_EXTENSION_KEY - Overrides settings.keySPECKIT_MY_EXTENSION_ANOTHER_KEY - Overrides settings.another_keyExample:
bash export SPECKIT_MY_EXTENSION_KEY="override-value"
Solution: Install the extension and create configuration:
bash specify extension add my-extension cp .specify/extensions/my-extension/config-template.yml \ .specify/extensions/my-extension/my-extension-config.yml
Solution: Ensure MCP server is configured in your AI agent settings.
Solution: Check credentials and permissions in the external service.
``bash
/speckit.my-extension.example ``
``bash
export SPECKIT_MY_EXTENSION_KEY="custom-value"
/speckit.my-extension.example ``
``bash
/speckit.tasks /speckit.my-extension.example ``
For more information, see the extension README or run specify extension info my-extension