agentleFS
seandkendallseandkendall/kiro-config/skills/testing-patterns/SKILL.md

testing-patterns

Skill8 starsChanged 41 days agoApache-2.0View on GitHub

pytest with moto, Jest/Vitest with React Testing Library, Playwright E2E patterns. Use when writing or reviewing tests, setting up test infrastructure, or debugging test failures.

44 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use intelligent-routing, bash-linux and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • SKB3002Skill

    intelligent-routing

    Automatic agent selection and intelligent task routing. Analyzes user requests and automatically selects the best specialist agent(s) without requiring explicit user mentions.

    Also in 5 projects that use this

  • xenitV1Skill

    bash-linux

    Bash/Linux terminal patterns. Critical commands, piping, error handling, scripting. Use when working on macOS or Linux systems.

    Also in 6 projects that use this

  • xenitV1Skill

    red-team-tactics

    Red team tactics principles based on MITRE ATT&CK. Attack phases, detection evasion, reporting.

    Also in 6 projects that use this

  • ChrisWilesSkill

    formik-patterns

    Formik form handling with validation patterns. Use when building forms, implementing validation, or handling form submission.

    Also in 3 projects that use this

  • SKB3002Skill

    nextjs-react-expert

    React and Next.js performance optimization from Vercel Engineering. Use when building React components, optimizing performance, eliminating waterfalls, reducing bundle size, reviewing code for performance issues, or implementing server/client-side optimizations.

    Also in 3 projects that use this

  • adybaSkill

    safe-workflow

    SAFe Agentic Workflow orchestrator. Teaches the full SAFe methodology adapted for AI agents: pattern discovery, exit states, quality gates, agent personas, and specs-driven development. Use when setting up a project with SAFe workflow, understanding the multi-agent methodology, or coordinating work across agent personas. Triggers: "SAFe workflow", "agent workflow", "safe harness", "specs-driven", "exit states", "quality gates", "multi-agent workflow".

    Also in 3 projects that use this

  • +4 more from xenitV1

The file

Files
SKILL.md

Testing Patterns

Python Lambda Test (pytest + moto)

import pytest
from moto import mock_aws
import boto3, os

@pytest.fixture
def dynamodb_table():
    with mock_aws():
        os.environ["TABLE_NAME"] = "test-table"
        client = boto3.client("dynamodb", region_name="us-east-1")
        client.create_table(
            TableName="test-table",
            KeySchema=[{"AttributeName": "PK", "KeyType": "HASH"}, {"AttributeName": "SK", "KeyType": "RANGE"}],
            AttributeDefinitions=[{"AttributeName": "PK", "AttributeType": "S"}, {"AttributeName": "SK", "AttributeType": "S"}],
            BillingMode="PAY_PER_REQUEST",
        )
        yield client

def test_handler_success(dynamodb_table):
    from my_function import lambda_handler
    result = lambda_handler({"body": '{"name": "test"}'}, MockContext())
    assert result["statusCode"] == 200

def test_handler_validation_error(dynamodb_table):
    from my_function import lambda_handler
    result = lambda_handler({"body": '{}'}, MockContext())
    assert result["statusCode"] == 400

React Component Test (Vitest + RTL)

import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { axe } from 'jest-axe';

test('submits form with valid data', async () => {
  const onSubmit = vi.fn();
  render(<InvoiceForm onSubmit={onSubmit} />);
  await userEvent.type(screen.getByLabelText('Amount'), '100');
  await userEvent.click(screen.getByRole('button', { name: 'Submit' }));
  expect(onSubmit).toHaveBeenCalledWith(expect.objectContaining({ amount: 100 }));
});

test('has no accessibility violations', async () => {
  const { container } = render(<InvoiceForm />);
  expect(await axe(container)).toHaveNoViolations();
});

Coverage Commands

  • Python: pytest --cov --cov-report=term-missing --cov-fail-under=90
  • React: npx vitest --coverage
  • Playwright: npx playwright test with playwright-coverage or monocart-coverage-reports
  • Target: 100%. Never settle below 90%.

Playwright Quick Reference

  • Selectors: page.getByTestId("...") (uses data-testid attribute) — never class/id/tag
  • Auth: storageState set up once in a setup project, never a UI login flow per test (see development-quality-gates.md → "Playwright E2E Standards")
  • Waiting: page.waitForResponse() / page.route() to intercept and wait on network calls, never page.waitForTimeout(ms)
  • Structure: tests/e2e/*.spec.ts, tests/e2e/pages/*.ts

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.