Remove AI Code Slop & Cleanup Style
Goal
Make the change look like deliberate human code: minimal, consistent with surrounding files, no tutorial tone.
Common slop to remove
- Obvious comments: Restating the next line (
// increment i), section banners (// --- helpers ---), or JSDoc that duplicates types the IDE already shows. - Apologetic / meta comments: “Note:”, “This function does X”, “Important:” on straightforward code.
- Over-defensiveness: Try/catch that only rethrows or logs generically; null checks where types or callers already
guarantee values;
|| ''/??chains that mask real bugs. - Fake enterprise patterns: Wrappers that add no behavior,
handle*/process*names for one-liners,utilsbuckets for a single trivial helper. - Inconsistent style vs. neighbors: Different quote style, import order, or error-handling pattern than the rest of the file or package.
- Dead or speculative code: Unused imports, commented-out blocks, feature flags or props nobody asked for,
TODOwithout a ticket/owner. - Verbose AI scaffolding: Extra interfaces for one object,
as const/ generics where inference suffices, repeated string literals that should be one constant next to similar code.
Workflow
- Read context first — Open nearby files in the same package; match naming, patterns, and comment density (often: almost none).
- Delete before you simplify — Remove redundant comments, unused code, and abstraction layers that don’t buy clarity.
- Align with project tooling — Run the repo’s formatter and linter; fix what they flag instead of debating style in prose.
- Preserve behavior — Do not change public APIs or semantics unless the user asked; prefer mechanical refactors and deletions.
- Verify — Run targeted tests for touched packages if they exist and are fast enough for the session.
Checklist
- No comment that only repeats code or types
- Imports minimal; no unused symbols
- Names match local conventions (length and tone of existing symbols)
- Error handling matches sibling code (don’t add logging if the file never logs)
- Formatter/linter clean for edited files
In this repository (Porsche Design System)
- Use NPM; follow nearest AGENTS.md and
.cursor/rules/pds-*.mdc. - Format/lint:
npm run lintandnpm run formatfrom repo root (Biome + Prettier for MD/MDX). - After substantive component changes,
npm run build:core-dependenciesor fullnpm run buildbefore cross-package tests (see root AGENTS.md).
Output to the user
Briefly list what was removed or tightened (e.g. “dropped 12 redundant comments, merged duplicate guard, aligned imports
with foo.ts”).