Skip to content
AI Skills Central

Type to search Agent Skills, workflows, tutorials, tools and the glossary.

Workflow recipe

Give your coding agent current docs with Context7 or llms.txt

Stop your coding agent using outdated APIs: connect Context7 over MCP, point it at a library's llms.txt, or install a vendor skill, then check it worked.

By Checked Beginner45 min6 steps
Bookmark

Bookmarks are kept in your free account, so you can find this page again on any device.

Sign in to bookmark
On this page

To give a coding agent current documentation, capture one stale answer to test against, connect Context7 over MCP and re-run the test, point the agent at a library’s llms.txt where one exists, and install vendor-maintained skills for the platforms you use most. Keep whichever method fixed your test, and write the choice down for the team.

Models learn libraries from their training data, and training data lags. Ask for code against a library that shipped a new major version last month and you get confident code for the old one: a renamed function, a removed option, a config file in last year’s format. The agent is not wrong about the library it learned. It is wrong about the one you installed.

The fix is to put current documentation into the agent’s context at the moment it writes code. There are three common ways, and this recipe sets up all three so you can compare: Context7, a hosted documentation index the agent queries over MCP; a library’s own llms.txt file; and vendor-maintained Agent Skills that carry current API guidance.

TerminalAbout 5 min

1. Capture a stale answer to test against

Pick a library and task your agent has got wrong, or one that changed recently. Ask the agent without any extra docs and save the answer:

Baseline prompt · Claude Code, Codex or Cursor
Using [LIBRARY] version [VERSION FROM PACKAGE.JSON OR REQUIREMENTS], write [A SMALL, SPECIFIC TASK, E.G. A MIDDLEWARE THAT REDIRECTS UNAUTHENTICATED USERS]. Show the imports.

Check the answer against the library’s current docs or changelog. Note what is outdated. This is your test case for the rest of the recipe. Without it, you will not know whether the setup changed anything.

TerminalAbout 10 min

2. Connect Context7

The quickest route is Context7’s setup command. It signs you in, creates an API key and installs either a skill that uses the ctx7 CLI or the MCP server, for the agent you pick:

npx ctx7 setup --claude

Use --cursor or --opencode for those agents. To set it up by hand in Claude Code, add the remote MCP server with your key from the Context7 dashboard:

claude mcp add --transport http context7 https://mcp.context7.com/mcp \
  --header "Authorization: Bearer YOUR_CONTEXT7_API_KEY"

In Codex, add it to ~/.codex/config.toml, with the key in an environment variable rather than the file:

[mcp_servers.context7]
url = "https://mcp.context7.com/mcp"
bearer_token_env_var = "CONTEXT7_API_KEY"

Restart the agent and check that the server is connected (/mcp in Claude Code). Context7 exposes two tools: resolve-library-id, which turns a library name into a Context7 ID such as /vercel/next.js, and query-docs, which fetches documentation for that ID and your question.

Claude CodeAbout 10 min

3. Re-run the test with Context7 and watch the tool calls

Ask the same question, adding “use context7” so the agent calls the tools:

Prompt with Context7 · Claude Code, Codex or Cursor
Using [LIBRARY] version [VERSION], write [THE SAME TASK AS STEP 1]. Use context7 to look up the current API for this version before writing code. Tell me which documentation you used.

Watch the tool calls in the transcript. You should see resolve-library-id, then query-docs with your question. If you already know the library’s ID, put it in the prompt (“use library /supabase/supabase”) to skip the lookup. Compare the result with your baseline and the real docs.

Then make it automatic. Add one line to your instruction file (CLAUDE.md, AGENTS.md or a Cursor rule) so you do not have to remember the phrase:

## Library documentation
Before writing code that uses a third-party library API, look up the current docs
for the version in our lockfile with Context7. Say which docs you used.

BrowserAbout 10 min

4. Use llms.txt where a library publishes one

Many documentation sites publish an llms.txt file: a Markdown index of their docs, written for language models, at the root of the docs site. The proposal is at llmstxt.org. Some sites also publish llms-full.txt with the full text. Examples that exist today include https://code.claude.com/docs/llms.txt, https://developers.cloudflare.com/llms.txt and https://orm.drizzle.team/llms.txt.

