AI × AI Projectby Rodrigo Jorge
AI × AI resource · For people building a site or app with AI

Building securely with AI

Two prompts for people who build with AI and do not work in security. One reviews what you have already built. The other sets ground rules before your first request.

Version 1.0 · December 2, 2026
Free to share · CC BY-SA 4.0
Ler em português
01How to use

What's here

  • Review an app you have already builtThe AI that built the app reads the project, answers twelve questions with the file as evidence, and delivers a report on what to fix first.
  • Before you buildFive questions about the app you are about to build. You get back the security rules to paste into the project instructions.

AI will hand you an app that works. Whether it is secure is a separate question, and the AI only addresses it if you ask. One example: the calculation that is your competitive edge ends up in the code sent to the browser, where anyone can read and copy it. If you do not work in security, you do not know what to ask. These two prompts bring the questions.

Do not paste passwords or API keys into the conversation with the AI. The prompts do not ask for them. If the review finds a key in the code, the report shows only its first four characters and where it is.

The review reads the code. It does not test the live app and does not replace a review by a security professional.

02Review

Review an app you have already built

Paste the prompt into the tool where the app was built: Lovable, Bolt, v0, Replit, Cursor, Claude Code, or similar. That is where the AI can see the code. In a regular chat, without the project open, it says it cannot do the review and stops.

It asks four questions about the app, reads the project, and delivers the report, most serious issues first. Each item says what it is, what someone could do with it, which file it is in, how to fix it, and a ready-to-paste prompt for the AI. At the end come the three fixes to do first and what it could not tell from the code, such as the database and hosting dashboards, with where to look.

The report does not say the app is secure and gives no score. During the review the AI only reads: it changes nothing.

Prompt 1 · Review an app you have already built
Show the prompt
You are going to review the security of this project for the person who built it with the help of AI. They do not work in security. Everything you need is in this text. Do not search the web, do not explain the topic, and do not confirm that you understood.

BEFORE YOU START
- If you cannot open the project files in this conversation, say so on the first line and stop. Ask the person to paste this text into the tool where the app was built (Lovable, Bolt, v0, Replit, Cursor, Claude Code, or similar). Do not do the review from memory or from the person's description.
- This review is read-only. Do not change, create, or delete any file, and do not run anything that changes the database or what is live.

FIRST MESSAGE (send it all at once and wait for the answer)
1. Warning: do not paste passwords or API keys into this conversation.
2. Four questions, in plain language. "I don't know" is a valid answer.
   a) What does the app do, and who uses it: just you, your team, customers, anyone on the internet?
   b) Is it already live? Does it have real users?
   c) Does it take payments or store other people's data (name, email, phone, government ID number, address, health information, financial information)?
   d) Is there something proprietary that you do not want copied (a formula, a calculation, a pricing table, a prompt)?

AFTER THE ANSWER, READ THE PROJECT
Open the files. Do not answer from what you remember writing. For each question below, look in the code and note the file.

A. What runs in the browser
Everything that runs in the browser (the frontend) can be read and changed by anyone, using the browser's built-in tools.
1. Which calculations, formulas, prices, discounts, scores, or business rules are in the code sent to the browser?
2. Is any permission check (viewing a screen, using a paid feature, acting as an administrator) done only in the browser, by hiding a button or a page, with no check on the server or in the database?
3. Does the server trust any value from the browser without checking it: price, total, user ID, role, plan, paid status?

B. Keys and passwords
4. Is there an API key, password, or token hardcoded in the code, in a config file that is in the repository, or in a variable that is sent to the browser (for example the ones starting with VITE_, NEXT_PUBLIC_, PUBLIC_, or REACT_APP_)? A key that is meant to be public, such as the Supabase anon key, is not an issue: say it is public and what protects it.

C. Other people's data
5. For each database table or collection: who can read it and who can change it? Are there access rules in the database (for example Row Level Security in Supabase, or Firebase security rules)? A rule that allows everything counts as no rule.
6. Can a logged-in user see or change another user's data by changing an ID in the URL or in the request?
7. Which routes, functions, or endpoints work without login? Does any of them read, write, delete, send email, or cost money?
8. Where are user-uploaded files stored? Is access public? Are file type and size limited?

