Step 1: Install Cline in VS Code (3 Minutes)
Cline is an open-source AI coding agent that runs as a VS Code extension. Unlike Cursor and Windsurf (which are standalone IDEs): Cline works inside your existing VS Code installation. Install: open VS Code Extensions (Cmd+Shift+X), search 'Cline,' and install. No separate application needed — Cline adds an AI agent panel to your existing VS Code setup.
API key configuration: Cline is BYOK (Bring Your Own Key) — you provide your own API key from any supported provider: Anthropic (Claude), OpenAI (GPT-4), Google (Gemini), or local models (Ollama, LM Studio). In Cline settings: select your provider and enter the API key. For Claude: use your Anthropic API key. For teams: each developer uses their own key or the organization provides a shared API key through environment variables.
Model selection: Cline supports multiple models. For best rule-following and agentic capabilities: Claude claude-sonnet-4-20250514 or claude-opus-4-20250514 (strongest for complex multi-file tasks). GPT-4o: good alternative. Local models: work for simple tasks but may not follow custom rules as consistently. AI rule: 'Start with Claude Sonnet for the best balance of quality and speed. Switch to Opus for complex architectural tasks. Use local models only when API access is not available.'
Step 2: Configure .clinerules (5 Minutes)
Cline reads project-specific instructions from .clinerules in the project root. Create this file: same format as CLAUDE.md or .cursorrules — project context, coding conventions, testing standards, and project-specific rules. Cline loads the file automatically when you open the project. Additionally, Cline supports a .cline/rules/ directory for more complex rule organization.
Cline-specific considerations: Cline is an autonomous agent — it reads files, writes files, and runs terminal commands. Your rules should include: which files the agent should not modify (lock files, generated code, vendor directories), which terminal commands are safe to run (npm test, npm run lint — but not npm publish or database migrations without confirmation), and the approval workflow (should Cline auto-apply changes or ask for approval before each file edit?).
Verify: open the Cline panel in VS Code. Start a new task: 'What are the coding conventions for this project?' Cline should reference your .clinerules content. If it does not: check the file location (project root), file name (exactly .clinerules), and that the project is opened at the correct directory level in VS Code.
Cline can run terminal commands autonomously. Without guardrails: it might run npm publish, git push --force, or database migrations without asking. Your .clinerules should specify: 'Safe commands (auto-approve): npm test, npm run lint, npm run build, npx tsc --noEmit. Require approval: any git command, any deployment command, any database command.' This keeps Cline productive (runs tests without asking) while preventing dangerous operations (never pushes without your OK).
Step 3: Autonomous vs Approval Mode
Cline offers transparency into every action the agent takes: file reads, file writes, terminal commands, and web searches. You can configure: auto-approve reads (Cline reads any file without asking), require approval for writes (Cline shows the diff and waits for your OK before saving), and require approval for commands (Cline shows the command before running it). This granular control: distinguishes Cline from other AI agents.
Recommended settings for getting started: auto-approve file reads (the agent needs to understand your codebase), require approval for file writes (review every change before it is saved), and require approval for terminal commands (especially important — prevent accidental deployments or destructive operations). As you build trust: gradually expand auto-approve to include safe write operations. AI rule: 'Start with maximum approval requirements. Reduce as you understand Cline's behavior. It is easier to relax controls than to recover from an unwanted change.'
The diff view: when Cline proposes a file edit, it shows the full diff (additions in green, removals in red). Review the diff: does it follow your conventions? Does it change only what was requested (no scope creep)? Does it introduce any issues? Accept or reject each change individually. AI rule: 'The diff view is your quality gate. Every file edit passes through it. Read the diff with the same attention you give to a code review — because that is exactly what it is.'
Day 1 with Cline: require approval for every file write and every terminal command. This feels slow — but you are learning how Cline works. After 1 week: you understand Cline's patterns. You trust its file reads and safe commands. Auto-approve those. After 1 month: you may auto-approve file writes for certain directories (tests, components) while requiring approval for sensitive areas (auth, database, config). The trust builds incrementally. Rushing to auto-approve everything: risks unwanted changes.
Step 4: Cline Workflow and Best Practices
Task-based workflow: Cline works best with clear task descriptions. Good: 'Create a new API endpoint GET /api/products that queries the products table using Drizzle, returns paginated results with total count, and includes a Vitest test.' Cline breaks this into steps: read existing endpoints for patterns, create the route file, implement the handler, add the test, and verify by running the test. Each step: visible in the Cline panel with full transparency.
Context management: Cline can read any file in the project, but its context window is finite. For large projects: reference specific files in your task description ('Follow the pattern in src/routes/users.ts'). Cline will read the referenced file and use it as a template. Without explicit references: Cline may choose a different file as the pattern source, producing inconsistent results. AI rule: 'For consistency: always reference the file you want Cline to use as a pattern. Do not assume Cline will find the best example on its own.'
Cost awareness: Cline shows the token usage and estimated cost for each task. Claude API usage is billed per token. A complex multi-file feature: may use 50,000-200,000 tokens ($0.15-$3.00 depending on the model). Monitor costs in the Cline panel. For cost optimization: use Sonnet for most tasks (cheaper), Opus for complex tasks (more expensive but more capable), and set a per-task budget limit in Cline settings. AI rule: 'Monitor token usage per task. If a task consumes excessive tokens (Cline is looping or retrying): cancel and rephrase the task more specifically.'
Unlike subscription-based tools (Cursor, Copilot): Cline uses your API key directly. Every token is billed. A simple task (generate one function): 5,000-10,000 tokens (~$0.01-0.03). A complex feature (multi-file with tests): 50,000-200,000 tokens (~$0.15-3.00). A task where Cline loops or retries: can consume 500,000+ tokens unexpectedly. Monitor the token counter in the Cline panel. Set per-task budget limits. Cancel tasks that are consuming excessive tokens — rephrase and retry more specifically.
Cline Setup Summary
Complete Cline setup checklist.
- Install: VS Code extension. Works inside existing VS Code — no separate IDE needed
- API key: BYOK model. Anthropic (Claude), OpenAI, Google, or local models. Per-developer keys
- Model: Claude Sonnet for most tasks, Opus for complex tasks. Local models for offline
- .clinerules: project root. Include file restrictions, safe commands, and approval workflow
- Autonomous mode: start with max approvals. Auto-approve reads, require approval for writes/commands
- Diff view: review every proposed change. Accept/reject individually. Your quality gate
- Tasks: clear descriptions with file references. Cline breaks into visible steps
- Cost: monitor token usage. Sonnet for cost efficiency. Budget limits per task