# Building Scalable AI Agents with the Superpowers Agentic Skills Framework

> Learn how senior engineers can adopt the Superpowers agentic skills framework to standardize, test, and deploy AI agents efficiently across full‑stack projects.

I’ve spent the last three years shepherding AI‑augmented services from prototype to production across a handful of Fortune‑500 product teams. The most painful part wasn’t the model training or the prompt engineering—it was the chaos that emerged once we tried to stitch dozens of “agents” together, each with its own quirks, deployment pipeline, and testing strategy. The answer I landed on is what I now call the **agentic skills framework**: a unified, language‑agnostic contract that describes *what* an agent can do, *how* it does it, and *how* we verify it. In this post I’ll walk through the concrete pieces that make the framework work, why it matters for scaling, and the trade‑offs you’ll hit when you try to adopt it in a senior engineering team.

---

## Why a Unified Skills Contract Is the Missing Link

When you think about an AI agent, you’re really looking at a **skill set**—a collection of functions the model can invoke, each backed by code, data, or external services. In a monolithic LLM prompt we often hide those details behind a single “think‑and‑act” loop, but in production we need to expose them as first‑class, versioned artifacts.

### The Pain Points We Faced

| Symptom | Root Cause | What a Skills Framework Solves |
|---------|------------|--------------------------------|
| Duplicate validation logic across agents | Each team rolled its own input sanitization | Centralized schema definitions (e.g., Zod, Pydantic) |
| Inconsistent error handling | Ad‑hoc try/catch blocks | Standard `SkillError` hierarchy |
| Hard‑to‑track deployments | Separate CI pipelines per agent | Single source of truth for versioning and rollout |
| No clear ownership | Skills scattered across repos | Explicit `skillOwner` metadata |

These were not “nice‑to‑have” improvements; they were blockers that made us miss SLAs and forced us to roll back production releases more often than we’d like to admit.

### The Core Idea

> **An *agentic skill* is a pure, testable unit of capability that can be invoked by any LLM‑driven agent, regardless of the host language or runtime.**  
> The framework defines three immutable contracts:
> 1. **Interface contract** – a TypeScript (or OpenAPI) schema describing inputs, outputs, and error types.
> 2. **Implementation contract** – a Docker‑ready entrypoint that guarantees the same CLI flags and exit codes.
> 3. **Verification contract** – a set of deterministic unit‑ and integration‑tests that run in CI.

By treating skills as first‑class citizens, we can compose agents like Lego bricks, swap implementations without breaking downstream agents, and enforce quality gates before any code touches production.

---

## Designing the Skill Interface

The interface contract is the only piece that agents ever see directly. It must be language‑agnostic, versioned, and expressive enough to capture complex data structures.

### Choosing a Schema Language

We evaluated JSON Schema, Protobuf, and OpenAPI. JSON Schema gave us the best balance of readability and tooling support for both TypeScript and Python. The final decision was to store the schema in a `skill.yaml` file alongside the implementation.

```yaml
# skills/translate_text/skill.yaml
name: translate_text
version: 1.2.0
description: Translate a UTF‑8 string from source to target language.
owner: language-team
input:
  type: object
  required:
    - text
    - source_lang
    - target_lang
  properties:
    text:
      type: string
      minLength: 1
    source_lang:
      type: string
      enum: [en, es, fr, de, zh, ja]
    target_lang:
      type: string
      enum: [en, es, fr, de, zh, ja]
output:
  type: object
  required: [translated]
  properties:
    translated:
      type: string
error:
  type: object
  required: [code, message]
  properties:
    code:
      type: string
      enum: [INVALID_INPUT, SERVICE_UNAVAILABLE, TIMEOUT]
    message:
      type: string
```

The `skill.yaml` lives in the same directory as the implementation (`src/translate_text/`). This co‑location makes it trivial for a CI step to validate the schema against the code.

### Generating TypeScript Types

We use the `json-schema-to-typescript` CLI to generate a type definition that the rest of our monorepo can import:

```bash
npx json2ts -i skills/translate_text/skill.yaml -o src/types/translate_text.d.ts
```

The generated file contains a strict `TranslateTextInput`, `TranslateTextOutput`, and `TranslateTextError` type, which we then use in the agent orchestration layer.

