SShortSingh.
Back to feed

How a Simple /clear Command Cut Claude Code Usage After Playwright MCP Testing

0
·3 views

A developer using Claude Code at work noticed unexpectedly high usage credits being consumed, prompting a closer look at their daily workflow. Using the /clear command, they found that 36% of usage was linked to the Playwright MCP server and that 79% of sessions involved contexts exceeding 150,000 tokens. The root cause was accumulated browser-testing context from repeated Playwright MCP operations — such as page navigation, element inspection, and form interactions — that lingered in the session even after testing was complete. The developer realized that continuing to work in the same session carried forward large, no-longer-needed context, making subsequent processing heavier and more credit-intensive. Their fix was straightforward: after finishing a Playwright MCP test, if the context is not needed for the next task, they now run /clear to reset the session.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

A Single Markdown File Can Make GitHub Copilot Follow Your Codebase Rules

GitHub Copilot's output improves less from better prompt phrasing and more from a committed instructions file at .github/copilot-instructions.md, which is prepended to every request. Unlike generic advice such as 'write clean code,' effective rules must be durable, specific, and checkable — for example, flagging that datetime.utcnow() returns a naive datetime rather than vaguely saying 'handle timezones correctly.' The article recommends keeping the file short, ideally under ten rules, since a bloated instruction file dilutes the rules that matter and adds overhead to every interaction. Rules should also avoid duplicating what automated tools like linters already enforce, reserving the file for non-obvious, codebase-specific facts the model cannot infer from source code alone. The author extends the pattern to infrastructure-as-code contexts like Terraform, Kubernetes, and GitHub Actions, where subtle mistakes are costlier and harder to catch in review.

0
ProgrammingDEV Community ·

Fixed Is Not Repaired

Two Posts With Holes In Them For two and a half weeks, two posts on this blog referenced diagrams that did not load. Not a rendering quirk — a 404. Each post pointed at its diagram by bare filename, something ending in -diagram.svg, with no domain and no leading slash in front of it. That is a relative path. Ghost renders the markdown card verbatim, so the browser resolved that filename against the post's own URL and asked for a file that has never existed at that address.

0
ProgrammingDEV Community ·

Visual Regression Testing Uses Screenshot Diffing to Catch Silent Layout Breaks

Visual regression testing compares screenshots of a webpage taken before and after an update to detect layout changes that produce no errors or logs. Unlike traditional error monitoring, this method catches issues caused by CSS conflicts, font overrides, or class name clashes that can break a site's appearance without triggering any alerts. A naive pixel-by-pixel comparison proves unreliable due to rendering jitter and dynamic content, so a two-layer tolerance system is used instead — filtering minor per-pixel brightness differences and only flagging changes when more than 8% of the frame is affected. This threshold is deliberately high enough to ignore localized dynamic content like rotating banners while still catching large structural layout breaks. The approach was refined further following a real production incident, underscoring that robust visual testing requires careful calibration rather than simple pixel matching.

0
ProgrammingDEV Community ·

Developer Builds Browser-Based Random Chat App With Real-Time Language Translation

A solo developer has built Veilr, a random video, voice, and text chat platform designed to overcome language barriers between strangers matched online. The app translates text messages into a recipient's language before delivery and generates live translated captions during voice and video calls using speech-to-text service Soniox. Veilr runs in browsers across 16 interface languages and on Android, with Gemini handling text translation and a WebSocket-plus-Redis architecture keeping messages and signalling in sync across servers. Users retain control over captions — the listener activates them — and the app discloses when microphone audio is being streamed to a third-party provider as a result. The project was built without microservices or queue brokers, using Node, React, and Capacitor, and launched after the closure of Omegle in 2023, which inspired its core concept.