Библиотека промптов

Промпты: Разработка ПО

Промпты для планирования изменений, ревью кода, написания тестов и отладки, построенные так, чтобы ассистент возвращал работу, которую можно проверить.

Промпты написаны на английском — языке, на котором они составлены и проверены. Описания и инструкции на этих страницах переведены.

  • 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.

Иллюстрация: написан, чтобы показать ожидаемую форму, а не создан моделью.

Сделайте его своим

Измените требования под свои стандарты, затем проверьте результат. Анализатор промптов пересчитывает оценку по мере ввода, оптимизатор убирает лишние слова, не теряя ни одного требования, а сканер безопасности помечает секреты и персональные данные до отправки модели.

Другие категории