10 tips to get the most out of OpenCode - byandrev
10 tips to get the most out of OpenCode<br>Mar 31, 2026<br>11 min read
svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground uppercase text-xs">ai svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground uppercase text-xs">opencode
Series: Opencode<br>2 parts<br>1. How to use OpenCode and GitHub Copilot Pro for free?
2. 10 tips to get the most out of OpenCode
OpenCode is a powerful tool, but like any tool, the difference between using it and mastering it lies in the details. These are the tips that have helped me the most in my day-to-day work.
1. Initialize your project with `/init`<br>Before writing a single line of code, run /init at the root of your project. OpenCode will analyze your repository and generate a base context file that the model will use in every session. This is the starting point that prevents you from having to explain your project from scratch in every conversation.
This command will create an AGENTS.md file with the project context:
Initialize project in OpenCode
2. Use `undo` and `redo` without fear<br>OpenCode tracks the changes the model makes to your files. If you're not satisfied with a change, undo reverts the last action, and redo restores it. This gives you the freedom to experiment without the fear of permanently breaking something.
3. Mention files with `@` for precision<br>When you reference a file using @FileName, the model knows exactly where to look for relevant context instead of scanning the entire project. This significantly reduces token consumption and makes responses much more accurate.
# Example<br>Refactor the authentication logic in @src/features/auth/hooks/useAuth.ts
Use it whenever possible. It is one of the habits that has the biggest impact on response quality.
4. Switch models based on the task<br>Not all models cost the same in tokens, and not every task requires the most powerful model. A good rule of thumb:
Fast/Economic Model: exploration, simple questions, minor refactors.
Powerful Model: architecture, complex logic, deep debugging.
Switching models at the right time allows you to do more within the same token budget.
You can visit artificialanalysis.ai to compare model performance.
5. Master `plan` and `build`<br>OpenCode has two operating modes that work in sequence:
plan: the model analyzes the problem and proposes a strategy before touching any code. Use it for complex or high-risk tasks.
build: the model directly executes the changes.
The ideal combination is using plan to validate the approach and then build to execute. Jumping straight to build for complex tasks is likely to produce suboptimal results.
6. Activate the Prompt Improver before coding<br>The Prompt Improver is a feature that asks clarifying questions before executing a task. Instead of assuming what you want, the model gathers the necessary information to act with precision. This saves you several correction cycles.
You can use the skill skills.sh/github/awesome-copilot/boost-prompt to enhance this process.
Prompt Improver Example
7. Create commands for repetitive tasks<br>If you find yourself writing the same type of instruction over and over, it’s a sign you need a custom command. OpenCode allows you to define them to standardize frequent tasks such as:
Generating tests for a module.
Creating a new feature following the project structure.
Reviewing a file for code smells.
Commands turn a repetitive instruction into a single action.
To configure them, create a folder named commands inside .opencode and add a Markdown file with the name of your command (e.g., .opencode/commands/NEW-FEATURE.md). It must follow this structure:
description: Command description<br>agent: plan or build
Instruction content
Detailed example for a service:
description: A command to create a folder structure for a new feature in a project.<br>agent: build
Create a new service for the entity $1.<br>Follow the Hexagonal Architecture pattern:<br>1. Create the Input Port (Interface) in `domain/ports/in`.<br>2. Create the Service Implementation in `domain/services`.<br>3. Use Spring Boot annotations and ensure the code is compatible with Java 17.<br>4. If $2 is provided, use it as the primary repository interface.
Check the existing folder structure in `src/main/java` before generating.
To run it, type / and OpenCode will suggest your custom commands:
8. Leverage skills<br>Skills are snippets of specialized context...