Lesson 6 — Beginner
AI-Assisted Software Development
Coding agent ab sirf autocomplete nahi — wo repository padh sakta hai, files edit kar sakta hai, commands chalata hai aur output dekh kar khud iterate karta hai. Is bade lesson mein progression (autocomplete se agent tak), assisted engineering vs vibe coding, verification loop, minimum context, CLAUDE.md, spec-driven planning, Skills, subagents, MCP, hooks, plugins aur transferable skills — sab cover honge.
AI-assisted development kya hai
WHAT
Coding agent ek AI system hai jo repo padhta hai, files edit karta hai, commands chalata hai aur result dekh kar iterate karta hai. Tum task dete ho — wo observe-act-verify loop chalata hai; direction, scope aur review tumhare paas rehte hain.
WHEN
Exploration (naya repo samajhna), implementation (targeted changes), debugging, refactoring, tests likhna — har wahan jahan context aur judgement chahiye aur kaam ek jaisa repeat hota hai.
WHERE
Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI — sab isi pattern ke hain. Tumhara editor, terminal aur CI inhi se bhare pade hain.
Sabse zaroori mental model: AI-assisted proficiency software engineering ko replace nahi karti, multiply karti hai. Jo developer ko testing, diff review aur design aata hai wo tez hota hai; jo fundamentals khali hain wo tez garbage bhi bana leta hai. Isi liye ye lesson L0 ke end mein hai — fundamentals abhi fresh hain.
Autocomplete se assistants tak, aur agents tak
AUTOCOMPLETE : next tokens suggest karta hai — tum likhte ho, wo aage guess karta hai
CHAT ASSISTANT: sawaal ka jawab deta hai — code tum copy karke khud lagate ho
CODING AGENT : repo padhta hai -> files edit karta hai -> command chalata hai ->
output dekh kar khud iterate karta hai
Agent ka loop ek hi hai, baar baar: OBSERVE -> ACT -> VERIFY
Kab kaunsa:
syntax / boilerplate -> autocomplete (tumhare flow mein hi tez)
doubt / concept -> chat assistant (samjho, phir khud likho)
multi-file task -> agent (plan + diff + tests ke saath)
- Autocomplete ke paas repo ki soch nahi, assistant ke paas hands nahi — agent ke paas dono. Isi liye agent ko control aur verification chahiye.
- Agent ke paas tools hote hain: file read/edit, shell commands, search. Yahi usse "engineer" banate hain — aur yahin se risk bhi aata hai, galat command ke side effects asli hote hain.
- Speed dono taraf hai: kaam bhi tez, galti bhi tez. Isliye chhote batches aur chhote diffs — review possible rehta hai.
- Progression ka matlab nahi ki autocomplete mar gaya — sab ek saath use hote hain. Fark sirf kaam ke size aur verification ke discipline ka hai.
AI-assisted engineering vs vibe coding
AI-assisted engineering matlab: tum direct karte ho aur verify karte ho — scope, plan, acceptance criteria tumhare paas hain, agent haath hai. Vibe coding matlab: jo generate hua wahi accept, aur testing/review/understanding sab chhod diye. Dono ka output shuru mein same dikhta hai — farq tab dikhta hai jab production mein kuch tootta hai.
- Assisted ka signature: spec -> plan approve -> chhota diff -> automated check -> review -> accept. Tum owner ho, agent collaborator hai.
- Vibe ka signature: prompt -> paste -> "chal raha hai" -> ship. "Chal raha hai" ka matlab working nahi — tests honge toh hi pata chalega.
- Kab vibe theek hai: throwaway prototype, personal script, 30-minute experiment — jo code koi nahi padhega aur kuch store nahi karega.
- Kab nahi: kisi aur ka codebase, production service, data wala system — wahan verification cost code likhne se bhi sasti hai.
Verification loop — har change ka frame
1. CONTEXT : task ka scope batao — kaunsi files, kya badalna hai, kaise check hoga
2. GENERATE : agent pehle plan de, phir code likhe
3. DIFF : git diff padho — har hunk ka sawaal: ye kyun badla?
4. TEST : uv run pytest (ruff/mypy bhi) — automated check chalao
5. DEBUG : fail ho toh exact failure agent ko do, guess mat karo
6. REVIEW : overall design — naming, duplication, error handling, scope
7. ACCEPT : sirf tab jab diff saaf ho aur tests green ho
Batch rule: 5 minute se lamba diff kabhi nahi — chhota karo, alag commit karo.
- Diff hi asli artifact hai. Agent ki explanation nahi, git diff jo dikhata hai wo hua hai — dono alag cheezein hain, kabhi-kabhi explanation aur diff match bhi nahi karte.
- Har change ka ek automated check ho — test, lint, typecheck. Bina automated check ke review sirf nazar se hota hai, aur nazar thakti hai.
- Test fail ho toh exact error output do — tumhara guess ("shayad import missing hai") agent ko galat direction deta hai.
- Scope creep dhoondo: jo maanga nahi tha wo bhi badal diya — sabse chhupa bug hota hai. Plan ki file list se bahar ja rahe hain toh roko.
Minimum useful context
# GALAT — poora repo phenk diya
"Ye mera poora repo hai, kuch bhi theek kar do"
# SAHI — minimum useful context
Task : GET /orders ke response mein pagination add karni hai
Files : app/routes/orders.py, app/schemas/order.py (inhi tak rehna)
Contract: ?page= aur ?page_size= (default 20, max 100); response mein "next" field
Check : uv run pytest tests/test_orders.py pass rehna + naye cases add karo
Scope : auth aur frontend OUT OF SCOPE
- Context window limited hai — sab daalne se important instructions beech mein dhak jaati hain (lost in the middle) aur cost/latency dono badhti hain.
- Minimum useful context = task + relevant files + contract + verification + scope boundary. Ye paanch cheezein 90% tasks ke liye kaafi hain.
- Pehle explore karne do, phir targeted task do: agent ko bolo kahan padhna hai, phir sirf relevant files kaam par lagao — poora repo dene ki zarurat nahi.
- Boundary bhi context hai: "in files tak", "out of scope" — jo na likhoge agent wo bhi chhoo lega. Scope ki rail lagao.
CLAUDE.md — project ki memory
# CLAUDE.md (repo ke root mein — har session mein agent ise padhta hai)
## Project: order-service
## Commands
- Install: uv sync
- Test: uv run pytest -q
- Lint + types: uv run ruff check . && uv run mypy app
- Run: uv run uvicorn app.main:app --reload
## Conventions
- Python 3.12, har public function par type hints mandatory
- Errors: HTTPException raise karo, print se error mat dikhao
- Routes app/routes/*.py mein, schemas app/schemas/*.py mein
## Do NOT
- .env aur secrets kabhi commit mat karo
- dependency bina uv add ke mat jodo
CLAUDE.md (ya kisi bhi agent ka project instruction file) = project ki long-term memory. Yahan architecture, conventions, commands aur test instructions likhte hain — ye har session mein same rehte hain. Temporary task context (aaj ka bug, aaj ki files) uske saath alag prompt mein hai.
Spec-driven development aur planning
# Spec: order pagination (docs/specs/ mein commit hoti hai)
## Requirement
GET /orders abhi sab records ek saath deta hai. Pagination chahiye.
## API contract
- Query: page (default 1), page_size (default 20, max 100)
- Response: {"items": [...], "page": 1, "total": 42, "next": 2}
## Acceptance
- [ ] page_size 100 se zyada par 422
- [ ] tests: happy path, boundary, bad input
- [ ] /docs mein updated
## Out of scope
- cursor-based pagination
- frontend changes
- Pehle requirement aur spec, phir plan, tabhi code. Plan approve hone se pehle agent ko repo mat chhoorne do — wo ek line ka galat direction 10 files tak le jaata hai.
- Plan mein wahi files list honi chahiye jo badlegi. List se bahar file change ho rahi hai? Ruko — scope creep shuru ho gaya.
- Acceptance criteria hi tumhara test banega. Checkbox tick bina "done" ka matlab kuch nahi — yahi spec-driven ka poora khel hai.
- Spec repo mein hi rakho (docs/specs/) — do mahine baad reviewer ko yahi batata hai ye feature kyun bana tha.
Slash commands aur Skills
---
name: api-review
description: FastAPI endpoint ka review checklist — validation, status codes, errors, tests
---
# API Review checklist
1. Har route par Pydantic input model hai? (raw dict = validation nahi)
2. Status codes sahi hain? (201 create, 4xx client, 5xx log)
3. Error body ka ek hi shape hai har jagah?
4. External call par timeout aur error handling hai?
5. tests mein kam se kam ek negative case hai?
- Slash commands: jo prompt tum baar baar type karte ho wo command bana do. /api-review — das line ek line ban gaye.
- Skills: reusable capability — instruction file + metadata + examples, jo zarurat padne par hi load hoti hai. Command ek prompt hai, skill ek procedure hai.
- Kaunsi skills banane layak: code review, test generation, docs update, refactoring, project-specific conventions — jo hafte mein teen baar karo wahi skill hai.
- Skill likhne ka style: outcome batao, checklist do, sample output dikhao. Vague skill agent ko wahi vague result deta hai.
Subagents aur MCP — delegation aur external systems
# Delegation — kaam ke hisaab se alag context
reviewer : diff padho — correctness + conventions (code nahi likhta)
tester : failing test banao, pytest chalao, result lao
debugger : stack trace + logs se root cause aur fix plan
researcher : docs/API explore karo, summary wapas — repo touch nahi
Har subagent ka apna context — bada task bina sab kuch ek window mein ghuse.
{
"mcpServers": {
"orders-db": {
"command": "npx",
"args": ["-y", "mcp-server-postgres"],
"env": { "DATABASE_URL": "postgres://readonly:pass@db:5432/orders" }
}
}
}
# MCP (Model Context Protocol) — agent ke tools ka standard plugin format
- Subagent ka fayda = context isolation. Reviewer ko pura chat nahi chahiye, sirf diff. Ek window mein sab rakhne se important cheezein bhi dhak jaati hain.
- MCP se agent repo ke bahar systems tak pahunchta hai — databases, APIs, ticketing, docs. Ek server likho, koi bhi MCP-supporting agent use kar lega.
- MCP server = agent ke haath mein external power. DB wala server read-only user se jodo; write tools sirf rollback ke saath do.
- Delegation ka rule: padhna vs likhna vs verify karna — alag responsibilities ho toh alag context. Sab kuch ek hi mein mat ghusao.
Hooks, plugins aur transferable skills
{
"hooks": {
"PostToolUse": [
{ "matcher": "Edit|Write",
"hooks": [{ "type": "command", "command": "uv run ruff format . && uv run ruff check --fix ." }] }
],
"Stop": [
{ "hooks": [{ "type": "command", "command": "uv run pytest -q" }] }
]
}
}
# Edit ke baad lint, stop par test — model ko yaad dilane ki zarurat nahi
- Hooks = deterministic checks. "Model hamesha format karna bhool jata hai" kehne ke bajaye har edit ke baad hook chalao — model bhool sakta hai, hook nahi.
- Plugins = capability bundles: commands + skills + hooks + agents + integrations ek naam se. Team ko ek plugin install karo, sabko same workflow mil jaata hai.
- Sab kisi bhi agent mein kaam aata hai — Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI — kyunki durable cheezein hain: context, specification, planning, delegation, automation, verification.
- Tool badalte hain, tarika nahi. Tool-specific ratta kam rakho, principles pehle seekho — transfer yahin se hota hai.
Exercise
Question: Agent ke code change ke baad review ka sabse pehla actual kaam kya hai? (git ___)
Question: Project ke commands/conventions ko agent ke liye permanent file mein rakhne ka standard naam (Claude Code)?
Question: MCP ka full form? (teen shabd)
Question: Formatting/linting/tests ko model par chhodne ke bajaye deterministic banane wala feature?
Question: Poora repo dene ke bajaye agent ko kitna context dena chahiye? (do shabd)
Common mistakes
- Diff padhe bina accept karna: Agent ki explanation par bharosa karke commit kar diya. Explanation galat ho sakti hai — asli cheez git diff hai. Fix: har hunk padho, har change ka sawaal lo.
- Har task mein poora repo dump karna: Context window mein noise se important instructions dhak jaati hain aur cost badhti hai. Fix: minimum useful context — task, relevant files, contract, check, scope.
- Model se hi lint/format check karwana: Probabilistic model deterministic check nahi hai — kabhi chhodega, kabhi nahi. Fix: hooks/CI mein lint, format aur tests — tool deterministic hote hain.
- Bade prompt se sab kuch ek saath karwana: Spec/plan ke bina agent ko poora task dene se scope galat jaata hai aur review mushkil. Fix: spec -> plan approve -> chhote batches -> har batch par verification loop.
Ghar banwane mein mistri aata hai, lekin naksha (spec), kaam ka order (plan) aur har stage ki checking (verification) ghar malik ke paas rehti hai. Bina nakshe ke mistri ko chhod do toh deewar toh ban jaayegi — par darwaze ki jagah khidki kahan hai kisi ko nahi pata:
Spec : 2 BHK, kitchen east mein, budget fix
Plan : foundation -> walls -> electrical -> finishing
Agent : mistri jo plan se kaam kare aur sawaal kare
Verify : har stage par naksha se check (diff + tests)
Ship : ghar tab complete jab bijli-paani bhi chalu (deploy + smoke)- Q: AI-assisted engineering aur vibe coding mein farq? — Direct + verify karna vs jo generate hua accept kar lena.
- Q: Agent ka verification loop kaun se steps se guzarta hai? — context, generate, diff, test, debug, review, accept.
- Q: CLAUDE.md aur task prompt ka farq kya hai? — permanent project memory vs aaj ka temporary context.
- Q: Hooks vs model instruction — deterministic checks kahan rakhein? — hooks/CI mein, model ko yaad dilane mein nahi.
- Q: MCP se agent kya kar sakta hai jo plain repo access se nahi? — databases, APIs, tickets jaise external systems tak tool-based access.
Agent ab tumhara collaborator hai, blind button nahi. Agla lesson — Containers & Deployment — mein ye service container banakar public URL pe chalayenge.