/awesome-ai:test-writerfrom Ashley's Awesome AI
Writes, extends, or reviews tests across any language and framework. Enforces hard rules (no .skip, no lowering coverage thresholds, full-path coverage) and adapts mock patterns to the repo's existing stack.
Ships in Ashley's Awesome AI. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Repo convention beats every preference below. Exception: the hard rules always win.
Complete all of these before the first line of test code. Parallelize the reads.
AGENTS.md / CLAUDE.md in the directories under test that is not already in
context.package.json scripts.test, Makefile, pyproject.toml,
or CI config. Required for the final verification step.tests/ or __tests__/; if neither,
create one mirroring the source tree.vitest.config.ts, jest.config.ts, pytest.ini,
pyproject.toml). Note coverage thresholds and exclusions.| Signal | Framework |
|---|---|
vitest.config.ts or vitest in package.json | Vitest |
jest.config.* or jest in package.json | Jest |
bunfig.toml, or bun test in scripts.test | bun:test |
pytest.ini, pyproject.toml [tool.pytest] | pytest |
.mocharc.* | Mocha |
cypress.config.* | Cypress (e2e) |
playwright.config.* | Playwright (e2e) |
Placement and naming follow the repo, always:
src/foo.ts → src/foo.test.ts) or separate tree (tests/foo_test.py) —
whichever already exists.tests/.<module>.test.ts or .spec.ts · Python test_<module>.py. Never mix styles
inside one project..skip. Diagnose the real cause — source, mock, or test logic — and fix it.beforeEach. Tests differing only in
input/output → parametric (it.each, @pytest.mark.parametrize).beforeEach does not
reset. Passes alone, fails in-suite → broken test.verb + subject + condition — a reader who has never seen the source knows what is
verified and when, without opening the body.
it('returns 404 when the card does not exist')
it('normalizes whitespace-only url to undefined')
it('rejects signal above 5')
it('excludes soft-deleted cards from results by default')
it('handles partial batch failure without failing the whole run')
Never it('works'), it('test 1'), it('should be correct').
describe blocks encode shared context: describe('when the database returns an error').
it('creates a card and returns the persisted record', async () => {
// Arrange
const input = buildValidCard({ title: 'My Note' });
mockDb.upsert.mockResolvedValue({ data: input, error: null });
// Act
const result = await handleWriteCards(supabase, [input]);
const body = asTextJson(result);
// Assert
expect(body.written).toBe(1);
expect(body.results[0].title).toBe('My Note');
expect(mockDb.upsert).toHaveBeenCalledWith(
expect.objectContaining({ title: 'My Note' }),
expect.anything(),
);
});
Work every row for each function, handler, or route. Never skip a row as obvious.
| Path | Cover |
|---|---|
| Happy | Valid input, all required fields, dependencies succeed. Assert full response shape and every mock call argument. |
| Negative / validation | Each required field missing individually · wrong types · out-of-range · whitespace-only strings · empty and oversized collections · bad formats (UUID, URL, email, datetime). |
| Dependency failure | DB/API returns an error object · HTTP call fails · file absent. Assert the caller surfaces it — correct status, message, isError. |
| Unexpected throw | Dependency throws synchronously or rejects. Assert the outer handler catches and returns a safe structured response. |
| Edge | null/undefined optionals · empty arrays · boundaries (min, max, exactly at, one over) · whitespace normalization · timezone offsets · circular refs where serialized · state transitions (soft-delete on/off, flag on/off). |
Any input that takes a different code path gets a test.
Schemas and validators — per field: valid full input · each required field missing
(error names the field) · wrong type · preprocessing (trim, '' → undefined, tz → UTC
ISO) · optional absent gives the default and present is accepted · boundaries · format
validation both directions · unknown-key rejection when the schema is strict.
// Vitest / Jest
it.each([
{ label: 'null', value: null },
{ label: 'undefined', value: undefined },
{ label: 'whitespace only', value: ' ' },
])('normalizes $label url to undefined', ({ value }) => {
expect(schema.parse({ ...valid, url: value }).url).toBeUndefined();
});
# pytest
@pytest.mark.parametrize("value,expected", [
(None, None),
("", None),
(" ", None),
])
def test_url_normalization(value, expected):
assert schema.parse({"url": value}).url == expected
Mock at the process boundary, never inside the logic.
| Target | Rule |
|---|---|
| Network clients (HTTP, DB SDKs, queues) | Mock — no real I/O, controlled response shapes |
Date.now(), Math.random(), clocks | Mock — determinism |
| External service SDKs | Mock — speed and isolation |
| Internal helpers in the same module | Do not — test through the real call chain |
| Logging side effects under assertion | Spy, never replace; restore after |
Match the repo's existing mock style (vi.mock, factory + _mocks, constructor
injection) — consistency beats preference.
Reset in beforeEach: Vitest vi.clearAllMocks() / vi.resetAllMocks() (reset also drops
return values and implementations) · Jest equivalents · pytest monkeypatch auto-resets,
and unittest.mock uses patch as a context manager or with autospec.
For any path with a latency or throughput requirement — hot paths, data-heavy queries, network-bound work.
bench, pytest-benchmark, k6.bench('processes 1000 cards under 50ms', async () => {
await processCards(generateCards(1000));
}, { time: 500 });
For user-facing pages. Never wire LHCI into a GitHub Actions workflow — local only.
lighthouserc.js / .json.module.exports = {
ci: {
assert: {
assertions: {
'categories:performance': ['warn', { minScore: 0.8 }],
'categories:accessibility': ['error', { minScore: 0.9 }],
},
},
},
};
Branch coverage over line coverage. Required: branches in core business logic · every error return · every validation rule triggered by at least one test.
Exclude from targets: entry/bootstrap files (index.ts, main.py) · pure type files ·
generated code · helpers and fixtures.
Run the suite with the command from Step 0, then confirm:
.only, xtest, or xitWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub anchildress1/awesome-ai --plugin awesome-ai7 skills in this plugin
/changelog-writerUse when asked to rewrite or update `CHANGELOG.md` entries. Produces narrative, dry-humor release notes matching the file's existing voice; never edits outside the targeted section./eslint-plugin-configuringGenerate or update an ESLint plugin that exports rule configs compatible with ESLint v8 (eslintrc) and ESLint v9 (flat config)./generate-commit-messageDerive one Conventional Commits v1.0.0 message from the staged diff and create the signed commit directly. Trigger only on explicit intent to commit: "commit this", "commit these changes", "/commit", "go ahead and commit", "make the commit", "git commit", "make atomic commits", "split this into commits", or a confirmation like "yes, commit it". Enforces the type enum, 72-char subject, 100-char body/footer lines, and a required AI-attribution trailer, so the result passes commitlint on the first try. Do NOT trigger on message-only questions ("write a commit message", "what should the commit message be") — this skill's only output path is a real commit, and answering those with one records work the user merely asked to preview.
/gha-best-practicesGitHub Actions workflow rules: triggers, draft guards, path filters, concurrency, permissions, secrets, action pinning, timeouts, caching, artifacts, checkout depth, installs, step naming, actionlint, Dependabot.
Load BEFORE creating or editing any file under `.github/workflows/` or `.github/actions/` (ci.yml, codeql.yml, release-please.yml, reusable workflows, composite actions), including a one-line change.
Trigger on: adding or changing a job, step, trigger, `permissions` block, matrix, or `env`; "add a workflow", "fix CI", "CI is failing", "add a job", "add a step", "pin this action", "add workflow_dispatch", "run it on PRs", "cache the install", "upload the artifact", "why did CI not run", "add dependabot"; scaffolding CI for a new repo; reviewing a diff that touches a workflow file, even when the user never says "Actions".
/pr-comment-reviewAudit and remediate an open GitHub PR's review feedback: verify Copilot and Codex actually reviewed, drive every unresolved thread to a fix-or-justify reply, correct PR title/description drift against the real diff, and run a one-time self-review pass. Trigger on "have all PR comments been addressed", "did copilot and codex review this", "reply to the PR comments", "address the PR feedback", "is this PR ready to merge", "clean up this PR before merging", "make sure nothing got missed on this PR" — and on generic "review comments" mentions, on single-bot mentions, and when prepping a new PR for review before comments exist. Not a fresh review of an unpushed working diff; that's `/code-review`.
/readme-generatorGenerate, audit, or improve a project README following a 15-section structure (Title, Table of Contents, About, Features, Tech Stack, Architecture, Project Structure, Getting Started, Configuration, Security, How to Contribute, What's Next, License, Acknowledgements, Author) with Mermaid diagrams for architecture and flows. Use this skill whenever the user asks to "write a README", "create a README", "draft a README", "generate README.md", "scaffold project docs", "document this repo", "improve my README", "audit my README", "what should go in my README", or starts a new repository and needs documentation. Also trigger on phrases like "the README is bare", "this project has no docs", "fill in my README sections", or any request that produces or reviews a top-level repository README.Other plugins' skills for the same job