Portable skills: instruction files, tool loops and plain JSON

AnthropicKeyFreeAPI · Updated 2026-11-22 · 8 min read

Tool board with hand tools and one empty slot
A skill is a focused set of instructions picked off the wall when needed.

Developers building their own apps on a model API often want the experience they enjoy in the official interface: the assistant notices it needs a capability, loads the right instructions, calls a tool and carries on. A common question comes from people building a web app on the Claude API who are also considering a multi-model router for more choice, and wonder whether skills and agentic tool use will survive the switch. Others simply admire how Claude's ecosystem is laid out as tidy Markdown and JSON, and want the same structure in their own code.

This article separates the idea from the product. It explains what a skill is conceptually, which parts depend on a specific provider and which are just files and a loop you can own, and it shows a provider-neutral tool loop that runs on any OpenAI-compatible endpoint, including the free one on this site. AnthropicKeyFreeAPI is not affiliated with Anthropic; for the exact behaviour of Anthropic's own skills and tool use features, read its official documentation.

Frequently asked questions

What is a skill, in general terms?

A packaged set of instructions, and sometimes scripts or reference files, that an assistant loads only when a task calls for it. It keeps the main prompt short while giving the model detailed know-how on demand.

What is tool use?

A pattern where the model, instead of answering directly, asks your program to run a named function with specific arguments. Your code runs it, returns the result, and the model continues with that information.

How does native tool calling differ from a prompt-based loop?

Native tool calling is a structured API feature where the provider parses and validates tool requests. A prompt-based loop asks the model to emit JSON in its text and your code parses it. The native version is more robust; the prompt version works with any model.

Will skills keep working if I switch to a model router?

Provider-specific features only work where that provider supports them. The underlying idea, instruction files loaded when relevant plus a tool loop, can be rebuilt in your own code and then works with any model.

Which is better for agents, a frontier model or a mid-sized open one?

Frontier models follow tool formats and long plans more reliably. A mid-sized open model like free-ai handles short, well-specified tool loops but makes more mistakes on long chains.

Does the free endpoint support native function calling?

Treat it as a plain chat endpoint and build tool use with the prompt-and-JSON pattern shown here. That approach does not depend on any server-side tool feature.

What is free-ai?

An independent open-weight model of about 35B parameters, served free and keyless through the OpenAI chat format. It is not Claude and not related to Anthropic's products.

The idea behind skills

Strip away branding and a skill is a simple, powerful idea: do not stuff every instruction into one enormous system prompt. Instead, keep a library of focused instruction files, each describing how to do one kind of task well, and give the model only a short index. When a request matches an entry, the relevant file is loaded into context.

This solves two problems at once. Prompts stay short, which saves tokens and keeps the model focused. And knowledge becomes maintainable: a team can edit the instructions for writing release notes without touching the instructions for reviewing SQL.

An index the model can read

Each skill needs a name and a one-line description of when to use it. That index is cheap to include in every request and lets the model, or a simple router in your code, choose what to load.

Files, not magic

The appeal of a Markdown-and-JSON layout is that everything is inspectable. You can version it in git, review it in pull requests and diff it when behaviour changes.

What is provider-specific and what is portable

Some pieces of the experience live on the provider's side: how their app discovers skills, how it executes code in a sandbox, how its API represents tool calls. Those do not transfer to another model through a router, because the router simply forwards your request to a different back end that knows nothing about them.

The rest is yours. The instruction files, the index, the decision of which to load and the loop that runs tools and feeds results back are ordinary application logic. Build them yourself, and they work with any model that can follow instructions and produce JSON.

In other words, the portable part is the part you understand best: your own instructions and your own functions. Investing in those pays off regardless of which provider you use next year.

  • Portable: instruction files, the skill index, your tool functions, the loop
  • Portable: evaluation prompts that check each skill still works
  • Provider-specific: hosted code sandboxes and file stores
  • Provider-specific: native tool-call formats and server-side validation
Crane moving a container between two ships
Files and loops move between providers; hosted features stay behind.

A tool loop you can own

The core of agentic tool use is a loop. Send the conversation and the list of available tools. If the model replies with a tool request, run it, append the result and send again. If it replies with a final answer, stop. Native tool-calling APIs formalise this; you can also implement it with plain text by asking for strict JSON.

The example below uses only the chat completions endpoint. The system prompt describes two tools and asks for one JSON object per reply. The loop parses it, runs the tool and stops on a final answer or after a few steps.

Always cap the steps

A model can loop forever if a tool keeps returning something it does not expect. A hard limit on iterations, plus a clear message when it is reached, keeps costs and latency predictable.

Feed parsing errors back

When the reply is not valid JSON, telling the model so and asking again fixes most hiccups. Mid-sized models benefit from this more than frontier ones.

import json
from datetime import datetime, timezone

from openai import OpenAI

client = OpenAI(base_url="https://api.anthropickeyfreeapi.com/v1", api_key="none")

TOOLS = {
    "utc_now": lambda args: datetime.now(timezone.utc).isoformat(),
    "word_count": lambda args: str(len(args.get("text", "").split())),
}

