Configuring Claude Code with CLAUDE.md

How to get AI agents to write better code consistently

  • Article
  • Data Engineering
  • Data Science
  • AI
Claude Code with CLAUDE.md

There is a clear difference between teams that occasionally achieve decent results with Claude Code and teams that consistently produce high-quality output. That difference rarely comes down to better prompts. In practice, it is usually something more fundamental: the rules and expectations you establish before the agent starts writing.

With the current generation of models, the nature of the work has shifted. You are no longer just writing code—you are also directing the behaviour of the agent that writes the code. Recently, Andrej Karpathy described this as Agentic Engineering: the logical next step beyond what is often referred to as “vibe coding”.

Without explicit boundaries, an agent falls back on patterns learned from its training data. The result is often generic solutions, unnecessary complexity, and technical choices that may be correct in isolation but do not fit your project or team.

The solution is not more prompts. It is one file.

Why Claude Code goes off track without context

Coding agents have a strong tendency to align themselves with what they believe the user expects. Even when the correct response should actually be: this does not make sense or there is information missing.

This behaviour is visible in benchmarks such as the Bullshit Benchmark, where models are more likely to validate incoherent input than challenge it.

The Bullshit Benchmark compares AI models on their ability to identify and correct incorrect assumptions, misleading questions and incoherent input. The results show that even advanced models are often inclined to validate user assumptions rather than critically challenge them. This behaviour can also appear in AI coding agents when project context and quality standards are not clearly defined.
Benchmark ranking AI models by their ability to recognise and correct incorrect assumptions.

In code, this often manifests as overengineering: additional logic, extensive error handling or architectural layers that nobody requested.

This does not happen because the model is unintelligent. It happens because the model has no explicit definition of what “good” looks like within your repository.

Without clear context, Claude Code fills those gaps itself. Those assumptions are based on patterns it has most frequently encountered during training, not on your technology stack, standards or team agreements.

CLAUDE.md as a behavioural baseline for AI agents

CLAUDE.md addresses this problem. The file sits in the root of your project and contains the standards, boundaries and behavioural rules that should always apply. Claude Code automatically reads it at the start of every session.

Functionally, you can think of it as an .editorconfig file, but for agent behaviour rather than code formatting.

Although this article focuses on CLAUDE.md, the same principle applies to other AI coding agents. Similar files exist in other ecosystems, such as AGENTS.md.

By defining these rules at project level, there is no need to repeat them in every prompt. In practice, this leads to:

  • More consistent architectural decisions
  • Fewer surprises during code reviews
  • Less time spent correcting solutions that are almost—but not quite—appropriate

Why fewer rules produce better results

One crucial point is often overlooked: CLAUDE.md is included with every API call as part of the system prompt.

A file containing 2,000 tokens that is sent 40 times results in 80,000 input tokens being consumed purely by instructions. Those tokens also compete with the actual code context the model needs to work with.

This visual illustrates how instructions from CLAUDE.md are included in every API call. A file containing 2,000 tokens that is used 40 times during a session results in 80,000 input tokens being consumed by instructions alone. This demonstrates why a concise and focused CLAUDE.md is often more effective than a lengthy document filled with generic rules.
Diagram showing how a 2,000-token CLAUDE.md file results in 80,000 input tokens across 40 API calls.

Even the latest models show performance degradation when context windows become overloaded.

Recent research supports this. One study found that large quantities of generic, AI-generated instructions can produce worse results than having no rules at all.

What to include in CLAUDE.md — and why

Effective CLAUDE.md files generally contain three categories of rules.

Hard technical constraints

These are decisions the agent must not deviate from:

  • Programming languages
  • Frameworks
  • Architectural principles
  • Established coding conventions
## Hard Limits

- Functions: <= 100 lines

- Cyclomatic complexity: <= 8

- Positional parameters: <= 5

- Files: <= 500 lines

These rules prevent the agent from introducing “helpful” alternatives that do not fit your codebase.

Stack and tooling

Without explicit guidance, agents default to what they have seen most frequently in training data.

That is how you end up with pip install recommendations when your team uses uv, or suggestions for black when your standard is ruff.

## Python Tooling

- Package manager: uv

- Linting + formatting: ruff

- Type checking: ty

- Testing: pytest
Example of tooling standards defined in CLAUDE.md for a Python project. By specifying package managers, linters, type checkers and testing frameworks, teams can ensure that AI coding agents generate recommendations and code that align with established development workflows and engineering standards.
Example CLAUDE.md configuration specifying Python tooling, including uv, ruff, ty and pytest.

These rules are simple to document but often provide immediate quality improvements.

Behavioural guidelines

This is often the most underestimated category.

Here you define how the agent should reason:

  • When refactoring is appropriate
  • How uncertainty should be handled
  • When clarification should be requested instead of making assumptions

