Guide · GAOBA AI Resources

7 Rules to Protect Your Project with AI Agents

A practical guide (in Arabic): 7 rules that keep your project safe when an AI agent edits your files, each with a ready prompt to copy into Claude Code or Cursor.

If the PDF does not open inside Instagram, tap ⋯ (top corner) and choose “Open in browser”.

Cover of the “7 Rules to Protect Your Project with AI Agents” guide by GAOBA AI

An “agent” (AI agent) is an AI that edits your project's files by itself, not one that only answers your questions.

When AI edits your project fast, you need a system that keeps the changes in order and protects you from chaos: every task on its own branch, and if the agent gets it wrong, you simply don't merge its changes.

It's the same idea as GAOBA AI's reel about Pando, turned into 7 simple rules. Each rule comes with a ready prompt you copy and paste to the agent. You don't need to be a programmer.

What you get

  • A safe restore point before every change, so you can go back to a working version in seconds.
  • Every task on a separate branch, so the original stays intact until you approve.
  • A plan before any edit, and a plain-language review of the changes before merging.
  • A clear emergency button when things break, and protection for API keys and passwords.
  • Steps specific to Claude Code and Cursor, plus a permanent rules file you add once.
  • A 6-point checklist to run before every session.

Before you start (once only)

Make sure your project is saved in Git. Git is your project's “save history”: every save point is one you can go back to.

Copy & paste

Make sure the project uses Git. If it doesn't, run git init, add a .gitignore that suits the project, and make the first save (commit) named "start". Don't change any other code. Then tell me what you did in two sentences.

The rules 7

  1. Rule 1

    A restore point before every request

    Before any big change, save the version that works. If something breaks, you're back in seconds.

    Copy & paste

    Before you start this task, commit the current state as "before: <task name>". Don't start editing until you've confirmed the save is done.

  2. Rule 2

    Every task on its own branch

    A branch is a side copy of your project. The agent works there and the original stays intact until you approve. It's the same idea as the “private lane” in Pando.

    Copy & paste

    Create a new branch named task/<task-name> and work only there. Never touch the main branch (main), and don't merge until I say "merge".

  3. Rule 3

    Plan first, edit later

    Have the agent tell you what it's going to do before it touches any file.

    • Claude Code: Turn on Plan Mode before big tasks.
    • Cursor: Ask for the plan in the chat first.
    Copy & paste

    Don't edit any file yet. Write me a short plan: which files you'll change, why, and what could break. Wait for my approval before doing it.

  4. Rule 4

    One small task at a time

    One big request means many changes that are hard to undo, so split it up. And never run two agents on the same file at the same time.

    Copy & paste

    Do only the first step of the plan, commit it, and stop. Don't continue to the second step until I've reviewed.

  5. Rule 5

    Review before you merge

    You don't need to be a programmer: ask the agent to explain the changes in plain words.

    Copy & paste

    Show me a summary of all the changes on this branch compared with main (git diff), in plain words: what changed, why, and whether any file was deleted or any setting changed. Don't hide anything.

  6. Rule 6

    The emergency button

    If the project breaks, don't let the agent “fix” on top of the mess. Go back to the last working version.

    • Claude Code: It has checkpoints you can return to with the /rewind command.
    • Cursor: It has a Restore Checkpoint button next to the chat messages.
    Copy & paste

    Stop editing. Restore the project to the last commit whose name starts with "before:" without deleting the history, and tell me exactly what you restored.

  7. Rule 7

    Keys and secrets never get pushed

    API keys and passwords belong in a .env file, and that file never goes into Git.

    Copy & paste

    Make sure .env and every key file are listed in .gitignore. Scan the project: is there any API key or password written in the code or saved in Git? If you find one, tell me exactly where and how to move it to .env. Don't push anything.

Claude Code and Cursor

Where each tool fits into the rules.

  • Claude Code

    • Plan Mode before big tasks.
    • Checkpoints you can return to with /rewind.
    • The permanent rules file goes in CLAUDE.md in the project folder.
  • Cursor

    • Ask for the plan in the chat before any edit.
    • A Restore Checkpoint button next to the chat messages.
    • The permanent rules file goes inside .cursor/rules or in AGENTS.md.

The permanent rules file (paste once, the agent follows it every time)

Put these rules in a file inside your project and the agent follows them in every session without you repeating them.

  • Claude Code: Put it in a CLAUDE.md file in the project folder.
  • Cursor: Put it in a rules file inside .cursor/rules or in AGENTS.md.
Copy & paste

# Working rules for this project - Before any task: commit named "before: <task>". - Always work on a task/<task-name> branch; never edit main directly. - Show the plan and wait for approval before editing more than one file. - Do one step, commit it, and stop for review. - Don't delete files or change database or payment settings without explicit approval. - Never write API keys or passwords in the code. Use .env. - Don't merge into main until I say "merge". - After every step: summarise the changes in plain words.

Quick checklist before every session

  • The last working version is saved (commit)
  • The agent is on its own branch, not on main
  • I've seen the plan and approved it
  • The task is small and single
  • I reviewed the summary of changes before merging
  • .env is listed in .gitignore

What you need

  • Claude Code or Cursor, or any AI agent that edits your project's files.
  • A project saved in Git (the guide shows how to set this up with one prompt).

Keep the guide with you

Every rule and prompt on this page, in one PDF to keep on your phone or computer.

Download PDF