D. Login
9. How does someone become an administrator? Can a regular user change their own role or plan?

E. Money and third-party services
10. If there is payment: is the amount charged set on the server? Is the payment provider's webhook signature verified before the app delivers what was bought?
11. If the app calls an AI service or another paid service: is the call made from the server? Is there a per-user limit? Can someone who is not logged in run up charges?

F. What is left exposed
12. What was left on that should not be in production: a test page or route, a test user and password, an error message that shows internal details, a log with a password, token, or personal data?

HOW TO CLASSIFY EACH QUESTION
- issue found: you saw it in the code. Give the file and, if you can, the line or the snippet.
- no issue found: you opened the files that handle this and found nothing. Say which ones you opened.
- cannot tell from the code: the answer is outside the code (database dashboard, hosting dashboard, domain settings, server environment variables). Say where the person should look and what to look for.
- not applicable: the app does not have this (for example, it has no payment). Say what you based that on.
Do not write "issue found" without a file. Do not write "no issue found" without having opened the files. When in doubt, "cannot tell from the code". If the issue exists only depending on something the code does not show (for example, how the hosting handles a request), it is "cannot tell from the code", with what to check, and it does not go on the list of fixes.

REPORT
Write for someone who does not work in security. Short sentences. Use a technical term only with a one-line explanation the first time. In this order:
1. What was reviewed: what the app does, in one line, and which parts of the project you read. If any part was not read, say which.
2. What needs fixing, from most serious to least serious. Rank by the effect the code shows, not by the worst case you can imagine: an annoyance or a small cost goes in d).
   a) anyone on the internet, without logging in, can read or change other people's data, use one of your keys, or spend your money;
   b) a logged-in user can do something they should not: see another user's data, become an administrator, use a paid feature without paying, change a price;
   c) your proprietary logic is in the browser and can be copied (use the answer to question d);
   d) everything else.
   For each item:
   - What it is, in one sentence with no jargon.
   - What someone could do with it, in a concrete example from this app.
   - Where it is: file and snippet.
   - How to fix it, in one sentence.
   - Ready-to-paste prompt: the text the person pastes into the AI to fix only this item. It says what to change, asks that nothing else be changed, asks the AI to explain what it will do before touching the live database, and asks at the end for a list of what changed and a way to test it. If the fix touches several parts of the app, say that it is a large change and split it into smaller prompts, in the order they should be run.
3. If you found an exposed key or password: give the file and the variable name, and show at most the first four characters. Warn that the key must be treated as compromised: removing it from the code is not enough. A new one has to be generated in the service's dashboard and the old one revoked.
4. Three fixes to do first: three items from the list above, one item per fix, without combining several into one. One at a time, testing the app after each. If a key is exposed, rotating the keys comes first and does not count as one of the three. If the list has fewer than three items, write the ones there are; if it has none, write "no fixes identified in this review".
5. What you could not tell from the code: each item, where to look, and what to look for.
6. Result per question: the twelve questions, one line each, with the classification (issue found, no issue found, cannot tell from the code, not applicable) and the files opened.
7. Limitations, with these three sentences: "This review read the code. Nothing was run or tested against the live app." "An AI reviewing code it wrote itself will miss issues." "Before you take payments or store other people's sensitive data, have a security professional review the app."
8. Last line: "Prompt: AI × AI Project (IA × IA), Rodrigo Jorge, iaxia.rodrigojorge.me (CC BY-SA 4.0)".

RULES
- Use only what is in the files and what the person answered. Do not assume a protection you did not see.
- Do not say the app is secure, and do not give a score, a percentage, or a badge. "No issue found" does not mean there are no issues.
- Do not fix anything during the review, even if the person asks partway through. Deliver the report first.
- Do not recommend vendors or products other than the ones the project already uses.
- Do not cite statistics or cases from other companies.
- No praise, no introduction, no offer of help at the end.

After the report

  • Fix one item at a time and test the app after each.
  • If a key or password turned up in the code, removing it is not enough. Generate a new one in the service's dashboard and revoke the old one.
  • Run the review again after the fixes.

The twelve questions

This is what the AI checks in the project. You can also use them to check things yourself.

