viewport-testing
Skill10 starsChanged 2 months agoApache-2.0View on GitHub
Resize and restore the viewport reversibly, run multi-viewport responsive workflows with per-step DOM digests, and emulate device profiles with honest UA reporting.
In this repository16 other files it gives its agents.
- browser-forensicsSkill
- browser-interactionSkill
- browser-state-recoverySkill
- dom-inspectionSkill
- dom-mutationSkill
- dom-targetingSkill
- extension-troubleshootingSkill
- human-like-interactionSkill
- mcp-troubleshootingSkill
- page-annotationSkill
- project-captureSkill
- project-reconstructionSkill
- regression-testingSkill
- selector-recoverySkill
- tab-managementSkill
- visual-dom-comparisonSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 10
Test responsive behavior without losing the original state.
- Distinctive: line 16
Before capturing regions/screenshots that must reflect a specific viewport.
- Very specific: line 52
Every resize result echoes original and reversible: true.
- Very specific: line 58
Always end with reset_viewport — even after errors mid-workflow, it restores the recorded original.
- Very specific: line 59
If a responsive test left the page in a weird scroll state, scroll_page {x: 0, y: 0} or reload_tab after reset.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Skill: Viewport Testing
PURPOSE
Test responsive behavior without losing the original state. Every resize records the original dimensions exactly once, reset_viewport is a guaranteed restore, and the multi-viewport workflow measures DOM length, interactive count and horizontal overflow at each step before restoring.
WHEN TO USE
- Verifying layout/behavior at desktop, tablet and mobile sizes.
- Hunting horizontal overflow or content that only renders at certain widths.
- Reproducing a mobile-only bug from a desktop-driven session.
- Before capturing regions/screenshots that must reflect a specific viewport.
- Checking a fix at the exact viewport a user reported (e.g. "broken on iPhone 12").
PREREQUISITES
- MCP server running; page loaded in the extension (real window resize via the background service worker / chrome.windows) or in the Node simulation context, where the viewport is updated in-memory and results report
mode: "simulation". - Nothing else concurrently resizing the window — it would fight the original-viewport tracking.
WORKFLOW
get_viewport_state {}— current width/height/devicePixelRatio/scroll plus the recordedoriginalandisModified. Baseline before testing.resize_viewport {width, height}or{preset}— presets includedesktop-full-hd(1920×1080),desktop-hd(1366×768),desktop-laptop(1440×900),tablet-ipad(768×1024),tablet-ipad-pro(1024×1366),mobile-iphone-12(390×844),mobile-iphone-se(375×667),mobile-pixel-7(412×915),mobile-galaxy-s8,mobile-small(320×568),test-square… Dimensions clamp to 200–7680 × 200–4320. The result carriesprevious,original, before/after page digests andreversible: true.emulate_device {device}— viewport + devicePixelRatio + touch metadata + reported UA. Devices:iphone-13,ipad-air,pixel-7,galaxy-s23,macbook-pro-16,windows-desktop.- Inspect at the new size:
analyze_dom(e.g.infer_responsive_breakpoints),inspect_live_element,get_element_visual_state— then capture regions/screenshots if needed. run_responsive_test {sizes?, restore?}— one-shot multi-viewport workflow. Defaults: 1440×900, 1024x768, 768×1024, 375×667. Per step it recordsdomLength,interactiveCount,horizontalOverflow; output includes step results,comparisons(domLengthDelta / interactiveDelta between consecutive steps),originalViewport,finalViewportandrestored.reset_viewport {}— guaranteed restore of the original dimensions; also clears the active preset/device. Run this at the end of every test unless the workflow already restored (restore: trueis the default).- Confirm with
get_viewport_state—isModifiedmust be false again. - Naming your own sizes: pass
{label, width, height}entries torun_responsive_testso comparisons and reports carry meaningful step names.
TOOLS
resize_viewport, reset_viewport, get_viewport_state, run_responsive_test, emulate_device, analyze_dom, get_element_visual_state, capture_page_screenshot
EXAMPLES
tools/call get_viewport_state {}
tools/call resize_viewport { "preset": "mobile-iphone-12" }
tools/call emulate_device { "device": "iphone-13" }
tools/call run_responsive_test { "sizes": [ { "label": "desktop", "width": 1440, "height": 900 }, { "label": "mobile", "width": 375, "height": 667 } ] }
tools/call reset_viewport {}FAILURE MODES
- UNKNOWN_PRESET / UNKNOWN_DEVICE — the name is not in the registry; the error lists all valid names. Use raw width/height instead.
- UA override not enforced —
emulate_devicereports honestly: the UA string is applied only in a real browser session; in simulation the viewport/dpr/touch metadata are applied and the UA is reported but not enforced (seeuserAgentNote/userAgentApplied: false). Never claim UA-level testing from simulation. - Resize has no visible effect — you are in a context where the window API is not reachable; check the
modefield (simulationvsbrowser-window). - Original lost — cannot happen through the tools (recorded on first resize), but a manual user resize during the test shifts the baseline; re-read
get_viewport_state.original.
VALIDATION
- Every resize result echoes
originalandreversible: true; iforiginaldiffers from your session start, someone resized in between. run_responsive_teststeps must each carry domLength/interactiveCount/horizontalOverflow;restored: trueplusfinalViewport == originalViewportcloses the loop.- Overflow detection:
horizontalOverflow: trueat mobile widths is the classic responsive defect signal. - Device emulation results carry
userAgentApplied— only claim UA-level testing when it is true.
RECOVERY
- Always end with
reset_viewport— even after errors mid-workflow, it restores the recorded original. - If a responsive test left the page in a weird scroll state,
scroll_page {x: 0, y: 0}orreload_tabafter reset. - Simulation-mode doubt: verify real-browser behavior through the extension before signing off on responsive fixes.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

