Prompt for backend refactoring

I’m at the part where the instructor does a back-end refactoring and he uses a long prompt (which I’m not able to find it anywhere). Does anyone have access or can share it?

2 Likes

Couldn’t find this in the repo either, so I manually screen captured the video and passed the screenshots to another llm, here’s the prompt if I’m not mistaken:

Refactor @backend/ai_generator.py to support sequential tool calling where Claude can make up to 2 tool calls in separate API rounds.

Current behavior:
– Claude makes 1 tool call → tools are removed from API params → final response
– If Claude wants another tool call after seeing results, it can't (gets empty response)

Desired behavior:
– Each tool call should be a separate API request where Claude can reason about previous results
– Support for complex queries requiring multiple searches for comparisons, multi-part questions, or when information from different courses/lessons is needed

Example flow:
1. User: "Search for a course that discusses the same topic as lesson 4 of course X"
2. Claude: get course outline for course X → gets title of lesson 4
3. Claude: uses the title to search for a course that discusses the same topic → returns course information
4. Claude: provides complete answer

Requirements:
– Maximum 2 sequential rounds per user query
– Terminate when: (a) 2 rounds completed, (b) Claude's response has no tool_use blocks, or (c) tool call fails
– Preserve conversation context between rounds
– Handle tool execution errors gracefully

Notes:
– update the system prompt in @backend/ai_generator.py
– update the test @backend/tests/test_ai_generator.py
– Write tests that verify the external behavior (API calls made, tools executed, results returned) rather than internal state details.

Use two parallel subagents to brainstorm possible plans. Do not implement any code.

4 Likes

Thanks a ton, Pablo.

1 Like

The prompt can be found here - sc-claude-code-files/reading_notes/L4_notes.md at main · https-deeplearning-ai/sc-claude-code-files · GitHub

3 Likes

Thank you @greenvinyl for the reminder to the resources! :smiley: