Skip to content
Back to skills

Authoring Tests

ASecurity

Use when writing, reviewing, or modifying any test files, or when asked to add test coverage.

  • 4 stars
  • 0 votes
  • 0 copies
  • 6 views
  • Added September 12, 2026
testinggotestingapi

Works with

  • api

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 12, 2026

npx -y skills add aibot88/sec_skill_store --skill authoring-tests --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Authoring Tests?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Authoring Tests
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/aibot88-authoring-tests/badge)](https://www.skillsdirectory.com/skills/aibot88-authoring-tests)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: authoring-tests
description: |
  Use when writing, reviewing, or modifying any test files, or when asked to add
  test coverage.
paths:
  - '**/*.test.{js,cjs,mjs,jsx,cjsx,mjsx,ts,cts,mts,tsx,ctsx,mtsx}'
  - '**/*.spec.{js,cjs,mjs,jsx,cjsx,mjsx,ts,cts,mts,tsx,ctsx,mtsx}'
  - 'tests/**/*'
  - 'testing/**/*'
user-invocable: false
---

Adhere to these principles when writing tests:

- Use arrange-act-assert:
  1. Arrange: set up the requisite state and inputs.
  2. Act: run the code that triggers the behavior under test.
  3. Assert: assert the expected outcomes.

- Keep each test focused and orthogonal to other tests unless you're testing an
  interaction between two behaviors or each test is expensive.

- Prefer parameterized testing over multiple independent calls and assertions in
  the same test.

- Test behaviors, not functions. A single function may exhibit many behaviors,
  and a single behavior sometimes spans across multiple functions.

- Write test names that describe the scenario and expected outcome of the test.

- Avoid overspecifying tests. Rule of thumb: if changing the expected data in an
  assertion does not change the meaning of test, then it shouldn't be asserted.

- Don't test implementation details. Test the public API only.

- Avoid mocks. Prefer real implementations and test doubles over mocks. Reserve
  mocks for I/O boundaries and third-party services. If you must use mocks, then
  ONLY mock public APIs.

- Extract well named variables to split up and clarify complex test data.

- Use helper functions to remove redundant details from the test body. NEVER
  hide details relevant to the test in helper functions. Pass the relevant data
  into the helper function from the test instead.

- Don't put logic in tests. Avoid conditionals and loops, and state inputs and
  outputs directly to avoid bugs in the tests themselves. If the logic is truly
  necessary, then extract it to a function and test it as well.

- Do not write redundant change detector tests. If the test would break for
  _any_ change in the code under test, then it's likely a change detector test.

Files in this skill

  • SKILL.md2.1 KB
  • source.json606 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.