---
name: bigstack-review
version: 0.1.0
description: |
  Pre-landing code review. Two-pass review (critical issues first,
  then informational), with Fix-First classification and
  documentation staleness check.
allowed-tools:
  - Bash
  - Read
  - Glob
  - Grep
  - Edit
  - AskUserQuestion
---
<!-- Auto-generated from SKILL.md.tmpl by bigstack. DO NOT EDIT. -->
<!-- Regenerate: npm run gen:skill-docs -->

<!-- bigstack v0.1.0 | skill: bigstack-review -->

> **bigstack v0.1.0** — skills for Bigscreen development.

Before starting, run this setup block silently:

```bash
# Session context
BIGSTACK_VERSION="0.1.0"
BIGSTACK_DIR="C:/Users/GGPC/Documents/Github/bigstack"
REPO_NAME=$(basename "$(git rev-parse --show-toplevel 2>/dev/null)" 2>/dev/null || echo "unknown")
BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
echo "bigstack v$BIGSTACK_VERSION | repo: $REPO_NAME | branch: $BRANCH"
```

**Guidelines:**
- When asking the user a question, use AskUserQuestion (not inline text questions)
- When uncertain about a change, state your confidence level before proceeding
- Prefer modifying existing code over creating new files
- This is an existing codebase — understand before changing

# /bigstack-review — Code Review

Perform a structured code review of the current changes.

## Base Branch Detection

```bash
# Detect the base branch for PR targeting
BASE_BRANCH=$(gh pr view --json baseRefName -q .baseRefName 2>/dev/null || echo "")
if [ -z "$BASE_BRANCH" ]; then
  if git show-ref --verify --quiet refs/heads/main 2>/dev/null; then
    BASE_BRANCH="main"
  elif git show-ref --verify --quiet refs/heads/master 2>/dev/null; then
    BASE_BRANCH="master"
  else
    BASE_BRANCH=$(git remote show origin 2>/dev/null | grep 'HEAD branch' | awk '{print $NF}' || echo "main")
  fi
fi
echo "Base branch: $BASE_BRANCH"
```

## Workflow

### Step 1: Gather Changes

```bash
# What's being reviewed
git diff $BASE_BRANCH...HEAD --stat
echo "---"
git log --oneline $BASE_BRANCH..HEAD
```

Read the full diff: `git diff $BASE_BRANCH...HEAD`

### Step 2: Pass 1 — Critical Issues

Review for issues that **must be fixed** before merging:

- **Correctness**: Logic errors, off-by-one, null/undefined handling
- **Security**: Injection, auth bypass, secret exposure, OWASP Top 10
- **Data loss**: Destructive migrations, missing rollback, dropped constraints
- **Breaking changes**: API contract changes, removed public interfaces

For each critical issue found:
> **CRITICAL [C-N]**: [file:line] — [description]
> **Fix**: [specific fix recommendation]

### Step 3: Pass 2 — Informational

Review for issues that are **good to fix** but not blocking:

- **Performance**: N+1 queries, missing indexes, unnecessary allocations
- **Maintainability**: Code duplication, unclear naming, missing error context
- **Testing**: Untested paths, brittle assertions
- **Style**: Inconsistency with existing codebase conventions

For each informational issue:
> **INFO [I-N]**: [file:line] — [description]

### Step 4: Documentation Staleness

Check if changed code has associated documentation that needs updating:

```bash
# Find README, docs, and comment blocks near changed files
git diff $BASE_BRANCH...HEAD --name-only | while read f; do
  dir=$(dirname "$f")
  ls "$dir/README.md" "$dir/docs/" 2>/dev/null
done | sort -u
```

Flag any documentation that references changed behavior.

### Step 5: Summary

Present a review summary:

| Category | Count |
|----------|-------|
| Critical | N |
| Informational | N |
| Stale docs | N |

**Verdict**: APPROVE / REQUEST CHANGES / NEEDS DISCUSSION

## Confidence Calibration

Before completing a major action, state your confidence:

| Level | Meaning | Action |
|-------|---------|--------|
| **High** | Well-understood change, clear test coverage, matches existing patterns | Proceed |
| **Medium** | Reasonable approach but some uncertainty — unfamiliar area, partial test coverage | Proceed but flag risks |
| **Low** | Significant unknowns, could break existing behavior, no test coverage | Stop and ask the user |

Format: **Confidence: [High/Medium/Low]** — [one-line rationale]
