# Build And Check

> Build & Check

- Skill: `priority3/build-and-check` (Agent Skill)
- Install (CLI): `npx skillmds@latest add priority3/build-and-check`
- Raw SKILL.md: https://api.skillmd.com/api/skills/priority3/build-and-check/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: priority3 (https://skillmd.com/u/priority3)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/priority3/build-and-check

---


# Build & Check

Run a comprehensive build validation across the agent backend and Chrome extension before committing or deploying.

## When to use

- After making code changes to either `agent/` or `chrome-extension/`
- Before committing (pre-flight check)
- When user says "check", "build", "compile", "validate", "有没有报错"

## Steps

### 1. Agent TypeScript type-check

```bash
cd agent && npx tsc -p tsconfig.json --noEmit; echo "TSC=$?"
```

All changes must compile cleanly. If TSC != 0, fix errors before proceeding.

### 2. Chrome extension JS syntax check

```bash
cd chrome-extension && for f in background.js options.js popup.js i18n.js content.js; do
  node --check "$f" && echo "  ✓ $f" || echo "  ✗ $f FAIL"
done
```

Every JS file must pass `node --check`.

### 3. Manifest JSON validation

```bash
cd chrome-extension && node -e "JSON.parse(require('fs').readFileSync('manifest.json','utf8')); console.log('✓ manifest.json valid')"
```

### 4. Admin inline JS parse check (if admin/index.html was modified)

```bash
cd agent/admin && node -e "
const s = require('fs').readFileSync('index.html','utf8');
const m = s.match(/<script>([\s\S]*)<\/script>/);
new Function(m[1]);
console.log('✓ admin inline JS parseable')
"
```

### 5. Quick residual file check

```bash
ls agent/_*.ts chrome-extension/_*.html 2>/dev/null && echo "⚠ temp files found!" || echo "✓ no temp files"
```

## Stopping condition

- All checks pass (✓) → proceed
- Any check fails → fix the error, re-run the failing step only

## Notes

- The agent uses `tsx` at runtime but `tsc --noEmit` for type-checking only (no emit).
- Chrome extension is plain JS (no build step), so `node --check` is sufficient.
- The admin panel is a single HTML file with inline `<script>` — parse check catches syntax errors.

