Skip to content

sno-ai/sno-station-skills / plugins/sno-station-standalone/skills/first-principles-review

first-principles-review

Verified

MANUAL-ONLY: challenge a product idea, design, PRD, or architecture from first principles. Use only when the user names this skill. Research first, then write a local review and PRD handoff.

scripts/selftest/run-extractor-test.sh

View on GitHub
#!/usr/bin/env bash
export PYTHONDONTWRITEBYTECODE=1
set -Eeuo pipefail

selftest_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
skill_dir="$(cd "$selftest_dir/../.." && pwd)"
fixtures="$selftest_dir/fixtures"
extractor="$skill_dir/scripts/extract-prd-handoff.py"
valid_report="$fixtures/valid-report.md"
expected_handoff="$fixtures/expected-handoff.json"
temporary="$(mktemp -d)"
trap 'rm -rf "$temporary"' EXIT

expect_rejection() {
  local label="$1"
  shift
  if "$@"; then
    printf 'FAIL: %s was accepted\n' "$label" >&2
    exit 1
  fi
  printf 'PASS: %s rejected\n' "$label"
}

for required in "$extractor" "$valid_report" "$expected_handoff"; do
  [[ -f "$required" ]] || { printf 'missing required file: %s\n' "$required" >&2; exit 1; }
done

observed_handoff="$temporary/observed-handoff.json"
python3 "$extractor" "$valid_report" >"$observed_handoff"
python3 - "$expected_handoff" "$observed_handoff" <<'PY'
import json
import pathlib
import sys

expected = json.loads(pathlib.Path(sys.argv[1]).read_text(encoding="utf-8"))
observed = json.loads(pathlib.Path(sys.argv[2]).read_text(encoding="utf-8"))
if observed != expected:
    raise SystemExit("extracted handoff differs from expected-handoff.json")
PY
printf 'PASS: valid-report extraction exactly matches expected handoff data\n'

malformed="$temporary/malformed-handoff.md"
multiple="$temporary/multiple-handoff.md"
python3 - "$valid_report" "$malformed" "$multiple" <<'PY'
import pathlib
import sys

source = pathlib.Path(sys.argv[1]).read_text(encoding="utf-8")
pathlib.Path(sys.argv[2]).write_text(
    source.replace('{"true_problem"', '{"true_problem":', 1),
    encoding="utf-8",
)
pathlib.Path(sys.argv[3]).write_text(
    source + '\n```json\n{}\n```\n',
    encoding="utf-8",
)
PY
expect_rejection "malformed handoff block" python3 "$extractor" "$malformed"
expect_rejection "multiple handoff blocks" python3 "$extractor" "$multiple"

printf 'run-extractor-test passed\n'
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall