Skip to content

Tips & Trik OpenCode untuk Produktivitas

·Yudha Arief Wijaya

Tips Produktivitas OpenCode

Kumpulan tips dan trik untuk memaksimalkan OpenCode di daily workflow kamu.

1. Custom Commands

Bikin command kustom untuk task yang sering diulang:

{
  "commands": {
    "deploy": {
      "description": "Deploy ke staging",
      "command": "npm run build && npm run deploy:staging"
    },
    "test-all": {
      "description": "Jalankan semua test",
      "command": "npm test -- --coverage"
    }
  }
}

Panggil dengan /deploy atau /test-all di TUI.

2. Rules

Set custom instructions untuk OpenCode:

{
  "rules": [
    "Always use TypeScript for new files.",
    "Follow the existing code style.",
    "Run tests before suggesting changes.",
    "Use React Server Components by default."
  ]
}

3. Keybinds

Kustomisasi shortcut keyboard:

{
  "keybinds": {
    "ctrl+shift+p": "/agent",
    "ctrl+shift+r": "/review",
    "ctrl+shift+s": "/skill code-review"
  }
}

4. Language Formatters

OpenCode otomatis pake formatter spesifik bahasa:

{
  "formatters": {
    "typescript": "prettier",
    "python": "black",
    "go": "gofmt",
    "rust": "rustfmt"
  }
}

5. Permissions

Kontrol aksi mana yang butuh approval:

{
  "permissions": {
    "terminal": "always",
    "fileEdit": "ask",
    "network": "deny"
  }
}
LevelKeterangan
alwaysJalan tanpa konfirmasi
askMinta approval dulu
denyBlokir total

6. LSP Integration

OpenCode bisa integrasi dengan LSP servers untuk type checking dan diagnostics langsung di terminal.