三個值得保存的開發者提示詞,以及讓它們可重複使用的關鍵決定
Three developer prompts to keep, and the one decision that makes each reusable
PromptAlo 提出三個可重複使用的開發者提示詞,分別用於 PR 審查、把提交紀錄整理成變更紀錄,以及建立測試骨架。它們預先設定評審嚴重程度、變更紀錄的讀者對象或測試框架慣例,避免每次執行都要重新作出這些決定。
A prompt is reusable when you can paste it into a fresh chat, drop today's material underneath, and get something useful back without touching the instructions. That usually comes down to one decision made up front and written into the prompt, so it doesn't get remade every time.
Here are three example prompts for tasks most developers run into every sprint: reviewing a pull request, turning commits into a changelog, and scaffolding tests. Each one hinges on a different decision.
1. PR review: an explicit severity scale
You're reviewing a pull request before it's merged.
Label every finding with one of these severities:
- Blocker: will break something, lose data, or open a security hole.
- Major: a likely bug, or a behaviour change the description
doesn't mention.
- Minor: worth fixing, but fine to merge without.
Skip formatting and naming unless they hide a bug. The linter
handles style.
List findings from Blocker down to Minor. For each one, give the file
and line, what could go wrong, and a one-line suggested fix. If there
are no Blockers or Majors, say so in one sentence before the list.
The diff is below this line.
Why this one is reusable: the severity scale. Without it, a review comes back as a flat list where a missing null check sits next to a naming nitpick, and you sort it yourself every time. With three defined levels, every review is ordered the same way, "Major" means the same thing this week as last week, and anyone reading the output can stop after the Blockers if they're short on time. If your team draws the lines differently, rewrite the three definitions once. The rest of the prompt doesn't change.
2. Commits to changelog: a named reader
Below are the commit messages from one release.
Reader: people who use the product day to day. They don't know the
codebase and don't care about internal changes.
Group entries under Added, Changed and Fixed, with any breaking
changes in their own section at the top. Describe each change by
what this reader will notice, not by what was refactored.
Use the commit messages as your only source. If a commit is too vague
to describe for this reader, list it under "Needs a human" instead
of guessing. Leave out merge commits, dependency bumps and refactors
that don't change behaviour.
Why this one is reusable: the reader is named in the prompt. "People who use the product day to day" decides almost everything else: what counts as a change, how it's described, what gets left out. Leave the reader unstated and each release drifts between a user-facing note and an internal diff summary.
It also makes a second changelog trivial. Change one line to "Reader: maintainers and contributors who need to know what changed internally and what might affect their open branches", and the same prompt produces a maintainer changelog instead. Two readers, two saved prompts, one line apart.
3. Test scaffolding: pinned to framework conventions
Write pytest scaffolding for the code below.
Follow these conventions:
- Put the tests in a file named test_ plus the module name,
mirroring the source path.
- One test function per behaviour, named test_ plus what it checks.
- Shared setup goes in fixtures, not repeated inside each test.
- Use pytest.mark.parametrize for cases that differ only in their
arguments.
- Only mock external dependencies: network, filesystem, clock.
First list the behaviours you think need covering, including edge
cases and error paths. Then write the tests.
Where the expected value can't be known from the code alone, leave a
clearly marked TODO in the assertion instead of guessing.
The code is below this line.
Why this one is reusable: it's pinned to how your test suite already looks. File naming, one function per behaviour, fixtures for shared setup, parametrize for variations, a clear line on mocking. Generic "write tests for this" output needs reshaping before it fits a real suite. Output that follows your conventions drops in next to the existing tests and reads like them.
Using Jest, Go's testing package or something else? Rewrite the conventions block for your framework once, then leave it alone.
The common thread
Each prompt settles one question that would otherwise get answered differently on every run: how serious is this, who is reading, what does a test look like here. The material underneath changes every time. The decision doesn't.
Keeping them close at hand
A prompt like these is one to keep from the first day it works. PromptAlo is the Chrome extension we make for that: save the prompt, and next sprint send it to ChatGPT, Claude or Gemini in one click. AI tags label what each one does, your library syncs to your account, and if one is good enough to share, you can post it to the public community library. On Pro, an AI Quality Review checks it for personal data before it goes public.
More from us on saved prompts: https://promptalo.conceptgame.co.uk/?utm_source=devto&utm_medium=brand_post&utm_campaign=w7-fri-devto
Over to you
What decision would you write into a fourth developer prompt, so it never has to be made again?
This post was written with AI assistance and edited by the PromptAlo team.
來源:DEV Community · dev.to