一键导入
webstatus-backend
Use when creating or modifying Go backend API endpoints, modifying Spanner database schemas, or working with OpenAPI and Spanner mappers.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when creating or modifying Go backend API endpoints, modifying Spanner database schemas, or working with OpenAPI and Spanner mappers.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when modifying the frontend SPA, working with TypeScript, Lit web components, Shoelace components, or frontend tests.
Use when upgrading toolchain versions (Go, Node.js, Terraform, Playwright) or updating the DevContainer and Github CI configurations.
Use when working with the webstatus notification pipeline, event producer, push delivery, or push workers (e.g., Email, Webhooks), and Pub/Sub subscribers.
Use when modifying the ANTLR search grammar, adding new search terms, or working with the query parser and builder.
Use when writing, modifying, or debugging Playwright end-to-end (E2E) tests for webstatus.dev.
Use when working on Go data ingestion workflows, scheduled Cloud Run jobs, or adding new scrapers for BCD, WPT, or other data sources.
| name | webstatus-backend |
| description | Use when creating or modifying Go backend API endpoints, modifying Spanner database schemas, or working with OpenAPI and Spanner mappers. |
This skill provides guidance for developing the Go-based backend API for webstatus.dev.
backend/pkg/httpserver): Handles routing and requests via oapi-codegen stubs.lib/gcpspanner/spanneradapters): Translates API types to database types.lib/gcpspanner): Core logic for Spanner interactions using the Mapper pattern.lib/valkeycache): Isolated via Private Service Connect (PSC) for secure internal access.For a technical deep-dive into the backend implementation patterns, request flows, and auth middleware, see references/architecture.md.
lib/, util/, and the OptionallySet pattern.We use a Hexagonal-style Adapter Pattern to decouple application logic from infrastructure.
pkg/sender).lib/ (e.g., lib/gcpspanner/spanneradapters or lib/valkeycache).lib/backendtypes) to map raw internal errors to safe, static sentinel errors before they cross boundaries. This prevents dynamic context or database details from leaking to presentation layers.v1.QueryError in blobtypes) instead of using internal types directly. This maintain boundary isolation and prevents changes in the backend from breaking saved logs or deliveries.executionData).Load methods). Using structured types allows for future extension and maintains type safety.generic.OptionallySet[[]T] instead of relying on nil or empty slices to distinguish between "empty but validly checked" and "not set/not applicable". This ensures explicit intent and avoids ambiguity.spanneradapters for DB interactions in the API.gcpspanner.Client directly from httpserver handlers.row.ToStruct(&yourStruct) instead of manual column scanning.lib/gcpspanner.lib/workertypes for any data crossing service boundaries (e.g. results sent to Pub/Sub).testcontainers-go for any changes to the lib/gcpspanner layer.backend/pkg/httpserver/cache.go.lib/backendtypes into lib/gcpspanner (prevents circular dependencies).gcpspanner client.Merge functions in mappers copy ALL fields, including UpdatedAt....WithTransaction variants of helpers when inside a ReadWriteTransaction.eventPublisher.PublishSearchConfigurationChanged in handlers that modify user saved searches to trigger immediate notification dispatcher updates.noAuth: under components.securitySchemes in openapi.yaml whenever any operation specifies noAuth: [] in its security: requirements. In oapi-codegen v2.7+, <Scheme>ContextKey types (noAuthContextKey) are generated strictly from components.securitySchemes; omitting noAuth causes undefined: noAuthContextKey build failures.*string) when populating optional OpenAPI response header fields (like Location in 301 responses), as oapi-codegen v2.7+ models optional response headers as pointer types.backend.StrictHandlerFunc and backend.StrictMiddlewareFunc directly from the generated package rather than importing from github.com/oapi-codegen/runtime/strictmiddleware/nethttp.make precommit to execute the full suite of Go tests, formatting, and linting.make go-lint to lint all Go code using golangci-lint.
goconst & Spanner Queries: In .golangci.yaml, goconst is explicitly excluded for lib/gcpspanner/.*\.go (linters.exclusions.rules). Because lib/gcpspanner consists of dozens of files whose sole job is executing SQL queries where parameter map keys (map[string]any{"startAt": startAt}) naturally repeat across methods to match raw SQL parameters (@startAt), excluding goconst on this path eliminates false positives cleanly without requiring a brittle ignore-string-values whitelist or forcing DRY constants across independent queries.lib/gcpspanner (e.g. workers, API handlers), repeating magic strings ("type", "text", error messages) MUST be declared as package constants to satisfy goconst.go.work), to run tests quickly for a single package without running the whole suite, execute go test from within the specific module directory, or provide the full module path:
cd backend && go test -v ./pkg/...
# Or
go test -v github.com/GoogleChrome/webstatus.dev/lib/gcpspanner/...
lib/gcpspanner MUST include integration tests using testcontainers-go against the Spanner emulator.When making significant architectural changes, adding new major endpoints, or altering the database schema:
GEMINI.md to ensure I am aware of the changes.docs/ARCHITECTURE.md if the system boundaries change.