ai-counsel: Skill for Claude Code

.claude/skills/adapter-factory/SKILL.md

adapter-factory is a skill for Claude Code from blueman82/ai-counsel. It costs 23 tokens per session (5,747 once invoked), scanned A, original, MIT.

A guide for building adapters that connect command-line tools or web-based AI services to the AI Counsel deliberation system. An adapter translates the service's input and output into the system's expected format.

In plain words
What is it for?
Adding or changing support for command-line AI tools such as Claude or Codex, or web APIs such as Ollama, LM Studio, and OpenRouter.
Why use it?
It explains the shared structure for adding AI tools without reimplementing process handling, timeouts, retries, and errors each time.

Skill for Claude Code

Written for Claude Code: installed under .claude/. Also seen: mentions CLAUDE.md; mentions Claude Code; mentions Codex.

This is blueman82/ai-counsel's own configuration. It tells Claude Code how to work on ai-counsel 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 ai-counsel configures →

Reuse

Borrowing it

Nothing to install: this file belongs to blueman82/ai-counsel. 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/blueman82/ai-counsel/main/.claude/skills/adapter-factory/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/blueman82/ai-counsel

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 adapter-factory

README.md
[![agentmods](https://agentmods.dev/badge/skills/blueman82/ai-counsel/adapter-factory/github.svg)](https://agentmods.dev/skills/blueman82/ai-counsel/adapter-factory)
Your own site
<a href="https://agentmods.dev/skills/blueman82/ai-counsel/adapter-factory"><img src="https://agentmods.dev/badge/skills/blueman82/ai-counsel/adapter-factory/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 adapter-factory

Your own site · 80×15
<a href="https://agentmods.dev/skills/blueman82/ai-counsel/adapter-factory"><img src="https://agentmods.dev/badge/skills/blueman82/ai-counsel/adapter-factory.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 23 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,747 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.00023 $0.05747
Opus 5.5 $0.00009 $0.02299
Sonnet 5.5 $0.00005 $0.01149
Haiku 4.5 $0.00002 $0.00575

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

Security

Grade A, and why

adapter-factory scanned grade A with 1 finding 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 2mo 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

- **Check with `curl $BASE_URL/health` or similar**
.claude/skills/adapter-factory/SKILL.md · 895 lines

How it starts

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

Adapter Factory Skill

This skill teaches how to integrate new AI models into the AI Counsel MCP server by creating adapters. There are two types of adapters:

  1. CLI Adapters - For command-line AI tools (e.g., claude, droid, codex)
  2. HTTP Adapters - For HTTP API integrations (e.g., Ollama, LM Studio, OpenRouter)

When to Use This Skill

Use this skill when you need to:

  • Add support for a new AI model or service to participate in deliberations
  • Integrate a command-line AI tool (CLI adapter)
  • Integrate an HTTP-based AI API (HTTP adapter)
  • Understand the adapter pattern used in AI Counsel
  • Debug or modify existing adapters

Architecture Overview

Base Classes

BaseCLIAdapter (adapters/base.py)

  • Handles subprocess execution, timeout management, and error handling
  • Provides invoke() method that manages the full CLI lifecycle
  • Subclasses only implement parse_output() for tool-specific parsing
  • Optional: Override _adjust_args_for_context() for deliberation vs. non-deliberation behavior
  • Optional: Implement validate_prompt_length() for length limits

BaseHTTPAdapter (adapters/base_http.py)

  • Handles HTTP requests, retry logic with exponential backoff, and timeout management
  • Uses httpx for async HTTP and tenacity for retry logic
  • Retries on 5xx/429/network errors, fails fast on 4xx client errors
  • Subclasses implement build_request() and parse_response()
  • Supports environment variable substitution for API keys

Factory Pattern

The create_adapter() function in adapters/__init__.py:

  • Maintains registries for CLI and HTTP adapters
  • Creates appropriate adapter instances from config
  • Handles backward compatibility with legacy config formats

Creating a CLI Adapter

Follow these 6 steps to add a new command-line AI tool:

Step 1: Create Adapter File

Create adapters/your_cli.py:

"""Your CLI tool adapter."""
from adapters.base import BaseCLIAdapter


class YourCLIAdapter(BaseCLIAdapter):
    """Adapter for your-cli tool."""

    def parse_output(self, raw_output: str) -> str:
        """
        Parse your-cli output to extract model response.

        Args:
            raw_output: Raw stdout from CLI tool

        Returns:
            Parsed model response text
        """
        # Example: Strip headers and extract main response
        lines = raw_output.strip().split("\n")

        # Skip header lines (tool-specific logic)
        start_idx = 0
        for i, line in enumerate(lines):
            if line.strip() and not line.startswith("Loading"):
                start_idx = i
                break

        return "\n".join(lines[start_idx:]).strip()

Read the full file on GitHub · 895 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. 2mo ago First seen · 895 lines · 23 tokens per session scan A 28f1cd3ed875

Subscribe to this mod's changes

adapter-factory is a skill published in the GitHub repository blueman82/ai-counsel (1 stars, last pushed 27d ago), licensed MIT. It adds 23 tokens to every session and 5,747 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

adapter-factory compared with skills from other repositories

adapter-factory next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
adapter-factoryblueman82/ai-counselSkill127d agoMITA23Claude Code
imagegenopenai/codexSkill133kyesterdayApache-2.0A113Codex
playwright-climicrosoft/playwrightSkill99kyesterdayApache-2.0A19Claude Code
local-ai-agentsmicrosoft/ai-agents-for-beginnersSkill79k4d agoMITA200Claude Code, Codex
systematic-debuggingobra/superpowersSkill313k3d agoMITA21Claude Code
next-cache-components-adoptionvercel/next.jsSkill143kyesterdayMITA95Claude Code
next-partial-prefetching-adoptionvercel/next.jsSkill143kyesterdayMITA103Claude Code