Skills vs Agents: when to use each in Claude Code

This article is one chapter of my book Delphi in all its glory – AI-assisted development, the fifth book of the series.

Skills and sub-agents are both ways to extend Claude’s behavior, and they’re easy to confuse at first. They look similar on the surface but work very differently under the hood.

A skill is essentially a macro, a shorthand for something you’d otherwise type by hand every time.

A sub-agent is a whole separate Claude instance. When Claude spins up a sub-agent, it creates a fresh context window, runs the task in isolation, and returns a summary to your main conversation. Think of it as spawning a worker thread: the worker does its job, the main thread gets the result, and whatever the worker consumed along the way (token budget, files read, intermediate steps) never touches your main context.

That distinction matters more than it sounds.

Where It Shows Up In Practice

Say you have a legacy unit, CsvParser.pas, with 1,200 lines. You want a review.

With a skill (/review CsvParser.pas), Claude reads the entire file into your conversation, works through it, writes findings. 1,200 lines of Delphi code is easily 3,000–4,000 tokens. Your context shrinks by that much, plus the review itself.

With a sub-agent, Claude spawns a worker. The worker reads the file and all its dependencies, does a thorough review in its own context, and sends back a compact report: “5 issues found, here they are.” Your main conversation receives maybe 200 tokens of findings. The 3,000 tokens of source code never entered your context at all.

When To Use A Skill

Use a skill when the task is short, self-contained, and you want to see the output inline. Examples:

   /compile MyProject.dproj  — run the compiler and show errors right in chat
   /todos FormMain.pas       — list TODO comments in one file
   /bump-date                — update the date header in the current file

These are quick enough that the context cost doesn’t matter much. And since the result is right in front of you, you can immediately continue the conversation based on what Claude found.

Skills also make sense for tasks with tight back-and-forth. If you need to look at the output, ask a follow-up, and have Claude iterate — keeping everything in the main context is exactly what you want.

When To Use A Sub-Agent

Use a sub-agent when the task is heavy, independent, or could otherwise pollute your context. Examples:

delphi-compiler  — compiles project, interprets errors, suggests fixes
delphi-review    — deep review of multiple files, cross-references, report back
Explore          — searches the entire codebase for patterns or symbols

You’d also reach for a sub-agent when you want to run things in parallel. While Claude is writing new code in your main conversation, it can simultaneously spin up an Explore agent to search for all callers of the function being replaced. The search happens concurrently, doesn’t slow down the main task, and returns when done.

The Overlap: Skills That Run As Sub-Agents

Skills can be promoted to run in isolation with a single line in their configuration. Just add context: fork to the YAML header and Claude will automatically spin up a separate context for that skill, just like a sub-agent:

  name: review
  context: fork

Summary

If you find yourself typing the same prompt twice, make it a skill. If that skill reads a lot of files or runs a lot of code, add context: fork to it, or build a proper sub-agent instead.


This was one chapter of a whole book

You just read one chapter of Delphi in all its glory – AI-assisted development: more than 400 pages about Claude Code and AI for Delphi programmers. Written by a Delphi programmer, with the failures documented next to the wins.

Leave a Comment

Scroll to Top