Best Practices Advanced
Maximize your productivity with Kilocode by following proven strategies for task descriptions, cost optimization, model selection, security, team workflows, and avoiding common pitfalls.
Effective Task Descriptions
How you describe tasks directly impacts the quality and cost of Kilocode's output. Follow these guidelines:
The SPEC Framework
Structure your task descriptions using SPEC: Specific, Pointed (to files), Examples, Constraints.
| Element | Description | Example |
|---|---|---|
| Specific | State exactly what you want | "Add email validation to the registration form" |
| Pointed | Reference specific files or directories | "...in src/components/RegisterForm.tsx" |
| Examples | Provide examples of expected behavior | "Valid: user@example.com. Invalid: user@, @example" |
| Constraints | Set boundaries and requirements | "Use Zod for validation, no new dependencies" |
You: Add email validation to src/components/RegisterForm.tsx
Requirements:
1. Validate email format using Zod (already in project)
2. Show inline error message below the email input
3. Validate on blur and on submit
4. Valid: user@example.com, user+tag@domain.co
5. Invalid: user@, @example.com, user@.com
6. Add tests in __tests__/RegisterForm.test.tsx
7. Follow existing error styling in the LoginForm
Cost Optimization Strategies
Use Model Routing
Enable Kilocode's model routing to automatically use cheaper models for simple subtasks. This alone can reduce costs by 30-50%.
Right-Size Your Model
| Task | Recommended Model Tier | Estimated Cost |
|---|---|---|
| Quick questions about code | Fast (Haiku, Flash) | $0.001 - $0.01 |
| Simple file edits | Fast (Haiku, Flash) | $0.01 - $0.05 |
| Feature implementation | Mid (Sonnet, GPT-4o) | $0.10 - $0.50 |
| Complex refactoring | Premium (Opus, o3) | $0.50 - $3.00 |
Other Cost Tips
- Auto-approve reads: Reduces round trips and token overhead
- Use exclude patterns: Prevent Kilocode from reading large, irrelevant files
- Be precise: Vague prompts lead to more file reads and iterations
- Check the cost dashboard: Identify which task types are most expensive and optimize them
- Use local models for exploration: When brainstorming or experimenting, use free local models
Model Selection Guide
| Scenario | Best Choice | Why |
|---|---|---|
| Daily development work | Claude Sonnet 4 | Best balance of quality, speed, and cost |
| Critical architecture decisions | Claude Opus 4 | Deepest reasoning, most thorough analysis |
| Rapid prototyping | Gemini 2.5 Flash | Very fast, large context window, low cost |
| Sensitive/proprietary code | Ollama (local) | No data leaves your machine |
| Budget-conscious teams | Model routing enabled | Automatically optimizes cost per subtask |
Security Tips
- Review all generated code: AI can introduce subtle security issues (SQL injection, XSS, insecure defaults)
- Never share API keys in chat: Use environment variables and .env files
- Use local models for sensitive code: If your codebase contains proprietary algorithms or customer data
- Audit terminal commands: Always read commands before approving - watch for
rm -rf,curl | sh, and other dangerous patterns - Keep extensions updated: Install Kilocode updates promptly for security patches
- Configure .kilocodeignore: Exclude sensitive files from being read (e.g.,
.env,credentials.json,*.pem)
Team Workflows
Strategies for using Kilocode effectively in a team environment:
Shared Configuration
- Commit
.kilocode/rules.mdto version control so all team members share the same coding standards - Use workspace settings in
.vscode/settings.jsonfor project-specific Kilocode configuration - Document MCP server setup in the project README so teammates can replicate the environment
Code Review Process
- Always review AI-generated code through your normal PR review process
- Use Kilocode to help with code reviews: "Review this diff and identify potential issues"
- Mention when code was AI-assisted in commit messages or PR descriptions for transparency
Cost Management for Teams
- Set per-developer daily budgets using the cost dashboard
- Use OpenRouter's team features for centralized billing
- Review team spending weekly to identify cost optimization opportunities
Common Pitfalls
| Pitfall | Solution |
|---|---|
| Accepting changes without reviewing diffs | Always read the diff. Use Kilocode's enhanced diff view to quickly spot issues. |
| Over-relying on auto-approve | Start conservative. Only auto-approve reads. Manually approve writes and commands. |
| Vague task descriptions | Use the SPEC framework. Point to specific files. Provide examples and constraints. |
| Ignoring cost tracking | Check the cost dashboard regularly. Set budget alerts. Use model routing. |
| Not using checkpoints | Create named checkpoints before risky changes. Use them to roll back confidently. |
| Running in production without review | Never let Kilocode modify production systems directly. Use it in development only. |
Frequently Asked Questions
The Kilocode extension itself is free. You pay for API usage based on the AI model provider you choose. You can use completely free local models via Ollama or LM Studio for zero-cost operation.
Yes, both extensions can be installed simultaneously in VS Code. They operate independently and do not conflict with each other. You might use Cline for some tasks and Kilocode for others.
Model routing uses cheaper models for simple subtasks (like reading files or listing directories) and only uses expensive models when complex reasoning is needed. Since many subtasks in a typical coding workflow are simple, this can reduce costs by 30-50% compared to using a premium model for everything.
Kilocode works with VS Code's Remote Development extensions (SSH, Containers, WSL). It operates within the remote workspace and can access remote files and run remote commands. MCP servers also work in remote environments.
Install Kilocode alongside Cline. Copy your API key from Cline's settings to Kilocode. Rename your .clinerules file to match Kilocode's format if needed (check Kilocode docs for the exact file name). Your MCP server configurations may also be transferable. Both tools use similar configuration structures.
Kilocode will show an error message. Your work is not lost - checkpoints preserve all changes made before the error. Top up your API credits and resume the task from where it stopped.
Course Complete!
You now have a thorough understanding of Kilocode - from installation to advanced configuration and best practices. Start applying these strategies to your daily development workflow.
← Back to Course OverviewReady to Go Deeper?
Live instructor-led courses from our partners. Affiliate disclosure.
AI & ML Courses - 30% Off
Live instructor-led AI, machine learning, data science, and cloud courses for working professionals. Use code Limited30 at checkout.
EdurekaDataCamp - AI & Data Science
Hands-on Python, machine learning, and AI courses with interactive exercises and real projects.
DataCampedX - Top AI Courses
University-level AI courses from MIT, Harvard, Stanford. Earn certificates that employers recognize.
edX