jpskill.com
🛠️ 開発・MCP コミュニティ

ralph-prompt-single-task

単一の実装タスクに対し、明確な完了基準や自動検証、テスト駆動開発を取り入れた、Ralphで利用可能なプロンプトを生成し、バグ修正や機能追加などを効率的に進めるSkill。

📜 元の英語説明(参考)

Generate Ralph-compatible prompts for single implementation tasks. Creates prompts with clear completion criteria, automatic verification, and TDD approach. Use when creating prompts for bug fixes, single features, refactoring tasks, or any focused implementation that can be completed in one session.

🇯🇵 日本人クリエイター向け解説

一言でいうと

単一の実装タスクに対し、明確な完了基準や自動検証、テスト駆動開発を取り入れた、Ralphで利用可能なプロンプトを生成し、バグ修正や機能追加などを効率的に進めるSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o ralph-prompt-single-task.zip https://jpskill.com/download/9482.zip && unzip -o ralph-prompt-single-task.zip && rm ralph-prompt-single-task.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/9482.zip -OutFile "$d\ralph-prompt-single-task.zip"; Expand-Archive "$d\ralph-prompt-single-task.zip" -DestinationPath $d -Force; ri "$d\ralph-prompt-single-task.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して ralph-prompt-single-task.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → ralph-prompt-single-task フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Ralph Prompt Generator: シングルタスク

概要

単一の、焦点を絞ったタスクのために Ralph Wiggum 手法に最適化された、構造化されたプロンプトを生成します。これらのプロンプトには、明確な完了基準、自動検証(テスト)、自己修正ループ、および適切な <promise> 完了タグが含まれます。

最適な用途:

  • 明確な成功基準を持つバグ修正
  • 単一機能の実装
  • リファクタリングタスク
  • 既存のコードに対するテストの追加
  • 特定のモジュールのドキュメント
  • 測定可能な目標を持つパフォーマンス最適化

Ralph の哲学: このジェネレーターは、失敗は決定的であり修正可能であるという原則を取り入れています。各イテレーションは前のイテレーションから学習します。失敗を恐れないでください。失敗は予期されており、プロンプトの調整を通じて改善のためのデータを提供します。

クイックスタート

必要な入力:

  1. タスクの説明(何をすべきか)
  2. 成功基準(完了を検証する方法)
  3. 完了の約束テキスト(完了を示すフレーズ)

プロンプトの生成:

Generate a Ralph prompt for: [タスクの説明]
Success criteria: [検証方法]
Promise: [完了フレーズ]

プロンプト生成ワークフロー

ステップ 1: タスクの分析

以下の要素を特定します。

  • アクション: どのような具体的な作業が必要ですか?
  • スコープ: どのファイル/モジュールが影響を受けますか?
  • 検証: どのように成功を自動的に検証できますか?
  • エッジケース: 何がうまくいかない可能性がありますか?

ステップ 2: 完了基準の定義

優れた完了基準は次のとおりです:

  • 測定可能であること(テストに合格する、エラーがない、特定の出力)
  • 自動的に検証可能であること(主観的ではない)
  • 二元的であること(明らかに完了しているか、完了していないか)

例: | タスクの種類 | 良い基準 | 悪い基準 | |-----------|---------------|--------------| | バグ修正 | 「テストに合格し、バグが再現されなくなった」 | 「バグが修正された」 | | 機能 | 「すべての CRUD エンドポイントが 200 を返し、テストに合格する」 | 「機能が動作する」 | | リファクタリング | 「すべてのテストに合格し、コードが新しいパターンを使用する」 | 「コードがよりきれいになった」 |

ステップ 3: プロンプトの構造化

次のテンプレートを使用します。

# タスク: [明確なタスクタイトル]

## 目的
[何を達成する必要があるかを 1〜2 文で明確に説明]

## 背景
[簡単な背景 - 何が存在するか、なぜこれが必要なのか]

## 要件
1. [具体的な要件 1]
2. [具体的な要件 2]
3. [具体的な要件 3]

## 成功基準
- [ ] [測定可能な基準 1]
- [ ] [測定可能な基準 2]
- [ ] [測定可能な基準 3]

## 検証手順
1. [基準 1 を検証する方法]
2. [基準 2 を検証する方法]
3. [基準 3 を検証する方法]

## TDD アプローチ
1. 要件に対する失敗するテストを作成/特定する
2. ソリューションを実装する
3. テストを実行する: `[test command]`
4. テストが失敗した場合は、出力を分析して修正する
5. すべてのテストに合格するまで繰り返す

