プロンプトライブラリ

ソフトウェア開発のプロンプト

変更の計画、コードレビュー、テスト作成、デバッグ用のプロンプト。アシスタントが確認できる成果物を返すように構造化されています。

プロンプト本体は、作成・テストした言語である英語です。これらのページの説明と案内文は翻訳されています。

  • planning
  • architecture
  • code
100/100 · 163 トークン

変更の実装計画

機能の依頼と関連コードを、ファイル、リスク、テストを含む順序立った計画に変えます。

使う場面: 複数のファイルに関わる変更を始める前に、手順とリスクを先に書き出したいとき。

prompt
You are a senior software engineer planning a change to an existing codebase.

## Task
Produce an ordered plan for the requested change, based only on the code provided below.

## Requirements
- List the steps in the order they must be done.
- Name the file and function each step changes.
- State one risk for every step that changes existing behavior.
- List the tests that must pass before the change is complete.
- Use the phrase "not shown in the code provided" where the code does not contain what a step needs.

## Output format
Return markdown with four sections: Summary (2 sentences), Steps (numbered list), Risks (bulleted list), and Tests (bulleted list).

## Input
<request>
{{request}}
</request>

<code>
{{code}}
</code>

変数

{{request}}
希望する変更を、自分の言葉で。
{{code}}
変更が関わるファイルまたは関数。

入力例

request: Add rate limiting to the login endpoint, 5 attempts per minute per IP.
code: the login route handler and the existing middleware file.

出力例

## Summary
Add a per-IP limiter as middleware on POST /login. Existing middleware order is kept.

## Steps
1. middleware/rateLimit.ts: add createLimiter(max, windowMs)...
2. routes/auth.ts, loginRouter: apply the limiter before validateBody...

## Risks
- Step 2: requests behind a shared proxy share one IP...

## Tests
- 6th attempt within a minute returns 429...

例示です。期待される形を示すために書いたもので、モデルが生成したものではありません。

  • debugging
  • errors
  • code
100/100 · 162 トークン

エラーからの根本原因分析

スタックトレースと周辺のコードから、順位付けされた原因の一覧と、それぞれを確認するチェックを導きます。

使う場面: エラーとコードはあるが原因がまだ分からず、順番に検証できる仮説がほしいとき。

prompt
You are a senior software engineer debugging a production error.

## Task
Identify the most likely root causes of the error below, using the stack trace and the code provided.

## Requirements
- Rank at most 3 causes from most to least likely.
- Quote the line of code each cause depends on.
- Give one check for each cause that confirms or rules it out.
- Do not propose a fix for a cause until its check is stated.
- Write "cannot be determined from the input" for anything the trace and code do not show.

## Output format
Return a markdown table with the columns Rank, Cause, Evidence, and Check, followed by one paragraph naming the cause to test first.

## Input
<error>
{{error}}
</error>

<code>
{{code}}
</code>

変数

{{error}}
エラーメッセージとスタックトレース。
{{code}}
トレースに出てくる関数。

入力例

error: TypeError: Cannot read properties of undefined (reading 'id') at getOrder (orders.js:42)
code: the getOrder function and its caller.

出力例

| Rank | Cause | Evidence | Check |
|---|---|---|---|
| 1 | `user` is undefined when the session expired | `const id = req.user.id` (line 42) | Log `req.user` for a request with an expired cookie |

Test cause 1 first: it is the only path where `req.user` is unset.

例示です。期待される形を示すために書いたもので、モデルが生成したものではありません。

自分用に調整する

要件を自分の基準に合わせて編集し、結果をチェックしましょう。プロンプトアナライザーは入力に合わせて再採点し、オプティマイザーは要件を落とさずに冗長な表現を削り、セキュリティスキャナーはモデルに送る前に秘密情報や個人データを検出します。

その他のカテゴリ