I will admit that I gave Claude attitude. I’ll own that.
I was thinking about the proliferation of posts both pro and profane, I’ve been reading lately on social media outlets and other places talking about AI coding. I decided to give it a try and see what would happen. I tested Claude Code.
Instructions to the noob were fairly simple, and in retrospect a bit snobbish. I mistrusted Claude as soon as I met them, but I kept it to myself. Some people you meet in the cube farms just rub you the wrong way. I knew as soon as I saw their polished exterior interface, their projected inner confidence, that this Claude was going to push my buttons.
I mean, come on! This coder is so notorious that literally everyone is either try to shake hands or just apply the flame of public scorn. They can’t be all that. No way.
My query? “Create an http method for Drupal 10“.
Vague and cryptic though this challenge was, Claude churned out a passable Drupal module, although not without a few real-world issues. I have decided to use the code that Claude wrote to try and understand and share how this coding agent actually works, and what it can do and not do.
Follow along with Claude’s project here:
https://github.com/earlyburg/claude_http
I will be making changes to his code and writing about why he got it wrong (or right) in this and subsequent posts.
My specification
A PHP class method is what I had in mind. You can see one I wrote on line 479 in my Drupal contrib project called Communico Plus. In retrospect I should have told Claude, “Create an http class method for Drupal 10”.
I will say one thing for Claude, they are a hard worker.
One of the first things that I did during my initial evaluation is run the code through my favorite code checker and I was impressed at the code quality. Claude wrote well formatted and syntactically perfect PHP code. Unfortunately, like most entry-level devs, Claude missed things that a mid-level developer would have known were important. I’m putting a few bullet points together for my sync-up with Claude later on Monday, and I thought that I would share these with you.
- Read the Drupal documentation every time.
- Lock down the request paths – use a tighter permission scope.
- Limit request methods to match server security protocols.
- Add the missing “claude_http.services.yml” file.
- Add the missing required HOOK_help declaration.
- Add the missing “claude_http.module” file.
- Add Drupal 11 compatability.
- Remove and refactor custom logging in favor of integrated logger functionality.
- Containerize all Drupal services in classes not just a few.
- Refactor raw PHP functions to use Symfony.
- Don’t pass data from a POST or GET request directly into a database query without sanitizing
Clearly Claude and I are going to have to do a bit of paired programming. Although they are a hard worker and write code with good syntax, there are other considerations that they have not been taught. Also, Claude either does not have access to or does not know how to find, Drupal documentation on Drupal.org.
Check back in later this week, and I will update the team on Claude’s progress as I teach them how to write Drupal code.
I will redouble my efforts to communicate more clearly with Claude, and try to be more sensitive to their struggle.
Remember to follow along with Claude’s progress here:
https://github.com/earlyburg/claude_http
If you want to make a suggestion to Claude, please feel free to create a pull request!
