For a long time Claude Code was a terminal tool for me: I open it, type, and watch it work. Then I noticed that it is the same agent that can be called from a program, run on a server with no window at all, and given a task from a phone. From that moment I stopped treating it like an editor and started treating it like one more element of a system, next to the queue and the database. This is a story about that approach, not a deployment guide, and frankly: great fun.

Skills: team knowledge as files

A skill is a directory with a SKILL.md file: a name, a description and instructions for the agent. Mine hold code standards, architecture and the pitfalls someone has already fallen into once. The best part is that they are ordinary files in the repository. So a skill is pinned to a specific version of the code: an agent working on a given commit reads the instructions from that commit.

I like two consequences most. First, skills work wherever the agent works. They are not a setting of my laptop but part of the repository, so they travel with the code to a server or to the cloud, and the agent works there by the same rules as I do at my desk. Second, changing a standard is a commit, not a training session. Nobody has to remember that from Tuesday we do it differently. The agent simply reads the new version.

Claude Code through the API

The same agent as in the terminal can be called from a program through the Claude Agent SDK. The program supplies the task, a working directory and the list of allowed tools and skills, and receives the result and the cost:

TypeScript
import { query } from "@anthropic-ai/claude-agent-sdk";

for await (const message of query({
  prompt: "Update the dependencies and run the tests",
  options: {
    cwd: workDir,
    settingSources: ["project"],
    skills: ["code-standards"],
    allowedTools: ["Read", "Grep", "Glob", "Edit"],
    permissionMode: "dontAsk",
    maxTurns: 30,
    maxBudgetUsd: 2,
  },
})) {
  if (message.type === "result") {
    console.log(message.subtype, message.total_cost_usd);
  }
}

A few things from the documentation make a difference here. Skills are loaded from the file system through settingSources, and the skills option chooses which of them are enabled. permissionMode: "dontAsk" means no questions: whatever is not on the allowed list is denied, which suits an agent with nobody sitting next to it. maxBudgetUsd stops the loop once the given cost is exceeded, and the result carries total_cost_usd. The documentation notes that this is an estimate that can overshoot the limit, so leave headroom. The numbers in the example are an illustration, not a recommendation.

An agent inside a .NET program

Now the fun part: a .NET application hands work to the agent and enforces the rules. Who may request it, how much they may spend, what happens afterwards. The agent is then not a magic box but a service with a contract. A sketch in C#, with my own types:

C#
public async Task<AgentRunResult> RunAsync(AgentJob job, CancellationToken ct)
{
    if (!policy.CanRun(job.RequestedBy, job.Kind))
        throw new UnauthorizedAccessException("This user cannot request such tasks.");

    var request = new AgentRequest(
        job.Prompt,
        job.WorkingDirectory,
        AllowedTools: policy.ToolsFor(job.Kind),
        MaxBudgetUsd: policy.BudgetFor(job.Kind));

    var result = await runner.RunAsync(request, ct);

    await store.SaveAsync(job.Id, result.Summary, result.CostUsd, ct);
    await queue.PublishAsync(new AgentJobFinished(job.Id, result.Succeeded), ct);
    return result;
}

runner is a thin layer that launches the agent (the SDK in a separate process, or Claude Code in non-interactive mode) and hands back the result with its cost. The rest is ordinary code, the kind you would write for any service: authorisation, limits, storage, an event after completion. The agent is one of the elements, like a queue or a database.

An agent on a server

On a server the agent works on its own, with no open terminal: it gets a task, works and saves the result. That calls for different thinking about security than on a laptop, where I sit next to it. The general rules, without details:

  • a separate account with minimal privileges,
  • limited network access,
  • no keys within the agent's reach: what it cannot see, it cannot leak or break,
  • an explicit list of tools instead of permission for everything. The documentation says that the mode which skips permission prompts is meant for isolated environments.

A practical test of whether a task suits an unattended agent: it can be described in a few sentences and judged by its result. If it needs constant decisions along the way, I sit down at the terminal and work with the agent, as before. Both modes have their place.

A fix from the phone

My favourite part. On a tram or on a walk I describe in a browser on my phone what should change, and the agent does it on the server. In the evening I look at the finished result. I do not write code on a touch screen, I request and review. It changes how I think about small fixes: they no longer wait for "someday, at the computer".

What does not work or needs attention

So that this does not turn into marketing:

  • The agent makes mistakes. Sometimes confidently, sometimes quietly. That is why tests and reviewing the changes matter. I treat the agent's output like a pull request from a colleague: I read it and run it, and only then does it go in.
  • You have to see the cost. Every task has a cost and a limit, and the program stores it with the result. Without that, the first surprise arrives on the invoice.
  • Skills make a bigger difference than long prompts. A well-written rule in one file, read every time, beats the longest instruction pasted into a task. That is my observation, not a measurement.
  • Trust is earned gradually. I start with read-only tasks and add write access later.

A boring piece of advice at the end: treat the agent like any other component of the system. Give it a contract, limits, logs and review. The fun starts only once you know what can go wrong.