Question
A · What runs in the browser
1Which calculations, formulas, prices, discounts, scores, or business rules are in the code sent to the browser?
2Is any permission check (viewing a screen, using a paid feature, acting as an administrator) done only in the browser, by hiding a button or a page, with no check on the server or in the database?
3Does the server trust any value from the browser without checking it: price, total, user ID, role, plan, paid status?
B · Keys and passwords
4Is there an API key, password, or token hardcoded in the code, in a config file that is in the repository, or in a variable that is sent to the browser (for example the ones starting with VITE_, NEXT_PUBLIC_, PUBLIC_, or REACT_APP_)? A key that is meant to be public, such as the Supabase anon key, is not an issue: say it is public and what protects it.
C · Other people's data
5For each database table or collection: who can read it and who can change it? Are there access rules in the database (for example Row Level Security in Supabase, or Firebase security rules)? A rule that allows everything counts as no rule.
6Can a logged-in user see or change another user's data by changing an ID in the URL or in the request?
7Which routes, functions, or endpoints work without login? Does any of them read, write, delete, send email, or cost money?
8Where are user-uploaded files stored? Is access public? Are file type and size limited?
D · Login
9How does someone become an administrator? Can a regular user change their own role or plan?
E · Money and third-party services
10If there is payment: is the amount charged set on the server? Is the payment provider's webhook signature verified before the app delivers what was bought?
11If the app calls an AI service or another paid service: is the call made from the server? Is there a per-user limit? Can someone who is not logged in run up charges?
F · What is left exposed
12What was left on that should not be in production: a test page or route, a test user and password, an error message that shows internal details, a log with a password, token, or personal data?

Author's proposalThe questions are mine. They cover what matters most in an app built by someone outside security: what ends up in the browser, keys, access to other people's data, login, payment, and what is left exposed. They do not cover everything.

03Before

Before you build

For people who have not started yet, or are about to start a new project. This prompt works in any AI assistant. It asks five questions about the app and delivers the security rules to paste into the project instructions.

The rules tell the AI, from the first request, what stays on the server, how to handle keys, who can read each piece of data, and what it has to report when it finishes. You also get a list of what only you can do outside the code, plus three questions to ask after each part is finished.

Prompt 2 · Before you build
Show the prompt
You are going to write the security rules for an app that a person will build with the help of AI. They do not work in security. The rules will be pasted into the project instructions, in the tool where the app will be built, so the AI follows them from the first request. Everything you need is in this text. Do not search the web, do not explain the topic, do not confirm that you understood, and do not start building the app.

FIRST MESSAGE (send it all at once and wait for the answer)
1. Warning: do not paste passwords or API keys into this conversation.
2. Five questions, in plain language. "I don't know" and "I haven't decided yet" are valid answers.
   a) What will the app do, in two sentences, and who will use it: just you, your team, customers, anyone on the internet?
   b) Will people log in? Will there be different types of users, such as customer and administrator?
   c) What data about other people will it store (name, email, phone, government ID number, address, health information, financial information)? Will it accept file uploads?
   d) Will it take payments or use a pay-as-you-go service, such as AI, email, SMS, or maps?
   e) Is there something proprietary that you do not want copied (a formula, a calculation, a pricing table, a prompt)? And which tool will you build in, if you already know?

AFTER THE ANSWER, DELIVER IN THIS ORDER
Start directly with item 1, with no opening sentence.

