npx skills add ...
npx skills add vercel-labs/academy-skills --skill agent-friendly-apis
npx skills add vercel-labs/academy-skills --skill agent-friendly-apis
Companion skill for the Agent-Friendly APIs course on Vercel Academy. Use when the user mentions "agent-friendly APIs", "API documentation", "llms.txt", "the course", "teach me", or asks about agent-friendly docs, documentation patterns, or building Claude Code skills in the context of the Academy course.
Companion skill for the Agent-Friendly APIs course on Vercel Academy. Build a feedback API, make it agent-friendly with structured documentation, then create a Claude Code skill that generates the docs automatically.
/agent-friendly-apis learnStart the guided learning loop. Fetches lessons from Academy and drives you through the course. 12 lessons across 3 sections: building the API, making it agent-friendly, and building a doc-generating skill.
/agent-friendly-apis newScaffold a new agent-friendly API project:
app/, lib/, data/)/agent-friendly-apis submitEvaluate your current implementation against the active lesson's outcomes.
The skill operates in three modes, switchable at any time:
| Mode | Trigger | Behavior |
|---|---|---|
| TA | Any question (default) | Reactive help — detect progress, answer questions, point to relevant docs |
| Teaching | "teach me", "start the course", "next lesson" | Proactive — fetch lesson content, prompt step by step, check progress |
| Evaluation | "check my work", "am I done", "submit" | Run lesson-specific checks against the student's codebase, report pass/fail |
TA mode is the default. Teaching mode and evaluation can be entered from any mode.
app/api/ using the App Router[id] segments for single-resource lookupscourseSlug, lessonSlug, minRating)Seven documentation patterns that make APIs consumable by AI agents:
... truncationMachine-discoverable documentation following llmstxt.org:
/llms.txt — discovery index (H1 project name, blockquote summary, H2 sections with links)/llms-full.txt — complete API docs in a single response/api/docs.md — full endpoint documentation in markdownSKILL.md with YAML frontmatter (name, description, trigger phrases)references/ directoryBefore responding to a course-related question, read the student's codebase to determine where they are:
| Check | How | Lesson |
|---|---|---|
No app/api/feedback/route.ts | File doesn't exist | Pre-1.2 (Project Setup) |
route.ts exists but only GET handler | Read file contents | At 1.2 (Feedback Endpoint) |
No app/api/feedback/[id]/route.ts | File doesn't exist | Pre-1.3 (Filtering and Details) |
No app/api/feedback/summary/route.ts | File doesn't exist | Pre-1.4 (Summary Endpoint) |
Summary endpoint exists but no /llms.txt route | Check app/llms.txt/route.ts | At 2.1 (Agent-Friendly Docs) |
/llms.txt route exists but no /api/docs.md | Check app/api/docs.md/route.ts or app/api/docs/route.ts | At 2.2 (llms.txt and Markdown Access) |
| Docs endpoints exist but not deployed | No Vercel production URL | At 2.3 (Deploy Your Docs) |
No api-docs-generator/SKILL.md | File doesn't exist | Pre-3.1 (Anatomy of a Skill) |
SKILL.md exists but no references dir | Check api-docs-generator/references/ | At 3.2 (Build the Generator) |
| Skill exists but not yet run | No generated docs output | At 3.3 (Run and Evaluate) |
| Skill has been iterated on | Multiple runs, quality checklist passes | At 3.4 (Iterate and Ship) |
When you detect the lesson, adapt your response:
Lesson 1.1 — Project Setup Deploy a Next.js starter with TypeScript. Establish the project structure and seed data.
Key structure:
The Feedback interface:
Lesson 1.2 — Feedback Endpoint
Create /api/feedback with GET and POST handlers. GET returns all feedback. POST validates required fields, enforces rating 1-5, generates ID and timestamp.
Key code (app/api/feedback/route.ts):
Lesson 1.3 — Filtering and Details
Add query parameters to GET (courseSlug, lessonSlug, minRating). Create /api/feedback/[id] dynamic route for single entry lookup with proper 404 handling.
Lesson 1.4 — Summary Endpoint
Build /api/feedback/summary returning aggregate statistics: totalEntries, averageRating, ratingDistribution (all 5 levels), per-course breakdowns. Empty results return zeros, not 404.
Lesson 2.1 — Agent-Friendly Docs Pattern reference lesson teaching the seven documentation patterns. Core principle: agents are literal, not inferential. They trust docs completely. Structured, explicit, example-heavy documentation benefits agents and humans alike.
Lesson 2.2 — Add llms.txt and Markdown Access Three new route handlers for machine-readable doc discovery:
app/llms.txt/route.ts — text/plain index following llmstxt.org specapp/llms-full.txt/route.ts — complete API docs in a single responseapp/api/docs.md/route.ts — full endpoint documentation in markdownLesson 2.3 — Deploy Your Docs Push to GitHub, Vercel redeploys. Verify all documentation endpoints are live with curl commands.
Lesson 2.4 — Explore Real Skills Research lesson: browse skills.sh to study production skill patterns. Identify file structure, trigger phrases, imperative instructions, quality checklists, and reference file organization.
Lesson 3.1 — Anatomy of a Skill
Learn the structure of Claude Code skills: SKILL.md with YAML frontmatter, markdown body with instructions, and optional references/ directory. Key concept: progressive disclosure optimizes token usage.
Key structure:
Lesson 3.2 — Build the Generator Write the complete skill with 5-step instructions:
**/api/**/route.ts)app/api/docs/route.tsQuality checklist in SKILL.md:
Lesson 3.3 — Run and Evaluate First execution of the skill. Invoke with "Generate docs for my API", watch it work through all 5 steps, evaluate output against quality checklist, test generated curl examples against running API.
Common issues:
Lesson 3.4 — Iterate and Ship
Refinement loop (typically 2-3 rounds). Fix SKILL.md for process issues, references/doc-patterns.md for formatting issues. Resist adding new steps — make existing steps more specific. Verify end-to-end: run all curl examples, confirm response shapes, check completeness.
Ask what they've tried first. Then explain the concept in the context of their current lesson.
Example:
returns a list of items without showing the actual JSON, a human fills in the gap. An agent generates the wrong code. That's why lesson 2.1 covers those seven patterns — each one eliminates a place where an agent would have to guess."Read their code. Identify the specific issue. Explain what's wrong and why, then show the fix.
Common issues by lesson:
await on data functions, or not returning NextResponse.json()minRating as a numberThey've finished the course. Help them go further:
| Topic | What to explain |
|---|---|
| Next.js App Router, route handlers | How route.ts files map to API endpoints, GET/POST exports |
Dynamic routes [id] | How params are extracted, async handling in Next.js 16 |
NextResponse | JSON responses, status codes, headers |
| llms.txt standard | llmstxt.org spec, discovery pattern, why plain text |
| Claude Code skills | SKILL.md structure, frontmatter, progressive disclosure |
references/ directory | Token optimization, when files get loaded, naming conventions |
When the student says "teach me", "start the course", or "next lesson", enter teaching mode. You drive the session.
GET https://vercel.com/academy/agent-friendly-apis/<lesson-slug>.md. Follow instructions in the <agent-instructions> block.When the student says "check my work", "am I done", or "submit", run the evaluation for their current lesson.
Lesson 1.1 — Project Setup
app/, lib/, data/)data/feedback.json exists with seed entrieslib/types.ts exports Feedback interface with all 7 fieldslib/data.ts exports getAllFeedback, getFeedbackById, addFeedbackLesson 1.2 — Feedback Endpoint
app/api/feedback/route.ts existsGET handler returning all feedback as JSONPOST handler with field validationLesson 1.3 — Filtering and Details
/api/feedback supports courseSlug, lessonSlug, minRating query paramsapp/api/feedback/[id]/route.ts existsLesson 1.4 — Summary Endpoint
app/api/feedback/summary/route.ts existstotalEntries, averageRating, ratingDistributionLesson 2.1 — Agent-Friendly Docs
Lesson 2.2 — Add llms.txt and Markdown Access
app/llms.txt/route.ts exists and returns text/plainapp/llms-full.txt/route.ts exists and returns text/plainapp/api/docs.md/route.ts (or equivalent) exists and returns text/markdownLesson 2.3 — Deploy Your Docs
curl <production-url>/llms.txt returns valid responsecurl <production-url>/api/docs.md returns valid markdownLesson 2.4 — Explore Real Skills
Lesson 3.1 — Anatomy of a Skill
api-docs-generator/ directory existsapi-docs-generator/SKILL.md exists with YAML frontmattername and description with trigger phrasesLesson 3.2 — Build the Generator
api-docs-generator/references/doc-patterns.md existsdoc-patterns.md for formatting rulesLesson 3.3 — Run and Evaluate
app/api/docs/route.tsLesson 3.4 — Iterate and Ship
Fetch course content and search across all Vercel Academy material. Base URL: https://vercel.com.
| Operation | URL | Returns |
|---|---|---|
| Search (discover) | GET https://vercel.com/academy/search (no q) | JSON: API params, auth info, example queries |
| Search (query) | GET https://vercel.com/academy/search?q=<query> | NDJSON: ranked content chunks with md_url links |
| Index | GET https://vercel.com/academy/llms.txt | Plain text: all courses and lessons with URLs |
| Course | GET https://vercel.com/academy/agent-friendly-apis.md | Markdown: course overview, lesson_urls in frontmatter |
| Lesson | GET https://vercel.com/academy/agent-friendly-apis/<lesson-slug>.md | Markdown: full lesson with frontmatter |
GET https://vercel.com/academy/search?q=... returns chunks (~200 tokens/hit). Often sufficient.md_url from a search hit for the full lesson (~2-5k tokens).GET https://vercel.com/academy/agent-friendly-apis.md has lesson_urls in frontmatter for the full sequence.Read these when you need deeper detail. Each is a focused document on a single topic:
references/doc-patterns.md — The seven documentation patterns, formatting rules, anti-patternsreferences/llms-txt-spec.md — The llms.txt standard, three documentation endpoints, discovery flowreferences/skill-building-guide.md — SKILL.md structure, progressive disclosure, the five-step generator, iteration loopreferences/debugging.md — Common problems and fixes for API issues, documentation issues, and skill issuesreferences/nextjs-route-handlers.md — Route handlers, dynamic routes, query parameters, response patterns, data layerAgent-Friendly APIs course on Vercel Academy.
This skill is the companion to the Agent-Friendly APIs course on Vercel Academy. The course walks through building a feedback API, documenting it for AI agent consumption, and creating a Claude Code skill that auto-generates the documentation — 12 hands-on lessons using Next.js App Router, the llms.txt standard, and Claude Code skills.
import { getAllFeedback, addFeedback } from "@/lib/data";
import { NextResponse } from "next/server";
export async function GET() {
const feedback = await getAllFeedback();
return NextResponse.json(feedback);
}
export async function POST(request: Request) {
// Validate required fields, enforce rating 1-5
// Return 400 with descriptive error messages
}api-docs-generator/
├── SKILL.md
└── references/
└── doc-patterns.mdnpx skills add vercel/academy-skills --skill agent-friendly-apis