CLAUDE CODE AGENTS: FUNDAMENTALS - Chapter 3, Exercise 1 Rewriting "Fix the Login Bug" Into a Genuinely Well-Formed Brief ==================================================================================== QUESTION: Rewrite the brief "fix the login bug" into a genuinely well-formed brief, following this chapter's own list of what a good brief contains. SOLUTION / EXPLANATION: "Fix the login bug" fails on every element this chapter lists: it doesn't say what's actually wrong, doesn't point to any file or location, gives no constraints, and doesn't say what a finished result should look like. An agent receiving this has to first figure out what "the login bug" even refers to before it can do anything useful. A genuinely well-formed rewrite, covering each element the chapter names: "Users report that logging in with a correct password sometimes fails on the first attempt and only succeeds on a second try. The login handling code is in src/auth/login.ts, around lines 40-65, in the function validateCredentials. I've already checked that the password hashing itself is correct (verified separately in src/auth/hash.test.ts, which passes) - the bug is not in the hashing logic. Please investigate why the first login attempt can fail incorrectly, without changing the hashing function itself or the database schema. Once you've found the cause, make the fix and give me a short summary of what was wrong and what changed, along with the specific lines edited." This covers all four elements: the actual goal (fix the intermittent first-attempt login failure, stated with the real symptom rather than just "the bug"), what's already known (exact file, approximate lines, and what's already been ruled out - the hashing logic), constraints (don't touch hashing or the database schema), and the expected form of the result (a short summary plus the specific lines changed). -------------------------------------------------------------------------- WHY THIS WORKS AS AN ANSWER: It doesn't just add more words to the original brief - it specifically supplies each of the four elements the chapter names (goal, known context, constraints, expected result form), including a concrete example of "already ruled out" information that saves the agent from re-investigating ground already covered.