Skip to content
Agentic Levels
Start hereLevelsTracksPromptsAbout
Get my levelGet my level

  • Start hereYour first useful task with AI.
  • Level quiz8 questions. No AI needed.
  • Fluency ScoreYour Level and a score, from your own AI.

  • LevelsThe 11 levels, in order.
  • LessonsShort lessons, filter by level.
  • TracksGuided paths by tool, role or goal.
  • Set up your AI tool
  • Starter packFree files that help AI remember.

  • PromptsReady prompts to copy and adapt.
  • ChatGPT vs Claude vs GeminiPick the right one for the job.
  • How-tos
  • ReferenceCommands for Claude Code, Codex, Antigravity.
  • ResourcesHand-picked reading and tools.

  • Your progress
  • Your next moveAn interview that picks your next skill.
  • Your next lessonsThe next lessons at your level.
  • Updates

  • Pricing
  • About
  • FAQ & Feedback
  • Work with us
  • How we handle your data
Sign inPreferences
AboutPricingHow-tosPromptsStarter packMy stackHow we handle your data

© 2026 Fuentes Studio

PrivacyTermsRefundsAccessibilityAI content policyCredits
yourCouncil
Ready to help
✦

What do you want to understand?

Ask anything about what you're learning.

←Level 2
  1. Levels
  2. ›Level 2
  3. ›Write Stubs the Model Can Finish
2

Part of the Level 2 core path · Lesson 1 of 7 · Free

Write Stubs the Model Can Finish

After this, you'll be able to write function stubs that reliably produce useful inline completions, instead of vague or wrong ones.

Before you start

Before diving in, complete Set Up Your Persistent Workspace so the model already knows your project context before you write your first stub.

The idea

Inline completions are pattern-matching engines. They predict what comes next based on what you've already written. The quality of the prediction is almost entirely a function of how much information you packed into the stub.

Worked example

Before and after

