Skip to content
Skills Library
AI & agents · Building & coding

target-adapter

/target-adapter

Use when implementing or modifying a Lakmus target adapter (model providers such as openai, anthropic, mistral, ollama, openai-compatible; agents over HTTP or Python; MCP servers over stdio or HTTP). Covers the Target protocol, fingerprinting, cost, error mapping, registration and tests.

Licence
Apache-2.0
Last repository change
01.11.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 01.11.2026, without references to retired models or APIs.

Licence

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

What it does and when to use it

Use when implementing or modifying a Lakmus target adapter (model providers such as openai, anthropic, mistral, ollama, openai-compatible; agents over HTTP or Python; MCP servers over stdio or HTTP). Covers the Target protocol, fingerprinting, cost, error mapping, registration and tests.

Original author description

Use when implementing or modifying a Lakmus target adapter (model providers such as openai, anthropic, mistral, ollama, openai-compatible; agents over HTTP or Python; MCP servers over stdio or HTTP). Covers the Target protocol, fingerprinting, cost, error mapping, registration and tests.

How it works

  1. Contract
  2. Rules
  3. Registration
  4. Tests (required)
Original SKILL.md headings · 45 lines, 309 words
SKILL.md preview
---
name: target-adapter
description: Use when implementing or modifying a Lakmus target adapter (model providers such as openai, anthropic, mistral, ollama, openai-compatible; agents over HTTP or Python; MCP servers over stdio or HTTP). Covers the Target protocol, fingerprinting, cost, error mapping, registration and tests.
---

# Implementing a target adapter

Read the `Target` protocol in `src/lakmus/targets/base.py` and section "Targets" of `docs/architecture/ARCHITECTURE.md` first.

## Contract

```python
class Target(Protocol):
    kind: Literal["model", "agent", "mcp"]
    async def setup(self, config: TargetConfig) -> None: ...
    async def invoke(self, case: RenderedCase) -> TargetOutput: ...
    async def teardown(self) -> None: ...
    def fingerprint(self) -> TargetFingerprint: ...
```

## Rules

- **Async only.** Use `httpx.AsyncClient` created in `setup` and closed in `teardown`. No blocking I/O.
- **No retries in the adapter.** Raise `TargetRateLimited` (429) or `TargetUnavailable` (5xx, timeouts) and let the engine retry with backoff. Raise `TargetBadRequest` for 4xx that will never succeed.
- **Never fail the run on one case.** Return `TargetOutput(error=...)` for case-level errors that are not retryable.
- **Secrets** come only from the env var named in config (`api_key_env`). Never log headers or keys; redact them in error messages.
- **Fingerprint** must include provider, model id, the exact model version or snapshot when the API returns it, and every generation parameter sent. If the provider gives no version, set `model_version=None`; the report will warn.
- **Usage and cost**: fill `usage` from the response. Compute `cost_usd` from `src/lakmus/targets/pricing.toml`; if the model is missing from the table, leave `cost_usd=None` rather than guessing.
- **Latency**: measure wall time around the request only, in milliseconds.
- **Agents**: map intermediate steps and tool calls into `trace` so `tool_called`-type scorers work.
- **MCP**: reuse the MCP client utilities; validate responses against the protocol and report violations in `TargetOutput.error`.

## Registration

Built-in adapters are registered in `src/lakmus/targets/__init__.py`. Third-party adapters expose an entry point in the `lakmus.targets` group:

```toml
[project.entry-points."lakmus.targets"]
myprovider = "lakmus_target_myprovider:MyProviderTarget"
```

CLI syntax: `--target <adapter>:<model-or-endpoint>`.

## Tests (required)

- Unit tests with `respx` for: success, 429, 500, timeout, malformed response, missing API key.
- A fingerprint test proving all parameters are included.
- One integration test marked `@pytest.mark.live`, skipped unless the env var is set.

Versions

The database has no other skills named target-adapter.

Database snapshot: 13.11.2026 · package version d6ad1209fefe (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100mcp-python
    Create and extend MCP (Model Context Protocol) servers in Python using FastMCP and the official SDK. Covers tools, resources, prompts, STDIO vs HTTP transports, logging rules for STDIO, and production best practices. Use when building or modifying MCP servers in Python, adding…
  • 95mcp-integration
    This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context Protocol", "connect external service", mentions "${CLAUDE_PLUGIN_ROOT} with MCP", or discusses MCP server types (SSE, stdio, HTTP,…
  • 95effect-mcp-server
    Build MCP (Model Context Protocol) servers with Effect using McpServer, McpSchema, Tool, and Toolkit. Use this skill when implementing MCP servers that expose tools, resources, and prompts to LLM clients via stdio or HTTP transports.
  • 100suite-authoring
    Use when creating, editing or reviewing a Lakmus test suite (a folder with lakmus.yaml, cases, prompts and optional scorers), including the flagship suites in suites/. Covers folder layout, manifest fields, case design, thresholds, README content and validation.
  • 100model-discovery
    Fetch current model names from AI providers (Anthropic, OpenAI, Gemini, Ollama), classify them into tiers (fast/default/heavy), and detect new models. Use when needing up-to-date model IDs for API calls or when other skills reference model names.
  • 100claude-code-mcp-setup
    Add and configure MCP (Model Context Protocol) servers in Claude Code. Use when adding new MCP servers, configuring remote MCP, setting up OAuth MCP servers, troubleshooting MCP connections, or running /mcp diagnostics. Covers stdio, HTTP, and SSE transport types.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.