# Build

> Build any STAR subsystem (proto, gateway, firmware, ROS2, UI, MATLAB, or generate documentation) Use when this capability is needed.

- Skill: `tomevault-io/build-2` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/build-2`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/build-2/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Docs & Writing
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/build-2

---


# Build Skill

Build commands for all STAR subsystems. Use this when you need to compile, generate code, run tests, or build documentation.

## Protocol Buffers (`star-proto/`)

```bash
# Lint and format (run from star-proto/)
cd star-proto
buf lint proto/
buf format --diff proto/

# Generate code for all targets (run from workspace root)
buf generate star-proto/proto

# Alternative: Use Makefile
make proto-gen

# Run Go tests
cd star-proto/tests/go && go test ./...
```

## Gateway Service (`star-gateway/`)

```bash
# Build
cd star-gateway
go build ./cmd/star-gateway

# Test
go test ./...

# Run (on RPi5)
./star-gateway
```

## Documentation (`docs/`)

```bash
# Build PDF (latexmk handles all passes automatically)
cd docs
make

# Quick single-pass draft preview
make draft

# Clean build artifacts (keep PDF)
make clean

# Clean everything including PDF
make distclean

# Watch for changes and auto-rebuild
make watch
```

## MATLAB (`matlab/`)

```bash
# Run in MATLAB
motor_model_1st_order   # Estimate transfer function
pid_design_velocity     # Design PID controller
pid_discretize          # Generate discrete coefficients for RX72N
```

## ROS2 Code Quality (`star-ros2/`)

```bash
# Format all ROS2 C++ files
./scripts/ros2/format-ros2.sh

# Check formatting (CI mode)
./scripts/ros2/format-ros2.sh --check

# Run automated code review
./scripts/ros2/review-ros2.sh

# Generate review report to file
./scripts/ros2/review-ros2.sh --report review.txt

# Install pre-commit hook (recommended)
cp scripts/git/pre-commit .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit
```

## Code Review (`coderabbit`)

CodeRabbit is an AI-powered code review tool that provides detailed feedback and fix suggestions for CI/dev workflows.

```bash
# AI-powered code review with detailed feedback and fix suggestions
coderabbit review --plain

# Token-efficient mode (minimal output for AI agents)
coderabbit review --prompt-only

# Review specific files
coderabbit review --plain path/to/file.go

# Shorthand alias
cr review --plain
```

**When to use:**
- Before commits to catch issues early
- After implementing features to get improvement suggestions
- During refactoring to ensure code quality
- Use `--plain` for human-readable analysis
- Use `--prompt-only` when working with AI agents to save tokens

**IMPORTANT - Automated Review Workflow:**
When completing plan mode implementations or any significant code changes:
1. Consider running `coderabbit review --prompt-only` after implementing changes
2. Optionally review feedback and apply suggested changes as appropriate
3. Iteratively improve your code based on the feedback
4. You may skip for trivial changes (typos, docs)

**Note:** Must run from repository root directory.

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/locked-inc) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-14 -->

