Coding agents
Putting it all together
Congratulations, you've learned how to work with coding agents.
You now know how to use agents to understand codebases, create features quickly, search through your code and find bugs, review code more efficiently, and customize agents to your needs. This chapter shows an example of putting all of those pieces together.
An end-to-end example
You've joined a team that runs an ecommerce platform. You need to add discount codes to the checkout flow. The codebase is unfamiliar, and the feature needs to ship by end of week.
This is a realistic situation. You need to explore before you build, plan before you code, test before you ship, and review before you merge.
Step 1: Understand the codebase
Before touching anything, explore the checkout flow. Use the agent to build a mental map.
See the agent's response
src/pages/Cart.tsx) — User reviews items, clicks "Checkout"src/pages/Checkout.tsx) — Collects shipping address and payment methodsrc/components/OrderSummary.tsx) — Displays line items, subtotal, tax, and total. Calls PricingService.calculateTotal()Checkout.tsx:handleSubmit() calls OrderService.createOrder(), which calls PaymentService.charge()/orders/[id]/confirmationPricingService.calculateTotal() at line 34 computes the subtotal from line items. A discount step would go between subtotal calculation and tax calculation (line 41). The OrderSummary component would need a new row to show the discount amount.Ask follow-up questions to fill gaps:
See the agent's response
calculateTotal(items) → {
subtotal = sum(items.map(i => i.price * i.quantity)) // line 34
tax = subtotal * taxRate // line 41
total = subtotal + tax + shippingCost // line 45
}subtotal before tax calculation so tax is computed on the discounted amount.PricingService is also called by InvoiceService and QuoteService. Any discount logic needs to handle cases where no discount is applied (default path should be unchanged).This combines the search techniques from understanding your codebase to trace the checkout flow, then summarizes what it finds.
Step 2: Plan the feature
Now that you understand the codebase, create a plan. Switch to Plan Mode (Shift+Tab) and outline the work:
Add discount code support to checkout. Users enter a code, the system validates it, and the discount is applied to the order total before tax.
Review the plan. Remove steps that are too ambitious for the first iteration. Focus on the core flow: apply a code, calculate the discount, show it in the summary. Then click Build to create the first version of this feature.
Step 3: Debug a failing edge case
After the build, one test keeps failing: stacking a percentage discount with a fixed-amount discount produces the wrong total. The same set of discounts gives different results depending on the order they arrive.
Use Debug Mode or ask the agent to investigate the root cause:
See the agent's response
Thought for 3s
EditedDiscountService.ts+8-4
// Apply discounts in order received
for (const discount of discounts) {
// Always apply percentage discounts before fixed-amount
const sorted = [...discounts].sort((a, b) =>
a.type === 'percentage' ? -1 : 1
)
for (const discount of sorted) {This applies the debugging principles from the Finding and Fixing Bugs chapter: don't fix symptoms, find the cause.
Step 4: Review and test
Before pushing, run a self-review:
See the agent's response
DiscountService.ts, discountCode.test.ts, api/discount/validate/route.tsPricingService.ts (added discount step in calculateTotal)/api/discount/validate — add rateLimit(10, '1m') to match other validation endpointsdiscount_codes table queries by code column but no index exists. Will be slow at scale.If you have cloud agents set up, launch a few to test edge cases you might have missed: unicode characters in discount codes, large discount values, or concurrent code usage. Cloud agents report back with the cases they covered and areas that need more testing, so you can fill gaps before merging.
Step 5: Write a rule
You learned something during this feature: discount calculations should always apply percentage discounts before fixed-amount discounts so results are consistent regardless of input order. Capture this in a rule so the agent knows for next time:
Text
# Pricing rules
- Apply percentage discounts before fixed-amount discounts
- Order total must never go below $0
- See src/services/PricingService.ts for the canonical calculation pattern
This completes the loop. You explored, planned, built, tested, debugged, reviewed, and captured knowledge for the future.
You've finished the discount code feature. A teammate asks you to add gift cards next week. What's your first step?
Keep building
The best way to learn is to take what you've learned here and apply it.
The tools and models are improving rapidly and the specific practices will evolve over time. But this core skill, learning how to work collaboratively with coding agents, will keep compounding. It's becoming one of the most important skills in software engineering.
By pushing the limits of what coding agents can do, you'll get the most out of the latest tools and models as they ship. Good luck and stay curious.
You've completed this chapter
Back to the course outlineLast updated: November 23, 2026