HackIndia Logo
HackathonsNewsSkillsGrowth
HackIndia LogoContact: +91 9910125804

General

  • Companies
  • Colleges
  • Board of Advisors
  • Brand Ambassadors
  • FAQ
  • Contact
  • Report a Bug

Hackathons

  • Upcoming Hackathons
  • Judges
  • Mentors
  • Partners
  • Participating Colleges
  • Testimonials

Resources

  • About Us
  • Branding
  • Latest News
  • Growth
  • Skills
  • Builders
  • Ecosystem
  • Forum
  • Ideas
  • Prompt Optimizer
  • Games

© 2026 HackIndia. All rights reserved.

Privacy PolicyTerms of ServiceCode of ConductSitemap

Build 2.139 · 05 Nov 2026, 10:27 UTC

    HackIndia
    HackathonsNewsInternshipsSkillsGrowthPro Perks
    ← Use AI Coding Assistants Safely

    All the reading

    AI Coding Tools

    8 lessons, about 38 minutes. The check's questions come from these.

    Contents
    Prompting with real code
    1. 1. Prompt With Real Context
    2. 6. Use AI To Learn Codebases
    3. 7. Stay Interview Ready
    Repo rules and secrets
    1. 2. Add Repo Instructions
    2. 3. Keep Secrets Out
    3. 8. Submit Your Reviewed Repo
    Reviewing AI output
    1. 4. Review Before You Accept
    2. 5. Catch Invented APIs

    Prompting with real code

    1. Prompt With Real Context

    5 min

    In 30 seconds
    • Write prompts that include goal, files, constraints, and expected output.
    • Ask the assistant to inspect real code before suggesting changes.
    • Include test cases or checks so AI output is easier to verify.
    Key point

    The one idea

    Weak prompt: “Fix my auth bug.” Strong prompt: “Read these files, explain the bug, suggest the smallest change, and list checks I should run.”

    AI coding assistants work better when you give real project context. You still own the code and the final decision.

    Why context matters

    Copilot Chat can use extra context like your current file and chat history. That helps, but it does not know your full intent unless you say it.

    Unclear prompts often produce code that looks correct but does not fit your app. In a hackathon, that wastes time during demo prep.

    Your to-do

    What to include

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    0 of 5 done

    Common mistake

    Do not ask blindly

    Do not ask the assistant to guess your codebase. If it has not opened or read the relevant files, tell it not to speculate.

    6. Use AI To Learn Codebases

    5 min

    In 30 seconds
    • Ask AI to map a codebase using real files, not guesses.
    • Use focused questions to understand routes, data flow, and risky areas.
    • Save your learning notes so your README proves review ownership.
    Key point

    One rule

    Make the assistant read the code before it explains the code. If it has not inspected the relevant files, treat the answer as a guess.

    Why this matters

    In internships and hackathons, you often join an existing repo. You need to understand it fast without pretending you wrote every line yourself.

    AI can help you build a map. But it can also fill gaps with confident nonsense. Your job is to ask narrow questions, check the files, and keep notes you can explain later.

    Your to-do

    Ask better questions

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    0 of 5 done

    7. Stay Interview Ready

    4 min

    In 30 seconds
    • Explain AI-assisted code like it is your own work.
    • Keep a simple review log for features you used AI on.
    • Prepare interview answers from real commits, tests, and tradeoffs.
    Key point

    Own every line

    In an interview, “AI wrote it” is not an explanation. You need to explain what the code does, why you kept it, how you checked it, and what you would change next.

    Treat the assistant like a fast teammate, not the project owner. You are still responsible for reviewing and validating suggestions before accepting them.

    What interviewers ask

    For internships, expect simple but direct questions. “Walk me through this feature.” “Why this database schema?” “What bug did you find?” “How did you test it?”

    If your repo shows AI use, that is fine. The risk is not using AI. The risk is being unable to explain your own submission.

    Your to-do

    Build your proof

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    0 of 5 done

    Repo rules and secrets

    2. Add Repo Instructions

    5 min

    In 30 seconds
    • Add repo-level instructions so AI tools understand your project rules.
    • Create path-specific notes for risky folders like auth, payments, and database code.
    • Keep instructions short, current, and useful for review.
    Key point

    One idea

    Do not make every AI chat start from zero. Put your project rules inside the repo so the assistant sees the same context when it helps you code or review.

    Good instructions say what the app does, how to run checks, what patterns to follow, and what risks to watch.

    Why this matters

    AI coding assistants use more than your typed prompt. For example, Copilot Chat can use the current file and chat history, and supported instruction files can be added automatically to requests.

    That means your repo can guide the assistant before you ask anything. This is useful in a hackathon team where one person works on React, another on API routes, and another on database code.

    Your to-do

    Pick instruction files

    Reviewing AI output

    4. Review Before You Accept

    4 min

    In 30 seconds
    • Review AI code before it enters your main branch.
    • Use a small checklist: intent, diff, tests, risks, explainability.
    • Leave proof in your repo through tests or review notes.
    Key point

    Own the diff

    Treat AI output like a classmate’s pull request. Helpful, but not trusted by default.

    You are responsible for reviewing and validating generated code before you accept it. If you cannot explain a change in an interview, do not merge it yet.

    What to review

    Start with the diff, not the AI’s explanation. The explanation may sound clean while the code changes more than you asked for.

    Check whether the change matches your goal, touches the right files, keeps existing behavior, and avoids risky shortcuts like hardcoded secrets or unsafe user input handling.

    Your to-do

    Five-minute review loop

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    10 questions, 7 to pass.

    Sign in to take the test

    This matters when you use ChatGPT, Gemini, Claude, Copilot, or any editor assistant. A confident wrong answer is still wrong.

    Example

    Prompt template

    Use this when you are stuck on a feature or bug. Replace the bracketed parts with your project details.

    If your tool can read files from the repo, ask it to inspect them. If not, paste only the small relevant snippet, not secrets or full private files.

    Goal: [what I want to build or fix]
    
    Project context:
    - Stack: [React + Express + MongoDB, Flutter + Firebase, etc.]
    - Relevant files: [src/pages/Login.jsx, server/routes/auth.js]
    - Current behavior: [what happens now]
    - Expected behavior: [what should happen]
    
    Constraints:
    - Do not change [database schema / public API / existing UI]
    - Keep the solution simple for a hackathon demo
    - Do not add a new dependency unless needed
    
    Before answering:
    - Read the relevant files if you can access them
    - If you cannot see a file, ask me for it
    - Do not invent APIs or functions that are not in the code
    
    Output I want:
    1. Short explanation of the cause
    2. Minimal code change
    3. Tests or manual checks I should run
    4. Risks I should review before accepting
    Tip

    Add checks early

    Ask for tests or verification notes in the same prompt. AI can suggest checks, but you must still run them and review the code for issues like injection flaws or hardcoded secrets.

    For example, give one valid UPI ID and one invalid UPI ID if you are building a payment form validator. Concrete examples reduce guesswork.

    Example

    Better bug prompt

    Here is a realistic prompt for a college project repo. It asks for a small fix, not a full rewrite.

    Goal: Fix login redirect in my MERN hackathon app.
    
    Context:
    - Relevant files: client/src/pages/Login.jsx and server/routes/auth.js
    - Current behavior: after correct login, the page stays on /login
    - Expected behavior: redirect to /dashboard
    - Constraint: do not change the backend response shape unless necessary
    
    Please inspect the files before suggesting code. If you cannot see them, ask me to paste the specific parts.
    
    Return:
    1. likely cause
    2. smallest code change
    3. manual checks I should run in the browser
    4. any security issue you notice, especially token storage or hardcoded secrets
    Your to-do

    Do this now

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    0 of 5 done

    Example

    Good prompt

    Use this when you inherit a project from a teammate or an AI scaffold. It keeps the assistant grounded in the repo.

    Read the relevant files before answering.
    Do not speculate about files you have not opened.
    Goal: I need to understand how login works so I can review it safely.
    Please explain:
    1. Which files handle login routes, form submission, and session/token storage.
    2. The data flow from user input to server response.
    3. Any security risks you can confirm from the code.
    4. What I should test manually.
    If something is not present in the repo, write "not found".
    Tip

    Make a codebase map

    Create a short note while you learn. This is not extra work. It becomes proof that you reviewed the project instead of blindly accepting generated code.

    Keep it simple: main folders, key flows, risky files, and tests you ran. Add it to your README later as your review summary.

    Common mistake

    Common mistake

    Do not ask “explain this repo” and paste the answer into your README. That usually gives a broad summary, misses edge cases, and may mention files or APIs that are not real.

    Also avoid pasting secret files into external chats. Use repo instructions and scoped context where your tool supports it. Sensitive files should stay out of AI context.

    Example

    Learning note

    Keep a file like this locally or add a cleaned version to your README. It shows what you checked.

    AI-assisted codebase notes
    
    Feature reviewed: Login
    Files checked:
    - src/routes/auth.js
    - src/controllers/authController.js
    - src/middleware/session.js
    
    What I understood:
    - Login form sends email and password to POST /login.
    - authController checks the user record and creates a session.
    - session middleware protects private routes.
    
    Verification done:
    - Tried wrong password and got an error.
    - Tried valid login and reached dashboard.
    - Checked that no API keys or passwords are hardcoded in these files.
    
    Open questions:
    - Need to confirm session expiry behavior.
    Your to-do

    Do this now

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    0 of 5 done

    Tip

    Ask from files

    AI tools can use open files, chat history, and repo instructions as context. Still, do not assume the tool knows your intent.

    When asking for help, state the goal, constraints, and desired output. For codebase questions, tell the assistant to inspect relevant files and not guess about files it has not opened.

    Example

    Review note template

    Add a small review note while the work is fresh. Keep it short enough that you will actually maintain it during a hackathon night.

    This can go in your README or a separate file like REVIEW_NOTES.md.

    AI-assisted review note
    
    Feature: UPI-style payment status page
    Files changed: src/pages/PaymentStatus.jsx, src/api/orders.js
    AI help used for: refactoring UI states and suggesting edge cases
    What I checked:
    - Confirmed loading, success, failed, and expired states render correctly
    - Checked no API keys or tokens are in the frontend code
    - Tested with order IDs: valid, missing, and already paid
    What I rejected:
    - Removed an AI-suggested retry loop because it could call the API too often
    What I still need to improve:
    - Add automated tests for expired payments
    Common mistake

    Do not memorise scripts

    A common mistake is asking AI to generate interview answers, then memorising them. That breaks as soon as the interviewer asks a follow-up.

    Use AI to quiz you instead. Ask it to question you on your own code, one question at a time. Then answer without copying from the model.

    Your to-do

    Do this now

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    0 of 5 done

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    0 of 5 done

    Example

    Repo-wide example

    Start with a small file. You can improve it later. The goal is not to impress the AI. The goal is to reduce wrong assumptions.

    File: .github/copilot-instructions.md
    
    Project context:
    This is a hackathon project for college students to split group expenses and settle using UPI outside the app.
    
    Coding rules:
    - Use TypeScript for new app code.
    - Keep functions small and named by intent.
    - Do not add new dependencies unless the README explains why.
    - Do not hardcode API keys, tokens, phone numbers, or UPI IDs.
    
    Review rules:
    - Check for input validation in API handlers.
    - Check for hardcoded secrets or test credentials.
    - Check that generated code matches installed packages.
    - If a change affects settlement logic, ask for or add a small test case.
    
    Verification:
    - Run the existing test command before saying work is complete.
    - If tests are missing, write manual verification notes in the pull request or README.
    Example

    Path-specific example

    Use path rules when one part of the repo needs extra care. Auth, payments, database migrations, and admin panels are common examples.

    File: .github/instructions/backend.instructions.md
    
    Apply to: backend/**
    
    Backend rules:
    - Validate request body fields before using them.
    - Return safe error messages. Do not expose stack traces to users.
    - Keep database writes inside clear service functions.
    - For settlement or money-like amounts, use integer paise, not floating point rupees.
    - Add a test or manual verification note for every API behavior change.
    Common mistake

    Common mistake

    Beginners write vague rules like “write clean code” or “make it secure”. The assistant cannot apply that well during review.

    Write rules you can check. For example: “Do not hardcode secrets” is checkable. “Use integer paise for amounts” is checkable.

    Tip

    Use AI to draft

    Ask your AI tool to draft instructions after it reads your actual repo files. Then edit the result. Do not accept rules for tools, scripts, or folders that do not exist.

    A useful prompt is: “Read the README, package files, and main source folders. Draft concise repo instructions for coding and review. Do not speculate about files you have not opened.”

    Your to-do

    Do this now

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    0 of 5 done

    3. Keep Secrets Out

    5 min

    In 30 seconds
    • Spot secrets before they reach a public repo.
    • Use .env, .gitignore, and placeholders safely with AI tools.
    • Ask AI for a secret check without pasting real keys.
    Key point

    One rule

    Never paste or commit real secrets. A secret is anything that lets someone access money, data, accounts, servers, or APIs as you.

    AI coding assistants can use open files, chat history, and repo context. Keep keys out of files the assistant can read unless your tool and repo settings intentionally exclude them.

    What counts

    Common secrets include API keys, database URLs, JWT secrets, OAuth client secrets, service account JSON, private keys, access tokens, SMTP passwords, and payment gateway keys.

    For Indian hackathon projects, watch for Razorpay test keys, Firebase configs, MongoDB Atlas URLs, Supabase service role keys, Twilio tokens, and cloud credentials. Even test keys should not be public.

    Your to-do

    Store them safely

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    0 of 5 done

    Example

    Safe env setup

    Commit the example file. Do not commit the real one. Your README can tell judges to copy .env.example to .env and add their own values.

    # .gitignore
    .env
    .env.local
    *.pem
    service-account.json
    
    # .env.example
    MONGODB_URI="your_mongodb_connection_string"
    RAZORPAY_KEY_ID="your_razorpay_key_id"
    RAZORPAY_KEY_SECRET="your_razorpay_key_secret"
    JWT_SECRET="change_this_for_local_dev"
    Example

    Read, do not hardcode

    This pattern keeps secrets outside code. If an AI assistant suggests hardcoding a key, reject that part and ask for environment-variable based code.

    // Node.js example
    const express = require("express");
    require("dotenv").config();
    
    const app = express();
    
    const mongoUri = process.env.MONGODB_URI;
    if (!mongoUri) {
      throw new Error("Missing MONGODB_URI in environment variables");
    }
    
    // Use mongoUri to connect. Do not paste the real URI here.
    Common mistake

    Bad AI prompt

    Do not paste a real .env file into ChatGPT, Gemini, Claude, Copilot Chat, or any shared chat. OpenAI also warns not to include passwords, financial details, account numbers, or other sensitive personal information in shared content.

    Ask the assistant to review filenames and patterns instead. If you use ChatGPT, Temporary Chat does not show in history and is not used to train models, but you should still avoid entering secrets.

    Bad:
    Here is my .env. Fix my Razorpay integration: RAZORPAY_KEY_SECRET=rzp_secret_real_value
    
    Better:
    Review this code for hardcoded secrets. Do not ask me to paste secret values. Check for env variable usage and missing .gitignore entries.
    Tip

    Use AI safely

    Ask AI to create a secret checklist for your repo, then verify it yourself. AI can miss things, and current guidance says you are responsible for reviewing generated code before accepting it.

    If your tool supports content exclusion, use it for sensitive files. Remember that excluded files do not inform suggestions or code review, so do not expect the assistant to understand those values.

    Your to-do

    Do this now

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    0 of 5 done

    8. Submit Your Reviewed Repo

    5 min

    In 30 seconds
    • Prepare your repo so reviewers can see how AI helped and how you checked it.
    • Add proof: AI instructions, tests or verification notes, and no committed secrets.
    • Write a README section that you can defend in an internship or hackathon demo.
    Key point

    Proof beats claims

    A reviewed repo is not a repo where you say, “I used AI responsibly.” It is a repo where someone can see your instructions, checks, and decisions.

    Your goal is simple: make it easy for a judge, mentor, or interviewer to verify that you stayed in control.

    What reviewers look for

    They do not need your full chat history. They need evidence that the code was reviewed before it was merged or submitted.

    Show four things: project instructions for AI tools, tests or manual verification notes, no secrets in Git, and a README section explaining what AI helped with and what you checked.

    Your to-do

    Final repo checklist

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    0 of 5 done

    Example

    README review section

    Use simple language. Do not over-explain. Write it like something you can say in a placement interview.

    AI-assisted development review
    
    AI tools used:
    - Used an AI coding assistant to draft parts of the form validation and README.
    - Used AI to suggest test cases for login, empty fields, and invalid UPI ID format.
    
    How I reviewed the output:
    - Checked generated code before accepting it.
    - Verified package methods against the installed dependencies.
    - Ran the app locally and tested the main user flow.
    - Checked that no `.env` file, API key, token, or password is committed.
    
    Verification done:
    - Signup form rejects empty name and invalid email.
    - Payment screen shows an error for invalid UPI ID.
    - Project starts locally using the commands below.
    
    Known limits:
    - Payment is a mock flow for the hackathon demo.
    - No real money movement is implemented.
    Tip

    Use AI for the audit

    Ask your assistant to inspect the actual repo files before it comments. Give it the checklist and ask for missing proof, not praise.

    Still check the answer yourself. AI tools can miss secrets, misunderstand code, or suggest risky fixes.

    Prompt:
    Inspect this repository before answering. Do not guess about files you have not opened.
    Check whether the repo is ready for public hackathon submission.
    Look for:
    1. AI project instructions
    2. README section explaining AI-assisted development and review
    3. Tests or verification notes
    4. Possible committed secrets
    5. AI-generated code that needs security review
    Return only missing items and exact files to fix.
    Common mistake

    Do not submit vibes

    A common mistake is writing “Reviewed by AI” in the README. That is weak. AI review does not replace your review.

    Another mistake is making the repo public first and checking secrets later. Reverse the order. Check first, then publish.

    Your to-do

    Before you publish

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    0 of 5 done

    Your to-do

    Do this now

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    0 of 5 done

    0 of 5 done

    Tip

    Use AI as reviewer

    Ask the assistant to review the diff against clear criteria. Include your test cases or expected behavior so it can check against something concrete.

    Still verify the result yourself. AI can miss security issues, invent reasons, or approve code that only looks correct.

    Example

    Review prompt

    Use a prompt like this after the assistant writes code. It asks for review, not more code.

    Review this change before I accept it.
    Goal: Let users add an expense with amount, category, and note.
    Constraints:
    - Do not change authentication.
    - Do not store secrets in code.
    - Validate amount is a positive number.
    - Keep existing API response shape.
    Test cases to check:
    - amount = 100 should pass
    - amount = 0 should fail
    - amount = -50 should fail
    - missing category should fail
    Output:
    1. Files changed and why
    2. Possible bugs or security issues
    3. Tests I should run
    4. Anything I must understand before merging
    Common mistake

    Do not review vibes

    Beginners often accept code because the app starts. That is not enough.

    A feature can appear to work while storing wrong data, skipping validation, leaking secrets, or breaking another page. Review the exact change and the risky edges.

    Example

    Verification note

    Your hackathon repo should show proof that you reviewed AI-generated code. Keep it short and real.

    README section:
    
    AI-assisted review notes
    - Used AI to draft the expense creation endpoint.
    - Reviewed the diff before accepting.
    - Checked that no auth files were changed.
    - Verified amount validation for positive, zero, negative, and missing values.
    - Ran the add-expense flow locally.
    - Rejected one AI suggestion that hardcoded a test user ID.
    Your to-do

    Do this now

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    0 of 5 done

    5. Catch Invented APIs

    5 min

    In 30 seconds
    • Spot when an AI invents a function, package, route, or config option.
    • Verify APIs against your installed code, docs, and quick experiments.
    • Add review notes that show how you checked AI-generated API usage.
    Key point

    One rule

    Do not trust an API name just because the AI sounds confident. Treat every new method, import, config key, CLI flag, endpoint, and SDK call as unverified until you check it against your project.

    What gets invented

    AI coding tools predict likely code. Sometimes they mix versions, copy patterns from another library, or create a clean-looking API that does not exist.

    This happens often with fast-moving SDKs, payment gateways, auth libraries, AI APIs, UI components, and framework config. In a hackathon, it can waste your last two hours before demo.

    Your to-do

    Verify before using

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    0 of 5 done

    Example

    Bad and better prompt

    A weak prompt lets the assistant guess. A better prompt forces it to check your real project and admit uncertainty.

    Bad:
    Add Google login using the auth library.
    
    Better:
    Open package.json and the auth files in this repo first.
    Tell me which auth package and version we use.
    Then suggest the smallest Google login change using only APIs that exist in that package.
    If you are not sure an API exists, say so and tell me how to verify it.
    Common mistake

    Version mismatch

    A common mistake is copying code from an answer that targets a different version. The code may look normal but fail at runtime or during build.

    Do not fix this by asking the AI to “try another way” repeatedly. First confirm the version and the official API for that version.

    Tip

    Use tests as proof

    When you ask for AI help, include the test case or expected behaviour. VS Code’s AI best practices recommend including test cases in prompts, then still reviewing the generated code for issues.

    For your public repo, this becomes evidence. A reviewer can see that you did not blindly accept generated code.

    Example

    Review note example

    Add short notes like this in your README or verification notes. Keep it honest and specific.

    AI-assisted API review notes
    
    Feature: UPI payment status screen
    AI suggestion checked: use client.payments.getStatus(paymentId)
    Verification:
    - Checked package.json for payment SDK package and version.
    - Searched official SDK docs for getStatus.
    - Could not confirm that exact method.
    - Replaced with the documented status endpoint used by our installed SDK.
    - Added a manual test note: created a test payment ID and confirmed pending, success, and failed states render correctly.
    
    Decision: Did not accept the invented method.
    Your to-do

    Do this now

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    0 of 5 done