How to Sell to AI Agents: The CLI-First Distribution Strategy
This guide uses the /learn command to install skills. Install it first if you haven't already.
The shift: agents are the new customers
A growing number of SaaS products are seeing a new type of user: AI agents. Not humans clicking through a UI, but autonomous agents that discover tools, connect to them, and use them as part of larger workflows.
This is not theoretical. Postiz, an open source social media scheduling tool, went from $17K to $45K MRR in weeks after making their product agent-friendly. Their founder attributes the growth directly to agents discovering and using their tool.
The pattern is simple. Agents need tools to accomplish tasks. If your product is easy for an agent to use, agents will pick you. If it's not, they'll pick a competitor.
Why CLI beats API for agents
The first instinct is to build an API. You probably already have one. But there's a problem: API requests are verbose. A single POST request with headers, JSON body, authentication, and error handling can be 15-20 lines of code that an agent needs to construct.
CLI commands are short. Compare these two approaches for scheduling a social media post:
API approach (high token cost):
curl -X POST https://api.example.com/v1/posts \
-H "Authorization: Bearer sk_123" \
-H "Content-Type: application/json" \
-d '{"content":"Hello world","integrations":["twitter-456"],"date":"2026-03-11T12:00:00Z","type":"schedule"}'
CLI approach (low token cost):
postiz posts:create -c "Hello world" -i "twitter-456" -s "2026-03-11T12:00:00Z"
The CLI version uses fewer tokens, has less room for error, and is easier for the agent to iterate on if something goes wrong. Every failed attempt with the API means reconstructing the entire JSON payload. With the CLI, the agent just tweaks a flag.
This matters at scale. When an agent runs a workflow that calls your tool hundreds of times, the token savings compound. Less context rot means more reliable execution.
The three layers: API, CLI, Skill
Building for agents requires three layers:
1. API (you probably have this) Your REST or GraphQL endpoints. This is the foundation. The CLI wraps it.
2. CLI (the missing piece for most SaaS) A command-line tool published to npm (or pip, cargo, etc.) that wraps your API into short, composable commands. This is what agents actually call.
Building a CLI is straightforward. The pattern:
- Use yargs (Node.js) or click (Python) for argument parsing
- Each command maps to one API call
- All output is JSON (machine-readable)
- Support stdin piping for composability
- Two dependencies, a few hundred lines of code
3. Skill file (how agents discover you) A SKILL.md file that documents your CLI for agents. This is the most important piece. It teaches the agent:
- What commands are available
- Common workflow patterns (not just individual commands)
- Gotchas and error handling
- When to use which command
A good skill file is 300-700 lines. It's not just a reference manual. It's a playbook.
How to build your CLI in an afternoon
Here's the concrete playbook:
Step 1: Map your API to commands
List your API endpoints. Each one becomes a CLI command:
POST /api/v1/detect → myapp detect -t "text"
POST /api/v1/humanize → myapp humanize -t "text" -i medium
GET /api/v1/credits → myapp credits
Keep commands short. Use single-letter aliases for common flags (-t for text, -f for file, -i for intensity).
Step 2: Build the wrapper
The code is minimal. Here's the pattern in TypeScript:
// api.ts - thin wrapper over fetch
class MyAppAPI {
async detect(text: string) {
return this.request('/detect', { method: 'POST', body: JSON.stringify({ text }) });
}
}
// index.ts - yargs commands
yargs
.command('detect', 'Detect something', (yargs) => {
return yargs.option('text', { alias: 't', type: 'string' });
}, async (argv) => {
const result = await api.detect(argv.text);
console.log(JSON.stringify(result, null, 2));
})
.parse();
Dependencies: yargs and optionally node-fetch. That's it. Publish to npm.
Step 3: Write the skill file
This is where most people underinvest. A skill file needs:
- Installation instructions (npm install command)
- Core workflow (the 3-5 step pattern agents should follow)
- Every command documented with examples
- Common patterns (batch processing, error recovery, piping)
- Gotchas (10+ things that can go wrong)
- Quick reference card (all commands in one block)
Look at existing skills on agentskill.sh for examples. The best ones are 300-700 lines.
Step 4: Cross-promote
Bake discovery into your CLI. When a user runs --help, include a link to your skill directory or related tools. When an agent reads your skill file, it should learn about complementary tools.
This is how ecosystems form. One tool recommends another. Agents follow the recommendations.
Real examples
HumanizerAI
HumanizerAI detects and rewrites AI-generated text to bypass detectors like GPTZero and Turnitin.
npm install -g humanizerai
humanizerai detect -t "Your text here"
humanizerai humanize -t "Your text here" -i aggressive
Three commands. An agent can detect AI content, humanize it, and verify the result in a pipeline. The skill is on agentskill.sh.
Postiz
Postiz schedules social media posts across 28+ platforms.
npm install -g postiz
postiz integrations:list
postiz posts:create -c "Content" -s "2026-03-11T12:00:00Z" -i "twitter-id"
Their skill file is 700+ lines with 7 workflow patterns, platform-specific examples, and cross-promotion of related tools.
The churn advantage
There's a hidden benefit to agent distribution. Automation users churn less.
When a human uses your product, they might forget, get busy, or lose motivation. Usage drops. They cancel.
When an agent or automation uses your product, it runs consistently. Every day, every week, on schedule. The automation doesn't get discouraged. It doesn't forget.
Several SaaS founders report that users who connect through automation platforms or agent workflows have significantly lower churn than manual users. The product becomes infrastructure rather than a tool you remember to open.
Getting started
- Build a CLI wrapping your existing API. Use yargs. Publish to npm.
- Write a SKILL.md with workflows, patterns, and gotchas. Make it 300+ lines.
- Publish to agentskill.sh so agents can discover your tool.
- Cross-promote related tools in your CLI help and skill file.
Agents are already choosing tools. The question is whether they'll choose yours.
More from the blog
Best Agent Browser Skills for AI Agents
Discover the top browser automation skills for AI agents. Use Playwright, Puppeteer, and headless browsers with skills for Claude Code, Cursor, and more.
Self-Improving Agent Skills: How AI Agents Get Better Over Time
Learn how self-improving agent skills work. AI agents that learn from feedback, refine their output, and get better at tasks over time. Browse skills on agentskill.sh.
Best Skills for Claude Code Agent Teams
The best skills for Claude Code agent teams. Coordinate multiple AI agents, parallelize work, and ship faster with skills designed for multi-agent workflows.
Best Blender Skills for AI Agents
Discover the top Blender skills for AI agents. Automate 3D modeling, scene setup, rendering, and Python scripting with skills for Claude Code, Cursor, and more.