.claude/skills/new-regression-guard/SKILL.md
Scaffold a new bun:test regression guard under tests/regression/ following the existing file-walking + forbidden-patterns + structured-error-report pattern. Ask the user for the guard name, scan scope, forbidden patterns or assertion type, allowlist files, and the motivating OpenSpec change or Phase 0 gate. User-only — explicit invocation, not a background task.
npx skillsauth add jrmatherly/1dev new-regression-guardInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
The repo has multiple regression guards under tests/regression/. The canonical list and purpose of each guard lives in docs/conventions/regression-guards.md. They all share a common file-walking + forbidden-patterns + structured-error-report pattern. This skill scaffolds a new one without copy-pasting the ~80 lines of boilerplate.
To see the current count and list:
ls tests/regression/*.test.ts | wc -l
ls tests/regression/*.test.ts
brand-identity Tier A enforcement)tests/ but NOT under tests/regression/ — this skill is only for guardsRead ONE of these as a template based on the style of invariant. The canonical list and purpose of each guard is maintained in docs/conventions/regression-guards.md — refer to it for the full inventory.
| Existing guard | Pattern type | Read when your guard is... |
|---|---|---|
| tests/regression/auth-get-token-deleted.test.ts | File-existence assertion | A deleted-file guard ("X.ts must not exist") |
| tests/regression/token-leak-logs-removed.test.ts | Forbidden-substring in a directory | A pattern-in-directory guard ("string S must not appear in dir D") |
| tests/regression/brand-sweep-complete.test.ts | Forbidden-pattern + file-level allowlist | A pattern guard with Tier C exceptions |
| tests/regression/gpg-verification-present.test.ts | Required-substring (inverse) | A pattern-REQUIRED guard ("string S MUST appear in file F") |
| tests/regression/feature-flags-shape.test.ts | Schema-shape assertion | A structural guard ("object O must have field F") |
| tests/regression/credential-manager-deleted.test.ts | File-existence assertion (mirror of auth-get-token) | A deleted-file guard with related reasoning |
If not provided as arguments, ask:
sandbox-oauth-removed). Avoid generic names like new-guard; prefer {what}-{state} (something-removed, something-present, something-shape).src/main/, src/renderer/, scripts/, or a custom list of directories + individual files.Read the closest-match template from the table above. Do NOT blindly copy brand-sweep-complete.test.ts unless the new guard also needs file-level allowlisting.
Create the guard file at tests/regression/{guard-name}.test.ts. Match the existing structure:
docs/ pagedescribe, test, expect from bun:test; file I/O helpers from node:fs + node:pathREPO_ROOT constant computed via join(import.meta.dir, "..", "..")walkFiles, walkTsFiles, or similar) if scanning a directorydescribe block with a descriptive name matching the guard's purposetest blocks with structured error reporting (file:line, matched substring, explanation)Run the new guard in isolation to confirm it passes:
bun test tests/regression/{guard-name}.test.ts
Run the full test suite to confirm the new guard doesn't break any existing one:
bun test
Update documentation surfaces — add the new guard to:
docs/conventions/regression-guards.md (canonical list) — add the guard name, purpose, and a link to its motivating OpenSpec change or Phase 0 gateCLAUDE.md — if the critical-rules or pointers section cites a count or list, increment it.claude/PROJECT_INDEX.md — if it lists guards, update the count.serena/memories/task_completion_checklist.md — if it mentions the guard count, update it
The docs-drift-check skill will flag any missed surface.Verify the guard FAILS in a controlled way — temporarily reintroduce the forbidden pattern in a test file, run the guard, confirm the failure message is clear and actionable, then revert. The error message is what future contributors will see when their commit gets blocked — it must name the file, the line, the pattern, and provide a path forward (e.g., "add to ALLOWLIST_FILES with a justifying comment").
Every guard's failure message should contain:
file:line, matched content snippet (truncated), and the pattern nameExample from brand-sweep-complete.test.ts:
throw new Error(
`Found ${offenders.length} Tier A brand regression(s) outside the allowlist:\n${report}\n\n` +
`If the occurrence is a legitimate Tier C attribution, add the FILE to ALLOWLIST_FILES ` +
`in tests/regression/brand-sweep-complete.test.ts with a comment justifying the addition. ` +
`Otherwise, remove or rebrand the identifier.`,
);
Set<string> of repo-relative pathsbun being installed at a specific path — use only bun:test imports and node:fs/node:pathdevelopment
Background knowledge for AI agents before editing any file that handles authentication tokens or spawn environment variables in the 1Code enterprise fork. Triggers when touching src/main/lib/trpc/routers/claude.ts, claude-code.ts, claude/env.ts, feature-flags.ts, or claude-token.ts. Reminds the agent to consult the frozen Envoy Gateway strategy doc (auth-strategy-envoy-gateway.md v2.1) sections that impose hard rules on credential handling.
tools
Background knowledge for safely bumping the pinned versions of Claude CLI binary, Codex CLI binary, Electron, Vite, Tailwind, or Shiki in this repo. Each pin is load-bearing for a different reason — this skill encodes the per-pin rationale and the regression test that must pass before the bump can land. Use proactively whenever editing package.json, scripts/download-claude-binary.mjs, scripts/download-codex-binary.mjs, or any file that mentions these versions. Claude-only (background knowledge, not user-invocable).
development
Use when reading or writing any file under src/renderer/ that calls remoteTrpc.* or fetch(${apiUrl}/...). Verifies the call site is documented in docs/enterprise/upstream-features.md and warns if a new upstream-backend dependency is being introduced without a corresponding F-entry. This skill enforces the enterprise-fork posture documented in CLAUDE.md.
development
End-of-task sync — update CLAUDE.md, rebuild code graph, sync Serena memories, check roadmap drift, and commit. Run after completing any significant work to ensure all drift surfaces are current.