SwissArmyHammer

Manage AI prompts as local markdown files.

SwissArmyHammer

Program all the things, just by writing markdown. Really.

šŸ“š Complete Documentation & Guides šŸ“š

šŸ¦€ Rust API Documentation šŸ¦€

CI License Rust MCP

šŸ“– Documentation • šŸ¦€ API Docs


✨ What is SwissArmyHammer?

SwissArmyHammer transforms how you work with AI prompts and workflows by letting you manage them as simple markdown files.

  • a command line app that uses Claude Code as a sub agent
  • a powerful Model Context Protocol (MCP) server that seamlessly integrates with Claude Code
  • a flexible Rust library for building prompt-based applications.

TLDR

Follow the Calcutron sample to get started.

šŸŽÆ Key Features

  • šŸ“ File-based Management - Store prompts and sub agent workflows as markdown files with YAML front matter
  • šŸ”„ Live Reloading - Changes are automatically detected and reloaded
  • šŸŽØ Liquid Templates - Use Liquid templating with variables, conditionals, loops, and custom filters to make templates and workflows
  • ⚔ MCP Integration - Works seamlessly with Claude Code via Model Context Protocol
  • šŸ—‚ļø Organized Hierarchy - Built-in, user, and local prompt directories with override precedence
  • šŸ› ļø Developer Tools - Rich CLI with diagnostics, validation, and shell completions
  • šŸ“š Rust Library - Use as a dependency in your own Rust projects with comprehensive API
  • šŸ” Built-in Library - 20+ ready-to-use prompts for common development tasks
  • šŸ”§ Workflow Engine - Advanced state-based workflow execution with Mermaid diagrams
  • šŸ” Advanced Search - Vector search with fuzzy matching and relevance scoring
  • Git-based workflow with automatic branch management

Common Commands

sah --help

Standard Locations

  1. Builtin - Embedded in the SwissArmyHammer binary

    • Pre-installed prompts and workflows for common tasks
    • Always available, no setup required
  2. User - Your personal collection

    • Prompts: ~/.swissarmyhammer/prompts/
    • Workflows: ~/.swissarmyhammer/workflows/
    • Shared across all your projects
  3. Local - Project-specific files

    • Prompts: ./.swissarmyhammer/prompts/
    • Workflows: ./.swissarmyhammer/workflows/
    • Searched in current directory and parent directories
    • Perfect for project-specific customizations

Example Structure

~/.swissarmyhammer/          # User directory
ā”œā”€ā”€ prompts/
│   ā”œā”€ā”€ code-review.md       # Personal code review prompt
│   └── daily-standup.md     # Your daily standup template
└── workflows/
    └── release-process.md   # Your release workflow

./my-project/                # Project directory
└── .swissarmyhammer/        # Local directory
    ā”œā”€ā”€ prompts/
    │   └── api-docs.md      # Project-specific API documentation prompt
    └── workflows/
        └── ci-cd.md         # Project CI/CD workflow

šŸš€ Quick Start

Install

See https://wballard.github.io/swissarmyhammer/installation.html for detailed installation instructions.

Configure Claude Code

Add to your Claude Code MCP configuration

claude mcp add --scope user sah sah serve

Create Your First Prompt

mkdir -p ~/.swissarmyhammer/prompts
cat > ~/.swissarmyhammer/prompts/helper.md << 'EOF'
---
title: Task Helper
description: Helps with various tasks
arguments:
  - name: task
    description: What you need help with
    required: true
---

Please help me with: {{task}}

Provide clear, actionable advice.
EOF

That's it! Your prompt is now available in Claude Code. You can use it via MCP with /helper.

šŸ“– Documentation

Development Setup

See https://wballard.github.io/swissarmyhammer/installation.html for development setup instructions.

šŸ™ Acknowledgments


⭐ Star this repo if you find SwissArmyHammer useful!

Related Servers