## 完了
次のすべてが真の場合:
- すべての成功基準が満たされている(上記のチェックリスト)
- すべてのテストに合格している
- リグレッションが発生していない

出力: <promise>[COMPLETION_PHRASE]</promise>

## 行き詰まった場合
進捗がないまま複数回繰り返した後:
- 進捗を妨げているものを文書化する
- 試みたアプローチをリストする
- 特定のエラーまたは問題を特定する
- 偽の約束を出力しないでください - 反復を続けるか、最大反復回数まで待機してください

ステップ 4: 検証コマンドの追加

成功を検証するための特定のコマンドを含めます。

## 検証コマンド
```bash
# テストの実行
npm test
# または
pytest tests/

# エラーの確認
npm run lint
# または
ruff check .

# 特定の機能の検証
curl -X GET http://localhost:3000/api/endpoint

## プロンプトの例

### 例 1: バグ修正

**入力:**
- タスク: 認証トークンリフレッシュの競合状態を修正する
- 検証: 認証テストに合格する、ログに 401 エラーがない
- 約束: AUTH_FIX_COMPLETE

**生成されたプロンプト:**

```markdown
# タスク: 認証トークンリフレッシュの競合状態を修正する

## 目的
複数のリクエストが同時にリフレッシュをトリガーするときに、断続的な 401 エラーを引き起こすトークンリフレッシュの競合状態を修正します。

## 背景
`src/auth/` の認証モジュールは、JWT トークンのリフレッシュを処理します。トークンが期限切れになると、複数の同時リクエストがすべてリフレッシュを試みる可能性があり、一部のリクエストが 401 で失敗する競合状態が発生します。

## 要件
1. トークンリフレッシュのロック/キューイングメカニズムを実装する
2. 同時リクエストが単一のリフレッシュを待機するようにする
3. 既存の認証フローとの下位互換性を維持する
4. 同時リフレッシュシナリオをカバーするテストを追加する

## 成功基準
- [ ] すべての既存の認証テストに合格する
- [ ] 新しい同時リフレッシュテストに合格する
- [ ] 統合テストのログに 401 エラーがない
- [ ] トークンのリフレッシュは期限切れごとに 1 回のみ発生する

## 検証手順
1. 認証テストを実行する: `npm test -- --grep "auth"`
2. 同時リフレッシュテストを実行する: `npm test -- --grep "concurrent"`
3. 統合テスト後にログで 401 を確認する
4. 同時リクエスト中にログで単一のリフレッシュを検証する

## TDD アプローチ
1. 同時トークンリフレッシュシナリオのテストを作成する
2. 現在の実装でテストが失敗することを確認する
3. ロックメカニズムを実装する
4. テストを実行する: `npm test`
5. テストが失敗した場合は、分析して修正する
6. すべてに合格するまで繰り返す

## 完了
次のすべてが真の場合:
- すべての認証テストに合格している(新しい同時テストを含む)
- 統合テストで 401 エラーが表示されない
- ログで単一のリフレッシュが検証されている

出力: <promise>AUTH_FIX_COMPLETE</promise>

## 行き詰まった場合
複数回繰り返した後:
- 特定の競合状態の動作を文書化する
- 試したロックアプローチをリストする
- ロックが失敗している場所を特定する
- 偽の約束を出力しないでください

例 2: 機能の実装

入力:

  • タスク: /api/users エンドポイントにページネーションを追加する
  • 検証: ページネーションパラメータが動作する、テストに合格する
  • 約束: PAGINATION_DONE

生成されたプロンプト:


# タスク: ユーザーエンドポイントにページネーションを追加する

## 目的
ページ、制限、および合計カウントを使用して、GET /api/users エンドポイントにオフセットベースのページネーションを実装します。

## 背景
`src/routes/users.ts` のユーザーエンドポイントは、現在すべてのユーザーを返します。ユーザーベースが拡大するにつれて、パフォーマンスのためにページネーションが必要になります。

## 要件
1. `page` (デフォルト 1) および `limit` (デフォルト 20、最大 100) クエリパラメータを受け入れる
2

(原文がここで切り詰められています)
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Ralph Prompt Generator: Single Task

Overview

Generates well-structured prompts optimized for the Ralph Wiggum technique for single, focused tasks. These prompts include clear completion criteria, automatic verification (tests), self-correction loops, and proper <promise> completion tags.

Best For:

  • Bug fixes with clear success criteria
  • Single feature implementations
  • Refactoring tasks
  • Adding tests for existing code
  • Documentation for specific modules
  • Performance optimizations with measurable targets

Ralph Philosophy: This generator embraces the principle that failures are deterministic and fixable. Each iteration learns from the previous one. Don't fear failures—they're expected and provide data for improvement through prompt tuning.

