Built-in Prompts
SwissArmyHammer includes a comprehensive set of built-in prompts designed to assist with various development tasks. These prompts are organized by category and leverage Liquid templating for dynamic, customizable assistance.
Overview
All built-in prompts:
- Support customizable arguments with sensible defaults
- Use Liquid syntax for variable substitution and control flow
- Are organized into logical categories for easy discovery
- Follow a standardized YAML front matter format
Categories
Analysis
statistics-calculator
Calculate statistics on numeric data using math filters and array operations.
Arguments:
numbers
(required) - Comma-separated list of numbersprecision
(default: “2”) - Decimal precision for calculationsshow_outliers
(default: “true”) - Identify outliers in the datasetpercentiles
(default: “25,50,75”) - Calculate percentiles (comma-separated)visualization
(default: “true”) - Show ASCII visualization
Example:
swissarmyhammer test statistics-calculator --numbers "10,20,30,40,50" --percentiles "10,50,90"
Communication
email-composer
Compose professional emails with dynamic content using capture blocks.
Arguments:
recipient_name
(required) - Name of the email recipientsender_name
(required) - Name of the senderemail_type
(required) - Type of email (welcome, followup, reminder, thank_you)context
(default: “”) - Additional context for the emailformal
(default: “false”) - Use formal toneinclude_signature
(default: “true”) - Include email signaturetime_of_day
(default: “morning”) - Current time of day
Example:
swissarmyhammer test email-composer --recipient_name "John Doe" --sender_name "Jane Smith" --email_type "followup" --formal "true"
Data Processing
array-processor
Process arrays with flexible filtering and loop control.
Arguments:
items
(required) - Comma-separated list of items to processskip_pattern
(default: “”) - Pattern to skip items containing this textstop_pattern
(default: “”) - Pattern to stop processingmax_items
(default: “100”) - Maximum number of items to processshow_skipped
(default: “false”) - Show skipped items separatelyformat
(default: “list”) - Output format (list, table, json)
Example:
swissarmyhammer test array-processor --items "apple,banana,cherry" --skip_pattern "berry" --format "table"
Debug
debug/error
Analyze error messages and provide debugging guidance with potential solutions.
Arguments:
error_message
(required) - The error message or stack trace to analyzelanguage
(default: “auto-detect”) - The programming languagecontext
(default: “”) - Additional context about when the error occurs
Example:
swissarmyhammer test debug/error --error_message "TypeError: cannot read property 'name' of undefined" --language "javascript"
debug/logs
Analyze log files to identify issues and patterns.
Arguments:
log_content
(required) - The log content to analyzeissue_description
(default: “general analysis”) - Description of the issue you’re investigatingtime_range
(default: “all”) - Specific time range to focus onlog_format
(default: “auto-detect”) - Log format (json, plaintext, syslog, etc.)
Example:
swissarmyhammer test debug/logs --log_content "$(cat application.log)" --issue_description "API timeout errors"
debug/performance
Analyze performance problems and suggest optimization strategies.
Arguments:
problem_description
(required) - Description of the performance issuemetrics
(default: “not provided”) - Performance metricscode_snippet
(default: “”) - Relevant code that might be causing the issueenvironment
(default: “development”) - Environment details
Example:
swissarmyhammer test debug/performance --problem_description "Database queries taking 5+ seconds" --environment "production"
Documentation
docs/api
Create comprehensive API documentation from code.
Arguments:
code
(required) - The API code to documentapi_type
(default: “REST”) - Type of API (REST, GraphQL, gRPC, library)format
(default: “markdown”) - Documentation format (markdown, openapi, swagger)include_examples
(default: “true”) - Whether to include usage examples
Example:
swissarmyhammer test docs/api --code "$(cat api.py)" --api_type "REST" --include_examples "true"
docs/comments
Add comprehensive comments and documentation to code.
Arguments:
code
(required) - The code to documentcomment_style
(default: “auto-detect”) - Comment style (inline, block, jsdoc, docstring, rustdoc)detail_level
(default: “standard”) - Level of detail (minimal, standard, comprehensive)audience
(default: “developers”) - Target audience for the comments
Example:
swissarmyhammer test docs/comments --code "$(cat utils.js)" --comment_style "jsdoc" --detail_level "comprehensive"
docs/readme
Create comprehensive README documentation for a project.
Arguments:
project_name
(required) - Name of the projectproject_description
(required) - Brief description of what the project doeslanguage
(default: “auto-detect”) - Primary programming languagefeatures
(default: “”) - Key features of the project (comma-separated)target_audience
(default: “developers”) - Who this project is for
Example:
swissarmyhammer test docs/readme --project_name "MyLib" --project_description "A library for awesome things" --features "fast,reliable,easy"
Formatting
table-generator
Generate formatted tables with alternating row styles.
Arguments:
headers
(required) - Comma-separated list of table headersrows
(required) - Semicolon-separated rows, with comma-separated valuesstyle
(default: “markdown”) - Table style (markdown, html, ascii)zebra
(default: “true”) - Enable zebra striping for rowsrow_numbers
(default: “false”) - Add row numbers
Example:
swissarmyhammer test table-generator --headers "Name,Age,City" --rows "John,30,NYC;Jane,25,LA" --style "markdown"
Planning & Productivity
plan
Create structured plans and break down complex tasks.
Arguments:
task
(required) - The task to plan forcontext
(default: “”) - Additional context for the planningconstraints
(default: “none”) - Any constraints or limitations to consider
Example:
swissarmyhammer test plan --task "Implement user authentication" --constraints "Must use OAuth2"
task-formatter
Format and organize tasks with priorities and grouping.
Arguments:
tasks
(required) - Comma-separated list of tasksgroup_by
(default: “none”) - How to group tasks (priority, status, category, none)show_index
(default: “true”) - Show task numbersshow_status
(default: “true”) - Include status checkboxesdate_format
(default: “%B %d, %Y”) - Date format for due dates
Example:
swissarmyhammer test task-formatter --tasks "Write tests,Fix bug,Update docs" --group_by "priority"
Prompt Management
prompts/create
Help create effective prompts for SwissArmyHammer.
Arguments:
purpose
(required) - What the prompt should accomplishcategory
(default: “general”) - Category for the promptinputs_needed
(default: “”) - What information the prompt needs from userscomplexity
(default: “moderate”) - Complexity level (simple, moderate, advanced)
Example:
swissarmyhammer test prompts/create --purpose "Generate database migrations" --category "database"
prompts/improve
Analyze and enhance existing prompts for better effectiveness.
Arguments:
prompt_content
(required) - The current prompt content (including YAML front matter)improvement_goals
(default: “overall enhancement”) - What aspects to improveuser_feedback
(default: “”) - Any feedback or issues users have reported
Example:
swissarmyhammer test prompts/improve --prompt_content "$(cat my-prompt.md)" --improvement_goals "clarity,flexibility"
Refactoring
refactor/clean
Refactor code for better readability, maintainability, and adherence to best practices.
Arguments:
code
(required) - The code to refactorlanguage
(default: “auto-detect”) - Programming languagefocus_areas
(default: “all”) - Specific areas to focus onstyle_guide
(default: “language defaults”) - Specific style guide to follow
Example:
swissarmyhammer test refactor/clean --code "$(cat messy_code.py)" --focus_areas "naming,complexity"
refactor/extract
Extract code into well-named, reusable methods or functions.
Arguments:
code
(required) - The code containing logic to extractextract_purpose
(required) - What the extracted method should domethod_name
(default: “auto-suggest”) - Suggested name for the extracted methodscope
(default: “method”) - Scope for the extraction (method, function, class, module)
Example:
swissarmyhammer test refactor/extract --code "$(cat complex.js)" --extract_purpose "validate user input"
refactor/patterns
Refactor code to match a target pattern or improve structure.
Arguments:
code
(required) - The code to refactortarget_pattern
(required) - The pattern or style to refactor towards
Example:
swissarmyhammer test refactor/patterns --code "$(cat service.py)" --target_pattern "Repository pattern"
Code Review
review/code
Review code for quality, bugs, and improvements.
Arguments:
file_path
(required) - Path to the file being reviewedcontext
(default: “general review”) - Additional context about the code review focus
Example:
swissarmyhammer test review/code --file_path "src/auth.py" --context "focus on security"
review/code-dynamic
Language-specific code review with conditional logic.
Arguments:
file_path
(required) - Path to the file being reviewedlanguage
(required) - Programming language (python, javascript, rust, etc.)focus_areas
(default: “style,bugs,performance”) - Comma-separated list of areas to focus onseverity_level
(default: “warning”) - Minimum severity level to report (info, warning, error)include_suggestions
(default: “true”) - Include code improvement suggestions
Example:
swissarmyhammer test review/code-dynamic --file_path "app.js" --language "javascript" --focus_areas "security,performance"
review/security
Perform a comprehensive security review of code to identify vulnerabilities.
Arguments:
code
(required) - The code to review for security issuescontext
(default: “general purpose code”) - Context about the codelanguage
(default: “auto-detect”) - Programming languageseverity_threshold
(default: “low”) - Minimum severity to report (critical, high, medium, low)
Example:
swissarmyhammer test review/security --code "$(cat login.php)" --context "handles user authentication"
review/accessibility
Review code for accessibility compliance and best practices.
Arguments:
code
(required) - The UI/frontend code to reviewwcag_level
(default: “AA”) - WCAG compliance level target (A, AA, AAA)component_type
(default: “general”) - Type of component (form, navigation, content, interactive)target_users
(default: “all users”) - Specific user needs to consider
Example:
swissarmyhammer test review/accessibility --code "$(cat form.html)" --component_type "form" --wcag_level "AA"
Testing
test/unit
Create comprehensive unit tests for code with good coverage.
Arguments:
code
(required) - The code to generate tests forframework
(default: “auto-detect”) - Testing framework to usestyle
(default: “BDD”) - Testing style (BDD, TDD, classical)coverage_target
(default: “80”) - Target test coverage percentage
Example:
swissarmyhammer test test/unit --code "$(cat calculator.py)" --framework "pytest" --style "BDD"
test/integration
Create integration tests to verify component interactions.
Arguments:
system_description
(required) - Description of the system/components to testtest_scenarios
(default: “basic flow”) - Specific scenarios to test (comma-separated)framework
(default: “auto-detect”) - Testing framework to useenvironment
(default: “local”) - Test environment setup requirements
Example:
swissarmyhammer test test/integration --system_description "User service and database" --test_scenarios "user creation,user update"
test/property
Create property-based tests to find edge cases automatically.
Arguments:
code
(required) - The code to test with propertiesframework
(default: “auto-detect”) - Property testing frameworkproperties_to_test
(default: “common properties”) - Specific properties or invariants to verifynum_examples
(default: “100”) - Number of random examples to generate
Example:
swissarmyhammer test test/property --code "$(cat sort.js)" --properties_to_test "output length equals input length"
General Purpose
help
A prompt for providing helpful assistance and guidance to users.
Arguments:
topic
(default: “general assistance”) - The topic to get help aboutdetail_level
(default: “normal”) - How detailed the help should be
Example:
swissarmyhammer test help --topic "git workflows" --detail_level "detailed"
example
An example prompt for testing.
Arguments:
topic
(default: “general topic”) - The topic to ask about
Example:
swissarmyhammer test example --topic "testing prompts"
Usage Patterns
Basic Usage
# Use a prompt with default arguments
swissarmyhammer test review/code --file_path "main.py"
# Specify custom arguments
swissarmyhammer test test/unit --code "$(cat utils.js)" --framework "jest" --coverage_target "90"
Piping Content
# Pipe file content to a prompt
cat error.log | xargs -I {} swissarmyhammer test debug/logs --log_content "{}" --issue_description "memory leak"
# Use command substitution
swissarmyhammer test docs/api --code "$(cat api.py)" --api_type "REST"
Combining Multiple Prompts
# First analyze the code
swissarmyhammer test review/code --file_path "service.py" > review.md
# Then generate tests based on the review
swissarmyhammer test test/unit --code "$(cat service.py)" --style "TDD"
Custom Workflows
# Create a security-focused workflow
swissarmyhammer test review/security --code "$(cat auth.js)" --severity_threshold "medium" > security.md
swissarmyhammer test test/unit --code "$(cat auth.js)" --focus "security edge cases"
Best Practices
- Choose the Right Prompt - Select prompts that match your specific task
- Provide Context - Use optional arguments to give more context
- Combine Prompts - Use multiple prompts in sequence for comprehensive workflows
- Customize Arguments - Override defaults when you need specific behavior
- Review Output - Always review and validate generated content before using it
Creating Custom Prompts
If the built-in prompts don’t meet your needs:
- Use the
prompts/create
prompt to generate a template - Save it in your
~/.swissarmyhammer/prompts/
directory - Follow the YAML front matter format for consistency
- Test with various inputs to ensure reliability
For more information on creating custom prompts, see Creating Prompts.