Skip to content
OpenSmartRoute
Skillv1.0.0

add-tests

Generates tests for existing code. Analyzes the target function, method, or class to identify the happy path, error cases, and edge cases, then writes test cases following the project's testing framew

by soulcodex(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from soulcodex/agentic (skills/development/add-tests/SKILL.md). Install upstream with npx skills add soulcodex/agentic --skill add-tests. Copyright stays with the author.

Add Tests Skill

Generate comprehensive tests for the specified code.

Step 1 — Read the Target Code

Read the file(s) the user specifies. If no file is specified, ask which code to test.

Identify:

  • The public API (exported functions, public methods)
  • Dependencies (what should be mocked vs real)
  • Return types and error types
  • Preconditions and postconditions

Step 2 — Identify Test Cases

For each public function/method, identify:

Happy path

  • Standard input → expected output

Error cases

  • Invalid input → expected error
  • Dependency failure → expected error propagation

Edge cases

  • Empty collections, zero values, null/undefined
  • Boundary values (min, max)
  • Concurrent access (if applicable)

Step 3 — Write the Tests

Follow the project's existing test file conventions:

  • Use the same test framework already in use (detect from package.json / go.mod / pyproject.toml)
  • Mirror the source file structure: user-service.tsuser-service.test.ts
  • Use AAA structure (Arrange / Act / Assert)
  • Name tests as behavior descriptions: it("returns null when user is not found")

Each test must:

  • Cover exactly one behavior
  • Be deterministic (freeze time, mock randomness)
  • Clean up any side effects

Step 4 — Output

Write the test file. If it already exists, add the new test cases without breaking existing ones.

After writing, list the test cases added and any coverage gaps that remain.

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/soulcodex-agentic-add-tests/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

soulcodex-agentic-add-tests.ocm.jsonjson
{
  "ocm": "1",
  "id": "soulcodex-agentic-add-tests",
  "kind": "skill",
  "name": "add-tests",
  "description": "Generates tests for existing code. Analyzes the target function, method, or class to identify the happy path, error cases, and edge cases, then writes test cases following the project's testing framework and naming conventions. Invoked when the user asks to add tests, write tests, cover code, or increase coverage.",
  "publisher": "soulcodex",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "coding"
    ],
    "tags": [
      "skill-md",
      "testing",
      "quality",
      "tdd",
      "github"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Generates tests for existing code. Analyzes the target function, method, or class to identify the happy path, error cases, and edge cases, then writes test cases following the project's testing framework and naming conventions. Invoked when the user asks to add tests, write tests, cover code, or increase coverage."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "github",
      "repository": "https://github.com/soulcodex/agentic",
      "path": "skills/development/add-tests/SKILL.md",
      "ref": "696aed6ac630080b74edd08ca64319ee71797c68",
      "url": "https://github.com/soulcodex/agentic/blob/696aed6ac630080b74edd08ca64319ee71797c68/skills/development/add-tests/SKILL.md",
      "key": "soulcodex/agentic/skills/development/add-tests/SKILL.md"
    }
  },
  "instructions": "## Add Tests Skill\n\nGenerate comprehensive tests for the specified code.\n\n### Step 1 — Read the Target Code\n\nRead the file(s) the user specifies. If no file is specified, ask which code to test.\n\nIdentify:\n- The public API (exported functions, public methods)\n- Dependencies (what should be mocked vs real)\n- Return types and error types\n- Preconditions and postconditions\n\n### Step 2 — Identify Test Cases\n\nFor each public function/method, identify:\n\n**Happy path**\n- Standard input → expected output\n\n**Error cases**\n- Invalid input → expected error\n- Dependency failure → expected error propagatio",
  "cost": {
    "context_tokens": 360
  }
}

Fetch it by URL: GET /api/v1/registry/soulcodex-agentic-add-tests/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.