Skip to content

OpenCode Snippets

Source: OpenCode Documentation

Terminal User Interface (TUI) Commands

Terminal window
# Connect to a provider, for example Amazon Bedrock, Anthropic, Azure, GitHub Copilot, OpenAI, Ollama and others
/connect
# Select user interface theme
/theme
# Select models
/model
# Initialize OpenCode for project after cd into project directory, create AGENTS.md
/init
# Undo changes
/undo
# Redo changes
/redo
# View sessions
/sessions
# Start sub agent
@code-reviewer
@security-engineer
# Manage skills
/skills
# Use skill called skill-name
/skill-name
/find-skills
# Quit, Exit
/exit
/q
# Reference file with @
How is authentication handled in @packages/functions/src/api/index.ts
# Include file and line numbers in prompt context
Review @README.md#5-10
Terminal window
# Open opencode with directory as context
opencode
# Help
opencode -h
# Create a new agent with guide, prompt injections
opencode agent create
# Manage sessions
opencode session
# Manage sessions, List them
opencode session list

Microsoft Documentation External MCP Server and Terraform Local MCP Server

Section titled “Microsoft Documentation External MCP Server and Terraform Local MCP Server”

Source: Microsoft Docs configuration originally from MCP Servers - microsoft/skills - GitHub, Install Terraform MCP locally with go install github.com/hashicorp/terraform-mcp-server/cmd/terraform-mcp-server@main or package manager/nix.

{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"microsoft-docs": {
"type": "remote",
"url": "https://learn.microsoft.com/api/mcp"
},
"terraform": {
"type": "local",
"command": "/path/to/terraform-mcp-server",
"env": {
"TFE_TOKEN": "<<TFE_TOKEN_HERE>>"
},
}
}