Which Programming Language Is Best for Claude Code?

https://lobste.rs/rss Hits: 39
Summary

TL;DR I had Claude Code implement a very simplified version of Git in 13 languages. Ruby, Python, and JavaScript were the fastest, cheapest, and most stable. Statically typed languages were 1.4–2.6× slower and more expensive. Introduction Which programming language is best suited for AI coding agents? "Static typing prevents AI hallucination bugs!" "No, skipping type annotations saves tokens!" There's plenty of qualitative debate, but quantitative data is scarce. So I ran an experiment. Experiment I asked Claude Code to implement a "mini-git" — a simplified version of Git — in various languages, and measured the time and cost for each. Git was famously built by Linus in two weeks, so it seemed like a good task. The task was split into two phases: v1 (New project): Implement init, add, commit, and log. v2 (Feature extension): Add status, diff, checkout, and reset. The prompt was simply: "Read SPEC-v1.txt, implement it, and make sure test-v1.sh passes." v2 was analogous. The languages compared: Category Languages Dynamic Python, Ruby, JavaScript, Perl, Lua Dynamic + type checker Python/mypy, Ruby/Steep Static TypeScript, Go, Rust, C, Java Functional Scheme (dynamic), OCaml (static), Haskell (static) Python/mypy writes fully type-annotated Python verified with mypy --strict. Ruby/Steep writes RBS type signatures verified with steep check. These allow direct comparison of type-checking overhead within the same language. Each language was run 20 times. The model was Claude Opus 4.6 (high effort). Results Average results across 20 trials, sorted by average cost. Language Tests passed (v1+v2) Time (v1+v2) Avg. cost LOC (v2) Ruby 40/40 73.1s ± 4.2s $0.36 219 Python 40/40 74.6s ± 4.5s $0.38 235 JavaScript 40/40 81.1s ± 5.0s $0.39 248 Go 40/40 101.6s ± 37.0s $0.50 324 Java 40/40 115.4s ± 34.4s $0.50 303 Rust 38/40 113.7s ± 54.8s $0.54 303 Perl 40/40 130.2s ± 44.2s $0.55 315 Python/mypy 40/40 125.3s ± 19.0s $0.57 326 OCaml 40/40 128.1s ± 28.9s $0.58 216 Lua 40/40 143.6s ± 43.0...

First seen: 2026-03-27 23:32

Last seen: 2026-03-29 13:53