DEV Community

Abhishek Gupta
Abhishek Gupta

Posted on

The Complete Guide to Working With AI While Coding (Hackathons, Cursor, VS Code, AI Agents)

AI has fundamentally changed how developers build software.

In hackathons, startups, and daily development, many developers now rely on tools like:

  • Cursor
  • VS Code + GitHub Copilot
  • ChatGPT / Claude
  • Aider
  • Continue
  • Antigravity agents

These tools can:

  • generate code
  • modify multiple files
  • refactor large parts of a project
  • debug errors
  • suggest architecture
  • write tests
  • even build full features

Because of this, small teams can now build large systems extremely fast.

But there is a hidden problem.

Many developers use AI without a system.

At first everything feels amazing.
AI generates code quickly and features appear fast.

But after some time, the project starts breaking.

You begin to notice things like:

  • messy code structure
  • features randomly breaking
  • AI modifying unrelated files
  • duplicate logic appearing
  • debugging becoming harder and harder

This happens because developers don’t manage AI collaboration properly.

The correct approach is simple:

Treat AI like a developer on your team.

If a new developer joins your project, you don’t just say:

“Build whatever you want.”

You give them:

  • documentation
  • architecture explanation
  • coding rules
  • feature plans
  • debugging notes

AI needs the same structure.

This guide explains how to build a proper system for working with AI while coding.


Why AI Sometimes Breaks Your Project

AI tools work with limited context.

Most coding assistants only see:

  • the file you opened
  • a few related files
  • your conversation with the AI

They do not automatically understand your entire project.

Imagine your project has:

  • controllers
  • services
  • repositories
  • event systems
  • socket communication

If AI doesn’t understand those rules, it may generate code that breaks your architecture.

For example:

  • business logic placed inside controllers
  • duplicated services
  • incorrect database queries
  • conflicting APIs

The result is architecture drift.

To prevent this, developers must provide structured context for AI.


The Solution: Build an AI Workspace

The best way to work with AI is to treat your project as having two systems:

1️⃣ Your application code
2️⃣ Your AI collaboration system

A clean structure might look like this:

project-root/

README.md
AI_RULES.md

docs/
plans/
ai-logs/
debug/
reviews/
ai-history/

src/
tests/
scripts/
Enter fullscreen mode Exit fullscreen mode

This structure helps both:

  • human developers
  • AI coding tools

understand the project.


Step 1: Write a Clear README

Many AI tools read the README first to understand the project.

A good README should explain:

  • what the project does
  • the technology stack
  • the main modules

Example:

# CommDesk

CommDesk is a platform for managing developer communities,
events, and hackathons.

Stack

Frontend: React + Vite
Backend: Node.js + Express
Database: MongoDB
Desktop: Tauri
Enter fullscreen mode Exit fullscreen mode

This gives AI immediate context about your system.


Step 2: Create AI Rules

Create a file called:

AI_RULES.md
Enter fullscreen mode Exit fullscreen mode

This file tells AI how your codebase works.

Example:

AI Rules

1. Controllers only handle HTTP requests.
2. Business logic must stay inside services.
3. Database queries belong in repositories.
4. Follow the existing folder structure.
5. Do not duplicate existing logic.
Enter fullscreen mode Exit fullscreen mode

This prevents AI from breaking your architecture.


Step 3: Create a Documentation Folder

Create a folder:

docs/
Enter fullscreen mode Exit fullscreen mode

Example structure:

docs/
AI_CONTEXT.md
ARCHITECTURE.md
FILE_STRUCTURE.md
CODING_GUIDELINES.md
SYSTEM_FLOW.md
Enter fullscreen mode Exit fullscreen mode

These documents provide project-level understanding.


AI_CONTEXT.md

Explain what the project does.

Project Overview

CommDesk is a platform for managing developer communities.

Core modules:
- Authentication
- Event Management
- Notification System
Enter fullscreen mode Exit fullscreen mode

ARCHITECTURE.md

Explain the system design.

Client → API → Services → Database

Services:

Auth Service
Event Service
Notification Service
Enter fullscreen mode Exit fullscreen mode

FILE_STRUCTURE.md

Explain how the codebase is organized.

src/

controllers/
services/
models/
routes/
utils/
Enter fullscreen mode Exit fullscreen mode

This prevents AI from inventing new random structures.


Step 4: Plan Features Before Asking AI

