TLDR
- Use the provided
search_docsandmy_docsprompts - When you know your prompt will require working with a tricky library, use Ref’s default prompts. - Guide the model with rules files - Set up a project rules file so the model always knows when you want it to use Ref.
How coding agents use Ref
Coding agents leverage Ref’s MCP tools to access documentation at the right moment. Understanding when and how agents use Ref helps you guide them more effectively.1. When explicitly guided by the user
Agents use Ref when you explicitly instruct them to search documentation. This is the most reliable way to ensure agents access the latest docs. Example prompts:implement cors in my firebase functions, check docs with ref/Ref:search_docs langchain streaming callback handler implementation pythonlook up how i explained ref.tools in my yc application in my private docs
search_docs- Guides agents to search public documentationmy_docs- Directs agents to search your private resources
/Ref and your IDE or CLI will autocomplete these prompts.
2. When encountering lint errors
When a coding agent detects errors related to library or API usage, they will search Ref for documentation without user guidance. Example flow:- Agent hallucinates a function name that doesn’t exist.
- Linter flags the error.
- Agent searches relevant documentation and applies the correct pattern.
AGENTS.md or similar file.
Guiding Agents with Rules Files
Rules files let you provide consistent instructions to coding agents. They’re especially powerful for directing agents to use Ref automatically.Example Rules File Content
Rules files typically include project-specific instructions that guide AI agents in how to work with your codebase. For Ref integration, they should specify when and how to search documentation. They should generally be simple and direct. ✅ Recommended for everyone It’s helpful to provide a basic level of guidance to the agent that you want it to check docs with Ref.Rules Files
Different AI coding tools support different rules file formats:| File | Location | Supported Tools | Description |
|---|---|---|---|
AGENTS.md | Project root | Cline, Windsurf, Roo Code, Goose, and other MCP-compatible tools | Vendor-neutral instructions file that works across multiple AI coding assistants |
.cursorrules | Project root | Cursor (legacy) | Legacy rules file for Cursor IDE |
.cursor/rules/ | .cursor/rules/ directory | Cursor | Recommended location for Cursor rules files |
CLAUDE.md | Project root | Claude Code, Claude API integrations | Claude-specific instructions with tool-specific guidance |
.windsurfrules | Project root | Windsurf | Windsurf Cascade-specific rules |
copilot-instructions.md | .github/ directory | GitHub Copilot | GitHub Copilot-specific instructions |
AGENTS.md as your primary rules file. It’s supported by most modern AI coding tools that implement MCP or read standard project files.
Next Steps
Add Private Resources
Build your own custom index of private documentation sources for you or your team.