SYSTEM = (
    "You can use tools. Reply with exactly one JSON object and nothing else.\n"
    'To call a tool: {"tool": "utc_now" | "word_count", "args": {...}}\n'
    'To finish: {"final": "your answer"}\n'
    "word_count takes {\"text\": string}. utc_now takes {}."
)


def run(question, max_steps=5):
    messages = [{"role": "system", "content": SYSTEM}, {"role": "user", "content": question}]
    for _ in range(max_steps):
        reply = client.chat.completions.create(model="free-ai", messages=messages, temperature=0)
        text = reply.choices[0].message.content.strip()
        messages.append({"role": "assistant", "content": text})
        try:
            obj = json.loads(text[text.find("{"): text.rfind("}") + 1])
        except ValueError:
            messages.append({"role": "user", "content": "Invalid JSON. Reply with one JSON object."})
            continue
        if "final" in obj:
            return obj["final"]
        fn = TOOLS.get(obj.get("tool"))
        result = fn(obj.get("args", {})) if fn else "unknown tool"
        messages.append({"role": "user", "content": f"Tool result: {result}"})
    return "stopped after max steps"


print(run("What time is it in UTC, and how many words are in 'the quick brown fox'?"))

Loading skills on demand

With a loop in place, skills are a small addition. Store each skill as a Markdown file with a short header. Before calling the model, build an index from those headers. Then either let the model pick a skill by name through a dedicated tool, or match the request yourself with simple keyword rules or a cheap classification call.

Once chosen, append the skill's full text to the system prompt for that request only. The model gets detailed instructions exactly when it needs them, and every other request stays light.

Let a cheap model route

Choosing a skill is a classification task, which small models handle well. A free model can pick the skill, and a stronger model can execute it if the task is demanding.

Keep skills short and testable

A skill that runs to many pages is a second system prompt in disguise. Aim for focused files, each paired with two or three example prompts that show it working.

Card catalogue with an open drawer
A short index lets the model choose which skill to load.

Making tool calls reliable on smaller models

Frontier models follow tool formats with impressive consistency. Mid-sized open models are good but less precise: they may wrap JSON in prose, invent a tool name or forget a required argument. Most of these failures are easy to absorb with a few defensive habits.

Be explicit about the format, keep tool lists short, use low temperature for tool-selection steps and validate arguments before running anything. If a tool has side effects, ask the model to confirm intent, or require a human click, before executing it.

Fewer tools, clearer names

Five well-named tools beat twenty vague ones. If you need many, group them by skill and expose only the group relevant to the current task.

Validate before you execute

Check every argument against what the function expects. Reject or repair anything malformed instead of passing it through, especially for tools that write files or send messages.

Routers, providers and the quality trade-off

A multi-model router is attractive because it gives you one integration and many back ends. The cost is that you code to the lowest common denominator, or you branch on provider to use special features. Owning the skill system and tool loop yourself keeps that branching small.

Be candid with yourself about where quality matters. Claude's larger models are strong at agentic work, and for complex multi-step tasks they will outperform a 35B open model. Many teams route planning and hard reasoning to a frontier model and keep the free or cheap model for routing, extraction and short tool steps. See small vs large models for a framework.

Railway switch directing tracks to two branches
Route easy steps to a cheap model and hard ones to a strong one.

Connecting skills to MCP servers

The Model Context Protocol has become a popular way to expose tools and data sources to assistants in a standard form. An MCP server describes tools with names, descriptions and argument schemas, much like the tools in the loop above. Your application can act as the client, read the tool list from a server and present it to whichever model you use.

This separates tools from models cleanly: the MCP server owns what can be done, your loop decides when, and the model only proposes calls. We walk through a small server in building a minimal MCP server.

Schemas double as documentation

Tool schemas written for MCP can be pasted into a system prompt for a prompt-based loop. One description serves both native clients and models without tool-calling support.

Testing skills like code

Because skills are files, they can be tested. Keep a handful of prompts per skill along with checks on the output: does the JSON parse, does the reply include required sections, did the right tool get called. Run them whenever you edit a skill or switch the model behind it.

The free endpoint is handy for this. Its limits per IP, one request per second with bursts of three, two in parallel and up to 10,000 requests per day, are plenty for a test suite of a few dozen cases run several times a day.

Keep golden outputs

For each test prompt, store an output you were happy with. Comparing new outputs to it, by eye or with a cheap model as judge, quickly shows whether a change made things better or worse.

Test tubes in a rack with a pipette
Test each skill with a few prompts whenever it changes.

Limits that shape agent design

The free endpoint is stateless, so your loop must resend the conversation each step, which it does anyway. Context is capped at 32,000 tokens, so trim tool results and old turns as the loop progresses. Responses can reach 16,000 tokens, more than enough for most steps.

It is also text only: no images or audio. Skills that depend on reading screenshots or documents as images need a multimodal model. And because there is no SLA, any agent that users rely on should have a fallback, as described in handling overloaded errors.

Summarise as you go

After a few tool steps, replace older results with a short summary. The model keeps the facts it needs while the context stays well within the limit.

Try the free API

Send a prompt to the keyless free-ai endpoint from the home page and see how it handles your own task, no signup needed.

Read also