Quick Start

Input Required:

  1. Task description (what needs to be done)
  2. Success criteria (how to verify completion)
  3. Completion promise text (the phrase that signals done)

Generate prompt with:

Generate a Ralph prompt for: [task description]
Success criteria: [how to verify]
Promise: [completion phrase]

Prompt Generation Workflow

Step 1: Analyze the Task

Identify these elements:

  • Action: What specific work needs to be done?
  • Scope: What files/modules are affected?
  • Verification: How can success be automatically verified?
  • Edge cases: What could go wrong?

Step 2: Define Completion Criteria

Good completion criteria are:

  • Measurable (tests pass, no errors, specific output)
  • Verifiable automatically (not subjective)
  • Binary (clearly done or not done)

Examples: | Task Type | Good Criteria | Bad Criteria | |-----------|---------------|--------------| | Bug fix | "Tests pass, bug no longer reproducible" | "Bug is fixed" | | Feature | "All CRUD endpoints return 200, tests pass" | "Feature works" | | Refactor | "All tests pass, code uses new pattern" | "Code is cleaner" |

Step 3: Structure the Prompt

Use this template:

# Task: [Clear Task Title]

## Objective
[1-2 sentence clear description of what needs to be accomplished]

## Context
[Brief background - what exists, why this is needed]

## Requirements
1. [Specific requirement 1]
2. [Specific requirement 2]
3. [Specific requirement 3]

## Success Criteria
- [ ] [Measurable criterion 1]
- [ ] [Measurable criterion 2]
- [ ] [Measurable criterion 3]

## Verification Steps
1. [How to verify criterion 1]
2. [How to verify criterion 2]
3. [How to verify criterion 3]

## TDD Approach
1. Write/identify failing tests for the requirement
2. Implement the solution
3. Run tests: `[test command]`
4. If tests fail, analyze output and fix
5. Repeat until all tests pass

## Completion
When ALL of the following are true:
- All success criteria met (checklist above)
- All tests passing
- No regressions introduced

Output: <promise>[COMPLETION_PHRASE]</promise>

## If Stuck
After multiple iterations without progress:
- Document what's blocking progress
- List approaches attempted
- Identify specific error or issue
- Do NOT output false promise - continue iterating or wait for max-iterations

Step 4: Add Verification Commands

Include specific commands to verify success:

## Verification Commands
```bash
# Run tests
npm test
# or
pytest tests/

# Check for errors
npm run lint
# or
ruff check .

# Verify specific functionality
curl -X GET http://localhost:3000/api/endpoint

## Example Prompts

### Example 1: Bug Fix

**Input:**
- Task: Fix authentication token refresh race condition
- Verification: Auth tests pass, no 401 errors in logs
- Promise: AUTH_FIX_COMPLETE

**Generated Prompt:**

```markdown
# Task: Fix Authentication Token Refresh Race Condition

## Objective
Fix the race condition in token refresh that causes intermittent 401 errors when multiple requests trigger refresh simultaneously.

## Context
The auth module in `src/auth/` handles JWT token refresh. When a token expires, multiple concurrent requests may all attempt to refresh, causing a race condition where some requests fail with 401.

## Requirements
1. Implement token refresh locking/queuing mechanism
2. Ensure concurrent requests wait for single refresh
3. Maintain backward compatibility with existing auth flow
4. Add tests covering concurrent refresh scenario

## Success Criteria
- [ ] All existing auth tests pass
- [ ] New concurrent refresh test passes
- [ ] No 401 errors in integration test logs
- [ ] Token refresh happens only once per expiration

## Verification Steps
1. Run auth tests: `npm test -- --grep "auth"`
2. Run concurrent refresh test: `npm test -- --grep "concurrent"`
3. Check logs for 401 after integration test
4. Verify single refresh in logs during concurrent requests

## TDD Approach
1. Write test for concurrent token refresh scenario
2. Verify test fails with current implementation
3. Implement locking mechanism
4. Run tests: `npm test`
5. If tests fail, analyze and fix
6. Repeat until all pass

## Completion
When ALL of the following are true:
- All auth tests passing (including new concurrent test)
- Integration tests show no 401 errors
- Single refresh verified in logs

Output: <promise>AUTH_FIX_COMPLETE</promise>

## If Stuck
After multiple iterations:
- Document the specific race condition behavior
- List locking approaches tried
- Identify where locks are failing
- Do NOT output false promise

Example 2: Feature Implementation

Input:

  • Task: Add pagination to /api/users endpoint
  • Verification: Pagination params work, tests pass
  • Promise: PAGINATION_DONE

Generated Prompt:

