A Few Prompts I Use When Developing, Organized

Lately, having AI do code reviews has become a habit for me, but just saying "take a look at this" doesn’t work well—giving it a role and criteria makes a difference. Here are the formats I use often.

  • Review: "You are a senior backend developer with 10 years of experience. Point out issues in the code below from the perspectives of performance, readability, and security, and assign a priority to each item."
  • Refactoring: "Remove duplication while preserving behavior. Add comments explaining the reason for each change."
  • Testing: "First list test cases focused on boundary values and exception cases, then write the code."

The key seems to be specifying 'role + criteria + output format.' This significantly cuts down on unnecessary fluff.

by 밤샘코더327

10 answers

Do you have a source? I feel like most prompt tips of this kind are just hearsay.

by 데이터덕후727 · ▲0

This is so true lol. If you don’t give it a role, it just turns into a compliment machine.

by 클라우드러버226 · ▲0

I feel the same way. If you just say "take a look," there isn't much there.

by 밤샘코더763 · ▲0

Having it pull test cases first is really great. If you ask it to write code right away, you just get happy-path cases endlessly. I also add "a one-line explanation of why each case is needed"—try adding that. It makes it easier to find coverage gaps.

by 취준생김씨180 · ▲0

But I’m a bit skeptical about how much the "10-year senior" role assignment actually changes the results. Have you ever run benchmarks on it? Honestly, role prompts don’t really feel like they make much difference—maybe it’s just in my head—and specifying criteria (a checklist) had a bigger effect. Output format definitely seems to work, though.

by 카페인중독828 · ▲0