Instead of telling AI:

“Build notifications.”

Create a plan first.

plans/
Enter fullscreen mode Exit fullscreen mode

Example files:

IMPLEMENTATION_PLAN.md
FUTURE_FEATURES.md
ROADMAP.md
Enter fullscreen mode Exit fullscreen mode

Example feature plan:

Feature: Notification System

Step 1 Create database schema
Step 2 Create service layer
Step 3 Create API endpoints
Step 4 Add socket events
Step 5 Create UI components
Enter fullscreen mode Exit fullscreen mode

Now AI can build features step by step.


Step 5: Track AI Changes

Create a folder:

ai-logs/
Enter fullscreen mode Exit fullscreen mode

Example files:

CHANGE_LOG.md
PROMPTS.md
AI_SESSIONS.md
Enter fullscreen mode Exit fullscreen mode

Example log:

Date: 2026-03-10
AI Tool: Cursor

Task:
Create Notification Service

Files Created:
src/services/notificationService.js

Files Updated:
src/controllers/notificationController.js
Enter fullscreen mode Exit fullscreen mode

Tracking AI changes makes debugging much easier later.


Step 6: Store AI Session History

Create:

ai-history/
Enter fullscreen mode Exit fullscreen mode

Example:

ai-history/
2026/
 03/
  10/
   session-1.md
   session-2.md
Enter fullscreen mode Exit fullscreen mode

Example session log:

Date: 2026-03-10
Time: 15:30

AI Tool: Cursor

Task:
Create notification service

Files created:
notificationService.js

Developer Notes:
Added validation manually.
Enter fullscreen mode Exit fullscreen mode

This becomes a timeline of how the project evolved.


Step 7: Track Bugs and Fixes

Create a folder:

debug/
Enter fullscreen mode Exit fullscreen mode

Example files:

ERRORS.md
FIXES.md
INCIDENTS.md
Enter fullscreen mode Exit fullscreen mode

Example:

Error

Notification event not triggering
Enter fullscreen mode Exit fullscreen mode

Cause:

Incorrect socket event name
Enter fullscreen mode Exit fullscreen mode

Fix:

Changed event name
notifyUser → notification:new
Enter fullscreen mode Exit fullscreen mode

This builds a knowledge base of problems and solutions.


Step 8: Review AI Code

AI-generated code should always be reviewed.

Create:

reviews/
Enter fullscreen mode Exit fullscreen mode

Example:

AI_REVIEW.md
CODE_REVIEW.md
Enter fullscreen mode Exit fullscreen mode

Example review:

File
notificationService.js

Issues
Missing validation
Missing error handling
Enter fullscreen mode Exit fullscreen mode

This keeps your codebase clean and maintainable.


Example AI Development Workflow

A typical workflow might look like this:

Feature Idea
      ↓
Write Implementation Plan
      ↓
Ask AI to generate step 1
      ↓
Review generated code
      ↓
Log AI changes
      ↓
Test the feature
      ↓
Fix bugs with AI
      ↓
Update documentation
Enter fullscreen mode Exit fullscreen mode

Example Bug Fix Workflow

Bug detected
      ↓
Record in debug/ERRORS.md
      ↓
Ask AI to investigate
      ↓
Apply fix
      ↓
Log the change
      ↓
Document the solution
Enter fullscreen mode Exit fullscreen mode

Best Practices When Using AI

Always:

  • ask AI for small tasks
  • review generated code carefully
  • track AI-generated changes
  • maintain documentation

Avoid:

  • generating entire systems in one prompt
  • blindly trusting AI output
  • skipping architecture planning

The Most Important Skill in the AI Era

Many developers believe the key skill today is prompt engineering.

But the real skill is:

Context Engineering

Context engineering means:

  • organizing documentation
  • structuring your project clearly
  • giving AI the right information
  • guiding AI step by step
  • maintaining development history

Developers who master this can build faster, more reliable software with AI.


Final Thoughts

AI tools like:

  • Cursor
  • Copilot
  • VS Code AI extensions
  • Antigravity
  • AI coding agents

are transforming software development.

But AI works best when it is guided properly.

When developers provide:

  • clear documentation
  • structured plans
  • coding rules
  • review processes

AI becomes a powerful development partner instead of a source of chaos.

And learning how to collaborate with AI will likely become one of the most important skills for developers in the coming years.

Top comments (1)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.