All Posts

Codex Examples: Experiments and Learnings with OpenAI Codex

·ai, javascript ·2 min read
aicodexjavascriptexperiment
weisser-dev/codex-examples

Before building full projects with AI assistance, I spent time systematically testing what OpenAI Codex could and couldn’t do. The codex-examples repository is the result of that exploration — a collection of small JavaScript programs generated with Codex to probe specific capabilities: algorithm implementation, DOM manipulation, API integration, error handling, and data transformation.

The most consistent finding was that Codex performs best on well-defined problems with clear inputs and outputs. Give it a function signature and a description of the expected behavior, and it produces solid, often production-quality code. Ask it to reason about an ambiguous requirement or design a system architecture, and the results degrade quickly. This isn’t surprising — it’s a code completion model, not a reasoning engine — but understanding the boundary precisely was useful.

A few experiments stood out. Codex handled classic algorithm implementations (sorting, graph traversal, dynamic programming) almost perfectly — these are well-represented in its training data and the correctness criteria are unambiguous. DOM manipulation for UI components worked well for simple cases but often produced brittle event listener patterns that would cause memory leaks in a real application. The model clearly learned from tutorials rather than production codebases in those cases. Error handling was consistently the weakest area: generated code would often have no error handling at all, or would add it in places that made no sense.

The practical lesson from all of this was that Codex is most useful as a starting point, not an endpoint. The right workflow is to generate a draft with the model, then review it critically — not just for bugs, but for the kind of structural issues that pass tests but cause problems at scale. That lesson carried forward into how I use AI coding agents today: the agent writes the first version, but I’m still responsible for the code.

Erik Weisser
Erik Weisser

Software developer obsessed with microservices, CI/CD, automation and AI. I build things, break them, document what I learn.