Using AI Agents in Cursor: Rules, Context, and Review
By Darus S Alfatah · 2025-09-09 · Tutorial · 6 menit
Author note: We give Cursor a short project rule so its suggestions match our code style.
Why Rules Matter
An agent without project context guesses conventions. It invents naming styles, imports libraries you do not use, and writes tests in a framework you abandoned. A short rules file fixes most of this before it happens.
Write the rules once, keep them current, and treat them as part of the repository rather than personal notes.
Step-by-Step Workflow
- Add a rules file describing language, style, and test framework.
- Ask the agent to summarise the project structure first.
- Give one specific, verifiable task at a time.
- Review the diff before running tests.
- Run the build and test suite.
- Commit with a message explaining the change.
- Start a new session for the next unrelated task.
Keeping Context Small
Large context is expensive and dilutes attention. Reference only the files involved, and close unrelated tabs. When a task spans many files, describe the flow in words instead of attaching everything.
Review Discipline
Read every change. Pay attention to error handling, database queries, and configuration, where plausible mistakes hide. If a diff is too large to review carefully, ask for it to be split.
When to Stop
If three attempts fail on the same task, stop and restructure. Repeated failures usually mean the task is too broad or the code is too tangled for the agent to navigate, and continuing simply burns tokens.
Frequently Asked Questions
Should the agent commit? Let it prepare changes; commit yourself after review.
How large should tasks be? Small enough that the diff can be read in a few minutes.
Do rules really help? Yes; they reduce style churn more than any prompt trick.
What about secrets? Never give the agent production credentials.
How do I measure benefit? Track review time and defects, not just typing speed.
Conclusion
Agents accelerate mechanical work when the project has clear rules and tasks stay small. The review step is what keeps the speed-up from becoming technical debt.
Working With Tests
Ask the agent to write tests first, review them for coverage of edge cases, then request the implementation. This order makes the acceptance criteria explicit and prevents the agent from inventing behaviour that was never asked for.
If the project has few tests, spend one session adding them around the module you are about to change. It is the highest-leverage preparation before delegating work to an agent.
Documentation of Changes
Require a short summary per change: what was modified, why, and what was verified. When something breaks two weeks later, that note is the fastest path to the cause. It also slows down careless edits, since the agent must state its intent.
Team Adoption
Share the rules file and a short guide with the team. When everyone uses the same conventions, agent output becomes predictable and review faster. Revisit the guide monthly as the project evolves.
Track two numbers after adoption: time to review and defects found after merge. If review time grows faster than coding time shrinks, tasks are too large and should be split.
An example project rule: A short rule like use TypeScript, avoid new dependencies, and keep comments short keeps suggestions aligned with the team style.
Frequently Asked Questions
Can beginners follow this tutorial?
Yes. The steps are explained in order with code examples, suitable for beginners and experienced developers alike.
Is BankAI’s endpoint compatible with the library I already use?
Yes, BankAI is 100% OpenAI-compatible, so libraries such as the OpenAI SDK and LangChain work without code changes beyond the Base URL and API key.
Where do I get an API key to follow this tutorial?
You get the API key (and Secret Token) after registering and completing payment in the BankAI dashboard.