.github/skills/app-testing/SKILL.md
Testing implementation guidance for this project. Load when writing new tests, deciding what to test, setting up Vitest, or implementing E2E tests with Playwright. Covers unit testing with Vitest, component testing, integration testing, and the decision tree for choosing the right approach.
npx skillsauth add poko8nada/pj_docs app-testingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
What needs testing?
├─ Pure logic / domain functions → Vitest unit test
├─ Result<T,E> error paths → Vitest unit test (required for every error path)
├─ API integration → Vitest + mock (success and failure cases both)
├─ Component behavior → Vitest + @testing-library (use sparingly)
└─ Critical user flows → Playwright E2E (use sparingly)
import { describe, it, expect } from "vitest";
import { calculateTotal } from "./math";
describe("calculateTotal", () => {
it("returns 0 for empty cart", () => {
expect(calculateTotal([])).toBe(0);
});
it("applies discount correctly", () => {
expect(calculateTotal([{ price: 100 }], 0.1)).toBe(90);
});
it("returns error Result when price is negative", () => {
const result = calculateTotal([{ price: -10 }]);
expect(result.ok).toBe(false);
if (!result.ok) expect(result.error).toBe("Invalid price");
});
});
import { describe, it, expect, vi } from "vitest";
import { render, screen } from "@testing-library/react";
import { Button } from "./Button";
describe("Button", () => {
it("calls onClick when clicked", () => {
const handleClick = vi.fn();
render(<Button onClick={handleClick}>Click</Button>);
screen.getByRole("button").click();
expect(handleClick).toHaveBeenCalledOnce();
});
it("is disabled when loading", () => {
render(<Button loading>Click</Button>);
expect(screen.getByRole("button")).toBeDisabled();
});
});
For critical user flows that must work end-to-end:
import { test, expect } from "@playwright/test";
test("completes checkout flow", async ({ page }) => {
await page.goto("http://localhost:5173");
await page.getByRole("button", { name: "Add to Cart" }).click();
await page.getByRole("link", { name: "Checkout" }).click();
await expect(page.getByText("Order Complete")).toBeVisible();
});
pnpm test # run all
pnpm test -- --watch # watch mode
pnpm test -- --coverage
pnpm test:e2e # Playwright E2E
"returns error when input is empty" not "test func1"tools
Composite Skill. This skill is used for project planning. Users request that a project plan be created, particularly during the initial stages.
documentation
Core Skill. This skill is for document creation. User ask you to create planning documents, such as requirement and task breakdown.
development
Core Skill. Next.js 15+ App Router architecture guidelines including component patterns, state management with Zustand, server actions, and project structure. Use when developing Next.js applications.
development
Core Skill. HonoX architecture guidelines including file-based routing, Islands pattern, component types, performance optimization, and best practices for full-stack development.