Skip to content

Commit 7b8cb04

Browse files
author
shijiashuai
committed
chore: add CLAUDE.md, /verify skill, and gofmt-on-edit hook
1 parent 9bf159d commit 7b8cb04

File tree

3 files changed

+62
-0
lines changed

3 files changed

+62
-0
lines changed

.claude/settings.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"hooks": {
3+
"PostToolUse": [
4+
{
5+
"matcher": "Write|Edit",
6+
"hooks": [
7+
{
8+
"type": "command",
9+
"command": "jq -r '.tool_input.file_path // .tool_response.filePath' | { read -r f; case \"$f\" in *.go) gofmt -w \"$f\" 2>/dev/null ;; esac; } || true",
10+
"timeout": 10
11+
}
12+
]
13+
}
14+
]
15+
}
16+
}

.claude/skills/verify/SKILL.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
name: verify
3+
description: Run the full CI check suite locally — build, test with race detector, and lint.
4+
---
5+
6+
Run the full verification suite that CI runs:
7+
8+
1. Build: `go build ./...`
9+
2. Test: `go test -race -count=1 -coverprofile=coverage.out ./...`
10+
3. Vet: `go vet ./...`
11+
4. Lint: `golangci-lint run`
12+
13+
Report pass/fail for each step. If any step fails, show the relevant output and stop.

CLAUDE.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project
6+
7+
Go 1.22+ WebSocket signaling server for WebRTC P2P audio/video. Backend: `cmd/server/main.go` + `internal/signal/`. Frontend: vanilla JS in `web/` (no bundler, no framework).
8+
9+
## Commands
10+
11+
- **Build**: `go build ./...`
12+
- **Test**: `go test -race -count=1 ./...`
13+
- **Lint**: `golangci-lint run` (config: `.golangci.yml`, 11 linters including staticcheck, revive, gocritic)
14+
- **Run server**: `go run ./cmd/server` (listens on `:8080`)
15+
- **Single test**: `go test -race -run TestName ./internal/signal/`
16+
17+
## Code Style
18+
19+
- Go: tabs, `gofmt`. JS/CSS/HTML: 2-space indent (see `.editorconfig`).
20+
- US English spelling (enforced by misspell linter).
21+
- No dot imports, no blank imports (enforced by revive).
22+
23+
## Commits
24+
25+
Use [Conventional Commits](https://www.conventionalcommits.org/): `feat:`, `fix:`, `docs:`, `refactor:`, `test:`, `chore:`.
26+
27+
## Environment Variables
28+
29+
| Variable | Default | Purpose |
30+
|:---------|:--------|:--------|
31+
| `ADDR` | `:8080` | HTTP listen address |
32+
| `WS_ALLOWED_ORIGINS` | `localhost` | Comma-separated origins; `*` for all |
33+
| `RTC_CONFIG_JSON` | public STUN | JSON ICE/TURN config passed to browser |

0 commit comments

Comments
 (0)