AI coding models are trained to be helpful, which often results in bloated code full of redundant tutorial comments and repetitive boilerplate wrappers.
Identifying AI Code Slop
•Zombie Tutorial Comments: Comments that explain syntax rather than architectural intent.
•Generic Variable Names: Excessive reliance on generic variable tags like data, res, temp, and item.
•Pass-Through Try-Catch Blocks: Catch blocks that simply log errors and return generic empty objects.
Practical Refactoring Example
typescript
// BEFORE (AI Slop)
const handleSubmit = async (e: any) => {
e.preventDefault();
try {
const data = { name, email };
const res = await submitForm(data);
if (res) {
console.log("Success");
}
} catch (error) {
console.error("Error occurred:", error);
}
};
// AFTER (Clean Human Code)
const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
const payload = { name, email };
await submitForm(payload);
};