Check whether your library has one by opening /llms.txt on its docs domain. If it does, point your agent at it:

Prompt with llms.txt · Claude Code or Codex
Fetch [DOCS SITE]/llms.txt and use it to find the pages about [TOPIC]. Read those pages, then write [THE SAME TASK AS STEP 1] for the version we use. Quote the doc URLs you relied on.

The difference from Context7: llms.txt comes straight from the library’s maintainers, so there is no third-party index in between, but it is not searchable and it covers one site. The agent needs a web fetch tool, and large llms-full.txt files can fill a big part of the context window.

TerminalAbout 5 min

5. Add vendor skills for the platforms you use most

Some vendors publish Agent Skills that carry their current guidance, and the agent loads them only when the task matches. Examples in our directory include claude-api from Anthropic, gemini-api-dev from Google and wrangler from Cloudflare. Install the one for your main platform following its page, then repeat the step 1 test for a task on that platform.

Skills suit platforms you use every day, because they encode conventions as well as APIs. Context7 and llms.txt suit the long tail of libraries you touch once a month.

EditorAbout 5 min

6. Decide what to keep and write it down

Look at your three results. A typical outcome: Context7 for most third-party libraries, a vendor skill for your main platform, and llms.txt when a library is missing from Context7 or you want the maintainers’ own words. Record the decision in your instruction file so teammates and their agents work the same way, and add the MCP server at project scope (--scope project in Claude Code writes it to .mcp.json) if the whole team should get it.

Check it worked

Verification checklist

0 of 6 done

When it goes wrong

If the agent never calls Context7, the server is not connected or the instruction is too vague. Check /mcp, and name the library and version in the prompt.

If Context7 returns docs for the wrong library or version, give it the exact library ID and the version number. Library names are ambiguous (“next”, “router”), IDs are not.

If you hit rate limits, add an API key. Context7 recommends one for higher limits.

If the answer is still outdated, compare what the tool returned with the official docs. Context7’s index is built from projects’ public documentation, and it says itself that it cannot guarantee every entry is accurate. For anything security-relevant, check the maintainers’ docs directly.

Variations

Without MCP, use Context7’s CLI mode from ctx7 setup: the agent runs ctx7 library and ctx7 docs commands through a skill instead of calling MCP tools. It suits agents or environments where you prefer not to add MCP servers.

For your own internal libraries, publish an llms.txt at the root of your internal docs site, or write a small skill that points to the right pages. The build an MCP server for an internal API workflow covers the heavier option.

For pinned versions, add the lockfile version to every docs prompt. Documentation for “latest” is just as wrong for a project on last year’s release as training data is for one on this year’s.

Context engineering basics explains why what the agent sees matters as much as how you ask, and connecting MCP servers to your agent covers setup in other clients. The llms.txt glossary entry gives the short definition, and a useful AGENTS.md is a good place to record which docs source the team chose. More recipes are in the AI workflow examples hub.

Outcome and tools

Outcome
Your coding agent looks up current documentation for the libraries you name before writing code, and you can see when it did.
For
Developers
Variants for
Claude Code, Codex, Cursor
  • Context engineering techniques: what the model should see

    What to put in a model's context at each step, what to leave out, and how instruction files, retrieval and tools fit.

    TutorialIntermediate30 min

  • MCP explained: hosts, clients, servers and transports

    What MCP is and how the Model Context Protocol connects AI apps to tools and data: hosts, clients, servers, transports and what the 2026-07-28 spec changed.

    TutorialBeginner20 min

  • llms.txt

    A proposed Markdown file at a website's root that summarises the site and links to its key documentation pages for language models.

    Glossary

  • Context7

    Serves current, version-specific library documentation to coding agents over MCP.

    Tool

  • MCP in production

    An MCP course for production use: connect clients, build and test servers for a team, secure remote servers and keep up with changes to the MCP specification.

    Learning pathAdvanced6 h9 steps

Back to top