These rules are what distinguish merely correct output from output that is genuinely useful.

CLAUDE.md is a living document, not a checklist

You do not create a CLAUDE.md file once and forget about it.

In practice, it acts as a feedback mechanism. If the agent repeatedly makes the same mistake, add a rule. If a rule has little measurable effect, remove it.

Over time, this creates a compact set of guidelines that provides exactly enough direction without burdening the model with unnecessary context.

For teams using AI systematically in software development and data environments, this is a natural step towards mature adoption. Not by writing more prompts, but by clearly defining what “good” means before the agent begins.

Looking to use AI agents effectively?

Want to embed AI coding agents into your organisation in a structured and sustainable way? We help teams establish technical standards, governance frameworks and practical AI use cases that deliver real value. Get in touch or schedule a meeting to discuss the possibilities.

This is an article by Paul Hoekstra

Paul is a Data Engineering Consultant at Digital Power. He focuses on building automated data pipelines, scalable data models and reliable ETL transformations. With a hands-on and analytical approach, he helps organisations turn complex data landscapes into clear insights that truly make a difference.

Paul Hoekstra

Receive data insights, use cases and behind-the-scenes peeks once a month?

Sign up for our email list and stay 'up to data':

You may find this interesting too

Monthly Digital Insights – November 2026

In this monthly series, we share the latest trends, product updates and industry insights in AI, data and analytics that are most relevant to you. We look beyond the update itself and explain what these developments could mean for your organisation, where they may create opportunities and how you can turn them into value.

Read more

50% faster development of Customer 360 functionality with Databricks Lakebase

To provide customers with effective, personalised support, Independer needs a reliable and complete view of each customer. However, its existing Customer 360 architecture was complex and difficult to extend. Together with Independer, we modernised the technical foundation using Databricks Lakebase. As a result, the data team can develop new functionality faster, while laying the foundation for processing more customer data in real time. This improves their customer service.

Read more

Conversational analytics in practice: Coolgreen demo

Conversational analytics makes data accessible to everyone, without the need to perform complex analyses or navigate multiple dashboards.

Read more

Monthly Digital Insights – October 2026

In this monthly series, we share the latest trends, product updates and industry insights in AI, data and analytics that are most relevant to you. We look beyond the update itself and explain what these developments could mean for your organisation, where they may create opportunities and how you can turn them into value.

Read more

Piano Academy 2026

Piano is evolving from a digital analytics platform into an AI-driven analytics and activation platform. At Piano Academy 2026 in Amsterdam, we saw how conversational analytics, contextual data and AI integrations are making data more accessible and actionable across organisations.

Read more

132% more customers fully supported with conversational AI

Insurer Univé wanted to improve customer satisfaction and reduce pressure on its customer service team by handling more customer questions directly through the chatbot. However, the existing scripted chatbot struggled to deal with different types of questions and context, meaning customers often still ended up speaking to an employee. By replacing the scripted chatbot with one based on a large language model, customer satisfaction increased while pressure on customer service decreased.

Read more

Monthly Digital Insights – September 2026

In this monthly series, we share the latest trends, product updates and industry insights in AI, data and analytics that are most relevant to you. We look beyond the update itself and explain what these developments could mean for your organisation, where they may create opportunities and how you can turn them into value.

Read more

Which BI tools are most ready for AI?

Artificial intelligence is becoming a structural part of how you work with data. Predictive models, generative AI and automated decision support are no longer experiments. They can be part of daily operations. At some point, you reach a critical question: does your current BI setup still support where you want to go?

Read more

From smart meter data to real-time decisions

By 2028, the world will generate 394 zettabytes of data a year, more than double the roughly 181 zettabytes produced in 2025 (IDC, cited by TechTarget). If you work in energy, you'll feel this shift more than most. Much of that data won't come from your spreadsheets or databases. It will come from smart meters, grid sensors and AI systems that never stop reporting.

Read more

Answering data questions independently within minutes with conversational analytics

Within Digital Power, we wanted to give Finance and Business Support more ownership of management dashboards and give Sales faster, independent access to relevant insights. With a simpler data model and Databricks Genie, users can now ask questions about data in natural language and immediately ask follow-up questions. Finance and Business Support can also make dashboard changes themselves, reducing the amount of time technical specialists spend on recurring questions and changes.

Read more

Monthly Digital Insights – August 2026

In this monthly series, we share the latest trends, product updates and industry insights in AI, data and analytics that are most relevant to you. We look beyond the update itself and explain what these developments could mean for your organisation, where they may create opportunities and how you can turn them into value.

Read more

400% faster time-to-market for new personalisation use cases

In September 2023, Transavia asked us to evaluate their Customer Data Platform (CDP): did it still align with their marketing objectives, and was it future-proof considering the stricter regulations around third-party cookies?

Read more