---

## Implementing the Skill as a Dockerized Service

The implementation contract forces every skill to expose a **single binary entrypoint** that respects a predictable CLI interface. This eliminates the “my skill runs on Node, yours on Python” friction.

### Standard CLI Flags

| Flag | Description | Example |
|------|-------------|---------|
| `--input` | Path to a JSON file containing the input payload | `--input /tmp/input.json` |
| `--output` | Path where the skill must write its JSON response | `--output /tmp/output.json` |
| `--log-level` | Logging verbosity (`debug`, `info`, `warn`, `error`) | `--log-level info` |
| `--timeout` | Hard timeout in seconds; the container must exit with code `124` on breach | `--timeout 30` |

All skills must exit with **code 0** on success, **124** on timeout, and any other non‑zero code for custom errors defined in the schema.

### Sample TypeScript Implementation

```typescript
// skills/translate_text/src/index.ts
import { readFileSync, writeFileSync } from "fs";
import { TranslateTextInput, TranslateTextOutput, TranslateTextError } from "../../types/translate_text";

function loadInput(path: string): TranslateTextInput {
  const raw = readFileSync(path, "utf-8");
  return JSON.parse(raw);
}

function writeOutput(path: string, data: TranslateTextOutput | TranslateTextError) {
  writeFileSync(path, JSON.stringify(data, null, 2));
}

// Mock translation – replace with real API call in production
function translate(text: string, from: string, to: string): string {
  // Very naive placeholder; real implementation would call a translation service.
  return `[${to}] ${text}`;
}

// Main entrypoint
function main() {
  const args = require("minimist")(process.argv.slice(2));
  const inputPath = args["input"];
  const outputPath = args["output"];

  if (!inputPath || !outputPath) {
    console.error("Missing required flags");
    process.exit(1);
  }

  try {
    const payload = loadInput(inputPath);
    const result: TranslateTextOutput = {
      translated: translate(payload.text, payload.source_lang, payload.target_lang),
    };
    writeOutput(outputPath, result);
    process.exit(0);
  } catch (e: any) {
    const err: TranslateTextError = {
      code: "INVALID_INPUT",
      message: e.message,
    };
    writeOutput(outputPath, err);
    process.exit(2);
  }
}

main();
```

We build the skill into a minimal Docker image using `node:20-alpine`:

```dockerfile
# skills/translate_text/Dockerfile
FROM node:20-alpine AS builder
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
RUN npm run build

FROM node:20-alpine
WORKDIR /app
COPY --from=builder /app/dist ./dist
ENTRYPOINT ["node", "dist/index.js"]
```

The image is tagged with the skill version (`translate_text:1.2.0`) and pushed to our private registry. Because the CLI contract is immutable, any downstream agent can invoke the skill without caring about the underlying language.

---

## Verification Contract: Tests That Never Miss

A skill that compiles but fails silently in production is a liability. The verification contract forces **deterministic unit tests**, **property‑based fuzzing**, and **integration tests against a mock LLM orchestrator**.

### Unit Tests with Jest

```typescript
// skills/translate_text/__tests__/unit.test.ts
import { execSync } from "child_process";
import * as fs from "fs";
import * as path from "path";

const skillBin = path.resolve(__dirname, "../../dist/index.js");

function runSkill(input: object): { stdout: string; exitCode: number } {
  const tmpIn = "/tmp/input.json";
  const tmpOut = "/tmp/output.json";
  fs.writeFileSync(tmpIn, JSON.stringify(input));
  try {
    execSync(`node ${skillBin} --input ${tmpIn} --output ${tmpOut}`, { stdio: "ignore" });
    const out = fs.readFileSync(tmpOut, "utf-8");
    return { stdout: out, exitCode: 0 };
  } catch (e: any) {
    return { stdout: "", exitCode: e.status };
  }
}

test("happy path translates correctly", () => {
  const { stdout, exitCode } = runSkill({
    text: "Hello world",
    source_lang: "en",
    target_lang: "es",
  });
  expect(exitCode).toBe(0);
  const out = JSON.parse(stdout);
  expect(out.translated).toContain("[es]");
});
```

