Something I would add is planning. A big "aha" for effective use of these tools is realizing they run on dynamic TODO lists. Ex: Plan mode is basically bootstrapping how that TODO list gets seeded and how todos ground themselves when they get reached, and user interactions are how you realign the todo lists. The todolist is subtle but was a big shift in coding tools, and many seem to be surprised when we discuss it -…
How to code Claude Code in 200 lines of code
131–140 of 249 posts
Re: How to code Claude Code in 200 lines of code
#132It's a great point and everyone should know it: the core of a coding agent is really simple, it's a loop with tool calling. Having said that, I think if you're going to write an article like this and call it "The Emperor Has No Clothes: How to Code Claude Code in 200 Lines of Code", you should at least include a reference to Thorsten Ball's excellent article from wayyy back in April 2025 entitled "How to Build an Age…
Re: How to code Claude Code in 200 lines of code
#133 from ddgs import DDGS
def web_search(query: str, max_results: int = 8) -> list[dict]:
return DDGS().text(query, max_results=max_results)Re: How to code Claude Code in 200 lines of code
#134Yea.. our startup greatly overestimated how hard it is to make a good agent loop. Handling exit conditions, command timeouts, context management, UI, etc is surprisingly hard to do seamlessly.
Re: How to code Claude Code in 200 lines of code
#135Re: How to code Claude Code in 200 lines of code
#136Earlier quoted context omitted.
Oh yes, I commonly add something like "Use a very granular todo list for this task" at the end of my prompts. And sometimes I will say something like "as your last todo, go over everything you just did again and use a linter or other tools to verify your work is high quality"
If you have pre-commit hooks it should do this last bit automatically, and use your project settings
Re: How to code Claude Code in 200 lines of code
#137Re: How to code Claude Code in 200 lines of code
#138Earlier quoted context omitted.
Oh yes, I commonly add something like "Use a very granular todo list for this task" at the end of my prompts. And sometimes I will say something like "as your last todo, go over everything you just did again and use a linter or other tools to verify your work is high quality"
Right now I start chatting with a separate LLM about the issue, the best structure for maintainability and then best libraries for the job, edge and corner cases, how to handle those, and then have it spit out a prompt and a checklist. If it has a UI I'll draw something in paint and refine it before having the LLM describe it in detail and primary workflow etc. and tell it to format it for an agent to use. That will…
Like a manual sub agents approach. I try not to pollute the Claude code session context with meanderings to much. Do that in the chat and bring the condensed ideas over.
Re: How to code Claude Code in 200 lines of code
#139Something I would add is planning. A big "aha" for effective use of these tools is realizing they run on dynamic TODO lists. Ex: Plan mode is basically bootstrapping how that TODO list gets seeded and how todos ground themselves when they get reached, and user interactions are how you realign the todo lists. The todolist is subtle but was a big shift in coding tools, and many seem to be surprised when we discuss it -…
Re: How to code Claude Code in 200 lines of code
#140Earlier quoted context omitted.
Please don't fulminate on HN. The guidelines make it clear we're trying for something better here. https://news.ycombinator.com/newsguidelines.html
Agreed. Aside from the guideline violation, he has a tiny point. Python is quite garbage for this sort of thing.