agentleFS
crystal-autobotcrystal-autobot/autobot/.claude/skills/autobot-provider/SKILL.md

autobot-provider

Skill47 starsChanged 8 months agoMITView on GitHub

Add new LLM providers to Autobot with proper integration

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 3 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Add a new ProviderSpec to the PROVIDERS list in src/autobot/providers/registry.cr.

    line 21
  2. Distinctive:

    Ensure keywords and API URL are correctly specified.

    line 22
  3. Very specific:

    Update src/autobot/config/schema.cr with provider config if needed.

    line 25
  4. Very specific:

    Test provider registration in registry_spec.cr.

    line 30
  5. Distinctive:

    Test API integration (mocked).

    line 31
  6. Very specific:

    Update docs/providers.md - Add to provider comparison.

    line 35
  7. Very specific:

    Add to PROVIDERS in src/autobot/providers/registry.cr:

    line 88
  8. Distinctive:

    Use this skill when:

    line 119

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Adding a New LLM Provider

Files to Create/Modify

  1. Create provider implementation:
    • src/autobot/providers/<name>_provider.cr
    • Inherit from HttpProvider or implement Provider interface
  2. Register provider:
    • Add a new ProviderSpec to the PROVIDERS list in src/autobot/providers/registry.cr.
    • Ensure keywords and API URL are correctly specified.
  3. Add configuration schema:
    • Update src/autobot/config/schema.cr with provider config if needed.
    • Most HTTP providers work automatically if they follow OpenAI compatibility.
  4. Create tests:
    • spec/autobot/providers/<name>_provider_spec.cr
    • Test provider registration in registry_spec.cr.
    • Test API integration (mocked).
  5. Add documentation:
    • docs/<name>.md - Provider setup guide.
    • Update docs/providers.md - Add to provider comparison.

Provider Implementation Template

# src/autobot/providers/<name>_provider.cr
module Autobot
  module Providers
    class <Name>Provider < HttpProvider
      def initialize(
        api_key : String,
        api_base : String? = nil,
        @model : String = "default-model",
        @extra_headers = {} of String => String,
        provider_name : String? = nil,
      )
        super(api_key, api_base)
        @gateway = Providers.find_gateway(provider_name, api_key, api_base)
      end

      def chat(
        messages : Array(Hash(String, JSON::Any)),
        tools : Array(Hash(String, JSON::Any))? = nil,
        model : String? = nil,
        max_tokens : Int32 = DEFAULT_MAX_TOKENS,
        temperature : Float64 = DEFAULT_TEMPERATURE,
      ) : Response
        # Implement API-specific logic here
        # Or call super for OpenAI-compatible APIs
        super
      end

      def default_model : String
        @model
      end
    end
  end
end

Alternative: Non-HTTP Provider

For providers with non-standard APIs (like AWS Bedrock), inherit directly from Provider:

class BedrockProvider < Provider
  # Implement abstract methods directly
  # See src/autobot/providers/bedrock_provider.cr for full example
end

ProviderSpec Registration

Add to PROVIDERS in src/autobot/providers/registry.cr:

ProviderSpec.new(
  name: "<name>",
  keywords: ["<keyword1>", "<keyword2>"],
  display_name: "<Display Name>",
  api_url: "https://api.<provider>.com/v1/chat/completions",
)

Testing Checklist

  • Provider registers correctly in registry
  • Configuration schema validates properly
  • API calls are mocked in tests
  • Error handling works (401, 429, 500 responses)
  • User-Agent handling (if provider requires specific UA)
  • Interactive setup includes new provider

Documentation Requirements

Each provider doc must include:

  • API key acquisition instructions
  • Supported models list
  • Rate limits and pricing notes
  • Special features (if any)
  • Example configuration

When to Use

Use this skill when:

  • Adding support for a new LLM service
  • Integrating a new AI provider API
  • Testing provider implementations
  • Updating provider documentation

Related Skills: autobot-test

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.