カスタムモード
特定のタスクやワークフローに合わせて Bob の動作を調整するカスタムモードを作成できます。Bob Shell のカスタムモードは Bob IDE のモードと同様に機能します。
Bob Shell でカスタムモードを使う理由
- シェル最適化されたワークフロー:ターミナルベースの開発タスク専用に設計されたモードを作成する
- コマンドラインの安全性:本番環境での作業時に安全な操作のみにモードを制限する
- 環境固有の動作:異なるシェル環境に適応するモードを設定する
- 自動化対応:インタラクティブと非インタラクティブの両セッションでシームレスに動作するモードを設計する
- チームの標準化:一貫したワークフローのためにシェル固有のモードをチーム全体で共有する
カスタムモードに含まれるもの
Bob Shell のカスタムモードは Bob IDE のモードと同じコア構造を使用します:
| プロパティ | 説明 | シェル固有の考慮事項 |
|---|---|---|
slug | 一意の内部識別子 | コマンドライン引数で使用:bob --chat-mode=my-mode |
name | UI での表示名 | インタラクティブモードのモードセレクターに表示される |
description | モードセレクターに表示される短い説明 | モードの目的を簡潔に説明する |
roleDefinition | コアのアイデンティティと専門知識 | シェルのコンテキストとコマンドラインワークフローを考慮する必要がある |
groups | 許可されたツールセットとファイルアクセス | シェル環境ではコマンド実行権限が重要 |
whenToUse | モード選択のガイダンス | Bob Shell がタスクに適切なモードを選択するのに役立つ |
customInstructions | 固有の動作ガイドラインまたはモードのルール | Bob Shell の開発パターンを参照できる |
利用可能なツール
利用可能なツールグループ
read:ファイルとディレクトリを読み取るedit:ファイルを変更する(fileRegexで制限可能)browser:ブラウザー自動化を使用するcommand:ターミナルコマンドを実行するmcp:MCP サーバーにアクセスする
カスタムモードの作成
設定ファイル
Bob Shell は Bob IDE と同じ設定形式をサポートしており、YAML(推奨)と JSON 形式の両方に対応しています。
グローバルモード
すべてのプロジェクトで使用可能なモードのために ~/.bob/custom_modes.yaml を作成または編集します:
customModes:
- slug: shell-debug
name: 🐛 Shell Debugger
roleDefinition: >-
You are a debugging specialist focused on command-line troubleshooting.
You excel at analyzing shell output, environment variables, and system logs.
whenToUse: Use for debugging shell scripts, command failures, and environment issues.
customInstructions: |-
When debugging:
- Always check environment variables first
- Examine command exit codes
- Review relevant log files
- Test commands in isolation before suggesting fixes
groups:
- read
- command
- browserプロジェクト固有のモード
プロジェクトルートの .bob/custom_modes.yaml を作成または編集します:
customModes:
- slug: deploy-helper
name: 🚀 Deployment Assistant
roleDefinition: You are a deployment specialist for this project's infrastructure.
whenToUse: Use for deployment tasks, infrastructure changes, and release management.
customInstructions: |-
Deployment guidelines:
- Always verify the target environment before running commands
- Check for running processes that might be affected
- Validate configuration files before applying changes
- Create backups before destructive operations
groups:
- read
- - edit
- fileRegex: \.(yaml|yml|sh|env)$
description: Configuration and script files only
- commandコマンドラインでのモード選択
Bob Shell を起動する際にモードを指定します:
# 特定のモードで Bob Shell を起動する
bob --chat-mode=shell-debug
# 他のオプションと組み合わせる
bob --chat-mode=deploy-helper --sandboxインタラクティブなモードの切り替え
インタラクティブモードでは、スラッシュコマンドを使ってモードを切り替えます:
# カスタムモードに切り替える
/mode shell-debug
# またはモードのスラッグを直接使用する
/shell-debugシェル固有の設定
本番安全モード
本番環境向けの安全重視モードを作成します:
customModes:
- slug: prod-ops
name: 🔒 Production Operations
roleDefinition: >-
You are a production operations specialist with a strong focus on safety.
You never run destructive commands without explicit confirmation.
whenToUse: Use when working with production systems or sensitive environments.
customInstructions: |-
Production safety rules:
- NEVER run destructive commands without explicit user confirmation
- Always verify the target environment before any operation
- Suggest dry-run options when available
- Check for active connections or processes before changes
- Recommend backup procedures before modifications
groups:
- read
- browser
# Note: No edit or command groups for maximum safetyスクリプト開発モード
シェルスクリプト開発用のモードを作成します:
customModes:
- slug: script-dev
name: 📜 Script Developer
roleDefinition: >-
You are a shell scripting expert specializing in bash, zsh, and POSIX-compliant scripts.
whenToUse: Use for creating, debugging, or improving shell scripts.
customInstructions: |-
Shell scripting best practices:
- Use shellcheck-compliant syntax
- Include proper error handling with set -e and set -u
- Add usage documentation at the top of scripts
- Quote variables to prevent word splitting
- Provide exit codes for different error conditions
groups:
- read
- - edit
- fileRegex: \.(sh|bash|zsh)$
description: Shell script files only
- commandコマンド実行権限
コマンドアクセスの制限
command グループを省略することで、モードが実行できるコマンドを制御します:
customModes:
- slug: safe-reviewer
name: 👀 Safe Code Reviewer
roleDefinition: You are a code reviewer focused on analysis, not modification.
whenToUse: Use for code reviews and analysis without making changes.
groups:
- read
- browser
# No command or edit groups - read-only mode特定のコマンドを許可する
設定ファイルでカスタムモードに Bob Shell の allowed ツール設定を使用します:
{
"tools": {
"allowed": [
"run_shell_command(git status)",
"run_shell_command(git log)",
"run_shell_command(git diff)"
]
}
}インタラクティブと非インタラクティブの動作
両方のモードに対応した設計
インタラクティブと非インタラクティブの両セッションでうまく動作するモードを作成します:
customModes:
- slug: test-runner
name: 🧪 Test Runner
roleDefinition: >-
You are a testing specialist who runs and analyzes test suites.
You adapt your output based on the running context.
whenToUse: Use for running tests, analyzing test results, and debugging test failures.
customInstructions: |-
Testing guidelines:
- In interactive mode: Provide detailed explanations and suggestions
- In non-interactive mode: Focus on concise, actionable output
- Always report test results clearly
- Suggest fixes for failing tests
groups:
- read
- command非インタラクティブでの使用
非インタラクティブモードでモードを使用します:
# 自動化用に設計されたモードを使用する
bob --chat-mode=test-runner -p "Run the test suite and report failures"
# 出力処理と組み合わせる
bob --chat-mode=test-runner -p "Run tests" --hide-intermediary-output > results.txtファイルによるモード固有の指示
ディレクトリベースの指示
.bob/rules-{mode-slug}/ にモード固有の指示ファイルを作成します:
指示ファイルの例(.bob/rules-shell-debug/01-environment-checks.md):
# Environment Debugging Checklist
When debugging shell issues, always check:
1. **Environment Variables**: PATH, SHELL, TERM, and application-specific variables
2. **Shell Configuration**: .bashrc, .zshrc, .profile files
3. **System State**: Current working directory, file permissions, disk space
4. **Command Availability**: Use `command -v <cmd>` to verify commands exist単一ファイルの指示(フォールバック)
代わりに、ワークスペースルートの単一ファイル .bobrules-{mode-slug} を使用することもできます。
設定の優先順位
モードの設定は次の順序で適用されます:
- コマンドライン引数(
--chat-mode=mode-slug) - プロジェクトレベルのモード(
.bob/custom_modes.yaml - ユーザーレベルのモード(
~/.bob/custom_modes.yaml) - システムレベルのモード(プラットフォーム固有の場所)
- デフォルトモード
カスタムモードでのサンドボックス化
安全な実験のためにカスタムモードと Bob Shell のサンドボックス機能を組み合わせます:
# カスタムモードでサンドボックスを起動する
bob --chat-mode=script-dev --sandbox
# Docker サンドボックスで使用する
bob --chat-mode=deploy-helper --sandboxBob IDE からのモードの移行
主な違い
Bob IDE から Bob Shell にカスタムモードを移行する際の違い:
| 側面 | Bob IDE | Bob Shell |
|---|---|---|
| UI インタラクション | パネル付きビジュアルインターフェース | ターミナルベースインターフェース |
| ファイル編集 | エディター内の diff とプレビュー | CLI diff ビューまたは外部エディター |
| コマンド実行 | 統合ターミナル | 直接シェル実行 |
| モードの切り替え | UI ドロップダウンまたはスラッシュコマンド | スラッシュコマンドまたは CLI 引数 |
| 設定 | 設定 UI + ファイル | 設定ファイルのみ |
適応チェックリスト
Bob IDE のモードを Bob Shell に適応させる際:
- シェル固有のコンテキストに合わせて
roleDefinitionを見直す - コマンドラインワークフローを参照するよう
customInstructionsを更新する groups設定でコマンド実行の安全性を考慮する- インタラクティブと非インタラクティブの両セッションでモードをテストする
- シェルコンテキストでのファイルパスの処理を確認する
- 該当する場合はサンドボックスモードでテストする
移行例
元の Bob IDE モード:
customModes:
- slug: code-reviewer
name: 👀 Code Reviewer
roleDefinition: You are a code reviewer who provides detailed feedback.
groups:
- read
- browserBob Shell 向けに適応したもの:
customModes:
- slug: code-reviewer
name: 👀 Code Reviewer
roleDefinition: >-
You are a code reviewer who provides detailed feedback.
You work efficiently in terminal environments and provide clear, actionable suggestions.
whenToUse: Use for code reviews, pull request analysis, and code quality checks.
customInstructions: |-
Code review guidelines:
- Provide feedback in a structured format suitable for terminal output
- Reference specific line numbers and file paths
- Suggest concrete improvements with examples
- Format output for easy parsing if used in non-interactive mode
groups:
- read
- command # Added for git operations
- browser