Show HN: YOLO – metaprograming AI decorator generating function code from stubs

Hacker News - AI
Jul 16, 2025 13:33
spstoyanov
1 views
hackernewsaidiscussion

Summary

A developer has created a Python decorator called YOLO that uses AI to generate function code from simple stubs, supporting async functions and class methods while caching results locally. This approach enables rapid prototyping of features like FastAPI endpoints and encourages test-driven development, as tests can guide and validate the AI-generated code. The project highlights a potential shift toward AI-native programming workflows, where code generation becomes more automated and integrated into development practices.

The other day I was thinking about the future of programming and how our workflows change with AI and I started wondering what would an AI-native programming language look like. So I got this idea - what if we can just write function / class definitions and let AI generate the actual code for us. One thing led to another and after a fun weekend I got something working. I made a simple python decorator that uses a function definition to generate the function code. It works for async functions and class methods, and it caches the generated code locally. There are some fun use cases like AI-generated fastAPI endpoints and agent tools. I also realized that this approach somewhat incentivizes test-driven development because if you write the tests ahead of time you don’t only make sure that the code works but it is generated and cached before the actual program runs. I haven’t had enough time to do a proper comparison but I wonder if this test-driven approach produces better code vs traditio