Skip to content

Pierre-Malherbe/PatternForge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎨 PatternForge

Dynamic prompt patterns powered by Claude Code

PatternForge is a blazing-fast TUI (Terminal User Interface) that brings the power of Fabric-style patterns to Claude Code. Create, edit, and manage reusable AI prompts with an elegant interface and Vim-style keybindings.

Version Go License

✨ Features

  • 🎯 Dynamic Pattern Loading - Patterns are markdown files you can edit anytime
  • πŸ“ Category Navigation - Organize patterns by category (Bug, Tickets, Refactor, etc.)
  • βš™οΈ Pattern Variables - Forms with configurable fields (priority, environment, etc.)
  • 🌐 Community Patterns - Clone and sync patterns from git repositories
  • πŸ“ {{input}} Templating - Control exactly where user content goes
  • ⚑ Vim Keybindings - j/k navigation, natural for terminal users
  • πŸ”§ Live Editing - Press m to edit patterns in Vi, changes apply instantly
  • πŸ“Š Token Stats - See input/output tokens and execution time
  • πŸ“‹ Copy to Clipboard - One key press to copy results
  • 🎨 Beautiful TUI - Built with Bubbletea and Lipgloss
  • πŸš€ Fast & Lightweight - Pure Go, single binary, no dependencies

🎬 Quick Demo

# 1. Launch PatternForge
$ patternforge

# 2. Select a category, then a pattern
> πŸ“ Tickets
  > 🎫 Create Ticket βš™οΈ

# 3. Fill in variables (if pattern has them)
Priority: [low] medium [high]
Type: [bug] feature [task]

# 4. Paste your content, press Ctrl+D

# 5. Get beautiful results with stats
✨ Result
[Your formatted ticket here]
πŸ“Š 172 tokens input + 612 output = 784 total | 3.2s

# 6. Press 'y' to copy output

πŸ“¦ Installation

Prerequisites

  1. Go 1.21+ - Install Go
  2. Claude Code - Required for AI processing
    pip install claude-code
    claude auth login
  3. Git - For community patterns (optional)
  4. Vi/Vim - For editing patterns (usually pre-installed on macOS/Linux)

Build from Source

# Clone the repository
git clone https://github.com/Pierre-Malherbe/PatternForge.git
cd patternforge

# Install dependencies
make deps

# Build
make build

# Install system-wide (optional)
make install

πŸš€ Usage

Basic Usage

# Use default patterns directory (./patterns)
patternforge

# Use custom patterns directory
patternforge ~/my-patterns

CLI Commands

# Sync community patterns from repositories
patternforge upgrade

# List configured repositories
patternforge repo list

# Add a pattern repository
patternforge repo add https://github.com/user/patterns-repo

# Remove a repository
patternforge repo remove <name>

First Run

On first run, PatternForge will:

  1. βœ… Check if Claude Code is installed
  2. πŸ“ Ask where to save results
  3. 🌐 Offer to enable community patterns (clones official repo)
  4. 🎯 Launch the TUI

Workflow

  1. Select Category - Browse patterns by category
  2. Select Pattern - Use j/k or arrow keys, press enter
  3. Configure Variables - Fill in form fields (if pattern has variables)
  4. Input Content - Paste or type your content
  5. Process - Press Ctrl+D to send to Claude Code
  6. View Results - Scroll through output, see token stats
  7. Copy/Save - Press y to copy, or s to save to file

⌨️ Keyboard Shortcuts

Category/Pattern Selection Screen

Key Action
j / ↓ Move down
k / ↑ Move up
enter Select category/pattern
esc Back to categories
m Modify selected pattern (opens Vi)
n Create new pattern (opens Vi)
U Upgrade/sync repositories
S Settings
/ Search
q Quit

Variables Screen

Key Action
↑ / ↓ / Tab Navigate fields
← / β†’ Change selection (for select fields)
enter Continue to input
esc Back

Input Screen

Key Action
Ctrl+D Process with Claude Code
Esc Back to pattern selection

Results Screen

Key Action
j/k or ↑/↓ Scroll output
y Copy output to clipboard
s Save output to file
Esc New pattern
q Quit

πŸ“ Creating Patterns

Patterns are simple Markdown files in the patterns/ directory.

Basic Pattern

# πŸ” Code Review

