ralph-loop-writerGenerate ready-to-run shell loop commands for Claude Code, Gemini CLI, or Grok CLI, customized by AI tool, model, shell, complexity, and loop features.
Install via ClawdBot CLI:
clawdbot install Walkamolee/ralph-loop-writername: ralph
description: "Generate Claude Code, Gemini CLI, or Grok CLI automation loop commands. Asks questions about your requirements and outputs a ready-to-run command for PowerShell, Windows CMD, or Bash/Linux."
allowed-tools:
Generate optimized loop commands for automating Claude Code, Gemini CLI, or Grok CLI with PROMPT.md.
Use AskUserQuestion:
1. "Claude Code (Recommended)" - "Claude AI assistant CLI"
2. "Gemini CLI" - "Google Gemini AI assistant"
3. "Grok CLI" - "xAI Grok AI assistant with agentic coding"
Store the choice for later.
Use AskUserQuestion based on AI tool choice:
If Claude Code selected:
1. "Default (Recommended)" - "Use default model (currently Sonnet 4.5)"
2. "Haiku" - "Fastest and most cost-effective"
3. "Sonnet" - "Balanced performance and cost"
4. "Opus" - "Most capable, higher cost"
If Gemini CLI selected:
1. "Default (Recommended)" - "Use default model"
2. "gemini-3-flash" - "Latest Gemini 3, fastest and most cost-effective"
3. "gemini-3-pro" - "Latest Gemini 3, most capable for complex tasks"
4. "gemini-2.5-flash" - "Stable production model, fast"
5. "gemini-2.5-pro" - "Stable production model, more capable"
If Grok CLI selected:
1. "Default (Recommended)" - "Use grok-code-fast-1, optimized for fast code generation and agentic loops"
2. "grok-4-latest" - "Latest Grok 4, most capable for complex reasoning"
3. "grok-beta" - "Preview of upcoming features"
Store the choice for later.
Use AskUserQuestion:
1. "PowerShell (Recommended)" - "Windows PowerShell"
2. "Windows CMD" - "Command Prompt (cmd.exe)"
3. "Bash/Linux" - "Linux, Mac, or WSL"
Store the choice for later.
Use AskUserQuestion:
1. "Simple (Recommended)" - "Basic loop with minimal options"
2. "Intermediate" - "Combine 2 control mechanisms"
3. "Advanced" - "Full control with multiple safeguards"
Use AskUserQuestion:
1. "Fixed count (Recommended)" - "Run exactly N times"
2. "Infinite with delay" - "Run forever with pauses"
3. "Stop file trigger" - "Run until STOP.txt exists"
Use AskUserQuestion:
1. "Fixed iterations" - "Run max N times"
2. "Time limit" - "Run for max X minutes"
3. "Stop file" - "Stop when STOP.txt appears"
4. "Delay between runs" - "Pause X seconds"
5. "Show counter" - "Display run number"
6. "File monitoring" - "Stop at file size/lines"
Use AskUserQuestion:
1. "Max iterations (Recommended)" - "Limit runs"
2. "Time limit (Recommended)" - "Max duration"
3. "Stop file (Recommended)" - "Manual stop"
4. "Delay between runs" - "Pause X seconds"
5. "Timestamp logging" - "Show time of each run"
6. "Counter display" - "Show run number"
Based on selected features, ask for values:
If fixed iterations selected:
If time limit selected:
If delay selected:
If file monitoring selected:
Build the appropriate command based on:
IMPORTANT - Command Syntax:
For Claude Code (PowerShell/Bash):
Use claude-code (NOT claude -p) to accept piped input. The -p flag requires an argument, not pipe.
Get-Content PROMPT.md -Raw | claude-code --dangerously-skip-permissionsGet-Content PROMPT.md -Raw | claude-code --model haiku --dangerously-skip-permissionsGet-Content PROMPT.md -Raw | claude-code --model sonnet --dangerously-skip-permissionsGet-Content PROMPT.md -Raw | claude-code --model opus --dangerously-skip-permissionsFor Claude Code (Bash):
cat PROMPT.md | claude-code --dangerously-skip-permissionscat PROMPT.md | claude-code --model haiku --dangerously-skip-permissionsFor Gemini CLI (PowerShell):
Gemini CLI accepts stdin piping.
Get-Content PROMPT.md -Raw | gemini --yoloGet-Content PROMPT.md -Raw | gemini --model gemini-3-flash --yoloGet-Content PROMPT.md -Raw | gemini --model gemini-3-pro --yoloGet-Content PROMPT.md -Raw | gemini --model gemini-2.5-flash --yoloGet-Content PROMPT.md -Raw | gemini --model gemini-2.5-pro --yoloFor Grok CLI (PowerShell):
Get-Content PROMPT.md -Raw | grok-auto (uses default model from GROK_MODEL env var, auto-approves permissions)Get-Content PROMPT.md -Raw | grok-auto -m grok-code-fast-1Get-Content PROMPT.md -Raw | grok-auto -m grok-4-latestGet-Content PROMPT.md -Raw | grok-auto -m grok-betaIMPORTANT - Placeholder Replacement:
For Claude Code: Replace [AI_COMMAND_WITH_PROMPT] with the FULL command including the prompt argument:
claude -p (Get-Content PROMPT.md -Raw) --dangerously-skip-permissionsclaude -p (Get-Content PROMPT.md -Raw) --model haiku --dangerously-skip-permissionsFor Gemini CLI: Replace [AI_COMMAND_WITH_PROMPT] with piped command:
Get-Content PROMPT.md -Raw | gemini --yoloGet-Content PROMPT.md -Raw | gemini --model gemini-3-flash --yoloFor Grok CLI: Replace [AI_COMMAND_WITH_PROMPT] with piped command:
Get-Content PROMPT.md -Raw | grok-autoGet-Content PROMPT.md -Raw | grok-auto -m grok-4-latestCRITICAL: Claude Code requires the prompt as a command-line argument. Piping does NOT work with claude -p.
PowerShell - Simple Fixed:
for ($i=1; $i -le N; $i++) { $start = Get-Date; Write-Host "`n=== Run $i/N ===" -ForegroundColor Cyan; [AI_COMMAND_WITH_PROMPT]; $duration = ((Get-Date) - $start).TotalSeconds; Write-Host "⏱️ Time: $([math]::Round($duration, 2))s" -ForegroundColor Magenta }
PowerShell - Simple Fixed + Delay:
for ($i=1; $i -le N; $i++) { $start = Get-Date; Write-Host "`n=== Run $i/N ===" -ForegroundColor Cyan; [AI_COMMAND_WITH_PROMPT]; $duration = ((Get-Date) - $start).TotalSeconds; Write-Host "⏱️ Time: $([math]::Round($duration, 2))s" -ForegroundColor Magenta; if ($i -lt N) { Write-Host "⏸️ Waiting X seconds..." -ForegroundColor Yellow; Start-Sleep -Seconds X } }
PowerShell - Simple Infinite + Delay:
$i=1; while ($true) { $start = Get-Date; Write-Host "`n=== Run $i ===" -ForegroundColor Cyan; [AI_COMMAND_WITH_PROMPT]; $duration = ((Get-Date) - $start).TotalSeconds; Write-Host "⏱️ Time: $([math]::Round($duration, 2))s" -ForegroundColor Magenta; Write-Host "⏸️ Waiting X seconds..." -ForegroundColor Yellow; Start-Sleep -Seconds X; $i++ }
PowerShell - Advanced Full Control:
$end = (Get-Date).AddMinutes(M); for ($i=1; $i -le N -and (Get-Date) -lt $end -and -not (Test-Path STOP.txt); $i++) { $start = Get-Date; Write-Host "`n[$(Get-Date -Format 'HH:mm:ss')] Run $i" -ForegroundColor Cyan; [AI_COMMAND_WITH_PROMPT]; $duration = ((Get-Date) - $start).TotalSeconds; Write-Host "⏱️ Time: $([math]::Round($duration, 2))s" -ForegroundColor Magenta; if ($i -lt N) { Write-Host "⏸️ Waiting X seconds..." -ForegroundColor Yellow; Start-Sleep -Seconds X } }; Write-Host "`n✅ Complete!" -ForegroundColor Green
CMD - Simple Fixed:
for /L %i in (1,1,N) do @(echo. & echo === Run %i === & type PROMPT.md | [AI_COMMAND])
Note: CMD has limited capabilities. For time tracking, recommend PowerShell.
CMD - Simple Infinite + Delay:
for /L %i in (1,0,2) do @(echo. & echo === Run %i === & type PROMPT.md | [AI_COMMAND] & timeout /t X /nobreak > nul)
CMD - Advanced:
for /L %i in (1,1,N) do @(if exist STOP.txt exit & echo. & echo [%time%] Run %i & type PROMPT.md | [AI_COMMAND] & timeout /t X /nobreak > nul)
Note: For time tracking, use PowerShell (see RalphPowerShellComands.md).
Bash - Simple Fixed:
for i in {1..N}; do echo -e "\n=== Run $i/N ==="; start=$(date +%s); cat PROMPT.md | [AI_COMMAND]; dur=$(($(date +%s) - start)); echo "⏱️ Time: ${dur}s"; done
Bash - Simple Fixed + Delay:
for i in {1..N}; do echo -e "\n=== Run $i/N ==="; start=$(date +%s); cat PROMPT.md | [AI_COMMAND]; dur=$(($(date +%s) - start)); echo "⏱️ Time: ${dur}s"; [ $i -lt N ] && { echo "⏸️ Waiting X seconds..."; sleep X; }; done
Bash - Simple Infinite + Delay:
i=1; while :; do echo -e "\n=== Run $i ==="; start=$(date +%s); cat PROMPT.md | [AI_COMMAND]; dur=$(($(date +%s) - start)); echo "⏱️ Time: ${dur}s"; echo "⏸️ Waiting X seconds..."; sleep X; ((i++)); done
Bash - Advanced:
end=$(($(date +%s) + M*60)); for i in {1..N}; do [ $(date +%s) -ge $end ] && break; [ -f STOP.txt ] && break; echo -e "\n[$(date +%H:%M:%S)] Run $i"; start=$(date +%s); cat PROMPT.md | [AI_COMMAND]; dur=$(($(date +%s) - start)); echo "⏱️ Time: ${dur}s"; [ $i -lt N ] && { echo "⏸️ Waiting X seconds..."; sleep X; }; done; echo -e "\n✅ Complete!"
Create a timestamped filename in the format: ralphcommand-YYYY-MM-DD-HHMMSS.md
Example: ralphcommand-2026-01-14-233045.md
Use the Write tool to create this file in the current directory with:
File structure:
# Ralph Command
Generated: [timestamp]
Shell: [PowerShell/CMD/Bash]
## Command[shell-type]
[THE ACTUAL COMMAND]
## How to run
1. Make sure you have a PROMPT.md file in this directory
2. Copy the command above
3. Paste into your [PowerShell/CMD/Bash] terminal
4. Press Enter
## How to stop
- Press Ctrl+C at any time
[- OR create STOP.txt: `echo $null > STOP.txt` / `touch STOP.txt`] (if stop file enabled)
## What it does
Runs [claude/gemini/grok] with PROMPT.md as input [N times / for M minutes / until stopped].
[Pauses X seconds between runs.]
[Shows timestamp and run number.]
[Displays execution time for each run.]
After creating the file, tell the user the exact filename created:
✅ Created ralphcommand-YYYY-MM-DD-HHMMSS.md in your current directory!
The file contains your command ready to run. Just open it and copy the command.
For more variations and explanations, see:
- RalphPowerShellComands.md - Full PowerShell reference
- RalphWindowsCommands.md - Full CMD reference
- RalphLinuxCommands.md - Full Bash reference
- RalphGemini.md - Full Gemini CLI guide
- RalphGrok.md - Full Grok CLI guide
claude -p (Get-Content PROMPT.md -Raw) --dangerously-skip-permissions. Piping does NOT work with claude -p.Get-Content PROMPT.md -Raw | gemini --yolo or Get-Content PROMPT.md -Raw | grok-auto.--model flagclaude -p (Get-Content PROMPT.md -Raw) --dangerously-skip-permissionsclaude -p (Get-Content PROMPT.md -Raw) --model --dangerously-skip-permissions haiku, sonnet, opusGet-Content PROMPT.md -Raw | gemini --yoloGet-Content PROMPT.md -Raw | gemini --model --yolo gemini-3-flash, gemini-3-pro, gemini-2.5-flash, gemini-2.5-pro-p flag is deprecated in Geminigrok-auto PowerShell function which calls xAI API directly (perfect for automation)Get-Content PROMPT.md -Raw | grok-auto (no -m flag, uses GROK_MODEL env var if set)Get-Content PROMPT.md -Raw | grok-auto -m grok-code-fast-1, grok-4-latest, grok-beta, grok-4grok-auto is a PowerShell function that calls the xAI API directly (no CLI needed)Get-Date (PowerShell) or date +%s (Bash)ralphcommand-YYYY-MM-DD-HHMMSS.md[AI_COMMAND_WITH_PROMPT] with the full claude command including prompt argument[AI_COMMAND] with the command after the pipeGenerated Mar 1, 2026
Developers can use this skill to generate loop commands that automatically run Claude Code or Gemini CLI on a PROMPT.md file containing code snippets, enabling continuous code review and refactoring suggestions. This is ideal for teams needing to maintain code quality across multiple iterations without manual intervention.
Marketing teams can leverage the skill to create loops that repeatedly generate marketing copy or social media posts using AI tools like Grok CLI. By setting up infinite loops with delays, they can produce fresh content on a schedule, streamlining campaign workflows.
Data analysts can use the skill to build commands that run Gemini CLI or Claude Code on data prompts, automating the generation of reports or insights. With features like fixed iterations and time limits, it ensures efficient processing of large datasets without manual oversight.
Educators and students can employ this skill to create loops that test different AI models (e.g., Claude vs. Gemini) on educational prompts, comparing outputs for learning purposes. The simple complexity level makes it accessible for beginners exploring AI capabilities.
Support teams can automate the creation of standardized responses to common customer queries by using loops with Claude Code. By setting up stop file triggers, they can halt generation when new guidelines are added, ensuring up-to-date and consistent support.
Offer a subscription-based service where users access pre-configured loop templates and advanced features for automating AI tasks. Revenue is generated through monthly or annual fees, targeting businesses that rely on repetitive AI-driven processes.
Provide a free version with basic loop generation capabilities, while charging for advanced features like multi-select options, custom parameters, and priority support. This model attracts a broad user base and converts power users to paid plans.
Generate revenue by offering consulting services to help organizations integrate this skill into their existing workflows, such as setting up complex loops for specific AI tools. This includes training, customization, and ongoing support contracts.
💬 Integration Tip
Integrate this skill into existing CI/CD pipelines by using the generated commands in automation scripts, ensuring seamless AI tool usage without manual setup.
Write persuasive copy for landing pages, emails, ads, sales pages, and marketing materials. Use when you need to write headlines, CTAs, product descriptions, ad copy, email sequences, or any text meant to drive action. Covers copywriting formulas (AIDA, PAS, FAB), headline writing, emotional triggers, objection handling in copy, and A/B testing. Trigger on "write copy", "copywriting", "landing page copy", "headline", "write a sales page", "ad copy", "email copy", "persuasive writing", "how to write [marketing text]".
Write compelling UX copy, marketing content, and product messaging. Use when writing button labels, error messages, landing pages, emails, CTAs, empty states, tooltips, or any user-facing text.
Use when you have a spec or requirements for a multi-step task, before touching code
You are a Writing Team Lead managing specialized writers via MCP tools. Please ANALYZE the writing task and then:1. if exist references, create a detailed co...
Creates high-quality, SEO-optimized content that ranks in search engines. Applies on-page SEO best practices, keyword optimization, and content structure for...
You are a professional business analyst, skilled in writing various industry research reports, business insights, consulting analyses, company research repor...