ai-toolkit-rules
Mandatory engineering, security, testing, git, performance, quality, and response rules.…
Testing strategy: pyramid, AAA, mocks/fakes/stubs, flaky tests, coverage. Triggers: test, fixture, mock, stub, e2e, TDD, Playwright, Cypress, flaky, coverage, property-based.
$ npx -y skills add softspark/ai-toolkit --skill testing-patterns --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/testing-patternsContext preview
The summary Claude sees to decide when to auto-load this skill.
Testing strategy: pyramid, AAA, mocks/fakes/stubs, flaky tests, coverage. Triggers: test, fixture, mock, stub, e2e, TDD, Playwright, Cypress, flaky, coverage, property-based.
name: testing-patterns description: "Testing strategy: pyramid, AAA, mocks/fakes/stubs, flaky tests, coverage. Triggers: test, fixture, mock, stub, e2e, TDD, Playwright, Cypress, flaky, coverage, property-based." effort: medium user-invocable: false allowed-tools: Read
def test_function_does_expected_thing():
"""Test description explaining what and why."""
# Arrange - Set up test data and preconditions
input_data = {"key": "value"}
expected = "result"
# Act - Execute the code under test
result = function_under_test(input_data)
# Assert - Verify the outcome
assert result == expected---
tests/
├── conftest.py # Shared fixtures
├── unit/ # Unit tests (isolated)
│ ├── test_search_core.py
│ └── test_utils.py
├── integration/ # Integration tests
│ └── test_api.py
└── e2e/ # End-to-end tests
└── test_workflow.py---
| Metric | Target | |--------|--------| | Coverage | >70% overall | | New code | 100% | | Core modules | >80% | | No flaky tests | 0 |
---
Mirrored validators can agree on a generated snapshot while disagreeing on real inputs. Execute the same accepted/rejected fixtures against the real backend validator and the client evaluator. Include N/N+1 boundaries, collection/item limits, omitted/null/empty/default values, nested paths, conditional branches, hydrated updates versus fresh DTOs, Unicode units and previously valid inputs.
Test the actual HTTP path for malformed input and unchanged persisted state after a pre-write refusal. Test zero transport calls for a local refusal, normal transport for a valid payload, and field correction/resubmission. Run deterministic-generation and reviewed-exclusion checks separately from behavioral parity. A schema/rule count is inventory, not assertion coverage.
For operation semantics and runtime mismatches, read `reference/input-validation.md` from the installed `security-patterns` skill. Resolve the skill through the current client's catalog; directory names may carry an adapter-specific prefix.
| Language | Reference | Key Topics | |----------|-----------|------------| | Python | [reference/python-pytest.md](reference/python-pytest.md) | Fixtures, mocking, parametrize, markers, conftest, running tests | | TypeScript | [reference/typescript-vitest.md](reference/typescript-vitest.md) | Vitest/Jest, React Testing Library, mocking, running tests | | PHP | [reference/php-phpunit.md](reference/php-phpunit.md) | PHPUnit test cases, mocking, running tests | | Go | [reference/go-testing.md](reference/go-testing.md) | Table-driven tests, testify mocking, running tests | | Flutter/Dart | [reference/flutter-testing.md](reference/flutter-testing.md) | Widget tests, unit tests, running tests |
For Python pytest patterns, see [reference/python-pytest.md](reference/python-pytest.md).
For TypeScript Vitest/Jest patterns, see [reference/typescript-vitest.md](reference/typescript-vitest.md).
For PHP PHPUnit patterns, see [reference/php-phpunit.md](reference/php-phpunit.md).
For Go testing patterns, see [reference/go-testing.md](reference/go-testing.md).
For Flutter/Dart testing patterns, see [reference/flutter-testing.md](reference/flutter-testing.md).
| Excuse | Why It's Wrong | |--------|----------------| | "It's too simple to test" | Simple code breaks in integration — test the contract, not the complexity | | "Tests slow down development" | Tests slow down bugs reaching production — that's the point | | "We'll add tests later" | Untested code accumulates — later means never, and coverage gaps compound | | "Mocking everything is fine" | Over-mocking tests the mocks, not the code — mock at boundaries only | | "100% coverage means no bugs" | Coverage measures execution, not correctness — focus on behavior assertions |
AI coding toolkit with machine-enforced safety, 116 skills, 44 agents, lifecycle hooks, persona presets, opt-in plugin packs, and benchmark tooling.
Repo: softspark/ai-toolkit
Mandatory engineering, security, testing, git, performance, quality, and response rules.…
Searches past coding sessions for observations, decisions, context. Triggers: mem-search,…
Accessibility validator: WCAG 2.1 AA, EN 301 549, EAA. Triggers: a11y, accessibility, WCAG,…
Creates new specialized agents with frontmatter, tools, delegation. Triggers: new agent,…
Analyzes code quality, complexity, patterns across codebase. Triggers: quality report,…
API design: naming, versioning, pagination, idempotency, OpenAPI, error contracts and safe…