rebuild

A server rebuild command stops a running server, builds the current or selected worktree, and starts the server again. A worktree is a separate working directory linked to a Git branch.

In plain words
What is it for?
Use it to restart the project from the current branch or a named worktree, optionally on a chosen port.
Why use it?
It avoids repeating the stop, build, directory selection, and restart commands manually.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/kewton/commandmate/rebuild
Any agent
npx skills add Kewton/CommandMate --skill rebuild
Clone the repo
git clone --depth 1 https://github.com/Kewton/CommandMate

Made for: Claude Code, Codex.

Per session 55 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 914 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00055 $0.00914
Opus 5 $0.00028 $0.00457
Sonnet 5 $0.00011 $0.00183
Haiku 4.5 $0.00006 $0.00091

Measured 2d ago against content hash c881b977bea0, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

rebuild scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/rebuild/SKILL.md · 75 lines

What it actually says

Rebuild

サーバーを停止し、ビルドしてバックグラウンドで再起動します。

使用方法

/rebuild                        # 現在のリポジトリで実行
/rebuild feature/235-worktree   # 指定ブランチのWorktreeで実行
/rebuild --port 3011            # ポート3011で起動
/rebuild feature/235-worktree --port 3011  # ブランチ指定+ポート指定

パラメータ

  • branch_name: 対象ブランチ名(省略可)。指定時は git worktree list からディレクトリを解決する。
  • --port {number}: 起動ポート番号(省略可)。指定時は CM_PORT 環境変数を設定してサーバーを起動する。未指定時はデフォルト(3000)。

実行手順

Step 1: 実行ディレクトリの決定

  1. ブランチ名が指定された場合:

    • git worktree list を実行し、指定ブランチに対応するディレクトリを取得する
    • 見つからない場合はエラー終了(「ブランチ '{branch_name}' に対応するWorktreeが見つかりません」)
    • 見つかったディレクトリを TARGET_DIR とする
  2. ブランチ名が未指定の場合:

    • 現在の作業ディレクトリ(プロジェクトルート)を TARGET_DIR とする

Step 2: サーバー停止・ビルド・再起動

停止とビルド・再起動を 1回のBash呼び出し で実行する(ユーザーへの許可確認を1回に抑えるため)。

ポート指定なしの場合:

cd {TARGET_DIR} && ./scripts/stop.sh && ./scripts/build-and-start.sh --daemon

ポート指定ありの場合:

cd {TARGET_DIR} && CM_PORT={port} ./scripts/stop.sh && CM_PORT={port} ./scripts/build-and-start.sh --daemon

注意: ポート競合が発生した場合は lsof -i :{port} -t でプロセスを特定し、killしてから再試行する。

完了報告形式

✅ サーバー再起動完了!

📋 サーバー情報:
  ディレクトリ: {TARGET_DIR}
  ブランチ:     {branch_name}
  PID:          [プロセスID]
  ポート:       {port} (デフォルト: 3000)
  URL:          http://localhost:{port}
  ログ:         {TARGET_DIR}/logs/server.log

🔧 操作コマンド:
  ログ確認: tail -f {TARGET_DIR}/logs/server.log
  停止:     cd {TARGET_DIR} && CM_PORT={port} ./scripts/stop.sh

注意:

  • ./scripts/stop.sh./scripts/build-and-start.sh はプロジェクトルートの .env ファイルを自動読み込みする(CM_PORT, CM_DB_PATH 等)。
  • --port オプションで CM_PORT を明示指定した場合、.env の値より優先される(環境変数が既にセットされている場合は .env で上書きされない仕様)。
  • 複数ポートで起動している場合、特定ポートだけ停止するには必ず CM_PORT={port} を付けること。
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 75 lines · 55 tokens per session scan A c881b977bea0

Subscribe to this mod's changes

rebuild is a skill published in the GitHub repository Kewton/CommandMate (39 stars, last pushed 2d ago), licensed MIT. It adds 55 tokens to every session and 914 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

aoe

Use when launching, monitoring, or controlling AI coding agents (Claude Code, Codex, OpenCode, etc.) in tmux via Agent of Empires (aoe). Covers creating sessions, capturing agent output, running parallel worktree agents, and organizing work into groups and profiles. Prefer aoe over raw tmux for agent management.

agent-of-empires/agent-of-empires · 71 tokens

aoe

Manage AI coding agent sessions via Agent of Empires (aoe).

agent-of-empires/agent-of-empires · 17 tokens

verify

Drive CrowTelemetry's OTLP ingest end-to-end — boot the real receiver, POST OTLP JSON with curl, inspect the SQLite db.

corveil/crow · 30 tokens

crow-show-image

Surface an image you've generated (a diagram, chart, screenshot, or rendered figure) in Crow's Images panel so the user can see it inline. Use whenever you produce a visual artifact worth showing.

corveil/crow · 44 tokens

remobi-setup

Full interactive onboarding for remobi — the mobile terminal overlay for tmux. Checks prerequisites, inspects tmux config, interviews the user about their workflow, generates a validated remobi.config.ts, suggests tmux mobile optimisations, and walks through deployment. Use this skill whenever someone asks to set up…

connorads/remobi · 127 tokens

build-and-verify

Build, test, and end-to-end verify the Multiplex visionOS/iPadOS SSH-tmux terminal app. Use this whenever you need to compile the app, run its unit tests, regenerate the Xcode project after editing project.yml or adding/ removing source files, or confirm a change works in the real app on the visionOS or iPad…

multiplex-term/Multiplex · 176 tokens