### Property‑Based Fuzzing with fast-check

```typescript
import fc from "fast-check";

test("rejects empty text", () => {
  fc.assert(
    fc.property(fc.constantFrom("en", "es", "fr"), fc.constantFrom("en", "es", "fr"), fc.string({ minLength: 0, maxLength: 0 }), (src, tgt, txt) => {
      const { exitCode } = runSkill({ text: txt, source_lang: src, target_lang: tgt });
      return exitCode !== 0;
    })
  );
});
```

### Integration Test Against a Mock Orchestrator

We spin up a lightweight orchestrator container that mimics the LLM’s `skill_call` JSON schema. The orchestrator validates that the skill returns a payload matching the declared output schema using `ajv`.

```bash
docker run -d --name mock-orchestrator -p 8080:8080 \
  -v $(pwd)/skills/translate_text/skill.yaml:/app/skill.yaml \
  myorg/mock-orchestrator:latest
```

The CI pipeline runs the orchestrator, invokes the skill via HTTP, and asserts the response shape. This gives us confidence that the skill will behave correctly when the LLM actually calls it.

> **Verification note** – The exact behavior of the mock orchestrator described here is based on internal tooling; public equivalents may differ.

---

## Orchestrating Skills at Scale

Now that each skill is a versioned, test‑covered Docker image with a stable CLI, the next challenge is **orchestration**: how do we let LLMs discover, invoke, and compose them without hard‑coding endpoints?

### Skill Registry Service

We built a tiny **Skill Registry** (Node.js + Fastify) that stores metadata:

```json
{
  "name": "translate_text",
  "versions": [
    {
      "tag": "1.2.0",
      "image": "registry.myorg.com/translate_text:1.2.0",
      "schema": "https://registry.myorg.com/skills/translate_text/skill.yaml"
    }
  ],
  "owner": "language-team"
}
```

The registry exposes a `GET /skills/:name` endpoint that returns the latest stable version. Agents query this endpoint at runtime to resolve the Docker image they need to spin up.

### Runtime Invocation Pattern

```typescript
// orchestrator/src/skillInvoker.ts
import fetch from "node-fetch";
import { spawn } from "child_process";

export async function invokeSkill(name: string, payload: any): Promise<any> {
  const meta = await fetch(`https://registry.myorg.com/skills/${name}`).then(r => r.json());
  const image = meta.versions[0].image; // pick latest
  const container = spawn("docker", [
    "run",
    "--rm",
    "-i",
    "-e", "LOG_LEVEL=info",
    image,
    "--input", "/dev/stdin",
    "--output", "/dev/stdout",
  ]);

  return new Promise((resolve, reject) => {
    let stdout = "";
    container.stdout.on("data", d => (stdout += d));
    container.stderr.on("data", d => console.error(`[${name}]`, d.toString()));
    container.on("close", code => {
      if (code === 0) {
        resolve(JSON.parse(stdout));
      } else {
        reject(new Error(`Skill ${name} exited with ${code}`));
      }
    });
    container.stdin.write(JSON.stringify(payload));
    container.stdin.end();
  });
}
```

Because the skill runs in an isolated container, we get **resource isolation**, **language independence**, and **easy rollback** by pulling a previous image tag.

### Scaling with Kubernetes Jobs

In production we don’t want a single orchestrator process spawning Docker directly. Instead we translate each skill invocation into a **Kubernetes Job** that runs the skill image with the same CLI flags. The job’s `spec.template.spec.containers[0].command` mirrors the CLI contract, and we mount a `ConfigMap` containing the input JSON.

```yaml
apiVersion: batch/v1
kind: Job
metadata:
  name: translate-text-{{uuid}}
spec:
  backoffLimit: 2
  template:
    spec:
      containers:
        - name: skill
          image: registry.myorg.com/translate_text:1.2.0
          command: ["node", "dist/index.js"]
          args:
            - "--input"
            - "/data/input.json"
            - "--output"
            - "/data/output.json"
            - "--log-level"
            - "info"
          volumeMounts:
            - name: payload
              mountPath: /data
      restartPolicy: Never
      volumes:
        - name: payload
          configMap:
            name: translate-text-payload-{{uuid}}
