2.1 Asking useful questions

Explanation

Useful questions are specific. Instead of asking whether something is correct, ask about inputs, outputs, assumptions, edge cases, complexity, and validation.

Weak:

Is this function correct?

Better:

For this Rust function, propose a clear signature using &[f64] for
input data. List the output type, edge cases, and tests that would
catch a wrong implementation.

If you do not yet know what to ask, start honestly. Ask the AI agent to suggest what should be checked, then use that list to make more specific questions.

I do not yet know what to check in this Rust numerical function.
Suggest a review checklist: function signature, ownership and borrowing,
inputs, outputs, assumptions, edge cases, numerical accuracy,
performance, Cargo tests, and validation checks.

Useful Rust questions often mention project structure explicitly. Ask where the code should live, such as src/lib.rs, and where tests should live, such as tests/mean.rs. Ask how to run the check with cargo test.

Things to look up

  • How to ask coding questions
  • Rust function signature
  • Cargo project
  • cargo test
  • Input and output
  • Edge case
  • Failure mode
  • Prompting for code review
  • Review checklist
  • Brainstorming

Exercise

You are given an unknown function that computes a numerical quantity from an array. First, write one prompt asking an AI agent to suggest what should be checked. Then write five specific follow-up questions you would ask to understand the function.

At least two follow-up questions should be Rust-specific. For example, ask whether the function should take &[f64], whether empty input should return Option<f64> or Result<f64, Error>, how to set up a small Cargo project, and which tests should go in tests/.

Notes for the exercise

  • It is acceptable to start by asking for possible review criteria.
  • Turn the proposed criteria into specific questions before asking for judgment.
  • Ask for a concrete Rust function signature.
  • Ask where source files and tests should be placed in a Cargo project.
  • Include at least one question about input.
  • Include at least one question about output.
  • Include at least one question about boundary cases.
  • Include at least one question about validation.
  • Include at least one question about how cargo test will check the answer.
  • Avoid the phrase β€œIs it correct?” unless you also specify a criterion.