A developer-friendly CLI tool that manages reusable prompt templates and executes them using locally installed AI CLIs (Claude Code, Gemini CLI, Codex CLI, GitHub Copilot CLI). It automatically detects available AI providers, expands shell commands within templates, and eliminates the need for API keys.
- Template Management: Store reusable prompt templates with Markdown + YAML frontmatter
- Dynamic Command Expansion: Embed shell commands in templates using
{{$ command }}syntax - Template Arguments: Pass arguments to templates (e.g.,
aiu pr-review feature-branch main) - Built-in Templates: PR description, PR review, and commit message templates included in binary
- Multi-Provider Support: Automatically detects and uses Claude, Gemini, Codex, or Copilot CLIs
- No API Keys Required: Leverages your existing CLI installations
brew tap trknhr/homebrew-tap
brew install aiu
# Upgrade
brew upgrade aiuInstall the latest release via:
curl -sSfL https://raw.githubusercontent.com/trknhr/ai-utils/main/install.sh | shThis will:
- Detect your OS and CPU architecture
- Download the correct binary
- Install it to
/usr/local/bin/aiu
You need at least one of these installed:
- Claude Code: Follow ClaudeCode installation
- Gemini CLI: Follow Gemini CLI installation
- Codex CLI: Follow Codex installation
- GitHub Copilot CLI: Follow Codex installation
# Generate PR description
aiu pr-desc
# Review a PR branch (compare feature/xxx with origin/main)
aiu pr-review feature/xxx
# Review with custom base branch
aiu pr-review feature/xxx develop
# Generate commit message from staged changes
git add .
aiu commit-msg
# Use codex explicitly
aiu pr-desc -P codex
# Override model (wins over config)
aiu pr-desc -P copilot --model gpt-5# Enable AI-powered commit messages globally
aiu enable-auto-commit
# Now just use git commit normally - AI generates the message!
git add .
git commit
# Skip AI for a specific commit
AI_IGNORE=1 git commit
# Disable auto commit
aiu disable-auto-commit┌─────────────┐ 1. Read Template ┌──────────────────┐
│ Prompt File │◄──────────────────────│ aiu CLI │
│ (*.md) │ │ │
└─────────────┘ │ - Parse YAML │
│ - Expand {{$}} │
┌─────────────┐ 2. Execute Commands │ - Detect AI CLI │
│ Shell │◄──────────────────────│ │
│ (git, etc) │ └────────┬─────────┘
└─────────────┘ │
│ 3. Send Prompt
┌──────────────────────────────▼─────┐
│ AI Provider (Claude/Gemini/Codex/Copilot) │
└────────────────────────────────────┘
- Template Loading: Reads Markdown files with YAML frontmatter
- Command Expansion: Executes
{{$ command }}placeholders and injects output - Provider Detection: Automatically selects available AI CLI (Claude → Gemini → Codex → Copilot)
- Execution: Sends expanded prompt to the provider and displays response
Templates are Markdown files with optional YAML frontmatter:
---
name: pr-desc
description: Generate PR description from staged changes
requires:
- git
---
Generate a clear and concise PR description based on the following git diff.
## Changes
\```
{{$ git diff --cached }}
\```
## Recent Commit History
\```
{{$ git log --oneline -5 }}
\```
Output format:
- Title: One-line summary
- Overview: Purpose and context
- Details: List of main changes| Syntax | Description | Example |
|---|---|---|
{{$ command }} |
Execute shell command and insert output | {{$ git diff }} |
$ARG1, $ARG2... |
Template arguments (passed from CLI) | {{$ echo $ARG1 }} |
$ARGS |
All arguments joined by space | {{$ echo $ARGS }} |
Built-in templates are embedded in the binary. Custom templates can be stored in:
<workspace>/.aiu/prompts/(overrides global; searched first)~/.aiu/prompts/(global)- Additional directories via
config.yaml(prompt_dirs)
Configuration files (merged in this order; workspace overrides global):
~/.aiu/config.yaml<workspace>/.aiu/config.yaml
# Prompt directories (searched in order)
prompt_dirs:
- <workspace>/.aiu/prompts
- ~/.aiu/prompts
- ~/.local/share/ai-utils/prompts
# Provider priority (tries in order)
provider_priority:
- claude
- gemini
- codex
- copilot
# Provider-specific settings
providers:
claude:
command: claude
args: ["-p", "--output-format", "text"]
timeout: 120s
gemini:
command: gemini
args: []
timeout: 120s
codex:
command: codex
args: []
model: ""
timeout: 120s
copilot:
command: copilot
args: ["-s"]
model: ""
timeout: 120s
# Defaults
defaults:
timeout: 60s
verbose: false# From current branch vs origin/main
aiu pr-desc# Review current branch vs origin/main
aiu pr-review
# Review specific branch vs origin/main
aiu pr-review feature/new-api
# Review with custom base branch
aiu pr-review feature/new-api develop# Stage changes first
git add .
# Generate commit message from staged changes
aiu commit-msg
# Or use auto-commit hook
aiu enable-auto-commit
git commit # AI generates message automatically# Show expanded prompt without sending to AI
aiu pr-review --dry-run# Use specific provider
aiu pr-desc --provider gemini# Run all available providers in parallel, then choose the best output
aiu pr-desc --multiple
# or: aiu pr-desc -m# Send prompt text directly (no template expansion)
aiu run -p "Write a PR description for this change"# Clone repository
git clone https://github.com/trknhr/ai-utils.git
cd ai-utils
# Build
make build
# Install locally
make install
# Run tests
make testai-utils/
├── cmd/aiu/ # CLI entry point
├── internal/
│ ├── cli/ # Command implementations
│ ├── config/ # Configuration management
│ ├── provider/ # AI provider implementations
│ └── template/ # Template parser & executor
│ └── prompts/ # Built-in templates (embedded)
├── build/ # Build output (gitignored)
├── go.mod
├── Makefile
└── README.md
- Go 1.21+
- At least one supported AI CLI installed
| Template | Description | Usage |
|---|---|---|
pr-desc |
Generate PR description from git diff | aiu pr-desc |
pr-review |
Comprehensive code review checklist | aiu pr-review [target] [base] |
commit-msg |
Generate commit message from staged changes | aiu commit-msg |
The PR review template generates a detailed review covering:
- Code Quality (readability, DRY, complexity)
- Security (input validation, credentials, vulnerabilities)
- Test Coverage (unit tests, edge cases)
- Performance (N+1, memory, optimization)
- Maintainability (docs, error handling, logging)
- Architecture & Design (separation of concerns, dependencies)
- Phase 1: Basic template system + Claude provider
- Phase 2: Built-in templates, template arguments, auto-commit hook
- Phase 3: Gemini & Codex providers,
aiu listcommand - Phase 4: Interactive mode, colored output, better error messages
- Phase 5: Plugin system, custom providers
PRs and issues welcome → github.com/trknhr/ai-utils
Apache 2.0 License — © 2025 Teruo Kunihiro