```

The orchestrator watches the Job’s status, reads the output ConfigMap, and returns the result to the LLM. This pattern scales horizontally: each skill call becomes a separate pod, and Kubernetes handles retries, resource quotas, and node affinity.

> **Verification note** – The exact Kubernetes Job spec may need adjustments for your cluster’s security policies (e.g., PodSecurityPolicies, ServiceAccounts). The example assumes a permissive namespace.

---

## Testing the Whole Pipeline: End‑to‑End Validation

Even with perfect unit tests, a skill can break when the orchestrator mis‑passes arguments or when the container runtime imposes limits. We therefore added an **E2E test suite** that runs the full stack in a disposable kind cluster.

```bash
# Install kind and create a cluster
kind create cluster --name skill-e2e

# Deploy registry, orchestrator, and a sample skill
kubectl apply -f k8s/registry.yaml
kubectl apply -f k8s/orchestrator.yaml
kubectl apply -f k8s/skills/translate_text.yaml

# Run the test harness (Node.js)
npm run test:e2e
```

The test harness sends a JSON request to the orchestrator’s HTTP endpoint, waits for the job to complete, and asserts the final payload matches the schema. Because the cluster is torn down after each CI run, we guarantee a clean environment every time.

---

## Versioning and Compatibility Strategies

A unified framework only works if you can evolve skills without breaking downstream agents. We adopt **semantic versioning** for the `skill.yaml` `version` field and enforce **backward‑compatible changes only** for minor releases.

### Compatibility Matrix

| Change Type | Allowed in | Impact |
|-------------|------------|--------|
| Add optional property | Minor (x.Y.0) | No break |
| Remove property | Major (X.0.0) | Breaking |
| Change enum values | Major | Breaking |
| Add new error code | Minor | No break |
| Change CLI flag name | Major | Breaking |

Our CI pipeline runs a **schema diff** step using `jsonschema-diff` to automatically reject PRs that introduce a major change without a version bump.

```bash
jsonschema-diff old/skill.yaml new/skill.yaml --allow-additional-properties
```

If the diff reports a breaking change, the pipeline fails and the author must either raise the major version or revert the change.

---

## Observability: Metrics, Logging, and Tracing

Because each skill runs in its own container, we can instrument them with **OpenTelemetry** without touching the business logic. The framework recommends a small wrapper library that injects a trace ID from the orchestrator into the skill’s environment.

```typescript
// utils/otel.ts
import { trace, context, propagation } from "@opentelemetry/api";

