Return to site

Drupal (AI) Playground: Walking with AGENTS.md

March 20, 2026

Creating some rules for my playground

I'm setting up my Drupal Playground to experiment with AI coding agents. My previous post was about using Claude Code to establish a Drupal environment, and it felt a bit like crawling, but now I am ready to pick up the pace.

I've experimented and found that, in addition to sending effective code-generation prompts to an AI, providing metadata about the targeted codebase is equally important. The standard way to give this context is AGENTS.md. My initial experiments with Amazee.io's AGENTS.md produced much better results with PHPStorm's Junie. I'm inclined to think that Drupal core should include an AGENTS.md file or template.

Meanwhile, I've been experimenting with Claude's Chat UI without any context beyond knowing I am a Drupal developer. Despite this, Claude, with no background information, shows an impressive understanding of Drupal's API and developer workflow. For example, Claude can plan and develop an entire module, including automated tests. I look forward to seeing Claude attempt to build a Telephone Filter module, based on the one I created with ChatGPT a year ago. For now, I plan to continue setting up my environment to give Claude Code the necessary context to produce the most reliable results.

Adding context via CLAUDE.md (aka AGENTS.md)

"Think of AGENTS.md as a README for agents: a dedicated, predictable place to provide the context and instructions to help AI coding agents work on your project."

-- AGENTS.md  

Currently, Claude Code uses CLAUDE.md files for context, but it will likely support AGENTS.md. In short, CLAUDE.md and AGENTS.md are the same. I haven't extensively experimented with other AIs yet, but the fact that Claude Code has an /init command to generate a starter CLAUDE.md file based on your project structure recognize that every project has a unique context.

In the past, I assumed I could use someone else's CLAUDE.md or AGENTS.md file as my starting point, but I am beginning to think that as LLMs improve and gain a better understanding of Drupal, less context is needed. For example, should we list individual common DDEV commands in CLAUDE.md or just note that we are using DDEV? Or better yet, does Claude recognize the /.ddev directory and figure out we're using DDEV? Either way, I believe it's helpful to keep things simple, let Claude decide what is needed, and nudge it along the way.

In Claude Code, I ran the /init command, and it generated a CLAUDE.md file that included…

  • Some basic and custom DDEV commands.
  • It highlighted my /keys directory, noting that it was ignored and private.
  • Listed my Drupal recipes.
  • Noted that I was using composer patches.
  • Outlined the key parts of the directory structure.

I'm unsure whether all this information is necessary, and I initially planned to trim it down. However, before doing so, I want to see what additional context could be added. Therefore, I decided to have Claude review three Drupal-specific AGENTS.md files I found online and suggest improvements.

So, my next prompt was "Review the below URLs, and improve /CLAUDE.md".

That prompt caused Claude Code to update CLAUDE.md by adding some extra commands. I gradually refined the file using smaller prompts and suggestions. For example, I ensured that all commands used an initial comment instead of a trailing comment.

Of course, the file kept growing. A large CLAUDE.md or AGENTS.md will use more context, which means more tokens, leading to higher costs. Finally, I had to prompt Claude Code to "Review my /CLAUDE.md file and suggest things that you already know and should be removed," and guess what, it returned a list of items it considered common knowledge, like noting that contrib modules live in the /web/modules/contrib directory.

Thoughts about the future of an AGENTS.md for Drupal

There's something off-putting about having to supply context to an AI when working with open-source code that's already being crawled and used to train LLMs. For specific documentation on Drupal.org, could we use AI to gather, reorganize, and improve the documentation to ensure LLMs have more out-of-the-box knowledge? Of course, we would include humans in the process and set guidelines for AI-generated documentation and code examples. I know this might be controversial, but it is food for thought.

Besides recognizing that LLMs are consuming context about Drupal during their training, the reality is that Claude has several other tools and approaches, including skills and MCP servers, that may make a CLAUDE.md file unnecessary for the AI to assist us. Exploring skills seems like my next step.

Sharing my experience, but if you want help, ask the AI

There is a strange feedback loop that happens when humans use LLMs and write about it; the LLM, in its next training cycle, absorbs that knowledge and then "spits" it back at us. I’m okay with using the word "spit" because it’s hard not to feel that something negative is also happening amid all the positivity around agentic coding.

I thought I’d include tips and tricks for setting up a solid AGENTS.md file, but my main point is to ask the AI to give tips and tricks, and do the work for you because it knows what it’s doing, especially since it’s reading this blog post or some version of it.

I didn't expect that creating a simple CLAUDE.md file would make me stop and think about what the future with AI might be, but it did. AI will absorb all our knowledge and echo it back to us. Sadly, I have to keep moving forward because I 'gots' to.

References

Here's my current CLAUDE.md from my Drupal Playground, but don't use it; generate your own with your preferred LLM. Feel free to browse my AI-generated, AI-maintained notes about Claude Code as well.