GC-201c · Module 3
Workflow Design Patterns
3 min read
After mastering the individual features, the final skill is composing them into end-to-end workflows. A well-designed Gemini CLI workflow combines GEMINI.md (context), custom commands (triggers), MCP servers (external access), hooks (enforcement), and headless mode (automation) into a coherent system. The pattern is always the same: define the context, encode the workflow, connect the tools, enforce the standards, and automate the repetition.
The "morning review" workflow is a practical example that combines multiple features. A shell script runs gemini -p to analyze overnight commits, generate a summary, check for issues against GEMINI.md standards, and produce a daily report. Custom commands handle the analysis templates. MCP servers connect to GitHub for PR data and the database for metrics. The output feeds into a Slack notification or email. The entire workflow runs in 30 seconds and replaces 20 minutes of manual review.
#!/bin/bash
# Morning review workflow — runs as cron or manual script
DATE=$(date +%Y-%m-%d)
REPORT="reports/daily-$DATE.md"
# 1. Summarize overnight commits
COMMITS=$(git log --since="yesterday" --oneline)
gemini -p "Summarize these overnight commits for a morning standup. Group by feature area. Flag anything risky.\n\n$COMMITS" > "$REPORT"
# 2. Check open PRs for review
PRS=$(gh pr list --json number,title,author --limit 10)
gemini -p "Summarize these open PRs. Flag any that have been open more than 3 days.\n\n$PRS" >> "$REPORT"
# 3. Run code quality check on changed files
CHANGED=$(git diff --name-only HEAD~5)
gemini -p "Quick quality scan of recently changed files. Flag any obvious issues.\n\nChanged files:\n$CHANGED" >> "$REPORT"
echo "Daily report generated: $REPORT"
- Map your repetitive workflows Identify tasks you do daily or weekly that follow a predictable pattern. Code review, standup prep, release notes, documentation updates.
- Prototype interactively Run each workflow step interactively in Gemini CLI. Refine prompts until the output quality is consistently good.
- Encode as commands and scripts Convert refined prompts into custom commands (.toml) for interactive use and shell scripts for automated use.
- Schedule and monitor Run automated workflows via cron, GitHub Actions, or CI triggers. Monitor output quality and adjust prompts as your project evolves.