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

Related Articles

I've been coding with AI for two years. Here is what I've learned

Hacker News - AIJul 17

In this article, the author reflects on two years of coding with AI tools, noting significant productivity gains and the ability to tackle more complex projects. However, they emphasize that human oversight remains crucial, as AI-generated code can introduce subtle errors. The piece highlights the growing importance of AI as a coding assistant, while underscoring the need for developers to maintain strong foundational skills.

7 AI features coming to iOS 26 that I can't wait to use (and how you can try them)

ZDNet - Artificial IntelligenceJul 17

Apple is introducing seven new AI-powered features in iOS 26, including the standout "Hold Assist," which promises to save users significant time. These enhancements reflect Apple's commitment to integrating advanced AI into everyday tasks, signaling increased competition and innovation in the mobile AI space.

Cheating? Or the acumen of modern programming? FOSS, "AI", and human conscience

Hacker News - AIJul 17

The article explores the ethical debate around using AI tools and open-source software (FOSS) in programming, questioning whether leveraging such technologies constitutes cheating or simply reflects modern programming practices. It highlights the evolving role of human conscience in determining the boundaries of acceptable AI-assisted work. The discussion underscores the need for clearer guidelines as AI becomes increasingly integrated into software development.