Lesson 13 · Building with AI Code Assistant (English Original)
Source: official the AI Platform 101 course, lesson 13 "Building with AI Code Assistant" (Skilljar, requires login). Stored for personal study only. Headings and paragraphing adjusted; wording unchanged.
Building with AI Code Assistant
Writing code that calls the the AI API by hand works fine, but there's an even faster path: have the AI write it for you. In this lesson, we'll use AI Code Assistant to fill in an API integration from a stubbed-out file — using the same primitives you've learned throughout this course.
Starting from a stub
The project is simple: a TypeScript file that gets weather. It contains two stubs:
- getWeather — accepts a city and returns the temperature and conditions.
- run — a function that should use the tool runner and the the AI TypeScript SDK.
The tool runner is the piece that handles tool calling and the agent loop for you, so you don't have to wire that up manually.
The the AI API skill
AI Code Assistant comes with a built-in skill called the AI API. You can invoke it directly with /claude-api, or AI Code Assistant will invoke it automatically when it detects that you're using the TypeScript SDK.
If you don't see the skill, you can add it from the marketplace:
/plugin marketplace add AnthropicsSkills
Note the s at the end of Anthropics — it's easy to miss.
One prompt, working code
Open the project folder in your terminal and launch AI Code Assistant.
From there, it takes a single prompt. A good prompt does three things:
- It names the file you want changed.
- It names the pattern you want used.
- It names the end state you expect.
AI Code Assistant then fills in getWeather and run against the types, appends a call at the bottom of the file, executes the script, and reports the output. If something errors out, it reads the error message and patches the code in place.
What AI Code Assistant produced
In this run, AI Code Assistant created a Zod tool that parsed the input and returned the output based on the city type. It also created the tool runner and the run function we asked for, and printed the final results of the agent loop.
The pattern to remember
Most of what you write against the the AI API has a familiar shape:
- Define a tool.
- Hand it to a runner.
- Return the result.
You don't need to type that from memory every single time. Instead, stub the file, hand it to AI Code Assistant, and just review the diff.
Recap
- AI Code Assistant is an agent that edits files and runs commands inside your terminal.
- The built-in the AI API skill loads automatically when AI Code Assistant detects the TypeScript SDK, or you can invoke it with
/claude-api. - Give it a prompt that names the file, the pattern, and the end state — it writes the code, runs it, and fixes errors in place.
- the AI API code follows a familiar shape: define a tool, hand it to a runner, return the result. Stub it, delegate it, review the diff.