← Docs/Recipes
Recipe

Conventional commit message writer

Generate structured commit messages from a diff using Meridian's prompt templates.

Overview

This recipe pipes a staged diff into Meridian with a system prompt that enforces the Conventional Commits specification. The model outputs a single commit message with type, optional scope, and description — nothing else.

System prompt

You are a commit message generator. Given a git diff, produce a single Conventional Commits message.

Rules:
- Format: <type>[optional scope]: <description>
- Types: feat, fix, chore, docs, style, refactor, perf, test, ci, build
- Description under 72 characters, imperative mood, no period at end
- Output ONLY the commit message line, no markdown, no explanation

Usage

git diff --staged | meridian run \
  --system "$(cat commit-prompt.txt)" \
  --max-tokens 80 \
  --temperature 0.2

Pipe the output directly into git commit -F - for a fully automated workflow.

Example

Input diff (abridged)
+  export function validateApiKey(key: string): boolean {
+    return key.startsWith("mk_") && key.length === 42;
+  }
Output
feat(auth): add API key validation helper