bobo-ai-cli 3.0.4 → 3.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +259 -259
- package/bundled-skills/CORE_SKILLS.txt +18 -18
- package/bundled-skills/backend-expert/SKILL.md +97 -97
- package/bundled-skills/code-review/SKILL.md +280 -280
- package/bundled-skills/code-review-expert/SKILL.md +85 -85
- package/bundled-skills/context-budget-analyzer/SKILL.md +76 -76
- package/bundled-skills/context-compressor/SKILL.md +75 -75
- package/bundled-skills/context-optimization-suite/SKILL.md +162 -162
- package/bundled-skills/frontend-expert/SKILL.md +93 -93
- package/bundled-skills/github/SKILL.md +12 -12
- package/bundled-skills/high-agency/SKILL.md +473 -473
- package/bundled-skills/high-agency/references/builder-patterns.md +126 -126
- package/bundled-skills/high-agency/references/recovery-playbook.md +298 -298
- package/bundled-skills/memory-manager/SKILL.md +214 -214
- package/bundled-skills/memory-manager/references/advanced-config.md +65 -65
- package/bundled-skills/orchestrator/SKILL.md +681 -681
- package/bundled-skills/planning-with-files/SKILL.md +193 -193
- package/bundled-skills/skill-creator/SKILL.md +220 -220
- package/bundled-skills/testing-expert/SKILL.md +99 -99
- package/bundled-skills/verify/SKILL.md +15 -15
- package/dist/agent.d.ts +5 -0
- package/dist/agent.js +11 -1
- package/dist/agent.js.map +1 -1
- package/dist/agents/catalog.d.ts +47 -0
- package/dist/agents/catalog.js +63 -5
- package/dist/agents/catalog.js.map +1 -1
- package/dist/agents/router.d.ts +12 -1
- package/dist/agents/router.js +43 -3
- package/dist/agents/router.js.map +1 -1
- package/dist/agents/spawn.js +36 -18
- package/dist/agents/spawn.js.map +1 -1
- package/dist/autonomous.js +5 -5
- package/dist/cli.js +23 -21
- package/dist/cli.js.map +1 -1
- package/dist/compactor.js +39 -39
- package/dist/dream.js +29 -29
- package/dist/image-input.d.ts +44 -0
- package/dist/image-input.js +161 -0
- package/dist/image-input.js.map +1 -0
- package/dist/memory.js +13 -13
- package/dist/project.js +15 -15
- package/dist/repl.js +88 -0
- package/dist/repl.js.map +1 -1
- package/dist/skills.js +54 -54
- package/dist/sub-agents.js +65 -65
- package/dist/tools/browser.js +21 -21
- package/dist/tools/claude-code.js +10 -10
- package/dist/web.js +7 -7
- package/dist/wiki-commands.d.ts +2 -0
- package/dist/wiki-commands.js +249 -0
- package/dist/wiki-commands.js.map +1 -0
- package/dist/wiki.d.ts +90 -0
- package/dist/wiki.js +614 -0
- package/dist/wiki.js.map +1 -0
- package/knowledge/advanced-patterns.md +70 -70
- package/knowledge/agent-directives.md +74 -74
- package/knowledge/api-integration-patterns.md +102 -0
- package/knowledge/code-review-protocol.md +69 -0
- package/knowledge/dream.md +36 -36
- package/knowledge/engineering.md +52 -46
- package/knowledge/error-catalog.md +38 -33
- package/knowledge/event-driven-architecture.md +43 -0
- package/knowledge/external-alignment.md +47 -0
- package/knowledge/high-agency.md +73 -0
- package/knowledge/image-generation.md +48 -0
- package/knowledge/index.json +194 -169
- package/knowledge/llm-wiki-pattern.md +71 -0
- package/knowledge/long-task-management.md +79 -0
- package/knowledge/memory/cache-optimization-and-skill-integration.md +102 -102
- package/knowledge/memory/engineering-patterns.md +134 -134
- package/knowledge/memory/feedback_root_structure.md +15 -15
- package/knowledge/memory/project-contexts.md +69 -69
- package/knowledge/memory/tools-and-services.md +85 -85
- package/knowledge/memory-management.md +72 -0
- package/knowledge/rules/advisor-strategy.md +204 -0
- package/knowledge/rules/agents.md +62 -62
- package/knowledge/rules/blocking-rules.md +323 -323
- package/knowledge/rules/cache-management.md +379 -379
- package/knowledge/rules/capability-evolution.md +132 -132
- package/knowledge/rules/coding.md +126 -126
- package/knowledge/rules/engineering-workflows.md +225 -225
- package/knowledge/rules/evomap-content-guidelines.md +354 -354
- package/knowledge/rules/evomap-guide.md +224 -224
- package/knowledge/rules/external-alignment.md +22 -0
- package/knowledge/rules/git.md +31 -31
- package/knowledge/rules/hooks.md +106 -106
- package/knowledge/rules/performance.md +101 -101
- package/knowledge/rules/remotion-auto-production.md +1120 -1120
- package/knowledge/rules/security.md +46 -46
- package/knowledge/rules/testing.md +32 -32
- package/knowledge/rules/work-mode.md +208 -208
- package/knowledge/rules.md +62 -62
- package/knowledge/self-evolution.md +78 -0
- package/knowledge/self-rationalization-guard.md +52 -0
- package/knowledge/skills/Skill_Seekers.md +1722 -1722
- package/knowledge/skills/ab-test-setup.md +557 -557
- package/knowledge/skills/agent-sdk-dev.md +238 -238
- package/knowledge/skills/agent-tools.md +136 -136
- package/knowledge/skills/analytics-tracking.md +597 -597
- package/knowledge/skills/artifacts-builder.md +89 -89
- package/knowledge/skills/asana.md +12 -12
- package/knowledge/skills/backend-expert.md +97 -97
- package/knowledge/skills/brand-voice.md +481 -481
- package/knowledge/skills/browser-use.md +419 -419
- package/knowledge/skills/cache-optimization-skill.md +179 -179
- package/knowledge/skills/canvas-design.md +147 -147
- package/knowledge/skills/citation-validator.md +203 -203
- package/knowledge/skills/clangd-lsp.md +52 -52
- package/knowledge/skills/code-review-expert.md +85 -85
- package/knowledge/skills/code-review.md +280 -280
- package/knowledge/skills/code-simplifier.md +12 -12
- package/knowledge/skills/commit-commands.md +258 -258
- package/knowledge/skills/competitor-alternatives.md +795 -795
- package/knowledge/skills/content-atomizer.md +910 -910
- package/knowledge/skills/content-research-writer.md +605 -605
- package/knowledge/skills/context-optimization-suite.md +162 -162
- package/knowledge/skills/context7.md +12 -12
- package/knowledge/skills/copy-editing.md +494 -494
- package/knowledge/skills/copywriting.md +510 -510
- package/knowledge/skills/csharp-lsp.md +40 -40
- package/knowledge/skills/decision-making-framework.md +154 -154
- package/knowledge/skills/developer-growth-analysis.md +335 -335
- package/knowledge/skills/direct-response-copy.md +2336 -2336
- package/knowledge/skills/docker-expert.md +229 -229
- package/knowledge/skills/document-skills.md +12 -12
- package/knowledge/skills/documentation-expert.md +126 -126
- package/knowledge/skills/email-sequence.md +1061 -1061
- package/knowledge/skills/email-sequences.md +910 -910
- package/knowledge/skills/example-plugin.md +72 -72
- package/knowledge/skills/explanatory-output-style.md +82 -82
- package/knowledge/skills/feature-dev.md +458 -458
- package/knowledge/skills/file-organizer.md +466 -466
- package/knowledge/skills/firebase.disabled.md +12 -12
- package/knowledge/skills/form-cro.md +488 -488
- package/knowledge/skills/free-tool-strategy.md +636 -636
- package/knowledge/skills/frontend-design-offical.md +55 -55
- package/knowledge/skills/frontend-design.md +41 -41
- package/knowledge/skills/frontend-expert.md +93 -93
- package/knowledge/skills/github.md +12 -12
- package/knowledge/skills/gitlab.md +12 -12
- package/knowledge/skills/gopls-lsp.md +32 -32
- package/knowledge/skills/got-controller.md +218 -218
- package/knowledge/skills/greptile.md +72 -72
- package/knowledge/skills/hookify.md +376 -376
- package/knowledge/skills/image-editor.md +189 -189
- package/knowledge/skills/image-enhancer.md +109 -109
- package/knowledge/skills/jdtls-lsp.md +49 -49
- package/knowledge/skills/json-canvas.md +654 -654
- package/knowledge/skills/keyword-research.md +559 -559
- package/knowledge/skills/kotlin-lsp.md +28 -28
- package/knowledge/skills/laravel-boost.md +12 -12
- package/knowledge/skills/launch-strategy.md +394 -394
- package/knowledge/skills/lead-magnet.md +393 -393
- package/knowledge/skills/learning-output-style.md +106 -106
- package/knowledge/skills/linear.md +12 -12
- package/knowledge/skills/lua-lsp.md +47 -47
- package/knowledge/skills/marketing-ideas.md +720 -720
- package/knowledge/skills/marketing-psychology.md +534 -534
- package/knowledge/skills/mcp-builder.md +369 -369
- package/knowledge/skills/meeting-insights-analyzer.md +347 -347
- package/knowledge/skills/memory-evolution-system.md +172 -172
- package/knowledge/skills/multi-lens-thinking.md +407 -407
- package/knowledge/skills/nano-banana-pro.md +116 -116
- package/knowledge/skills/newsletter.md +736 -736
- package/knowledge/skills/notebooklm.md +296 -296
- package/knowledge/skills/obsidian-bases.md +634 -634
- package/knowledge/skills/obsidian-markdown.md +651 -651
- package/knowledge/skills/onboarding-cro.md +494 -494
- package/knowledge/skills/orchestrator.md +681 -681
- package/knowledge/skills/page-cro.md +379 -379
- package/knowledge/skills/paid-ads.md +624 -624
- package/knowledge/skills/paywall-upgrade-cro.md +651 -651
- package/knowledge/skills/php-lsp.md +36 -36
- package/knowledge/skills/planning-with-files.md +193 -193
- package/knowledge/skills/playwright.md +12 -12
- package/knowledge/skills/plugin-dev.md +434 -434
- package/knowledge/skills/popup-cro.md +520 -520
- package/knowledge/skills/positioning-angles.md +330 -330
- package/knowledge/skills/pr-review-toolkit.md +359 -359
- package/knowledge/skills/pricing-strategy.md +777 -777
- package/knowledge/skills/programmatic-seo.md +714 -714
- package/knowledge/skills/pyright-lsp.md +43 -43
- package/knowledge/skills/quality-assurance-framework.md +168 -168
- package/knowledge/skills/question-refiner.md +160 -160
- package/knowledge/skills/ralph-loop.md +205 -205
- package/knowledge/skills/refactoring-expert.md +103 -103
- package/knowledge/skills/referral-program.md +668 -668
- package/knowledge/skills/research-executor.md +164 -164
- package/knowledge/skills/review-with-security.md +12 -12
- package/knowledge/skills/rust-analyzer-lsp.md +50 -50
- package/knowledge/skills/schema-markup.md +647 -647
- package/knowledge/skills/security-audit-expert.md +124 -124
- package/knowledge/skills/security-expert.md +140 -140
- package/knowledge/skills/security-guidance.md +12 -12
- package/knowledge/skills/seedance-prompt.md +139 -139
- package/knowledge/skills/self-evolution.md +1160 -1160
- package/knowledge/skills/seo-audit.md +432 -432
- package/knowledge/skills/seo-content.md +787 -787
- package/knowledge/skills/serena.md +12 -12
- package/knowledge/skills/signup-flow-cro.md +409 -409
- package/knowledge/skills/skill-creator.md +220 -220
- package/knowledge/skills/skill-manager.md +226 -226
- package/knowledge/skills/skill-share.md +98 -98
- package/knowledge/skills/slack.md +12 -12
- package/knowledge/skills/social-content.md +878 -878
- package/knowledge/skills/spec-flow-skill.md +124 -124
- package/knowledge/skills/stripe.md +12 -12
- package/knowledge/skills/supabase.md +12 -12
- package/knowledge/skills/swift-lsp.md +40 -40
- package/knowledge/skills/synthesizer.md +236 -236
- package/knowledge/skills/template-skill.md +16 -16
- package/knowledge/skills/testing-expert.md +99 -99
- package/knowledge/skills/theme-factory.md +72 -72
- package/knowledge/skills/tiktok-research.md +208 -208
- package/knowledge/skills/typescript-lsp.md +36 -36
- package/knowledge/skills/ui-ux-pro-max.md +247 -247
- package/knowledge/skills/verify.md +15 -15
- package/knowledge/skills/visual-prompt-engineer.md +102 -102
- package/knowledge/skills/webapp-testing.md +111 -111
- package/knowledge/skills/wide-research.md +191 -191
- package/knowledge/system.md +93 -93
- package/knowledge/task-router.md +46 -37
- package/knowledge/verification.md +38 -38
- package/knowledge/worker-prompt-craft.md +66 -0
- package/knowledge/workflows/3d-viz.md +47 -47
- package/knowledge/workflows/data-pipeline.md +47 -47
- package/knowledge/workflows/db-migration.md +51 -51
- package/knowledge/workflows/feature-dev.md +41 -41
- package/knowledge/workflows/tdd-flow.md +52 -52
- package/knowledge/workflows/ui-verify.md +51 -51
- package/package.json +74 -74
- package/dist/claude-bridge.d.ts +0 -18
- package/dist/claude-bridge.js +0 -91
- package/dist/claude-bridge.js.map +0 -1
- package/dist/tools/claude-bridge-tool.d.ts +0 -4
- package/dist/tools/claude-bridge-tool.js +0 -44
- package/dist/tools/claude-bridge-tool.js.map +0 -1
|
@@ -1,205 +1,205 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: "ralph-loop"
|
|
3
|
-
title: "Ralph Loop Plugin"
|
|
4
|
-
category: "agent-engineering"
|
|
5
|
-
tags: ["ralph loop plugin", "what is ralph loop?", "1. works on the task", "2. tries to exit", "3. stop hook blocks exit", "5. repeat until completion", "quick start", "commands", "prompt writing best practices"]
|
|
6
|
-
triggers: []
|
|
7
|
-
dependencies: []
|
|
8
|
-
source: "E:/Bobo's Coding cache/.claude/skills/ralph-loop"
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# Ralph Loop Plugin
|
|
12
|
-
|
|
13
|
-
Implementation of the Ralph Wiggum technique for iterative, self-referential AI development loops in Claude Code.
|
|
14
|
-
|
|
15
|
-
## What is Ralph Loop?
|
|
16
|
-
|
|
17
|
-
Ralph Loop is a development methodology based on continuous AI agent loops. As Geoffrey Huntley describes it: **"Ralph is a Bash loop"** - a simple `while true` that repeatedly feeds an AI agent a prompt file, allowing it to iteratively improve its work until completion.
|
|
18
|
-
|
|
19
|
-
This technique is inspired by the Ralph Wiggum coding technique (named after the character from The Simpsons), embodying the philosophy of persistent iteration despite setbacks.
|
|
20
|
-
|
|
21
|
-
### Core Concept
|
|
22
|
-
|
|
23
|
-
This plugin implements Ralph using a **Stop hook** that intercepts Claude's exit attempts:
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
# You run ONCE:
|
|
27
|
-
/ralph-loop "Your task description" --completion-promise "DONE"
|
|
28
|
-
|
|
29
|
-
# Then Claude Code automatically:
|
|
30
|
-
# 1. Works on the task
|
|
31
|
-
# 2. Tries to exit
|
|
32
|
-
# 3. Stop hook blocks exit
|
|
33
|
-
# 4. Stop hook feeds the SAME prompt back
|
|
34
|
-
# 5. Repeat until completion
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
The loop happens **inside your current session** - you don't need external bash loops. The Stop hook in `hooks/stop-hook.sh` creates the self-referential feedback loop by blocking normal session exit.
|
|
38
|
-
|
|
39
|
-
This creates a **self-referential feedback loop** where:
|
|
40
|
-
|
|
41
|
-
- The prompt never changes between iterations
|
|
42
|
-
- Claude's previous work persists in files
|
|
43
|
-
- Each iteration sees modified files and git history
|
|
44
|
-
- Claude autonomously improves by reading its own past work in files
|
|
45
|
-
|
|
46
|
-
## Quick Start
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
/ralph-loop "Build a REST API for todos. Requirements: CRUD operations, input validation, tests. Output <promise>COMPLETE</promise> when done." --completion-promise "COMPLETE" --max-iterations 50
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
Claude will:
|
|
53
|
-
|
|
54
|
-
- Implement the API iteratively
|
|
55
|
-
- Run tests and see failures
|
|
56
|
-
- Fix bugs based on test output
|
|
57
|
-
- Iterate until all requirements met
|
|
58
|
-
- Output the completion promise when done
|
|
59
|
-
|
|
60
|
-
## Commands
|
|
61
|
-
|
|
62
|
-
### /ralph-loop
|
|
63
|
-
|
|
64
|
-
Start a Ralph loop in your current session.
|
|
65
|
-
|
|
66
|
-
**Usage:**
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
/ralph-loop "<prompt>" --max-iterations <n> --completion-promise "<text>"
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
**Options:**
|
|
73
|
-
|
|
74
|
-
- `--max-iterations <n>` - Stop after N iterations (default: unlimited)
|
|
75
|
-
- `--completion-promise <text>` - Phrase that signals completion
|
|
76
|
-
|
|
77
|
-
### /cancel-ralph
|
|
78
|
-
|
|
79
|
-
Cancel the active Ralph loop.
|
|
80
|
-
|
|
81
|
-
**Usage:**
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
/cancel-ralph
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
## Prompt Writing Best Practices
|
|
88
|
-
|
|
89
|
-
### 1. Clear Completion Criteria
|
|
90
|
-
|
|
91
|
-
❌ Bad: "Build a todo API and make it good."
|
|
92
|
-
|
|
93
|
-
✅ Good:
|
|
94
|
-
|
|
95
|
-
```markdown
|
|
96
|
-
Build a REST API for todos.
|
|
97
|
-
|
|
98
|
-
When complete:
|
|
99
|
-
|
|
100
|
-
- All CRUD endpoints working
|
|
101
|
-
- Input validation in place
|
|
102
|
-
- Tests passing (coverage > 80%)
|
|
103
|
-
- README with API docs
|
|
104
|
-
- Output: <promise>COMPLETE</promise>
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
### 2. Incremental Goals
|
|
108
|
-
|
|
109
|
-
❌ Bad: "Create a complete e-commerce platform."
|
|
110
|
-
|
|
111
|
-
✅ Good:
|
|
112
|
-
|
|
113
|
-
```markdown
|
|
114
|
-
Phase 1: User authentication (JWT, tests)
|
|
115
|
-
Phase 2: Product catalog (list/search, tests)
|
|
116
|
-
Phase 3: Shopping cart (add/remove, tests)
|
|
117
|
-
|
|
118
|
-
Output <promise>COMPLETE</promise> when all phases done.
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
### 3. Self-Correction
|
|
122
|
-
|
|
123
|
-
❌ Bad: "Write code for feature X."
|
|
124
|
-
|
|
125
|
-
✅ Good:
|
|
126
|
-
|
|
127
|
-
```markdown
|
|
128
|
-
Implement feature X following TDD:
|
|
129
|
-
|
|
130
|
-
1. Write failing tests
|
|
131
|
-
2. Implement feature
|
|
132
|
-
3. Run tests
|
|
133
|
-
4. If any fail, debug and fix
|
|
134
|
-
5. Refactor if needed
|
|
135
|
-
6. Repeat until all green
|
|
136
|
-
7. Output: <promise>COMPLETE</promise>
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
### 4. Escape Hatches
|
|
140
|
-
|
|
141
|
-
Always use `--max-iterations` as a safety net to prevent infinite loops on impossible tasks:
|
|
142
|
-
|
|
143
|
-
```bash
|
|
144
|
-
# Recommended: Always set a reasonable iteration limit
|
|
145
|
-
/ralph-loop "Try to implement feature X" --max-iterations 20
|
|
146
|
-
|
|
147
|
-
# In your prompt, include what to do if stuck:
|
|
148
|
-
# "After 15 iterations, if not complete:
|
|
149
|
-
# - Document what's blocking progress
|
|
150
|
-
# - List what was attempted
|
|
151
|
-
# - Suggest alternative approaches"
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
**Note**: The `--completion-promise` uses exact string matching, so you cannot use it for multiple completion conditions (like "SUCCESS" vs "BLOCKED"). Always rely on `--max-iterations` as your primary safety mechanism.
|
|
155
|
-
|
|
156
|
-
## Philosophy
|
|
157
|
-
|
|
158
|
-
Ralph embodies several key principles:
|
|
159
|
-
|
|
160
|
-
### 1. Iteration > Perfection
|
|
161
|
-
|
|
162
|
-
Don't aim for perfect on first try. Let the loop refine the work.
|
|
163
|
-
|
|
164
|
-
### 2. Failures Are Data
|
|
165
|
-
|
|
166
|
-
"Deterministically bad" means failures are predictable and informative. Use them to tune prompts.
|
|
167
|
-
|
|
168
|
-
### 3. Operator Skill Matters
|
|
169
|
-
|
|
170
|
-
Success depends on writing good prompts, not just having a good model.
|
|
171
|
-
|
|
172
|
-
### 4. Persistence Wins
|
|
173
|
-
|
|
174
|
-
Keep trying until success. The loop handles retry logic automatically.
|
|
175
|
-
|
|
176
|
-
## When to Use Ralph
|
|
177
|
-
|
|
178
|
-
**Good for:**
|
|
179
|
-
|
|
180
|
-
- Well-defined tasks with clear success criteria
|
|
181
|
-
- Tasks requiring iteration and refinement (e.g., getting tests to pass)
|
|
182
|
-
- Greenfield projects where you can walk away
|
|
183
|
-
- Tasks with automatic verification (tests, linters)
|
|
184
|
-
|
|
185
|
-
**Not good for:**
|
|
186
|
-
|
|
187
|
-
- Tasks requiring human judgment or design decisions
|
|
188
|
-
- One-shot operations
|
|
189
|
-
- Tasks with unclear success criteria
|
|
190
|
-
- Production debugging (use targeted debugging instead)
|
|
191
|
-
|
|
192
|
-
## Real-World Results
|
|
193
|
-
|
|
194
|
-
- Successfully generated 6 repositories overnight in Y Combinator hackathon testing
|
|
195
|
-
- One $50k contract completed for $297 in API costs
|
|
196
|
-
- Created entire programming language ("cursed") over 3 months using this approach
|
|
197
|
-
|
|
198
|
-
## Learn More
|
|
199
|
-
|
|
200
|
-
- Original technique: https://ghuntley.com/ralph/
|
|
201
|
-
- Ralph Orchestrator: https://github.com/mikeyobrien/ralph-orchestrator
|
|
202
|
-
|
|
203
|
-
## For Help
|
|
204
|
-
|
|
205
|
-
Run `/help` in Claude Code for detailed command reference and examples.
|
|
1
|
+
---
|
|
2
|
+
id: "ralph-loop"
|
|
3
|
+
title: "Ralph Loop Plugin"
|
|
4
|
+
category: "agent-engineering"
|
|
5
|
+
tags: ["ralph loop plugin", "what is ralph loop?", "1. works on the task", "2. tries to exit", "3. stop hook blocks exit", "5. repeat until completion", "quick start", "commands", "prompt writing best practices"]
|
|
6
|
+
triggers: []
|
|
7
|
+
dependencies: []
|
|
8
|
+
source: "E:/Bobo's Coding cache/.claude/skills/ralph-loop"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Ralph Loop Plugin
|
|
12
|
+
|
|
13
|
+
Implementation of the Ralph Wiggum technique for iterative, self-referential AI development loops in Claude Code.
|
|
14
|
+
|
|
15
|
+
## What is Ralph Loop?
|
|
16
|
+
|
|
17
|
+
Ralph Loop is a development methodology based on continuous AI agent loops. As Geoffrey Huntley describes it: **"Ralph is a Bash loop"** - a simple `while true` that repeatedly feeds an AI agent a prompt file, allowing it to iteratively improve its work until completion.
|
|
18
|
+
|
|
19
|
+
This technique is inspired by the Ralph Wiggum coding technique (named after the character from The Simpsons), embodying the philosophy of persistent iteration despite setbacks.
|
|
20
|
+
|
|
21
|
+
### Core Concept
|
|
22
|
+
|
|
23
|
+
This plugin implements Ralph using a **Stop hook** that intercepts Claude's exit attempts:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# You run ONCE:
|
|
27
|
+
/ralph-loop "Your task description" --completion-promise "DONE"
|
|
28
|
+
|
|
29
|
+
# Then Claude Code automatically:
|
|
30
|
+
# 1. Works on the task
|
|
31
|
+
# 2. Tries to exit
|
|
32
|
+
# 3. Stop hook blocks exit
|
|
33
|
+
# 4. Stop hook feeds the SAME prompt back
|
|
34
|
+
# 5. Repeat until completion
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The loop happens **inside your current session** - you don't need external bash loops. The Stop hook in `hooks/stop-hook.sh` creates the self-referential feedback loop by blocking normal session exit.
|
|
38
|
+
|
|
39
|
+
This creates a **self-referential feedback loop** where:
|
|
40
|
+
|
|
41
|
+
- The prompt never changes between iterations
|
|
42
|
+
- Claude's previous work persists in files
|
|
43
|
+
- Each iteration sees modified files and git history
|
|
44
|
+
- Claude autonomously improves by reading its own past work in files
|
|
45
|
+
|
|
46
|
+
## Quick Start
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
/ralph-loop "Build a REST API for todos. Requirements: CRUD operations, input validation, tests. Output <promise>COMPLETE</promise> when done." --completion-promise "COMPLETE" --max-iterations 50
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Claude will:
|
|
53
|
+
|
|
54
|
+
- Implement the API iteratively
|
|
55
|
+
- Run tests and see failures
|
|
56
|
+
- Fix bugs based on test output
|
|
57
|
+
- Iterate until all requirements met
|
|
58
|
+
- Output the completion promise when done
|
|
59
|
+
|
|
60
|
+
## Commands
|
|
61
|
+
|
|
62
|
+
### /ralph-loop
|
|
63
|
+
|
|
64
|
+
Start a Ralph loop in your current session.
|
|
65
|
+
|
|
66
|
+
**Usage:**
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
/ralph-loop "<prompt>" --max-iterations <n> --completion-promise "<text>"
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Options:**
|
|
73
|
+
|
|
74
|
+
- `--max-iterations <n>` - Stop after N iterations (default: unlimited)
|
|
75
|
+
- `--completion-promise <text>` - Phrase that signals completion
|
|
76
|
+
|
|
77
|
+
### /cancel-ralph
|
|
78
|
+
|
|
79
|
+
Cancel the active Ralph loop.
|
|
80
|
+
|
|
81
|
+
**Usage:**
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
/cancel-ralph
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Prompt Writing Best Practices
|
|
88
|
+
|
|
89
|
+
### 1. Clear Completion Criteria
|
|
90
|
+
|
|
91
|
+
❌ Bad: "Build a todo API and make it good."
|
|
92
|
+
|
|
93
|
+
✅ Good:
|
|
94
|
+
|
|
95
|
+
```markdown
|
|
96
|
+
Build a REST API for todos.
|
|
97
|
+
|
|
98
|
+
When complete:
|
|
99
|
+
|
|
100
|
+
- All CRUD endpoints working
|
|
101
|
+
- Input validation in place
|
|
102
|
+
- Tests passing (coverage > 80%)
|
|
103
|
+
- README with API docs
|
|
104
|
+
- Output: <promise>COMPLETE</promise>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### 2. Incremental Goals
|
|
108
|
+
|
|
109
|
+
❌ Bad: "Create a complete e-commerce platform."
|
|
110
|
+
|
|
111
|
+
✅ Good:
|
|
112
|
+
|
|
113
|
+
```markdown
|
|
114
|
+
Phase 1: User authentication (JWT, tests)
|
|
115
|
+
Phase 2: Product catalog (list/search, tests)
|
|
116
|
+
Phase 3: Shopping cart (add/remove, tests)
|
|
117
|
+
|
|
118
|
+
Output <promise>COMPLETE</promise> when all phases done.
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### 3. Self-Correction
|
|
122
|
+
|
|
123
|
+
❌ Bad: "Write code for feature X."
|
|
124
|
+
|
|
125
|
+
✅ Good:
|
|
126
|
+
|
|
127
|
+
```markdown
|
|
128
|
+
Implement feature X following TDD:
|
|
129
|
+
|
|
130
|
+
1. Write failing tests
|
|
131
|
+
2. Implement feature
|
|
132
|
+
3. Run tests
|
|
133
|
+
4. If any fail, debug and fix
|
|
134
|
+
5. Refactor if needed
|
|
135
|
+
6. Repeat until all green
|
|
136
|
+
7. Output: <promise>COMPLETE</promise>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### 4. Escape Hatches
|
|
140
|
+
|
|
141
|
+
Always use `--max-iterations` as a safety net to prevent infinite loops on impossible tasks:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# Recommended: Always set a reasonable iteration limit
|
|
145
|
+
/ralph-loop "Try to implement feature X" --max-iterations 20
|
|
146
|
+
|
|
147
|
+
# In your prompt, include what to do if stuck:
|
|
148
|
+
# "After 15 iterations, if not complete:
|
|
149
|
+
# - Document what's blocking progress
|
|
150
|
+
# - List what was attempted
|
|
151
|
+
# - Suggest alternative approaches"
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**Note**: The `--completion-promise` uses exact string matching, so you cannot use it for multiple completion conditions (like "SUCCESS" vs "BLOCKED"). Always rely on `--max-iterations` as your primary safety mechanism.
|
|
155
|
+
|
|
156
|
+
## Philosophy
|
|
157
|
+
|
|
158
|
+
Ralph embodies several key principles:
|
|
159
|
+
|
|
160
|
+
### 1. Iteration > Perfection
|
|
161
|
+
|
|
162
|
+
Don't aim for perfect on first try. Let the loop refine the work.
|
|
163
|
+
|
|
164
|
+
### 2. Failures Are Data
|
|
165
|
+
|
|
166
|
+
"Deterministically bad" means failures are predictable and informative. Use them to tune prompts.
|
|
167
|
+
|
|
168
|
+
### 3. Operator Skill Matters
|
|
169
|
+
|
|
170
|
+
Success depends on writing good prompts, not just having a good model.
|
|
171
|
+
|
|
172
|
+
### 4. Persistence Wins
|
|
173
|
+
|
|
174
|
+
Keep trying until success. The loop handles retry logic automatically.
|
|
175
|
+
|
|
176
|
+
## When to Use Ralph
|
|
177
|
+
|
|
178
|
+
**Good for:**
|
|
179
|
+
|
|
180
|
+
- Well-defined tasks with clear success criteria
|
|
181
|
+
- Tasks requiring iteration and refinement (e.g., getting tests to pass)
|
|
182
|
+
- Greenfield projects where you can walk away
|
|
183
|
+
- Tasks with automatic verification (tests, linters)
|
|
184
|
+
|
|
185
|
+
**Not good for:**
|
|
186
|
+
|
|
187
|
+
- Tasks requiring human judgment or design decisions
|
|
188
|
+
- One-shot operations
|
|
189
|
+
- Tasks with unclear success criteria
|
|
190
|
+
- Production debugging (use targeted debugging instead)
|
|
191
|
+
|
|
192
|
+
## Real-World Results
|
|
193
|
+
|
|
194
|
+
- Successfully generated 6 repositories overnight in Y Combinator hackathon testing
|
|
195
|
+
- One $50k contract completed for $297 in API costs
|
|
196
|
+
- Created entire programming language ("cursed") over 3 months using this approach
|
|
197
|
+
|
|
198
|
+
## Learn More
|
|
199
|
+
|
|
200
|
+
- Original technique: https://ghuntley.com/ralph/
|
|
201
|
+
- Ralph Orchestrator: https://github.com/mikeyobrien/ralph-orchestrator
|
|
202
|
+
|
|
203
|
+
## For Help
|
|
204
|
+
|
|
205
|
+
Run `/help` in Claude Code for detailed command reference and examples.
|
|
@@ -1,103 +1,103 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: "refactoring-expert"
|
|
3
|
-
title: "Refactoring Expert"
|
|
4
|
-
category: "dev-tools"
|
|
5
|
-
tags: ["refactoring expert", "refactoring catalog", "analysis process", "output format", "code smell analysis", "recommended refactorings", "step-by-step plan", "risk assessment"]
|
|
6
|
-
triggers: ["Long methods", "duplicated code", "comments explaining code blocks"]
|
|
7
|
-
dependencies: []
|
|
8
|
-
source: "E:/Bobo's Coding cache/.claude/skills/refactoring-expert"
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
name: refactoring-expert
|
|
13
|
-
description: Expert skill for identifying refactoring opportunities and applying clean code transformations
|
|
14
|
-
---
|
|
15
|
-
|
|
16
|
-
# Refactoring Expert
|
|
17
|
-
|
|
18
|
-
You are an expert in code refactoring with deep knowledge of refactoring patterns, design patterns, and clean code principles.
|
|
19
|
-
|
|
20
|
-
## Refactoring Catalog
|
|
21
|
-
|
|
22
|
-
### Extract Method
|
|
23
|
-
|
|
24
|
-
When to use: Long methods, duplicated code, comments explaining code blocks
|
|
25
|
-
|
|
26
|
-
```
|
|
27
|
-
Before: Long function with multiple responsibilities
|
|
28
|
-
After: Multiple focused functions with clear names
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### Extract Variable
|
|
32
|
-
|
|
33
|
-
When to use: Complex expressions, magic numbers, repeated calculations
|
|
34
|
-
|
|
35
|
-
```
|
|
36
|
-
Before: if (user.age >= 18 && user.country === 'US' && user.verified)
|
|
37
|
-
After: const isEligible = user.age >= 18 && user.country === 'US' && user.verified;
|
|
38
|
-
if (isEligible)
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### Replace Conditional with Polymorphism
|
|
42
|
-
|
|
43
|
-
When to use: Switch statements based on type, repeated type checking
|
|
44
|
-
|
|
45
|
-
```
|
|
46
|
-
Before: switch(type) { case 'A': ... case 'B': ... }
|
|
47
|
-
After: interface Handler { handle(): void }
|
|
48
|
-
class AHandler implements Handler { ... }
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### Introduce Parameter Object
|
|
52
|
-
|
|
53
|
-
When to use: Multiple related parameters, data clumps
|
|
54
|
-
|
|
55
|
-
```
|
|
56
|
-
Before: function createUser(name, email, age, country)
|
|
57
|
-
After: function createUser(userData: UserData)
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### Replace Magic Numbers with Constants
|
|
61
|
-
|
|
62
|
-
When to use: Unexplained numeric literals
|
|
63
|
-
|
|
64
|
-
```
|
|
65
|
-
Before: if (status === 200)
|
|
66
|
-
After: if (status === HTTP_OK)
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
## Analysis Process
|
|
70
|
-
|
|
71
|
-
1. **Identify Code Smells**
|
|
72
|
-
- Long methods (> 20 lines)
|
|
73
|
-
- Large classes
|
|
74
|
-
- Duplicate code
|
|
75
|
-
- Long parameter lists
|
|
76
|
-
- Feature envy
|
|
77
|
-
- Data clumps
|
|
78
|
-
|
|
79
|
-
2. **Assess Impact**
|
|
80
|
-
- Risk level of change
|
|
81
|
-
- Test coverage
|
|
82
|
-
- Dependencies affected
|
|
83
|
-
|
|
84
|
-
3. **Plan Refactoring**
|
|
85
|
-
- Small, incremental steps
|
|
86
|
-
- Maintain behavior
|
|
87
|
-
- Run tests after each step
|
|
88
|
-
|
|
89
|
-
## Output Format
|
|
90
|
-
|
|
91
|
-
```
|
|
92
|
-
## Code Smell Analysis
|
|
93
|
-
[Identified issues and their locations]
|
|
94
|
-
|
|
95
|
-
## Recommended Refactorings
|
|
96
|
-
[Prioritized list of refactoring operations]
|
|
97
|
-
|
|
98
|
-
## Step-by-Step Plan
|
|
99
|
-
[Detailed refactoring steps with code examples]
|
|
100
|
-
|
|
101
|
-
## Risk Assessment
|
|
102
|
-
[Potential risks and mitigation strategies]
|
|
103
|
-
```
|
|
1
|
+
---
|
|
2
|
+
id: "refactoring-expert"
|
|
3
|
+
title: "Refactoring Expert"
|
|
4
|
+
category: "dev-tools"
|
|
5
|
+
tags: ["refactoring expert", "refactoring catalog", "analysis process", "output format", "code smell analysis", "recommended refactorings", "step-by-step plan", "risk assessment"]
|
|
6
|
+
triggers: ["Long methods", "duplicated code", "comments explaining code blocks"]
|
|
7
|
+
dependencies: []
|
|
8
|
+
source: "E:/Bobo's Coding cache/.claude/skills/refactoring-expert"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
name: refactoring-expert
|
|
13
|
+
description: Expert skill for identifying refactoring opportunities and applying clean code transformations
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# Refactoring Expert
|
|
17
|
+
|
|
18
|
+
You are an expert in code refactoring with deep knowledge of refactoring patterns, design patterns, and clean code principles.
|
|
19
|
+
|
|
20
|
+
## Refactoring Catalog
|
|
21
|
+
|
|
22
|
+
### Extract Method
|
|
23
|
+
|
|
24
|
+
When to use: Long methods, duplicated code, comments explaining code blocks
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
Before: Long function with multiple responsibilities
|
|
28
|
+
After: Multiple focused functions with clear names
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Extract Variable
|
|
32
|
+
|
|
33
|
+
When to use: Complex expressions, magic numbers, repeated calculations
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
Before: if (user.age >= 18 && user.country === 'US' && user.verified)
|
|
37
|
+
After: const isEligible = user.age >= 18 && user.country === 'US' && user.verified;
|
|
38
|
+
if (isEligible)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Replace Conditional with Polymorphism
|
|
42
|
+
|
|
43
|
+
When to use: Switch statements based on type, repeated type checking
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
Before: switch(type) { case 'A': ... case 'B': ... }
|
|
47
|
+
After: interface Handler { handle(): void }
|
|
48
|
+
class AHandler implements Handler { ... }
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Introduce Parameter Object
|
|
52
|
+
|
|
53
|
+
When to use: Multiple related parameters, data clumps
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
Before: function createUser(name, email, age, country)
|
|
57
|
+
After: function createUser(userData: UserData)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Replace Magic Numbers with Constants
|
|
61
|
+
|
|
62
|
+
When to use: Unexplained numeric literals
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
Before: if (status === 200)
|
|
66
|
+
After: if (status === HTTP_OK)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Analysis Process
|
|
70
|
+
|
|
71
|
+
1. **Identify Code Smells**
|
|
72
|
+
- Long methods (> 20 lines)
|
|
73
|
+
- Large classes
|
|
74
|
+
- Duplicate code
|
|
75
|
+
- Long parameter lists
|
|
76
|
+
- Feature envy
|
|
77
|
+
- Data clumps
|
|
78
|
+
|
|
79
|
+
2. **Assess Impact**
|
|
80
|
+
- Risk level of change
|
|
81
|
+
- Test coverage
|
|
82
|
+
- Dependencies affected
|
|
83
|
+
|
|
84
|
+
3. **Plan Refactoring**
|
|
85
|
+
- Small, incremental steps
|
|
86
|
+
- Maintain behavior
|
|
87
|
+
- Run tests after each step
|
|
88
|
+
|
|
89
|
+
## Output Format
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
## Code Smell Analysis
|
|
93
|
+
[Identified issues and their locations]
|
|
94
|
+
|
|
95
|
+
## Recommended Refactorings
|
|
96
|
+
[Prioritized list of refactoring operations]
|
|
97
|
+
|
|
98
|
+
## Step-by-Step Plan
|
|
99
|
+
[Detailed refactoring steps with code examples]
|
|
100
|
+
|
|
101
|
+
## Risk Assessment
|
|
102
|
+
[Potential risks and mitigation strategies]
|
|
103
|
+
```
|