---
title: Best Practices
description: Get the most out of Docfork with copy-paste rules and practical patterns.
---
import { Callout } from "fumadocs-ui/components/callout";
import { Conversation, Message, Action } from "@/components/conversation";
## Add a rule
Set one persistent rule so your agent uses Docfork automatically — no prompt suffix needed.
- **Claude Code:** `CLAUDE.md`
- **Cursor:** `Settings -> Cursor Settings -> Rules`
- **Other MCP clients:** global instructions or project rule file

Paste this into your client's rule config:
```markdown title="CLAUDE.md" theme={null}
## Docfork policy
Use Docfork MCP for library/API docs, setup, and configuration questions.
- Always provide the `library` parameter when calling `query_docs`. Use exact `owner/repo` when known, otherwise a short query/name.
- Call `query_docs` first. Only call `fetch_url` when the returned chunks are not enough — and only with URLs from `query_docs` results.
- Prefer Docfork results over training data when they conflict.
```
## Use exact library IDs
Skip the guessing step. If you know the library, pass its `owner/repo` directly and the agent resolves docs in one call.
```txt theme={null}
Implement basic auth with Supabase. Use Docfork library supabase/supabase.
```
## Scope results with Cabinets
Set a [Cabinet](/core/cabinets) to lock every query to your stack:
- Add your libraries (`vercel/next.js`, `better-auth/better-auth`, `drizzle-team/drizzle-orm`)
- Set the `DOCFORK_CABINET` header in your MCP config
- Every `query_docs` call returns only docs from that Cabinet — no context leaks
## Navigate broader docs with parent paths
`fetch_url` supports trimming a chunk URL to its parent path. This returns a table of contents instead of a single section — useful when you need to explore before committing to a deep read.
## Prompt patterns
| Goal | Prompt |
| ------------ | ------------------------------------------------------------------------------------ |
| Feature work | `Implement webhook verification with Stripe. Use Docfork. Run tests after.` |
| Bug fix | `Fix this Next.js middleware error. Use Docfork docs, then verify with build.` |
| Config/setup | `Set up Drizzle with PostgreSQL migrations. Use Docfork and provide exact commands.` |
<Callout type="info" title="Keep the rule small">
Short rules get followed more reliably in long sessions. Core policy goes in your rule file.
Task-specific details go in the prompt.
</Callout>