Two stubs for the same function. First: function processOrders() {. The model has no idea what Orders look like, what processing means, or what you expect to get back. It will hallucinate a plausible-looking body. Second: function processOrders(orders: Order[]): { fulfilled: Order[]; failed: Order[] } {. Now the model knows the input shape, the output shape, and the return structure. The completion it generates will use your actual types, respect the fulfilled/failed split, and almost certainly be usable.

Three things that make stubs completable. Typed parameters (the model sees exactly what it is working with). A descriptive name that signals intent, not just what (not process but validateAndCharge). A return type or a comment that describes the expected output. You do not need all three every time. Even one of them lifts the completion noticeably.

Try it (12 min)

Paste this into Claude

I want to practice skeleton-driven completions. Here is a function stub I wrote that got a bad or vague completion: [paste your stub here, e.g. a plain `function doThing() {` with no types or detail]. Help me rewrite it as a completable stub: (1) Add typed parameters that describe the input shape. (2) Add a return type or an inline comment describing what the function produces. (3) If the name is vague, suggest a more intent-revealing name. Then explain why each change makes the completion more predictable. I will test the new stub in my editor and report whether the completion improved.

What a good response looks like

Here is the rewritten stub for your processOrders function:

Before: function processOrders() {

After:

/**
 * Validates each order against inventory and marks it fulfilled or failed.
 * Does not mutate the input array.
 */
function processOrders(orders: Order[]): { fulfilled: Order[]; failed: Order[] } {

Three changes and why each one matters. First, typed parameter orders: Order[]: the completion engine now knows the exact shape of what it is iterating over, including every field on your Order type. Second, return type { fulfilled: Order[]; failed: Order[] }: the model knows it needs to split into two arrays, not return a boolean or a count. Third, the JSDoc comment: 'validates against inventory' and 'does not mutate' tells the model the business logic without requiring it to guess. When you trigger the completion now, you should see the body use your actual Order fields (like order.id, order.quantity) instead of invented ones. If it still invents fields, open your Order type definition file in another tab before completing.

Check yours against

  • You rewrote at least one stub from a blank/untyped version to a typed version with a return type
  • The completion your editor produced for the new stub was noticeably more specific and usable
  • You can name the three elements that make a stub completable: typed parameters, descriptive name, return type or comment
  • You did not have to edit the generated completion more than one or two lines to make it correct
  • You can describe in one sentence why typed stubs produce better completions than blank ones
  • Accepting the first completion without reading it. The model completes confidently regardless of whether it is correct.
  • Writing function names like handle, process, or doStuff. These give the model almost nothing to work with.
  • Skipping the return type in TypeScript or Python. It is the single highest-value addition to a stub.
  • Expecting the model to know your domain types without seeing them. Open the file that defines your types before you start completing call sites.
  • Treating a bad completion as a tool failure. Nine times out of ten it is a stub problem, not a model problem.

Go deeper (15 min)

Paste this into Claude

Take a function you already wrote with AI completion. Strip it back to just the stub: signature, types, and a short comment. Delete the body. Ask your editor to complete it again from the stub only. Compare the two versions: the original completion and this one. Paste both here and tell me: which version is closer to what you actually needed, and why? If the second one is worse, what is missing from your stub that the first session had as surrounding context?

What a good response looks like

Here is the comparison you asked for:

Original completion (from full session with surrounding context): The body used this.inventoryService.check(order.sku) and correctly referenced order.customerId for logging. It matched your actual service dependencies.

Regenerated from clean stub only: The body invented checkStock(item) and used order.itemId instead of order.sku. Both wrong. The model did not have your InventoryService import or your Order type visible, so it guessed.

What the original session had that the clean stub did not: your InventoryService import at the top of the file and 3 other functions in the same file that used order.sku as the identifier. The model pattern-matched from those. When you stripped the file to just the stub, that surrounding context disappeared.

Fix for round 3: Add a one-line comment to the stub: // Uses this.inventoryService.check(sku: string) and a typed parameter order: Order. That gives the regeneration enough signal to get order.sku right without needing the full file context.

Check yours against

  • You deliberately regenerated a completion from a clean stub rather than accepting the first one you got
  • You compared the two completions and identified what made one better or worse
  • You adjusted the stub based on what you learned and got a third completion that was at least as good as the original
  • You can explain one specific element of surrounding context that influenced the original completion

When this breaks

  • Breaks when the function has no clear input or output contract, because the model has nothing to pattern-match against and will invent shapes that look plausible but do not exist in your codebase.
  • Breaks in domains the model has weak training coverage on, because typed stubs help but cannot fully compensate for missing knowledge of your specific framework or internal conventions.

AI can help with this

Paste a vague stub into a chat with Claude and say: 'Rewrite this as a completable stub. Add typed parameters, a return type, and rename it if the name is vague. Explain each change.' You will get a template you can paste back into your editor before completing.

You can now

✓

Rewrite a vague untyped stub into one with typed parameters, an intent-revealing name, and a return type or comment, and demonstrate that the resulting completion needs at most one or two lines of editing.

Try it from memory

Pulling this out of your own head now is the part that actually moves it into long-term memory. Re-reading only feels like it does.

Without scrolling up, think of a small helper you'd want in a project of yours, not the one from the exercise. Describe in words its name, what goes in and what comes back, so a completion has something to go on.

One good answer: 'Name: calculateOrderTotal. Takes in: a list of item prices and a discount percentage. Gives back: one number, the total after the discount.' If your name is vague, like 'doThing', and nothing says what goes in or out, the completion will be vague too.

Key takeaways

The completion is only as good as the stub. Type your parameters, name your intent, declare your return shape. Then hit Tab.

  1. 1Typed parameters, intent-revealing names, and return types are the three signals that lift suggestions
  2. 2Even one of the three lifts the completion noticeably; you do not need all three every time
  3. 3Bad completions are almost always a stub problem, not a model problem

Go deeper

  • Cursor Docs: Getting Starteddocs.cursor.com (opens in a new tab) ↗
  • Claude Code Quickstartdocs.anthropic.com (opens in a new tab) ↗
  • GitHub Copilot Overviewgithub.com (opens in a new tab) ↗
Up nextRead Before Tab→

Was this helpful?

← Back to Level 2