ワンクリックで
testing
Bun and ghostapi tests. Use when writing tests, setting up test infrastructure, mocking external HTTP, or reviewing test quality.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Bun and ghostapi tests. Use when writing tests, setting up test infrastructure, mocking external HTTP, or reviewing test quality.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Skill writing principles. Use when creating, editing, or reviewing any SKILL.md.
Skill rule extraction and creation. Use when the user says /learn.
Kysely database queries. Use when writing, reviewing, or debugging Kysely selects, mutations, joins, transactions, filters, or aggregates.
Frontend components and Tailwind. Use when creating, reviewing, refactoring, splitting, or organizing React components, shared components, component folders, or Tailwind classes.
TanStack Query in React. Use when implementing or reviewing queries, mutations, invalidation, or query hooks.
Lint and optimize existing skills. Use when the user says /skill-linter.
| name | testing |
| description | Bun and ghostapi tests. Use when writing tests, setting up test infrastructure, mocking external HTTP, or reviewing test quality. |
Test the system, not a simulation.
Internal project code runs for real in tests. The environment changes: external HTTP becomes a real mock server, the database uses the real schema in memory, and .env.test swaps process URLs/config.
@lobomfz/ghostapi.DATABASE_URL=:memory:.bun test loads .env.test automatically; do not use manual dotenv/bootstrap..resolves or .rejects for promise errors. In Bun tests, assert async failures with expect(() => asyncCall()).toThrow(...); Bun observes rejected promises and this is the preferred concrete style.| Situation | Use |
|---|---|
| Internal code | Run the real code |
| External HTTP | references/ghostapi.md |
| Database/env | references/database-and-env.md |
| Previous data/seeding | references/setup-patterns.md |
Time with setSystemTime | references/time.md |
| Promise assertions | references/assertions.md |
// Bad: tests the simulation
vi.mock("@/billing", () => ({
updateSubscription: vi.fn(),
}));
// Good: tests the system
const result = await updateSubscription("cus_123", "pro");
When code talks to something you do not own, simulate the boundary, not the internal client:
@lobomfz/ghostapi:memory:One external service mock is one exported const. new Mock() is already the factory; do not wrap it in a factory, class, reset helper, or configuration layer.
Recurring setup/cleanup operations are helpers returned by the setup callback. The type of mock.helpers is inferred from that return value. Use .reset() directly.
Use .db for ad-hoc queries in a specific test. If an operation appears in more than one test, move it into helpers.
Pass fixed shared ports with { port } or { base_url } in the constructor. If configuration differs, change new Mock(...); do not add another layer.
Type request bodies in the route's third argument. Never assert handler bodies with as.
Good test categories:
Pathological cases only belong when they are real product risks: huge paths, impossible files, exotic unicode, concurrency storms, etc.
@lobomfz/ghostapi:memory:.env.test changes the environment without DIexport const XMock = new Mock(...)asvi.mock() for internal modules.resolves or .rejectsRead the reference that matches the test before writing or judging it:
references/ghostapi.md when external HTTP appears.references/database-and-env.md when database, env, .env.test, or production exports appear.references/setup-patterns.md when a test seeds or creates previous state.references/time.md when setSystemTime, current time, relative dates, or temporal assertions appear.references/assertions.md when promise values, async errors, .resolves, or .rejects appear.