> Review code for bugs and improvements

[Category: Review]

## Prompt

Analyze this code and provide feedback:

{{input}}

Include:
1. Bugs found
2. Improvements
3. Security issues

Pattern with Variables

Add configurable fields that appear as a form before input:

# 🎫 Create Ticket

> Generate a well-structured ticket

[Category: Tickets]

## Variables

- priority: Priority | select | low,medium,high,critical | medium
- type: Type | select | bug,feature,task | task
- env: Environment | select | dev,staging,prod | prod

## Prompt

Create a ticket with:
- Priority: {{var:priority}}
- Type: {{var:type}}
- Environment: {{var:env}}

Description:
{{input}}

Variable Definition Format

- name: Label | type | options | default | placeholder

Types:

  • text - Simple text input (default)
  • select - Dropdown with options (comma-separated)
  • multiline - Multi-line text area

Examples:

- priority: Priority | select | low,medium,high | medium
- description: Description | text | | | Enter details...
- notes: Notes | multiline

The {{input}} Variable

Control where user content is inserted:

## Prompt

Analyze this code:

{{input}}

Provide detailed feedback.

Without {{input}}: User content is appended at the end.

🌐 Community Patterns

Official Repository

Add the official patterns repository:

patternforge repo add https://github.com/Pierre-Malherbe/patternforge-patterns
patternforge upgrade

Or enable during first launch setup.

Pattern Sources

Patterns are loaded from multiple sources with priority:

  1. Local patterns (./patterns) - Highest priority
  2. Community patterns (from repositories) - Merged, local wins on conflict

Managing Repositories

# List all configured repos
patternforge repo list

# Add a new repository
patternforge repo add https://github.com/user/patterns

# Remove a repository
patternforge repo remove patterns

# Sync all repositories (also available via 'U' key in TUI)
patternforge upgrade

πŸ—οΈ Architecture

PatternForge follows Clean Architecture principles:

PatternForge/
β”œβ”€β”€ cmd/patternforge/     # Application entrypoint
β”‚   β”œβ”€β”€ main.go           # CLI & subcommands
β”‚   └── model.go          # Main TUI model (state machine)
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ pattern/          # Pattern loading, parsing, variables
β”‚   β”œβ”€β”€ repository/       # Git operations for community patterns
β”‚   β”œβ”€β”€ config/           # Settings & repository configuration
β”‚   β”œβ”€β”€ claude/           # Claude Code executor
β”‚   └── ui/
β”‚       β”œβ”€β”€ screens/      # TUI screens (selection, variables, input, results)
β”‚       └── styles/       # Centralized lipgloss styles
└── patterns/             # User's local pattern files

πŸ”§ Development

Running Tests

make test

Building for macOS

# Build for both Apple Silicon and Intel
make build-macos

# Outputs:
# bin/patternforge-darwin-arm64
# bin/patternforge-darwin-amd64

πŸ› Troubleshooting

Q: "claude CLI not found"

pip install claude-code
claude --version

Q: "Pattern not showing up"

  • Check file is in patterns/ directory
  • Ensure filename ends with .md
  • Press U to reload or restart PatternForge

Q: "Variables not working"

  • Check ## Variables section exists
  • Format: - name: Label | type | options | default
  • Use {{var:name}} in prompt

Q: "Repository sync failed"

  • Ensure git is installed: git --version
  • Check internet connection
  • Verify repository URL is correct

πŸ“š Resources

🀝 Contributing

Contributions welcome! Areas for improvement:

  • More community patterns
  • Pattern validation
  • Export results (PDF, HTML)
  • Custom themes
  • Windows support testing

πŸ“„ License

MIT License - See LICENSE file

πŸ™ Credits

  • Inspired by Fabric by Daniel Miessler
  • Built with Charm tools (Bubbletea, Lipgloss, Bubbles)

Built with ❀️ in πŸ‡«πŸ‡· for the Claude Code community

⭐ Star on GitHub | πŸ› Report Bug | πŸ’‘ Request Feature

About

Patternforge is a high-performance Terminal User Interface (TUI) designed to transform how you interact with Claude Code. It brings an engineering-grade workflow to AI prompting by allowing you to build, manage, and execute a library of reusable "patterns" with a blazing-fast, Vim-style interface.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors