Example: Build a Feature End-to-End
Apply every concept in one realistic, start-to-finish build.
Concepts are easier to remember when you see them working together. This lesson walks through a single realistic scenario — adding a search feature to a small web app — from the first prompt to a merged pull request. Each step maps to a real command or pattern.
Start: frame the task
Before writing any code, tell Claude enough context to make good decisions. You do not need to manually point Claude at files — it will read what it needs. Start by orienting it to the project.
what does this project do, and what's the main data model?I want to add a search endpoint that lets users filter products by name.
Explain how the existing API routes are structured before we start.Plan before touching files
Once Claude understands the codebase, switch to plan mode so it proposes a detailed approach without making any edits yet. Press Shift+Tab to enter plan mode, then describe the feature.
# Press Shift+Tab to enable plan mode, then:
Add a GET /api/products/search endpoint that accepts a ?query= param
and returns matching products from the database. Show me the plan first.Implement with Claude
Once the plan looks right, approve it. Claude will create or edit files, showing you each change for confirmation. If a single step looks wrong, reject it and explain what you expected — Claude will try again.
looks good, go ahead and implement the search endpointVerify with tests
After implementation, ask Claude to write tests for the new endpoint. Claude reads your existing test files to match your testing framework and assertion style automatically.
write tests for the new search endpoint covering:
- a query that returns results
- a query with no matches (expect empty array)
- a missing ?query= param (expect 400 error)
then run the tests and fix any failuresReview the diff and commit
Before committing, ask Claude to summarize what changed across all the files it touched. This is your final sanity check — a quick way to catch anything unexpected before it goes into version control.
summarize all the changes you made and flag anything I should double-checkcommit my changes with a descriptive messageOpen a pull request
Claude can create the pull request directly. It writes a title and description based on the changes in the session. You can refine the description before submitting.
create a pr
# or for more control:
create a pr with a description that explains the search algorithm
and notes that it uses a case-insensitive LIKE query for nowPicking up later
If review feedback comes in the next day, you do not start from scratch. Resume the session and pick up with full context intact.
# Resume the most recent session in this directory
claude --continue
# Or choose from the session picker
claude --resume