export function withTrace<T>(fn: () => T): T {
  const carrier = { traceparent: process.env.TRACEPARENT };
  const ctx = propagation.extract(context.active(), carrier);
  return context.with(ctx, fn);
}
```

Skills wrap their main logic:

```typescript
withTrace(() => {
  // existing main body
});
```

Metrics (invocation count, latency, error rate) are exported via a Prometheus endpoint that the sidecar container scrapes. This gives us per‑skill dashboards without any custom instrumentation per language.

---

## Security Considerations

Running arbitrary code—even in containers—poses risks. The framework enforces a **defense‑in‑depth** model:

1. **Read‑only filesystem**: Docker `--read-only` flag prevents accidental writes.
2. **User namespace isolation**: Each skill runs as a non‑root user (`USER 1001` in Dockerfile).
3. **Network egress whitelist**: Skills can only reach external services listed in a ConfigMap; everything else is blocked by a Kubernetes NetworkPolicy.
4. **Static analysis**: Before a skill image is promoted, we run the **AI‑Powered Codex Security CLI** (see our [AI‑Powered Security Scanning for TypeScript](/blog/ai-powered-codex-security-typescript-ci/)) to catch unsafe imports and hard‑coded secrets.

> **Verification note** – The exact set of OpenTelemetry libraries and security CLI flags may evolve; the versions referenced here reflect the state of our internal tooling as of late 2026.

---

## Migration Path for Existing Teams

If you already have a handful of ad‑hoc agents, you don’t need to rip and replace everything overnight. Here’s a pragmatic three‑step plan:

1. **Catalog Existing Capabilities** – Dump every LLM prompt that calls an external API into a spreadsheet. Identify the *input* and *output* shapes; these become the first draft of `skill.yaml`.
2. **Wrap One Skill** – Pick the most frequently used capability (e.g., “summarize_document”). Implement the Docker CLI contract and push a versioned image. Run the unit‑test suite and verify the orchestrator can call it.
3. **Iterate** – Gradually replace inline API calls in prompts with `skill_call` JSON that references the registry. As you gain confidence, deprecate the old prompt fragments.

Because the framework is **incremental**, you can keep delivering value while the codebase converges on a unified contract.

---

## Lessons Learned and Open Questions

### What Worked

* **Predictable CLI** – The single‑binary contract eliminated “my skill needs a virtualenv” headaches.
* **Schema‑driven Types** – Generating TypeScript types from the same source of truth prevented mismatched payloads.
* **Kubernetes Jobs** – Offloading execution to the cluster gave us natural scaling and isolation.

### What Didn’t

* **Over‑engineering for Low‑Volume Skills** – For a skill that runs < 10 times a day, the Docker + K8s overhead was disproportionate. In those cases a simple serverless function (e.g., Vercel) was cheaper.
* **Version Fatigue** – Teams sometimes bumped the minor version for a trivial doc change, causing unnecessary churn in the registry. We now enforce a “no‑doc‑only” rule for version bumps.

### Open Questions

* **Standardizing Skill Discovery** – Would a community‑driven OpenAPI extension be better than a custom registry? We’re watching the **OpenAI Function Calling** spec evolve.
* **Cross‑Language Testing** – Our current test harness is Node‑centric. A future goal is a language‑agnostic test runner that can execute a Ruby skill’s test suite alongside a TypeScript one without extra plumbing.

---

## TL;DR Checklist for Teams Ready to Adopt

- **Define `skill.yaml`** for each capability (inputs, outputs, errors). Store it next to the implementation.
- **Generate language bindings** (TypeScript, Python) from the schema.
- **Implement a Docker entrypoint** that respects the standard CLI flags and exit codes.
- **Write deterministic unit tests**, property‑based fuzzing, and integration tests against a mock orchestrator.
- **Publish the image** with a semantic version tag and register it in the Skill Registry.
- **Update the orchestrator** to resolve skills via the registry and invoke them as Kubernetes Jobs.
- **Add observability** (OpenTelemetry, Prometheus) and security hardening (read‑only containers, network policies).
- **Run E2E tests** in a disposable cluster on every PR.
- **Iterate**: start with one high‑value skill, then expand.

By treating AI capabilities as **first‑class, versioned skills**, we finally have a roadmap that scales from a single proof‑of‑concept LLM to a fleet of production agents serving millions of requests per day. The framework isn’t a silver bullet, but it gives senior teams a concrete, testable contract that turns “AI magic” into maintainable software.

---

## Conclusion

Adopting a framework is a migration, not an install. The teams that get value from it move one capability at a time and keep the old path working until the new one is proven, which is the same discipline any dependency upgrade deserves.

The migration path matters more than the framework, and [a unified agent skill framework](/blog/unified-agent-skill-framework/) covers the organisational side. I do this adoption work under [AI engineering](/services/ai-engineering/) and [AI agent development](/services/ai-agent-development/). For how to describe a skill so an agent picks it correctly, [Anthropic's guidance on writing tools for agents](https://www.anthropic.com/engineering/writing-tools-for-agents) is the place to start. If your rollout has stalled at the second team, [tell me why](/contact/).

## Frequently asked questions

### How do we migrate existing skills to a framework?

One capability at a time, with the old path kept until the new one passes the same tests. A big-bang migration gives you no way to tell which change broke something.

### What should we standardise first?

The skills several teams already duplicate. Those give the clearest saving and the clearest proof that the framework is worth the migration.

### How do we keep the framework from becoming a bottleneck?

Let teams define their own skills against the shared contract rather than routing every definition through one owner. The framework should standardise the shape, not the queue.

---

HTML version: https://fullstackweb.dev/blog/superpowers-agentic-skills-framework/
Maintained by Hendra Nicholas, Senior Full-Stack Software Engineer & AI Engineer, hello@fullstackweb.dev.