1. "Paste this into the project instructions". A block of text to copy, at most 350 words, written as instructions to the AI that will build the app. Start the block with: "Security rules for this project. They apply to every request. If a request of mine conflicts with a rule, warn me before doing it."
   Build the block from the rules below. Use the words of the person's app (the name of the calculation, the types of users, the data they mentioned). Drop any rule that does not apply. If the person answered "I don't know" or "I haven't decided yet", keep the rule, starting it with "If the app ever has...".
   - Browser and server: everything sent to the browser (the frontend) can be read and changed by anyone. Calculations, prices, discounts, and business rules run on the server; the browser only displays the result. If the person named something proprietary, say by name that it never goes into the browser code.
   - Permissions: every permission is checked on the server or in the database, on every call. Hiding a button or a page is not a control.
   - Values from the browser: the server never trusts a price, total, user ID, role, plan, or paid status sent by the browser. Those values come from the login session and the database.
   - Keys: no secret key, password, or token in the code, or in a variable that is sent to the browser. The secrets file (for example .env) stays out of the repository. When a key is needed, ask the owner to add it in the tool's secrets settings; never ask them to paste it into the conversation.
   - Database: every table is created with access rules turned on. Each user reads and changes only their own data. No rule that allows everything. A user cannot change their own role or plan.
   - Other people's data: each piece of data is readable only by the person it belongs to and by whoever needs it to provide the service. Health information, government ID numbers, and financial information never go into logs, error messages, or public links.
   - Routes: every route or function requires login, except the ones the owner approves as public. Public ones validate their input and are rate limited.
   - Files: stored in a private location, with limits on type and size, served through expiring links.
   - Administrator: the administrator role is assigned directly in the database, by the owner. The app has no screen or route that promotes a user.
   - Payment: the amount is set on the server. The payment provider's webhook signature is verified before the app delivers what was bought.
   - Pay-as-you-go services: the call is made from the server, requires login, and has a per-user limit. The system prompt stays on the server.
   - Production: no test routes, no test users, no passwords, tokens, or personal data in logs. Error messages show no internal details.
   - At the end of every request, the AI reports: what was put in the browser, which routes are public, and which access rules each new table has. If it cannot follow a rule, it stops and says so instead of working around it.

2. "Where to paste it". One or two lines: in the project instructions or project knowledge, if the tool has that field; if it does not, at the start of the first conversation and of every new conversation. If the person said which tool they will use and you are not sure what the field is called there, tell them to look for the project instructions field; do not make up the name.

3. "What only you can do". Up to five items, only the ones that apply to the app, one line each:
   - Store API keys in the tool's secrets settings, never in the conversation.
   - Set a spending limit and an alert on every pay-as-you-go service.
   - After the first version, open the database dashboard and check that every table has its access rules turned on.
   - Turn on two-factor authentication (2FA) on your accounts with the tool, the database, the domain registrar, and the payment provider.
   - Do not go live with other people's real data before running the review.

4. "Three questions to ask the AI after each part is done", exactly these:
   - What did you put in the browser that should be on the server?
   - Which routes work without login, and what does each one do?
   - For each table, who can read it and who can change it?

5. Limitations, with these two sentences: "These rules reduce security issues; they do not guarantee the app has none. Before you go live, run the review of what was built." "Before you take payments or store other people's sensitive data, have a security professional review the app."

6. Last line: "Prompt: AI × AI Project (IA × IA), Rodrigo Jorge, iaxia.rodrigojorge.me (CC BY-SA 4.0)".

RULES FOR YOU
- Use only what the person answered. Do not invent a feature, a type of user, or data they did not mention.
- Do not recommend vendors or products other than the tool the person said they will use.
- Do not cite statistics or cases from other companies.
- Outside the block to copy, write for someone who does not work in security: short sentences, and a one-line explanation the first time you use a technical term.
- No praise, no introduction, no offer of help at the end.

Rules reduce security issues; they do not guarantee the app has none. Before you go live, run the review.

04Limitations

What these prompts do not do

  • The review reads the code. Nothing is run or tested against the live app.
  • An AI reviewing code it wrote itself will miss issues. "No issue found" does not mean there are no issues.
  • The AI cannot see what is outside the code, such as the database, hosting, and payment provider dashboards. The report lists where to look.
  • The Portuguese prompts were tested on December 1 and 2, 2026, on Claude models, by simulation, with sample apps written for the test. The English prompts are a translation of them, reworded on December 2, 2026 after a terminology review. In English, each was run once on a Claude model (Haiku), by simulation; the review prompt was run again after the rewording, the other one was not. Neither version was tested inside Lovable, Bolt, v0, Replit, or Cursor, or on ChatGPT or Gemini.
  • Before you take payments or store other people's sensitive data, have a security professional review the app.

Author's proposalThe twelve questions, the rules, and the text of the two prompts are mine. If your app has an AI assistant for its users, see also Test your AI.