Best Practices Advanced
Get the most out of Cline with effective prompting strategies, cost management techniques, security awareness, tips for large projects, custom rules, and answers to frequently asked questions.
Effective Prompting for Cline
The quality of Cline's output depends heavily on how you describe your tasks. Here are proven strategies:
Be Specific and Detailed
| Instead of... | Try... |
|---|---|
| "Fix the login" | "Fix the login form: it submits twice when the user double-clicks the submit button. Add a loading state to prevent duplicate submissions." |
| "Add tests" | "Write unit tests for src/services/orderService.ts using Jest. Cover createOrder, cancelOrder, and getOrdersByUser including error cases." |
| "Make it faster" | "The /api/products endpoint takes 3 seconds. Add database indexing on the category column and implement response caching with a 5-minute TTL." |
Provide Context
- Reference specific files: "In src/components/Header.tsx, add a notification bell icon next to the user avatar"
- Explain the why: "We need to support email addresses with plus signs because our enterprise customers use them for email aliases"
- Share constraints: "This needs to work without adding new dependencies because we're in a dependency freeze"
Use Numbered Requirements
For complex tasks, number your requirements. This gives Cline a clear checklist and makes it easier to verify completeness:
You: Implement user profile editing:
1. Add a PUT /api/users/:id endpoint
2. Validate that email is unique (excluding current user)
3. Hash password if it's being changed
4. Return the updated user (without password)
5. Add unit tests for all validation rules
6. Update the frontend ProfileEdit component
Managing Costs
API costs can add up quickly with agentic tools. Here are strategies to keep costs under control:
Auto-Approve Limits
Set a maximum auto-approve spend limit in Cline's settings. When the task cost reaches this threshold, Cline pauses and asks for confirmation. Recommended limits:
| Use Case | Suggested Limit | Rationale |
|---|---|---|
| Quick questions | $0.50 | Simple Q&A should be cheap |
| Small edits | $2.00 | Single-file changes with verification |
| Feature development | $5.00 | Multi-file changes with testing |
| Large refactoring | $10.00 | Complex multi-step tasks |
Cost Optimization Strategies
- Use cheaper models for simple tasks: Claude Haiku or Gemini Flash for quick questions, formatting, or simple edits
- Be precise in your prompts: Vague prompts cause Cline to read more files and iterate more, increasing cost
- Break large tasks into smaller ones: Each new task starts with a fresh context, which can be more efficient than one massive conversation
- Auto-approve file reads: Saves time (and therefore tokens) by not waiting for approval on safe operations
- Use local models for exploration: When you're exploring or experimenting, use a free local model via Ollama
Security Considerations
Security Best Practices
- Review all commands: Always read terminal commands before approving. Watch for commands that could delete files, modify system settings, or exfiltrate data.
- Use local models for sensitive code: If your code contains trade secrets or sensitive business logic, use Ollama or LM Studio to keep everything on your machine.
- Protect API keys: Never paste API keys into the Cline chat. Store them in environment variables or .env files (which should be in .gitignore).
- Limit auto-approve: Be conservative with auto-approve settings, especially for terminal commands and file writes.
- Review generated code: Always review AI-generated code for security vulnerabilities like SQL injection, XSS, or hardcoded credentials.
Working with Large Projects
Cline works well with large codebases, but some strategies help it be more effective:
- Point Cline to the right area: Instead of "fix the bug," say "fix the bug in src/modules/billing/invoiceCalculator.ts"
- Use .clinerules for project context: Document your project's architecture, conventions, and important file locations
- Work in focused sessions: Instead of one massive task that touches 20 files, break it into 3-4 focused tasks
- Leverage drag-and-drop: Drop relevant files into the chat to ensure Cline has the exact context it needs
- Use .clineignore: Create a
.clineignorefile (similar to .gitignore) to exclude directories Cline shouldn't access, like node_modules or large data files
Custom Rules Files
Beyond .clinerules, you can create more targeted rule files:
- .clinerules: Project-wide rules (commit to version control)
- Custom instructions in settings: Personal preferences that apply to all projects
- Task-specific instructions: Include requirements in the task description itself
Community and Extensions
Cline has an active open-source community:
- GitHub: github.com/cline/cline — source code, issues, and discussions
- MCP Servers: A growing ecosystem of MCP servers for databases, APIs, and custom tools
- Community Forks: Projects like Kilocode build on Cline's foundation with additional features
- Discord: Active community for support, tips, and sharing workflows
Frequently Asked Questions
Cline itself is completely free and open source. However, you need to provide your own API key for the AI model you want to use. The cost depends on which model and provider you choose. You can also use completely free local models via Ollama or LM Studio.
Cline is an autonomous agent that can plan and execute multi-step tasks, while Copilot primarily provides inline code suggestions. Cline can edit multiple files, run terminal commands, use a browser, and connect to MCP servers. It also supports any AI model, while Copilot is limited to specific models. However, Copilot offers superior inline autocomplete.
Yes. Cline works with any programming language or file format. Since it uses general-purpose AI models, it can handle Python, JavaScript, TypeScript, Rust, Go, Java, C++, HTML/CSS, and any other language the underlying model supports.
When using cloud-based models (Anthropic, OpenAI, Google, OpenRouter), the code Cline reads is sent to that provider's API. If you need to keep code private, use local models via Ollama or LM Studio — everything stays on your machine.
Cline is designed for VS Code and should work with most VS Code-compatible editors. However, some forks may have compatibility issues with certain extension APIs. The best experience is with the official VS Code or VS Code Insiders builds.
Use cheaper models (Haiku, Flash) for simple tasks. Write specific, detailed prompts to reduce iterations. Set auto-approve spend limits. Auto-approve file reads to reduce round trips. Use local models for exploration. Break large tasks into smaller, focused sessions.
Kilocode is a fork of Cline that adds enhanced features like improved diff views, better context management, smart model routing, and a built-in cost dashboard. Both share the same core functionality, but Kilocode adds extra polish and workflow improvements. See the Kilocode course for details.
Course Complete!
You now have a solid understanding of Cline — from installation and basic usage to advanced workflows and best practices. Consider exploring Kilocode, an enhanced fork of Cline, for additional features.
← Back to Course Overview
Lilly Tech Systems