# Task: Add Pagination to Users Endpoint

## Objective
Implement offset-based pagination for GET /api/users endpoint with page, limit, and total count.

## Context
The users endpoint in `src/routes/users.ts` currently returns all users. As the user base grows, this needs pagination for performance.

## Requirements
1. Accept `page` (default 1) and `limit` (default 20, max 100) query params
2. Return paginated response with metadata: { data: [], page, limit, total, totalPages }
3. Handle edge cases: invalid params, page beyond data, empty results
4. Add comprehensive tests for pagination

## Success Criteria
- [ ] GET /api/users returns paginated response
- [ ] `page` and `limit` query params work correctly
- [ ] Response includes correct metadata (total, totalPages)
- [ ] Edge cases handled gracefully
- [ ] All new pagination tests pass
- [ ] Existing user tests still pass

## Verification Steps
1. Run tests: `npm test -- --grep "users"`
2. Manual verification:
   - `curl localhost:3000/api/users?page=1&limit=10`
   - `curl localhost:3000/api/users?page=999&limit=10`
   - `curl localhost:3000/api/users?limit=200`

## TDD Approach
1. Write tests for pagination behavior
2. Verify tests fail
3. Implement pagination logic
4. Run tests: `npm test`
5. If failures, fix and retry
6. Test edge cases manually

## Completion
When ALL of the following are true:
- All pagination tests pass
- All existing user tests pass
- Manual verification shows correct behavior
- Edge cases handled (returns empty for page beyond data)

Output: <promise>PAGINATION_DONE</promise>

## If Stuck
Document:
- Which tests are failing and why
- What pagination approach was tried
- Specific error messages
- Do NOT output false promise

Example 3: Refactoring Task

Input:

  • Task: Convert callbacks to async/await in database module
  • Verification: All DB tests pass, no callback patterns remain
  • Promise: ASYNC_REFACTOR_COMPLETE

Generated Prompt:

# Task: Convert Database Module to Async/Await

## Objective
Refactor all callback-based database operations in `src/db/` to use async/await pattern for improved readability and error handling.

## Context
The database module uses callback patterns from legacy code. Modern async/await improves code clarity and makes error handling more consistent.

## Requirements
1. Convert all callback-based functions to async/await
2. Replace callback error handling with try/catch
3. Update all callers to use await
4. Maintain identical external API behavior
5. No callback patterns remaining in db module

## Success Criteria
- [ ] All database functions use async/await
- [ ] No callback patterns in src/db/*.ts files
- [ ] All existing database tests pass
- [ ] All integration tests pass
- [ ] No TypeScript errors

## Verification Steps
1. Run tests: `npm test -- --grep "database"`
2. Search for callbacks: `grep -r "callback\|cb)" src/db/`
3. TypeScript check: `npm run typecheck`
4. Integration tests: `npm run test:integration`

## TDD Approach
1. Run all tests - ensure baseline passes
2. Convert one function at a time
3. Run tests after each conversion
4. If failures, fix before continuing
5. After all conversions, verify no callbacks remain

## Completion
When ALL of the following are true:
- All database tests passing
- grep for callbacks returns empty
- TypeScript compilation succeeds
- Integration tests pass

Output: <promise>ASYNC_REFACTOR_COMPLETE</promise>

## If Stuck
Document:
- Which function is causing issues
- The specific error or test failure
- What conversion approach was tried
- Do NOT output false promise

Best Practices

DO:

  • Use specific, measurable success criteria
  • Include actual test commands
  • Add verification steps for each criterion
  • Include TDD approach for self-correction
  • Set clear completion conditions
  • Provide "If Stuck" guidance

DON'T:

  • Use vague criteria ("make it work")
  • Skip verification commands
  • Forget edge cases
  • Make subjective success criteria
  • Allow escape without genuine completion

Integration with Ralph Loop

Run your generated prompt:

/ralph-wiggum:ralph-loop "[paste generated prompt]" --completion-promise "YOUR_PROMISE" --max-iterations 30

Recommended settings:

  • Bug fixes: --max-iterations 15-20
  • Features: --max-iterations 25-35
  • Refactoring: --max-iterations 20-30

Validation Checklist

Before using a generated prompt, verify:

  • [ ] Task has single, focused objective
  • [ ] Success criteria are measurable
  • [ ] Verification commands are specific and runnable
  • [ ] TDD approach is defined
  • [ ] Completion promise is clear and specific
  • [ ] "If Stuck" section provides guidance

For multi-task prompts, see ralph-prompt-multi-task. For project-level prompts, see ralph-prompt-project. For research/analysis prompts, see ralph-prompt-research.