Back

Vibe Coding to Prod

Mastering Cursor + AI

Anshuman Biswas, Ph.D.

17th October 2025
{ code }

What We'll Cover

1 Pair-programming with AI

  • Cursor IDE & Claude Code
  • Patterns for prompting
  • Advanced features (agent mode, file/folder context)

2 Production engineering

  • Think tokens & context windows
  • Generate tests first, iterate fast
  • Observability, security, ops
AI

Why AI-assisted coding?

Speed

Write skeleton code & tests in minutes, not hours.

Focus

Offload boilerplate so you think about logic & design.

Explore

Try new patterns, libraries, languages with confidence.

Meet the Tools

Cursor IDE

  • VS Code fork with AI at core
  • In-editor chat, Cmd+K inline edits
  • Multi-file awareness via @ mentions

Claude Code

  • Terminal-native agent from Anthropic
  • Autonomous "agent mode" for multi-step tasks
  • Built on Claude 3.5 Sonnet
Cursor Claude

Cursor Basics

  • Chat: ask questions, request code snippets
  • Cmd+K: inline code generation or modification
  • @files, @folders: attach context explicitly
  • @web, @docs: bring in external knowledge
  • Agent mode: let Cursor autonomously handle multi-step requests
Chat ⌘K Agent

Claude Code Basics

  • CLI-first: runs in your terminal, integrates with your workflow
  • Tool Use: reads/writes files, runs commands, searches code
  • Agent mode: breaks complex tasks into sub-tasks automatically
  • Long context: understands large codebases (200k+ tokens)
Terminal Claude Files

Agent Mode Deep Dive

What it does

  • Autonomously plans multi-step workflows
  • Reads files, runs tests, iterates on failures
  • Can self-correct and adapt to new info

When to use

  • Large refactors or feature additions
  • End-to-end debugging sessions
  • Exploratory tasks across many files
Plan Execute step OK Err

Prompt Patterns

Be specific

"Add a validateEmail function that returns true if valid."

Use context

"@readme Generate a setup script that matches our docs."

Iterate

"Now make it handle edge cases: empty string, special chars."

Prompt Code Review

Tokens & Context Windows

  • A token ≈ ¾ of a word (roughly 4 chars on average)
  • Context window = how many tokens the model can "see" at once
  • Claude 3.5: 200k tokens ≈ ~500 pages of text
  • Plan for ~30–40% overhead from code structure, formatting
200k tokens Your code + prompt

Tests First Philosophy

"Generate failing tests before writing implementation. Then iterate until they pass."

Why?

  • Clarity: forces you to define expected behavior upfront
  • Speed: AI can quickly scaffold test cases from requirements
  • Confidence: passing tests = shipping-ready code
Test Code

Practical Example: Blog Feature

Goal: Add a "Featured Post" toggle to blog admin

  1. Prompt: "Add a is_featured boolean column to Posts table."
  2. Prompt: "Generate a migration script + rollback."
  3. Prompt: "Add a toggle in the admin UI, wire to backend."
  4. Prompt: "Write tests for the feature flag logic."
  5. Run tests, iterate on failures.
DB API UI

Live Demo (time permitting)

What I'll show

  • Open Cursor, start a new feature
  • Use @files, inline edits
  • Switch to Claude Code for test generation
  • Run tests, debug, iterate
Cursor Claude Code Tests

Observability & Debugging

  • Logging: structured logs (JSON) for easy parsing
  • Metrics: track latency, error rates, throughput
  • Tracing: distributed traces for microservices
  • AI help: "Analyze these logs and suggest root cause"
Logs Metrics Traces

Security & Secrets Management

  • Never commit secrets: use .env, .gitignore
  • Vault services: AWS Secrets Manager, HashiCorp Vault, etc.
  • Rotate credentials: automate rotation, audit access
  • AI prompt: "Review this code for hardcoded secrets"
App Vault 🔒

CI/CD Integration

Continuous Integration

  • Run tests on every commit
  • Linting, type checks, security scans
  • Block merges if tests fail

Continuous Deployment

  • Auto-deploy to staging on merge
  • Smoke tests in staging
  • Manual or auto-promote to prod
Commit CI CD Prod

Deployment Best Practices

  • Blue-Green: run old + new versions, switch traffic gradually
  • Canary releases: roll out to 5% of users first
  • Rollback plan: always have a quick revert strategy
  • Health checks: automated smoke tests post-deploy
Blue Green → Traffic

Playwright Example

"Write an end-to-end test: user creates a project, adds a task, marks it done."
// e2e/project.spec.js
import { test, expect } from '@playwright/test';

test('user workflow: create project → add task → complete', async ({ page }) => {
  await page.goto('/projects');
  await page.getByRole('button', { name:/new project/i }).click();
  await page.getByRole('textbox', { name:/name/i }).fill('Demo');
  await page.getByRole('button', { name:/create/i }).click();
  await page.getByRole('link', { name:'Demo' }).click();
  await page.getByRole('textbox', { name:/title/i }).fill('First task');
  await page.getByRole('button', { name:/add/i }).click();
  await page.getByRole('checkbox', { name:/First task/i }).check();
  await expect(page.getByRole('listitem', { name:/First task/i }))
    .toHaveClass(/completed/);
});

Common Pitfalls

  • Over-reliance: don't skip code review—AI can be wrong
  • Context bloat: too many files → model gets confused
  • Vague prompts: "make it better" → unclear results
  • Ignoring tests: shipping untested AI code is risky
⚠️ ⚠️ ⚠️

Key Takeaways

  • Outcomes
  • Prompt patterns: be specific, use context, iterate.
  • Tokens rule everything: split/encode → think → decode/join.
  • Cursor + Claude Code = rapid, test-first iteration.
  • Ship small, observable, secure slices.

Twitter/X: @anchoo2kewl • anshumanbiswas.com

Q&A

Q A