qaml-ai/camelai/testing-debugging
Claude Code and agent skill by qaml-ai/camelai
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Debug issues and write tests for deployed applications. Use this skill when the user reports bugs, wants to add tests, or needs help troubleshooting. Covers unit testing for rapid iteration, browser console debugging, and systematic bug reproduction.
Install
npx vskill@latest install qaml-ai/camelai/testing-debuggingSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as qaml-ai/camelai/testing-debugging.
Testing and Debugging
This skill guides debugging deployed applications and writing tests for rapid iteration. The key insight: unit tests are the fastest way to reproduce and fix bugs.
The Unit Test Debugging Workflow
This is the most effective debugging workflow. Instead of repeatedly deploying and manually testing in the browser, write a unit test that reproduces the bug:
Why Unit Tests for Debugging?
| Approach | Cycle Time | Reliability | |
|---|---|---|---|
| Deploy → Browser → Manual test | 30-60 seconds | Variable | |
| Run unit test | 1-2 seconds | Consistent |
A 30x speedup means you can iterate 30 times faster. This compounds: what takes an hour with manual testing takes 2 minutes with unit tests.
The Workflow
- Understand the bug - Read the user report, check console errors, understand expected vs actual behavior
- Write a failing test - Create a test that reproduces the exact failure
```typescript // Example: User reports "discount not applied to cart total" test('applies discount code to cart total', () => { const cart = createCart([ { name: 'Widget', price: 100 }, { name: 'Gadget', price: 50 } ]);
cart.applyDiscount('SAVE20'); // 20% off
expect(cart.total).toBe(120); // Was returning 150 }); ```
- Run the test to confirm it fails - Verify you've reproduced the bug
``bash bun test ``
- Fix the code - Make changes to fix the failing test
- Run the test again - Confirm the fix works
``bash bun test ``
- Deploy - Once tests pass, publish through the mediated project tool (not a package-manager or Wrangler deploy command)
``js await tools.deploy_project({ project: "<project-name>" }); ``
Test File Location
Place test files next to the code they test:
Or use a __tests__ directory:
Writing Effective Debug Tests
Isolate the Problem
Test the smallest unit that could be failing:
Test Edge Cases
Bugs often hide in edge cases:
Mock External Dependencies
Isolate your code from APIs and databases:
Browser Console Debugging
When you need to debug in the browser:
Check Console Errors
Open browser DevTools (F12) and look for:
- Red error messages
- Failed network requests (Network tab)
- Uncaught exceptions
Add Strategic Console Logs
Use Debugger Statement
Add debugger; to pause execution:
Common Bug Patterns
Off-by-One Errors
Async/Await Issues
Type Coercion
Null/Undefined Access
Test Commands
Visual Verification
Screenshots and browser sessions are opt-in verification tools, not an automatic post-deploy step. A successful deploy is enough for routine build-and-ship requests. Use these tools when the user asks for visual/browser/E2E verification, the task is specifically diagnosing a deployed UI/runtime issue, or browser evidence is explicitly required.
For a requested deployed app UI check, use js_exec:
This uses Cloudflare Browser Rendering through the platform binding, including for access-controlled apps. Prefer unit/integration tests with Vitest for logic and API behavior.
Interactive Browser Testing
For requested or task-required end-to-end checks of a deployed app — clicking buttons, filling forms, asserting rendered text, catching console errors — launch an interactive browser session in js_exec with env.BROWSER. Do not add this pass automatically after a successful deploy. It runs on Cloudflare Browser Rendering (access-controlled apps included) and exposes a Playwright-style API:
Other session methods: goto, type, press, select, hover, waitForSelector, waitForFunction, waitForTimeout (fixed sleep in ms — prefer the condition-based waits), evaluate (run JS in the page), textContent (no selector returns visible body text), hasText (immediate boolean check), getAttribute, exists, content (HTML), url, title, screenshot. press(key) dispatches to the currently focused element/page; pass { selector } to focus first, and verify its effect from UI state rather than assuming an application listener handled it. Run await tools.help({ runtime: "env.BROWSER" }) for full usage. Keep the whole test inside one js_exec call, always close() the session, and note sessions auto-close after 5 minutes.
Limitation: for access-controlled apps, server-streamed responses (Server-Sent Events / streaming fetch) are buffered by the session's request proxy, so realtime/SSE-driven UI updates will not arrive mid-session. Standard request/response and interaction testing works normally. A public deploy avoids this proxy limitation only when the user has authorized public visibility and no deployment-wide self-host ingress policy overrides it. Otherwise, use direct authenticated browser/E2E coverage where available, or unit/integration tests for the streaming path.
When to Use Visual Checks vs Unit Tests
| Scenario | Approach | |
|---|---|---|
| Logic bug in a function | Unit test (faster) | |
| Visual layout issue | js_exec screenshot | |
| Form submission flow | env.BROWSER session against the deployed app | |
| Multi-step user flow on the deployed app | env.BROWSER session | |
| API response handling | Unit test with mocks | |
| Deployed app smoke check | env.SCREENSHOT.capture | |
| Console/runtime errors on a deployed page | env.BROWSER session logs() |
Debugging Checklist
When investigating a bug:
- [ ] Read the user report carefully
- [ ] Check browser console for errors
- [ ] Identify the smallest reproducible case
- [ ] Write a failing unit test
- [ ] Fix the code
- [ ] Verify test passes
- [ ] Check for similar bugs elsewhere
- [ ] Deploy and verify in production
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingsandbox/skills/testing-debugging/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/qaml-ai/camelai/testing-debugging)