{"id":5182,"date":"2026-11-18T21:23:47","date_gmt":"2026-11-18T21:23:47","guid":{"rendered":"https:\/\/bitflow-solutions.com\/guias-tecnicas\/ai-coding-agent-setup-claude-code-opencode\/"},"modified":"2026-11-18T21:23:47","modified_gmt":"2026-11-18T21:23:47","slug":"ai-coding-agent-setup-claude-code-opencode","status":"publish","type":"bf_guia","link":"https:\/\/bitflow-solutions.com\/en\/guias-tecnicas\/ai-coding-agent-setup-claude-code-opencode\/","title":{"rendered":"Basic setup to start coding with an AI agent: Claude Code and OpenCode"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">A practical guide to start coding with an <strong>AI agent<\/strong> in your terminal: <strong>Claude Code<\/strong>, by Anthropic, and <strong>OpenCode<\/strong>, which is open source. How to install them on Windows, connect them, give them your project\u2019s context and limit what they can do, with the everyday commands side by side. All the commands are also in the <strong>README.md<\/strong> on the left.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What you\u2019ll learn<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>What an <strong>AI coding agent<\/strong> does and how it differs from a chat.<\/li>\n\n\n<li>How to install <strong>Claude Code<\/strong> and <strong>OpenCode<\/strong> on Windows and check that they work.<\/li>\n\n\n<li>How to connect your account or model provider and choose the model.<\/li>\n\n\n<li>How to give the agent your project\u2019s context with <code>CLAUDE.md<\/code> or <code>AGENTS.md<\/code>.<\/li>\n\n\n<li>How to set permissions so it does not read your secrets or run anything you do not want.<\/li>\n\n\n<li>The everyday commands, how to undo and how to work safely.<\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Windows 10<\/strong> (version 1809 or later) with <strong>PowerShell<\/strong>; the equivalent commands for macOS and Linux are in each step.<\/li>\n\n\n<li>For <strong>Claude Code<\/strong>: a Claude <strong>Pro<\/strong>, <strong>Max<\/strong>, <strong>Team<\/strong> or <strong>Enterprise<\/strong> plan, or a <strong>Claude Console<\/strong> (API) account. The free Claude plan does not include Claude Code.<\/li>\n\n\n<li>For <strong>OpenCode<\/strong>: an account with a model provider (Anthropic, OpenAI, GitHub Copilot\u2026) or models on your own machine with Ollama (see the Ollama guide).<\/li>\n\n\n<li><strong>Git<\/strong> (on Windows, Git for Windows, recommended: Claude Code uses Git Bash if it is installed and PowerShell otherwise).<\/li>\n\n\n<li>A project in a Git repository, so you can review and undo the agent\u2019s changes.<\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Step by step<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. Understand what a coding agent does<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">An agent does not just answer questions: it <strong>reads your project, edits files and runs commands<\/strong> in your terminal to complete a task, and asks your permission for whatever you decide. That is why it needs to be set up properly before you use it on a real project.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th><\/th><th>Claude Code<\/th><th>OpenCode<\/th><\/tr><\/thead><tbody><tr><td>Who makes it<\/td><td>Anthropic<\/td><td>Open-source project (MIT licence)<\/td><\/tr><tr><td>Models<\/td><td>Claude (also through Amazon Bedrock, Google Cloud or Microsoft Foundry)<\/td><td>Several providers: Anthropic, OpenAI, GitHub Copilot, local models\u2026<\/td><\/tr><tr><td>Context file<\/td><td><code>CLAUDE.md<\/code><\/td><td><code>AGENTS.md<\/code> (and it reads <code>CLAUDE.md<\/code> if there is none)<\/td><\/tr><tr><td>Configuration<\/td><td><code>.claude\/settings.json<\/code><\/td><td><code>opencode.json<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">2. Install Claude Code<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The native installer is the recommended option on Windows: it does not need Node.js and updates itself in the background. From PowerShell:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Native installer (recommended): no Node.js needed and it updates itself\nirm https:\/\/claude.ai\/install.ps1 | iex\n\n# Alternative with WinGet (update it with winget upgrade Anthropic.ClaudeCode)\nwinget install Anthropic.ClaudeCode\n\n# Open a new terminal and check\nclaude --version\nclaude doctor<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">On macOS, Linux or WSL:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># macOS, Linux or WSL\ncurl -fsSL https:\/\/claude.ai\/install.sh | bash<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>claude doctor<\/code> checks the installation without opening a session. Do not confuse Claude Code with the Claude desktop app: they are separate downloads.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. Install OpenCode<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">OpenCode is not installed with Windows package managers: its documentation provides a <strong>zip with the executable<\/strong> for Windows (x64 and ARM64) and an installer for the desktop app. With the zip, unzip it into a folder and add that folder to your PATH:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Windows: unzip the OpenCode zip for Windows (x64 or ARM64) linked from opencode.ai\/docs,\n# for example into C:\\tools\\opencode, and add that folder to your user PATH:\n$current = [Environment]::GetEnvironmentVariable('PATH', 'User')\n[Environment]::SetEnvironmentVariable('PATH', \"$current;C:\\tools\\opencode\", 'User')\n\n# Open a new terminal and check\nopencode --version<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">On macOS and Linux:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># macOS or Linux: official script\ncurl -fsSL https:\/\/opencode.ai\/v2\/install | bash\n\n# or with Homebrew\nbrew install anomalyco\/tap\/opencode-v2\n\n# or with npm (on any system with Node.js)\nnpm install -g @opencode\/cli\n\n# Update later on\nopencode upgrade<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">4. Sign in and choose the model<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Both are started from the project folder. Claude Code takes you to the browser to sign in with your Claude account; in OpenCode you connect whichever provider you want from the interface itself:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Claude Code: go into your project and start it; the first time it opens the browser to sign in\ncd C:\\projects\\my-app\nclaude\nclaude auth status          # check which account you are signed in with\n\n# OpenCode: start it and, inside, connect a provider and choose the model\nopencode\n#   \/connect   -&gt; choose the provider (Anthropic, OpenAI, GitHub Copilot, Ollama\u2026) and enter the credentials\n#   \/models    -&gt; choose the model\n\n# OpenCode from the command line too\nopencode auth login\nopencode auth list\nopencode models<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Inside Claude Code, <code>\/login<\/code> and <code>\/logout<\/code> switch accounts and <code>\/model<\/code> changes the model.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">5. Give it context with CLAUDE.md or AGENTS.md<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">When it starts, the agent reads a file with your project\u2019s instructions: how it is built, how it is tested and which conventions you follow. In Claude Code, <code>\/init<\/code> analyses the project and creates an initial <code>CLAUDE.md<\/code> (if one already exists, it suggests improvements). In OpenCode the file is <code>AGENTS.md<\/code>, at the root of the project. An example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># My app\n\n## Commands\n- Install dependencies: npm install\n- Run the tests: npm test\n- Check the style: npm run lint\n\n## Conventions\n- Strict TypeScript; no any.\n- Every logic change comes with its test.\n- Do not touch the files in the migrations\/ folder unless asked.\n\n## Before finishing\n- Run npm test and npm run lint and fix anything that fails.<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">One file can serve both: Claude Code reads <code>AGENTS.md<\/code> when there is no <code>CLAUDE.md<\/code>, and OpenCode reads <code>CLAUDE.md<\/code> when there is no <code>AGENTS.md<\/code>. Commit it to the repository so the whole team works the same way. For personal notes, Claude Code uses <code>CLAUDE.local.md<\/code>: add it to <code>.gitignore<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">6. Set the permissions<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Decide what the agent can do without asking and what it must never do. In <strong>Claude Code<\/strong>, in <code>.claude\/settings.json<\/code> (shared with the team) or <code>.claude\/settings.local.json<\/code> (just for you, kept out of Git). <code>deny<\/code> rules always win:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"permissions\": {\n    \"allow\": [\n      \"Bash(npm run lint)\",\n      \"Bash(npm run test *)\"\n    ],\n    \"deny\": [\n      \"Read(.\/.env)\",\n      \"Read(.\/.env.*)\",\n      \"Read(.\/secrets\/**)\"\n    ]\n  }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In <strong>OpenCode<\/strong>, in <code>opencode.json<\/code> at the root of the project, with a list of rules (<code>allow<\/code>, <code>ask<\/code> or <code>deny<\/code>; if none matches it asks, and if several match the last one wins). Set the model there too, in <code>provider\/model<\/code> format:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"$schema\": \"https:\/\/opencode.ai\/config.json\",\n  \"model\": \"anthropic\/claude-sonnet-5-5\",\n  \"permissions\": [\n    { \"action\": \"shell\", \"resource\": \"npm test*\", \"effect\": \"allow\" },\n    { \"action\": \"read\", \"resource\": \"*.env\", \"effect\": \"deny\" },\n    { \"action\": \"read\", \"resource\": \"*.env.*\", \"effect\": \"deny\" }\n  ]\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Both files are JSON. In Claude Code it must be strict JSON: no comments and no trailing commas. In Claude Code, <code>\/permissions<\/code> shows all the active rules and which file each one comes from.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">7. Choose how it works: plan or edit<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Before a large change, ask for a plan first. In <strong>Claude Code<\/strong>, <strong>Shift+Tab<\/strong> cycles through the modes: the normal one (asks permission), <strong>accept edits<\/strong> (edits without asking) and <strong>plan<\/strong> (analyses and proposes without touching anything). In recent versions, the interactive session may start in automatic mode: check it at the bottom of the screen.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In <strong>OpenCode<\/strong> there are two agents: <strong>Build<\/strong>, the default, with full access, and <strong>Plan<\/strong>, which explores and plans without editing the project files. You switch between them with <strong>Shift+Tab<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">8. Use the everyday commands<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>What you want to do<\/th><th>Claude Code<\/th><th>OpenCode<\/th><\/tr><\/thead><tbody><tr><td>Start a new conversation<\/td><td><code>\/clear<\/code><\/td><td><code>\/new<\/code><\/td><\/tr><tr><td>Change model<\/td><td><code>\/model<\/code><\/td><td><code>\/models<\/code><\/td><\/tr><tr><td>Point to a file<\/td><td><code>@<\/code> + path<\/td><td><code>@<\/code> + path<\/td><\/tr><tr><td>Run a terminal command<\/td><td><code>!<\/code> at the start<\/td><td><code>!<\/code> at the start<\/td><\/tr><tr><td>Interrupt<\/td><td><code>Esc<\/code><\/td><td><code>Esc<\/code><\/td><\/tr><tr><td>Undo changes<\/td><td><code>Esc<\/code> twice or <code>\/rewind<\/code><\/td><td><code>\/undo<\/code> (and <code>\/redo<\/code>)<\/td><\/tr><tr><td>Summarise to free up context<\/td><td><code>\/compact<\/code><\/td><td><code>Ctrl+X<\/code> then <code>C<\/code><\/td><\/tr><tr><td>See previous sessions<\/td><td><code>\/resume<\/code><\/td><td><code>\/sessions<\/code><\/td><\/tr><tr><td>See usage and limits<\/td><td><code>\/usage<\/code><\/td><td>\u2014<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">And from the terminal, without opening the interface:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># A single request without opening the interface (useful in scripts)\nclaude -p \"Explain what the src\/services folder does\"\nopencode run \"Explain what the src\/services folder does\"\n\n# Pick up where you left off\nclaude -c                    # the last conversation in this folder\nclaude -r \"name-or-id\"       # a specific session<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If you use VS Code, both have an official extension: <strong>Claude Code<\/strong> (by Anthropic) and <strong>OpenCode<\/strong>. The Claude Code extension does not install the <code>claude<\/code> command: for the terminal, install it as in step 2.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">9. Work safely<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">You are responsible for what the agent changes and runs. Work on a branch, review every change before approving it and commit it yourself:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Before you start: leave the repository clean\ngit status\ngit switch -c agent\/new-feature\n\n# When you finish: review everything that has changed before committing it\ngit diff\ngit add -p<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Deny reading secrets (<code>.env<\/code>, keys, certificates) as in step 6.<\/li>\n\n\n<li>Do not pass the agent content of unknown origin (web pages, emails, third-party files) without reviewing it: it may carry hidden instructions (<em>prompt injection<\/em>).<\/li>\n\n\n<li>Do not use the mode that skips all permissions (<code>bypassPermissions<\/code> in Claude Code) outside an isolated environment.<\/li>\n\n\n<li>In Claude Code, <code>\/sandbox<\/code> isolates the agent\u2019s commands on macOS, Linux and WSL 2; it is not available on native Windows.<\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Common errors<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u201cclaude\u201d is not recognised as a command<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The installer folder is not on your PATH. Check that <code>%USERPROFILE%\\.local\\bin\\claude.exe<\/code> exists with <code>Test-Path \"$env:USERPROFILE\\.local\\bin\\claude.exe\"<\/code>, add that folder to your user PATH as in step 3 and open a new terminal.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u201copencode\u201d is not recognised as a command<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The folder where you unzipped the file is not on your PATH, or the terminal was opened before the change. Check the path from step 3 and open a new terminal.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Claude Code cannot find Git Bash<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Find where Git is with <code>where.exe git<\/code> and set the path to <code>bash.exe<\/code> in <code>settings.json<\/code>: <code>\"env\": { \"CLAUDE_CODE_GIT_BASH_PATH\": \"C:\\\\Program Files\\\\Git\\\\bin\\\\bash.exe\" }<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Session expired or \u201cNot logged in\u201d<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In Claude Code, sign in again with <code>\/login<\/code> or <code>claude auth login<\/code> and check that your computer\u2019s clock is correct. In OpenCode, reconnect the provider with <code>\/connect<\/code> and check with <code>opencode auth list<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">It does not work behind the company proxy<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Set the proxy before installing and starting: <code>$env:HTTPS_PROXY = \"http:\/\/proxy.example.com:8080\"<\/code> and the same with <code>HTTP_PROXY<\/code>. OpenCode also supports <code>NO_PROXY<\/code> and <code>NODE_EXTRA_CA_CERTS<\/code> for the company CA.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Claude Code does not find files when searching<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Install ripgrep (<code>winget install BurntSushi.ripgrep.MSVC<\/code>), add <code>\"USE_BUILTIN_RIPGREP\": \"0\"<\/code> to the <code>env<\/code> block of <code>settings.json<\/code> and check with <code>claude doctor<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">The agent read or changed something it should not have<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Undo the change (<code>\/rewind<\/code> in Claude Code, <code>\/undo<\/code> in OpenCode, or <code>git restore<\/code>) and add the missing <code>deny<\/code> rule. In Claude Code, <code>\/permissions<\/code> lets you review the active rules.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Next steps<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use models on your own machine with Ollama, without sending your code anywhere (see the Ollama guide).<\/li>\n\n\n<li>Agree a shared <code>CLAUDE.md<\/code> or <code>AGENTS.md<\/code> with your team and mandatory review of the code the agent produces.<\/li>\n\n\n<li>Connect external tools with MCP servers (in OpenCode, <code>opencode mcp add<\/code>).<\/li>\n\n\n<li>Use the agent in pipelines with <code>claude -p<\/code> or <code>opencode run<\/code> (see the CI\/CD with GitHub Actions guide).<\/li>\n\n<\/ul>\n\n\n","protected":false},"excerpt":{"rendered":"<p>Install Claude Code and OpenCode on Windows, connect your account or model provider, give the agent your project\u2019s context with CLAUDE.md or AGENTS.md and limit what it can do.<\/p>\n","protected":false},"featured_media":0,"template":"","bf_tecnologia":[107,105],"bf_nivel":[108],"class_list":["post-5182","bf_guia","type-bf_guia","status-publish","hentry","bf_tecnologia-ai","bf_tecnologia-development","bf_nivel-basic"],"acf":[],"_links":{"self":[{"href":"https:\/\/bitflow-solutions.com\/en\/wp-json\/wp\/v2\/bf_guia\/5182","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bitflow-solutions.com\/en\/wp-json\/wp\/v2\/bf_guia"}],"about":[{"href":"https:\/\/bitflow-solutions.com\/en\/wp-json\/wp\/v2\/types\/bf_guia"}],"version-history":[{"count":0,"href":"https:\/\/bitflow-solutions.com\/en\/wp-json\/wp\/v2\/bf_guia\/5182\/revisions"}],"wp:attachment":[{"href":"https:\/\/bitflow-solutions.com\/en\/wp-json\/wp\/v2\/media?parent=5182"}],"wp:term":[{"taxonomy":"bf_tecnologia","embeddable":true,"href":"https:\/\/bitflow-solutions.com\/en\/wp-json\/wp\/v2\/bf_tecnologia?post=5182"},{"taxonomy":"bf_nivel","embeddable":true,"href":"https:\/\/bitflow-solutions.com\/en\/wp-json\/wp\/v2\/bf_nivel?post=5182"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}