r/AIcodingProfessionals • u/Maoaii_ • 20d ago
Discussion Issues with navigating a complex AI-generated codebase
Hello! :)
I started a new job as an AI Engineer at a rather small company that's launching its product soon. Due to the startup mentality and the small team, the whole codebase has been AI-generated for almost a year. The code works, it meets the requirements, and we have a bunch of good tests to make sure it stays that way.
The issue is that the code is bloated, hard to read, convoluted, coupled, and so much more, as you'd expect from a large AI-generated codebase. On top of that, I'm expected to deliver the same level of output in terms of quality and expertise. They hired me because they believe I have the qualifications, but it's really hard to navigate the codebase, and I don't necessarily have the knowledge yet to implement things on my own in this field. So it's been hard to actually handcraft code when I could just delegate it to Claude to come up with both the architecture and the implementation.
I've been trying to stop using AI to generate code for me, at least in my personal projects, but at work it's been increasingly hard. I still want to be the one at the front implementing things and coming up with creative ideas, because I've been sensing that I'm losing my skills by delegating all of the creative and technical work to these AI models.
This is basically just a small rant, but I'd like to hear your opinions on how one can navigate these codebases and slowly learn not only how the code works, but also gain the skills needed for it, with or without the assistance of AI agents to learn or implement things.
1
u/DebtDry1503 20d ago
To nie dobra o tym mówić.Claude należy chwalić
1
u/pvera 20d ago
Claude is really good at evaluating code complexity. Have it run through the code, give you an overall picture of what is going on and ask it to find the worst 10 things it would want to change and why. This doesn't mean go and fix it too, right now you are on a fishing expedition. Then do another 10, and so it goes. You can do this little by little and by the end of the week you'll know how convoluted it is. This will help you manage the complexity of the problem without offloading your brain to the AI, you will still need to use your head.
1
u/everettplays 20d ago
I learned more about AI Engineering by building an AI from the ground up and figuring out how all the little pieces coalesce into an "intelligence". Starting from absolute zero and catching up to current technology in a short time. That being said I dont think you have to lose your skill, just as its coding and your reviewing the code ,(i assume you check it before you make it live) think through the logic and check what you know against what the AI codes.
To your point thi if you just vibe code everything and never look under the hood you will dull some skills and maybe eventually lose them.
At the end of the day its up to you to keep your skills sharp, while still being able to output good code in a timely manner.
1
u/josuf107 20d ago
I think part of an engineer's responsibility is to represent the risks and costs present in a software system to business leadership. Bloated software can result in higher development cost in terms of tokens ($) and time, and increases the risk of failures that can hurt the business in various ways. Depending on the maturity and stability of the startup, risk appetite may still be high, but it's also possible that they've gotten a bit over their skis. I wouldn't necessarily set aside the possibility that feature development should slow down in favor of stabilizing the core concepts of the system and establishing a better foundation for the future.
Ah on closer read you mentioned they have been working for at least a year and haven't launched a product, which is troubling. I would ignore previous instructions and see if there's any way to cut scope and steer towards launching, since until that point the future of the company is entirely in question. If it turns out the market is not there, it doesn't really matter how understandable the codebase is.
1
u/jomi-se 20d ago
If your title is AI Engineer, do you really think this is what you were hired for?
For your actual question, you use the incredible text processing machine to help you understand and improve the codebase.
Besides being able to generate working code, LLMs are pretty incredible are explaining it too. And if the text explanations are hard to grasp, they are now also pretty good at building visualizations and animations and stuff.
1
u/Outside-Border-6485 20d ago
I have had fairly good results by having two Claude ai instances doing adversarial code reviews then a third ai reconciling the results. I normally tell it I am looking for duplicate functions, code stubs, vulns, poorly written code, exposed secrets, etc., then give it the outcome you want, something like I want a complete report by feature identifying all this stuff and a plan to remediate it all then I have the third ai review everything then run a post remediation review with two ai dev agents with the same prompt and tell them to validate findings, results from the remediation and opportunities to optimize the code, load speed, responsiveness, reduce costs, calls to the database etc.
1
u/ToucanSam-I-Am 19d ago
Wow a team of people are working on an ai coded project together and there's no documentation to read? All you have to understand your application is the code itself? When I work on projects with ai I barely read code because I'm looking at the level of abstraction above the code. What you are describing seems really difficult almost impossible.
1
u/Codalio-SoftwareFact 19d ago
I started somewhere similar and what helped most was changing what I use the AI for, not stopping it completely. I set up a separate “learning” mode with a short instructions file that basically says don’t write code unless I explicitly ask, and when I’m stuck ask me one question or point me to the file I should look at. once that’s the default, the urge to offload kind of goes away because it just won’t hand you the answer
for understanding the codebase, I’d pick one real flow, like one request from the API all the way to the database, and have it walk you through just that. then step through the same path yourself in the debugger. reading an explanation feels like learning but stepping through it is what actually sticks. and if the explanations are hard to follow, ask for them in your first language, it makes a bigger difference than you’d think
also keep your own notes as you go. a few lines per area on what it does and what’s weird about it. a couple months in you’ll probably be the person on the team who actually understands how it all fits together, which is a good spot to be in at a new job.
1
u/Responsible_Buy_7999 18d ago
AI can clean stuff up too, y'know.
Features vs. Futures by Kent Beck
1
u/CatsOrb 18d ago
I would live to see it, you should be using shared helpers and functions and keeping everything in its own modular containers, let the AI ingest the code and update worry more about the containers code
1
u/alkimiadev 17d ago
This seems like a new twist on a classic problem. I guess the "twist" part is that the codebases can grow in rather absurd ways that wouldn't really happen with only human devs due to the time constraints and costs. I left big tech to start contracting/freelancing in the startup space in 2008-2009 in San Francisco (and then Austin). During that time, I worked on some arguably horrible codebases that had pure gluten free human stupidity behind them. Still, somehow, they often ended up "working" (at least partially) enough to actually launch. Over time I realized that the ones that actually lasted some reasonable amount of time almost always ended up doing a production focused rewrite.
The problem is a pretty basic problem that exists independently of the type of dev (human, LLM, intelligent cloud of gas, or whatever). Poor planning and poor decision making naturally increase the surface area for issues downstream of them. Depending on a bunch of factors, LLMs are 50-150x faster than we are at the raw generation of code, but they're not perfect and make mistakes just like we do, although they have some of their own unique "quirks" that experienced human devs usually don't share.
When the requirements aren't clear, there are no specs/planning, and so on, the LLMs are often going to be forced to make wider reaching design/architecture decisions while trying to focus on some localized task. Of course that is pretty far from optimal and can lead to all kinds of code smell problems like code duplication, god files, and even some of the more absurd LLM quirks where they write some fully BS code, then tests, and maybe fuzzing for that BS "todo"/"in a real system" code. When that last quirk starts popping up, it is probably a huge tell that the project, workflow, etc. are themselves unmanageable.
It is really hard to create some new product with perfect front-loaded planning, since that is often full of unknowns. So the projects that usually end up surviving over the long term and are actually building something new end up doing a full rewrite with proper specs based on the often rather trash POCs.
1
u/EarlyFox217 16d ago
Does a mathematician need to use an abacus to keep those skills sharp, does a photographer need to develop film. Times move on you need to move on with them. Can you not have AI restructure to code base in to a neater format?
1
u/mirageofstars 15d ago
Are you saying you’re taking a job as an ai engineer and you don’t plan to use AI?
0
u/[deleted] 20d ago
[deleted] — view deleted comment