In this lesson, we tackle milestone two: integrating the OpenAI API to automatically generate summaries of the websites we bookmark. We start by clearing context and feeding Claude Code the pre-written milestone two prompt, then drop into plan mode so it can work out the technical implementation. Along the way, you'll see the full process of securely storing API keys in Rails credentials across all three environments (development, staging, production), and I'll share a terminal alias trick that saves you from retyping long credential commands every time. We let Claude implement the feature using a background job (best practice for external API calls), then test it live — including how to debug real issues by feeding server logs back to Claude when summaries fail. We also explore a fallback strategy when the AI can't read a page's content directly. By the end, summaries are generating, regenerating, and gracefully handling errors.
In this lesson:
- Clearing context and starting milestone two with the pre-written prompt
- Why plan mode still matters even with a detailed PRD
- Generating an OpenAI API key and creating a dedicated project
- Storing API keys in Rails credentials for development, staging, and production
- Pro tip: setting up terminal aliases (in
.zshrc) for credentials commands - Answering Claude's clarifying questions on model choice, regenerate behavior, and URL changes
- Why background jobs are the right pattern for external API calls (and how Solid Queue handles it)
- Testing the AI summary feature live in the app
- Debugging failed summaries by piping server logs into Claude Code
- Troubleshooting model name issues (GPT 5.5 + temperature parameter)
- Building a fallback to meta description tags when full content can't be fetched
- Committing milestone two to GitHub and previewing the branching workflow we'll use next
