Manuals / AI Coding with Cursor / Chapter 3
A · Task Design · beginner · ~30 min · Chapter 3 of 11
Context management for code agents
Agents work best with focused context. Open relevant files, use .cursorrules, and keep conversations scoped to one feature at a time.
Path progress23%
Step 1 of 2
Write .cursorrules
Project conventions the agent should always follow: test framework, naming, lint rules, commit style.
Example
# .cursorrules
- Use Vitest for tests, not Jest
- Components in PascalCase, hooks in camelCase with "use" prefix
- All API calls go through src/api/client.ts
- Prefer functional components with TypeScript
- Run `npm run lint` before considering a task doneDo this now
Create .cursorrules with 5 project-specific rules. Run an agent task.
Was this step clear?
Chapter learning outcomes
- .cursorrules
- Focused context
- Conversation scoping
Clear these before you leave
Side quest
Rules iteration
After 3 agent tasks, update .cursorrules with one new rule.