Sitemap

Give Claude Code Context: One Principle, Many Implications

5 min readMar 18, 2025

--

Context ripples out in many directions. Generated using Flux Pro 1.1 Ultra

TL;DR: Providing Claude Code with relevant context significantly improves its output quality. This simple principle influences how you structure projects, write documentation, and approach the development process.

In Part 1, I shared some of my top tips for using Claude. Since then, I’ve worked extensively with Claude Code and implemented a substantial project with it (about 7,000 lines of code). Through that I’ve found myself coming back to the same point.

Here’s the key insight: Claude Code (and AI tools generally) performs significantly better when it has relevant context. This observation, while straightforward, has several important implications for how you use Claude Code effectively. And I suspect this principle will apply to future AI coding tools as well.

As you use Claude Code, consider these key questions:

  • How can I give Claude sufficient context to make informed decisions?
  • How do I make that context accessible and maintainable?
  • When Claude makes a mistake, is there a lack of context that could have prevented it?
  • How can I enhance Claude’s knowledge base to improve future interactions?

What follows are concrete examples of how context principles manifest in practice, though the specifics will vary by project.

Write the Design Doc First

Design docs often become afterthoughts in our projects. Many of us have written documentation after completing the code, primarily as a formality during handover.

Here’s the key difference now: design docs serve both humans and AI assistants. Writing the design doc first allows Claude to begin with the same understanding as you, rather than expecting it to infer your intentions.I’ve found design docs useful as a communication channel between Claude’s approach and my own. Here’s how I typically start projects now:

Step 1: Your Vision
I create a high-level design doc as a Markdown file describing my goals. I include constraints, preferences, and requirements that matter to the project. This establishes our shared understanding.

Step 2: Claude’s Understanding
Then I ask Claude Code to develop an implementation plan based on my design doc, saving it as another markdown file we’ll reference throughout development.

Step 3: Collaborative Refinement
I review Claude’s implementation plan and make necessary adjustments. This is where Claude suggests approaches to data storage, libraries, and architectural patterns. Some suggestions work well; others need modification based on factors I’m aware of. This process helps identify ambiguities before they become coding issues. I’ve had productive conversations with Claude about technical trade-offs. For instance, when discussing data storage options, Claude suggested a hybrid approach I hadn’t considered that worked well for my specific needs.

Step 4: Implementation with Memory
With a solid implementation plan in place, I have Claude begin the implementation. As we complete features, I have Claude update the implementation plan to mark items as done. This acts as a persistent memory of progress that survives across sessions.

This approach has proven valuable. When I experienced a laptop crash that reset Claude’s context, having the updated implementation plan allowed us to resume work without significant disruption.

Zoom Out, Then Zoom In

The common approach with AI coding tools is to start narrowly — “write me a function to do X.” This “zoomed in” perspective seems intuitive, as people often assume broader context might confuse the AI.

My experience is exactly the opposite. Claude Code works better with a broader context: “I’m building a data processing pipeline for inconsistent CSV formats. I’ve implemented similar validation logic in files A, B, and C. Could you create a common function and update the references?”

This contextual approach tends to produce better results than isolated requests. Claude benefits from understanding the larger picture before addressing specific details. With broader context, it can make more appropriate implementation decisions.

Claude favors Monorepos

Providing Claude with more context is easier when it can see how different components connect. My recent projects have had both backend and frontends. While you could use Claude on each separately, I’ve found it more effective to organize code as a monorepo with both components in the same root directory.

With this structure, Claude can work across components simultaneously. It can run tests that span the system and maintain consistency between frontend and backend. When Claude understands both sides of your API, its suggestions help maintain coherence across the system.

This approach helps prevent integration issues that might arise from misaligned interfaces or inconsistent data models. Claude becomes helpful for integration, not just individual component development.

Provide Context About Dependencies

One current limitation of Claude Code is its ability to search for documentation on dependencies (this can be somewhat addressed using MCP). Sometimes providing additional information about libraries is helpful.

For important libraries (such as the Anthropic Python SDK), I’ve occasionally included a copy of the repo in my local directory for Claude to reference. I’ve done similar things with API cookbooks, asking Claude to review examples to understand recommended approaches.

While this requires some effort, it improves Claude’s ability to work with these dependencies. When Claude can see implementation details or intended usage patterns, its suggestions become more relevant.

Keep Context Updated

A practical consequence of relying on context is that outdated documentation can lead Claude to make suboptimal choices. This encourages keeping documentation current throughout development.

I experienced this when switching logging libraries during a project. Claude continued suggesting the previous library until I realized the original recommendation remained in our CLAUDE.md file. After updating the reference, Claude’s suggestions aligned with the new approach.

Helpfully, Claude Code can assist with documentation maintenance. Asking “Please update CLAUDE.md to note that we now use library X for logging” works effectively. Claude serves as both a user and maintainer of project context.

Conclusion

A fundamental principle for team success is ensuring everyone has the context needed to make good decisions. This applies to both human and AI team members.

The principle of providing clear, accessible context influences how we interact with tools like Claude Code. It affects repository structure, documentation practices, and development workflow.

As AI coding assistants become more integrated into development processes, teams that effectively create and maintain shared context will likely see better outcomes. In my experience, investing time in context creation pays dividends in productivity and code quality — a small upfront cost that transforms the entire development experience.

--

--

Waleed Kadous
Waleed Kadous

Written by Waleed Kadous

Co-founder of CVKey, ex Head Engineer Office of the CTO @ Uber, ex Principal Engineer @ Google.

Responses (2)