|
| 1 | +# Prompts |
| 2 | + |
| 3 | +These are the prompts used in the Real Python tutorial |
| 4 | +[How to Use Claude Code to Write and Refactor Python](https://realpython.com/how-to-use-claude-code/), |
| 5 | +in the order they appear. |
| 6 | + |
| 7 | +Claude Code is nondeterministic, so your results will differ in wording and |
| 8 | +detail. Expect the same general shape, not identical output. |
| 9 | + |
| 10 | +## 1. Plan the project structure (Plan Mode) |
| 11 | + |
| 12 | +```text |
| 13 | +I want to build a minimal command-line contact manager in Python. |
| 14 | +
|
| 15 | +It should have two commands: |
| 16 | +
|
| 17 | +- `add` to append a new contact with name, email, and phone to a CSV file |
| 18 | +- `list` to print all contacts in a readable table format |
| 19 | +
|
| 20 | +Use `argparse` for the CLI. Store the CSV at ~/.mini-contacts.csv |
| 21 | +by default with a --path flag to override it. |
| 22 | +
|
| 23 | +Split the project into a mini_contacts/ package with storage.py for CSV |
| 24 | +read/write and cli.py for the `argparse` interface. |
| 25 | +``` |
| 26 | + |
| 27 | +## 2. Implement the plan |
| 28 | + |
| 29 | +```text |
| 30 | +Implement the plan. |
| 31 | +``` |
| 32 | + |
| 33 | +## 3. Exercise the happy path |
| 34 | + |
| 35 | +```text |
| 36 | +Add a contact named "John Doe" with email john@example.com and |
| 37 | +phone 555-0100, then list all contacts to verify it was saved. |
| 38 | +``` |
| 39 | + |
| 40 | +## 4. Write the tests |
| 41 | + |
| 42 | +```text |
| 43 | +Write tests for the storage and CLI modules. Cover the happy path for |
| 44 | +add and list, and test what happens when the CSV file doesn't exist yet. |
| 45 | +``` |
| 46 | + |
| 47 | +## 5. Run the tests with Shell mode |
| 48 | + |
| 49 | +```text |
| 50 | +! python -m unittest |
| 51 | +``` |
| 52 | + |
| 53 | +## 6. Commit the initial implementation |
| 54 | + |
| 55 | +```text |
| 56 | +Create a commit with the message "Add initial mini-contacts implementation". |
| 57 | +``` |
| 58 | + |
| 59 | +## 7. Explore the codebase in a fresh session |
| 60 | + |
| 61 | +```text |
| 62 | +Review this codebase. Tell me what the application does, describe |
| 63 | +each module and how they connect, and summarize the test coverage. |
| 64 | +``` |
| 65 | + |
| 66 | +## 8. Hunt for bugs and edge cases |
| 67 | + |
| 68 | +```text |
| 69 | +Now look for bugs, security issues, and edge cases that could cause |
| 70 | +crashes or data loss. Be specific about each finding. |
| 71 | +``` |
| 72 | + |
| 73 | +## 9. Plan the fixes (Plan Mode) |
| 74 | + |
| 75 | +```text |
| 76 | +Fix the crash bugs and the edge case for empty-string validation. |
| 77 | +For the crash on short CSV rows, handle rows with missing fields gracefully. |
| 78 | +For the empty-string fields, reject blank values for name, email, and phone. |
| 79 | +``` |
| 80 | + |
| 81 | +## 10. Implement the fixes |
| 82 | + |
| 83 | +```text |
| 84 | +Implement the fixes. |
| 85 | +``` |
| 86 | + |
| 87 | +## 11. Re-run the tests |
| 88 | + |
| 89 | +```text |
| 90 | +Run the tests and show me the results. |
| 91 | +``` |
| 92 | + |
| 93 | +## 12. Commit the fixes |
| 94 | + |
| 95 | +```text |
| 96 | +Create a commit with the message "Add input validation and fix crash bugs". |
| 97 | +``` |
0 commit comments