Vibe Coding
Is vibe coding a loan shark ?
I worry when I see vibe coding. Here's why.
The background
I have a problem with Claude Code (CC). It's so good I use it a lot.
At the last count CC and I had twenty-six active projects. I often had questions about past sessions. What prompting worked? Why did CC use a monkey-patch to get a test to pass? When did it volunteer a refactoring I hadn't thought of? How did it use jinja template files? There was no easy way to answer those questions.
Simon Willison to the rescue
Late last December, Simon Willison explained that he had a similar problem and posted about his solution. He and CC had written a tool to parse the transcripts that CC captures for every session. His claude-code-transcripts tool could read the transcripts and generate a tree containing html files showing the contents of each session. Here's a partial screenshot of an example:

Problem solved!
Then I looked at the code.
His tool was really useful, but it did things I didn't need, and it didn't do all the things I did need. I'm working on a book about Python coding with AI, and I hoped I could extend the project to convert sessions into Markdown. Then I could edit that and use it in the content of the book.
I thought that would be easy.
The project is open sourced on GitHub, so I took a quick look at the implementation.
All the code was in a single 2147-line function, containing Python, CSS and JavaScript!
How could that be?
The answer was clear; the code had been Vibe Coded. CC had created a really useful tool, but I quailed at the thought of adapting it.
CC refactored it. After a promising hour or so, CC reported that it had finished the job. It seemed to work, but somewhere along the line the output formatting had been un-fixably mangled. I put the problem in the Too Hard tray and enjoyed some family time for the rest of the year.
Restarting from scratch
Two days ago I decided to build what I wanted, starting with a new project. I used rigorous Test Driven Development. A couple of hours later I had code that worked and did exactly what I wanted. It was much cleaner, but CC still had a lot of html and css embedded in python code. I'd forgotten to tell it to use jinja2.
Time to refactor
CC planned a refactoring, switching to jinja and moving html and css out of the python code. Since this was a major change, it refactored in baby steps.
It did a great job but there were still more lines of code in the tests than I'd expected.
Adding pytest fixtures
Could CC use fixtures to reduce repetition in the tests? It did. Their length dropped considerably. But they were still a bit wordy. I decided to use PyHamcrest - a port of the Java Hamcrest framework. Hamcrest improves the readability of tests and the clarity of the messages when tests fail.
PyHamcrest helped
Luckily, CC is a pretty competent Hamcrest coder and it worked its way through the tests, writing custom matchers and simplifying the code. It took the best part of half an hour but by the end the tests were much more readable. The module sizes could be reduced but I'm happy for now.

Where are we now?
The project is in good shape. I'm very grateful to Simon Willison for the original inspiration, for all I've learned from his blog, and all of the code of his I've used. I'm also grateful to Anthropic for building a code agent that can build a well engineered project.
Steer clear of the loan shark
Claude code is capable of producing quality code when there's a human in the loop . Vibe coding is faster in the short term, but technical debt mounts fast. If you vibe code, you're in the hands of a loan shark; each time you extend the code, you get deeper in technical debt. On the plus side, Claude Code knows more about good Python practices than many junior developers, and applies them well so long as you keep it on a tight rein.