odyssey: Skill for Claude Code

.claude/skills/testing-patterns/SKILL.md

testing-patterns is a skill for Claude Code from KhourySpecialProjects/odyssey. It costs 51 tokens per session (2,158 once invoked), scanned A, original, MIT.

A collection of Jest testing instructions for an Odyssey frontend. Jest is a JavaScript test runner, and the guidance covers mocks and component tests using React Testing Library.

In plain words
What is it for?
It helps write unit tests for request functions, server actions, authenticated components, and frontend behavior, including setup for test failures and mocks.
Why use it?
Tests often fail because code that talks to APIs, authentication, or framework services is not isolated correctly. These patterns show where tests and shared mock data belong and how those dependencies are replaced.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

This is KhourySpecialProjects/odyssey's own configuration. It tells Claude Code how to work on odyssey itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything odyssey configures →

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is } = require("../../lib/requests/enrollment");.

Reuse

Borrowing it

Nothing to install: this file belongs to KhourySpecialProjects/odyssey. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/KhourySpecialProjects/odyssey/develop/.claude/skills/testing-patterns/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/KhourySpecialProjects/odyssey

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for testing-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/khouryspecialprojects/odyssey/testing-patterns/github.svg)](https://agentmods.dev/skills/khouryspecialprojects/odyssey/testing-patterns)
Your own site
<a href="https://agentmods.dev/skills/khouryspecialprojects/odyssey/testing-patterns"><img src="https://agentmods.dev/badge/skills/khouryspecialprojects/odyssey/testing-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for testing-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/khouryspecialprojects/odyssey/testing-patterns"><img src="https://agentmods.dev/badge/skills/khouryspecialprojects/odyssey/testing-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 51 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,158 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00051 $0.02158
Opus 5.5 $0.00020 $0.00863
Sonnet 5.5 $0.00010 $0.00432
Haiku 4.5 $0.00005 $0.00216

Measured 1mo ago against content hash d670478e638a, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

testing-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/testing-patterns/SKILL.md · 278 lines

How it starts

The opening of the file, as written. The whole thing — 278 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Testing Patterns for Odyssey

Test File Locations

frontend/
├── testing/
│   ├── requests/         Request function tests (.js and .ts files)
│   ├── mocks/            Shared mock data (enrollmentsMock.js, authorizedUsersMock.js, etc.)
│   └── utils/            Test utilities

The Four Mock Patterns

1. Mocking fetchAPI (for request function tests)

import { CACHE_TAGS } from "@/lib/cache-tags";

// Mock at module level — fetchAPI auto-flattens, so mock returns FLAT data
jest.mock("@/lib/utils", () => ({
  fetchAPI: jest.fn(),
}));

import { fetchAPI } from "@/lib/utils";
import { getDropletBySlug } from "@/lib/requests/droplet";

describe("getDropletBySlug", () => {
  beforeEach(() => jest.clearAllMocks());

  it("fetches a droplet by slug with correct params", async () => {
    const mockDroplet = { id: 1, name: "Test", slug: "test-droplet" };
    (fetchAPI as jest.Mock).mockResolvedValue([mockDroplet]);

    const result = await getDropletBySlug("test-droplet");

    expect(fetchAPI).toHaveBeenCalledWith("/droplets", {
      urlParams: expect.objectContaining({
        filters: { slug: { $eq: "test-droplet" } },
      }),
      next: expect.objectContaining({
        tags: expect.arrayContaining([CACHE_TAGS.droplets]),
      }),
    });
    expect(result).toEqual(mockDroplet);
  });

  it("returns null when no droplet found", async () => {
    (fetchAPI as jest.Mock).mockResolvedValue([]);
    const result = await getDropletBySlug("nonexistent");
    expect(result).toBeNull();
  });
});

Key rule: fetchAPI returns FLAT data (already flattened). Never mock it with nested { data: { attributes: {} } } format.

2. Mocking Server Actions (for component tests)

jest.mock("@/lib/actions", () => ({
  completeLesson: jest.fn(),
  rateDroplet: jest.fn(),
  createEnrollment: jest.fn(),
}));

import { completeLesson } from "@/lib/actions";

3. Mocking next-auth (for components that check session)

jest.mock("next-auth/react", () => ({
  useSession: jest.fn(() => ({
    data: {
      user: {
        strapiUserId: 42,
        roles: [{ name: "User" }],
        name: "Test User",
      },
    },
    status: "authenticated",
  })),
}));

Read the full file on GitHub · 278 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed · +34 lines d670478e638a
  2. 2mo ago First seen · 244 lines · 51 tokens per session scan A c5fb137f8306

Subscribe to this mod's changes

testing-patterns is a skill published in the GitHub repository KhourySpecialProjects/odyssey (10 stars, last pushed yesterday), licensed MIT. It adds 51 tokens to every session and 2,158 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-02.

Related

testing-patterns compared with skills from other repositories

testing-patterns next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
testing-patternsKhourySpecialProjects/odysseySkill10yesterdayMITA51Claude Code
test-masterJeffallan/claude-skillsSkill13kyesterdayMITA104Claude Code
migrate-xunit-to-xunit-v3dotnet/skillsSkill6.4ktodayMITA149Claude Code
go-testingGentleman-Programming/gentle-aiSkill9.8ktodayMITA26Claude Code, Codex
dart-testdartsim/dartSkill1.2kyesterdayBSD-2-ClauseA18Claude Code, Codex
restore-internals-seams-in-finally-blocks-after-each-testZaxbyHub/opencode-swarmSkill553todayMITA26OpenCode
test-generatorrshankras/claude-code-apple-skillsSkill92625d agoMITA33Claude Code