AI assistants write code that works but reads like nobody on your team wrote it: over-commented, generically named and inconsistent with the rest of the project. Here is how to clean it up so it fits in — by hand or automatically.
The problem with AI-generated code is rarely correctness. It's that the code doesn't match the conventions around it, so reviewers spend time on noise instead of logic. The common tells:
# Loop through each item above a for loop adds nothing a reader can't seeresult = a + b followed immediately by return result"""Calculate the total.""" on calculate_total()Keep comments that explain why — a business rule, a link to an issue, a workaround. Delete comments that explain what when the line below already says it. A good test: if every meaningful word in the comment already appears in the code, the comment can go.
Models number their steps because it helps them reason. In a pull request, # Step 3: Return the result is clutter. Remove the numbering; if the remaining text still adds information, keep it as a normal comment.
Python uses snake_case for locals, JavaScript and Java use camelCase, and C codebases each have their own house style. Rename AI-introduced locals to match. Leave function names and parameters alone unless you control every caller.
Inline variables that are assigned and immediately returned, and drop docstrings that only repeat the function name. Keep docstrings that document parameters, return values or edge cases.
Cleaned-up code is still code you're responsible for. Read it, run your tests and let your linter and formatter (Black, Prettier, ESLint, clang-format) have the final say on formatting.
Here is a typical AI draft and the same code after Code Humanizer's Idiomatic preset at 100%. The logic is unchanged.
Paste ChatGPT or Copilot code, pick a style preset and get code that fits your project. 3 free tries, no account needed.
Try Code Humanizer freeCode Humanizer is a readability and style tool. It isn't designed to hide who wrote code, and using it to break a course's academic integrity rules is against our Terms of Service. If your course allows AI assistance, comparing an AI draft with a cleaned-up version is a good way to learn idiomatic style.
To make AI code read like your own: delete comments that restate the code, strip step scaffolding, apply your naming convention, remove needless temporaries and trivial docstrings, then review and test. Code Humanizer automates the first four for Python, JavaScript, Java and C/C++.