{"slug": "building-a-full-stack-app-with-ai-pair-programming", "title": "Building a full-stack app with AI pair programming", "summary": "A developer used Cursor and Claude 3.5 Sonnet to build a full-stack Task Tracker app in under an hour, finding that providing a .cursorrules file and using iterative prompting with vertical slices reduced debugging time from 45 minutes to 2 minutes when the AI hit a wall. The key to success was maintaining shared context and being prescriptive about architecture, such as refactoring a client hook into a separate Client Component.", "body_md": "# Building a full-stack app with AI pair programming\n\nReal AI pair programming is about maintaining a shared state between your brain and the LLM. If you don't feed the AI the right context, you'll spend four hours debugging a hallucinated library version that hasn't existed since 2022.\n\nI tried building a simple Task Tracker last Tuesday. I used [Cursor](/en/tags/cursor/) (which is basically VS Code on steroids) and Claude 3.5 Sonnet. The goal was to move from a blank folder to a deployed app in under an hour.\n\n### Setting up the workspace for context\n\nThe biggest mistake beginners make is starting a chat without providing a roadmap. If you just say \"Build me a task app,\" the AI will guess your tech stack. It might give you Tailwind CSS when you wanted Bootstrap, or use an outdated Next.js API route structure.\n\nFirst, create a `.cursorrules`\n\nfile (or a project-level instruction file) in your root directory. This forces the AI to stick to your specific stack.\n\n```\n// .cursorrules\nYou are an expert Full-stack TypeScript developer.\nTech Stack: \n- Frontend: Next.js 14 (App Router), Tailwind CSS, Shadcn UI\n- Backend: Supabase (Auth and Database)\n- State Management: Zustand\n\nCoding Style:\n- Use functional components and arrow functions.\n- Strictly use TypeScript interfaces; avoid 'any'.\n- Implement error handling for all async calls using try/catch blocks.\n- Keep components small and modular.\n```\n\nWith this file in place, the AI stops guessing. It knows exactly which version of Next.js to use.\n\n### The \"Iterative Prompting\" loop\n\nDon't ask for the whole app at once. You'll get generic, buggy code. Instead, build in \"vertical slices.\"\n\n**Step 1: The Schema**\n\nI started by defining the data. I didn't write the SQL; I asked the AI to generate the Supabase migration script.\n\n`Prompt: Based on the .cursorrules, generate a SQL migration for a 'tasks' table. I need id (uuid), created_at, title (text), is_completed (boolean), and user_id (uuid referencing auth.users).`\n\n**Step 2: The Logic**\n\nOnce the DB was live, I needed the fetch logic. Instead of writing the function, I highlighted the empty `page.tsx`\n\nfile and used the \"Composer\" feature (Cmd+I in Cursor) to generate the server component.\n\n``` js\n// This is what the AI generated after I provided the Supabase schema\nimport { createClient } from '@/utils/supabase/server';\n\nexport default async function TasksPage() {\n  const supabase = createClient();\n  const { data: tasks, error } = await supabase.from('tasks').select('*');\n\n  if (error) return <div>Error loading tasks: {error.message}</div>;\n\n  return (\n    <div className=\"p-6 max-w-md mx-auto\">\n      <h1 className=\"text-2xl font-bold mb-4\">My Tasks</h1>\n      <ul className=\"space-y-2\">\n        {tasks?.map(task => (\n          <li key={task.id} className=\"p-2 border rounded shadow-sm\">\n            {task.title}\n          </li>\n        ))}\n      </ul>\n    </div>\n  );\n}\n```\n\n### When the AI hits a wall\n\nAt 2:15 PM, I hit a snag. The AI kept trying to use a client-side hook in a server component. It kept suggesting `useEffect`\n\n, which threw a \"useState/useEffect only works in Client Components\" error.\n\nThis is where most beginners panic. They just paste the error and ask \"Why isn't this working?\"\n\nThe fix is to be prescriptive. I told it: *\"You are attempting to use a client hook in a Server Component. Refactor the list item into a separate Client Component called TaskItem.tsx and pass the task data as a prop.\"*\n\nImmediately, the AI restructured the folder:\n\n`app/page.tsx`\n\n(Server) → fetches data.`components/TaskItem.tsx`\n\n(Client) → handles the checkbox toggle.\n\n| Approach | Result | Dev Time |\n\n| :--- | :--- | :--- |\n\n| \"Fix this error\" | 3-4 hallucinations, repetitive bugs | 45 mins |\n\n| \"Refactor to Client Component\" | Correct architecture on first try | 2 mins |\n\n### Scaling your skills through community\n\nYou can't learn this in a vacuum. You'll eventually run into a weird edge case—like a specific MCP (Model Context Protocol) server crashing or a prompt that works in [Claude](/en/tags/claude/) but fails in GPT-4o—and you'll feel like you're shouting into a void.\n\nThis is why joining an AI beginner community is non-negotiable. You need a place to see how other devs are structuring their prompts and which tools are actually delivering. For example, checking out [Prompt Sharing](/en/category/prompts/) can show you exactly how a senior dev prompts for a complex React hook, saving you the trial-and-error phase.\n\nThe \"magic\" isn't in the model; it's in the workflow.\n\n### Refining the prompt for production\n\nOnce the basic app worked, I wanted to add a \"Priority\" tag. If you just say \"add priority,\" the AI might just add a text field. To get it right, I used a structured prompt:\n\n`Prompt: Update the 'tasks' table to include a 'priority' column (enum: low, medium, high). Update the UI to show a colored badge based on the priority: low = gray, medium = yellow, high = red. Use Shadcn UI's Badge component.`\n\nThis is the difference between a prototype and a product. Specificity kills bugs.\n\nIf you're still struggling with the setup, browsing through established [Resources](/en/category/resources/) can help you find the right boilerplates so you aren't starting from zero every single time.\n\n### The final reality check\n\nAI pair programming doesn't replace the need to understand the code. If you blindly accept every suggestion, you're building a house of cards.\n\nLast week, the AI suggested a library for date formatting that was deprecated. Because I didn't check the documentation, I spent twenty minutes wondering why the build was failing.\n\nMy advice? Treat the AI as a very fast, slightly overconfident junior developer. Review every line. Question the architecture. If it suggests a library you've never heard of, go check its GitHub stars and last commit date before you `npm install`\n\n.\n\nThat's how you actually ship.\n\n[Next Can we actually handle a full video pipeline in the browser →](/en/threads/6586/)\n\n## All Replies （0）\n\nNo replies yet — be the first!", "url": "https://wpnews.pro/news/building-a-full-stack-app-with-ai-pair-programming", "canonical_source": "https://promptcube3.com/en/threads/6684/", "published_at": "2026-08-17 14:37:49+00:00", "updated_at": "2026-08-17 14:42:17.116751+00:00", "lang": "en", "topics": ["artificial-intelligence", "developer-tools", "ai-tools", "generative-ai"], "entities": ["Cursor", "Claude 3.5 Sonnet", "Next.js", "Tailwind CSS", "Shadcn UI", "Supabase", "Zustand", "TypeScript"], "alternates": {"html": "https://wpnews.pro/news/building-a-full-stack-app-with-ai-pair-programming", "markdown": "https://wpnews.pro/news/building-a-full-stack-app-with-ai-pair-programming.md", "text": "https://wpnews.pro/news/building-a-full-stack-app-with-ai-pair-programming.txt", "jsonld": "https://wpnews.pro/news/building-a-full-stack-app-with-ai-pair-programming.jsonld"}}