Audit Svelte 5 codebase for best-practice violations
Session from pi-web on Hugging Face by woxQAQ · MIT · condensed by Coders Talk
Click a segment to jump to that moment
16msession
0interventions
GOAL
Check whether the current Svelte codebase follows Svelte 5 best practices, then fix any issues found.
- +0Prompt · +0Check if current repo's Svelte code follows best practice
- +0mAgent did · +0mLoaded Svelte best-practice skills, read every component and store file in packages/svelte/src, and attempted to run the Svelte autofixer/MCP tool (which timed out) to check for issues.
- +3mAgent did · +3mProduced a full audit report concluding the codebase is largely compliant with Svelte 5 runes/event syntax, flagging a couple of remaining issues (window/document listeners in onMount instead of <svelte:window>/<svelte:document>, and an ad-hoc effect timer hack).
- +12mPrompt · +12mFix the two issues
- +13mAgent did · +13mEdited App.svelte to move window resize/keydown listeners into <svelte:window> and replaced the _timerSet mutation hack with a proper Set<string> tracker for notification auto-dismiss.
- +14mAgent did · +14mFound the same onMount document listener pattern in ChatTranscript.svelte and converted the copy/scroll listeners to declarative Svelte event bindings, verifying handleScroll's signature was compatible.
- +15mAgent did · +15mRan pnpm build:web to confirm the project still compiles after the changes; build passed cleanly.
- +16mPrompt · +16mCommit
- +16mOutcome · +16mCommitted fix as a063394 on main: 2 files changed, 10 insertions(+), 15 deletions(-).
VERDICT
I'd start by asking it to both audit and fix in one pass, since the audit alone took a long time reading every file before finding just two real issues. The build check after the edits was the step that actually mattered — it confirmed the svelte:window and effect-timer refactors didn't break compilation before I committed.