scopegate: Instructions file for Claude Code

CLAUDE.md

scopegate CLAUDE.md is an instructions file for Claude Code from alifanov/scopegate. It costs 7,477 tokens per session, scanned A, original, MIT.

Repository-specific instructions for developing Scopegate, a Next.js application that uses Prisma, PostgreSQL, authentication, and an MCP server.

In plain words
What is it for?
Use them when changing Scopegate, running local checks, understanding its architecture, or preparing commits and pull requests.
Why use it?
They explain the project’s commands, structure, and continuous-integration rules, including why a local production build should not be run before commits.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: mentions CLAUDE.md.

This is alifanov/scopegate's own configuration. It tells Claude Code how to work on scopegate itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything scopegate configures →

Reuse

Borrowing it

Nothing to install: this file belongs to alifanov/scopegate. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/alifanov/scopegate/master/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/alifanov/scopegate

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for scopegate CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/alifanov/scopegate/claude-md/github.svg)](https://agentmods.dev/instructions/alifanov/scopegate/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/alifanov/scopegate/claude-md"><img src="https://agentmods.dev/badge/instructions/alifanov/scopegate/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for scopegate CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/alifanov/scopegate/claude-md"><img src="https://agentmods.dev/badge/instructions/alifanov/scopegate/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 7,477 This file is loaded in full into every session.
When invoked 7,477 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.07477 $0.07477
Opus 5 $0.03739 $0.03739
Sonnet 5 $0.01495 $0.01495
Haiku 4.5 $0.00748 $0.00748

Measured 6d ago against content hash d35774e8ab01, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

scopegate CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 185 lines

How it starts

The opening of the file, as written. The whole thing — 185 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLAUDE.md

@.darkflow.d/claude.md

Commands

pnpm dev            # dev server → localhost:3000
pnpm build          # prisma generate + migrate deploy + next build (requires live DB)
pnpm test           # vitest run
pnpm lint           # eslint
bash ~/.darkflow/darkflow-run.sh        # Dark Flow routine dispatcher (global worker)

Commits & CI

Do NOT run pnpm build before or after commits. The Dark Flow CI gate (.github/workflows/darkflow-ci-gate.yml) runs installbuild (prisma generate && tsc --noEmit) → linttest on every push/PR on the project's self-hosted runner; it does not file anything itself. The ci-watch routine reads that workflow's conclusion and files a source:ci task on failure. This overrides the global "always run pnpm build before committing" rule because pnpm build runs migrations and requires a live DB. Failing checks → source:ci task → the fix-ci-issue worker pushes a fix (retries up to 3x, then needs-human); the task closes on green. Running pnpm lint/pnpm test locally for fast feedback is fine but not required. See docs/ci-runner.md for the full split between the workflow and ci-watch.

Architecture

Next.js 16 App Router · Prisma 7 + PostgreSQL · Auth: better-auth · MCP server: MCP SDK Streamable HTTP at /api/mcp/[apiKey] · OTel → SigNoz.

src/
  app/
    (auth)/           # login / register
    (dashboard)/      # admin / projects / settings / notifications
    api/
      mcp/[apiKey]/   # MCP HTTP endpoint (SSE keep-alive pings every 30s)
      cron/           # refresh-tokens (CRON_SECRET-guarded)
      oauth/          # OAuth callback handlers
      admin/          # invites / projects / users management
      notifications/  # notification API
      csp-report/     # CSP violation sink → SigNoz OTel span + structured log
      projects/[projectId]/  # per-project API
  lib/
    mcp/
      tools/          # per-service tool files (gmail, linkedin, stripe, airtable, calendar, calendly, openrouter, telegram, twitter-ads, …)
        index.ts      # TOOL_DEFINITIONS — aggregates all service tools
        types.ts      # ToolDefinition · ToolContext
      permissions.ts  # per-action permission definitions; PERMISSION_GROUPS derived from PROVIDER_REGISTRY
      handler.ts      # tool execution + audit logging; 30s per-tool timeout; OAuthTokenError detection
      metrics.ts      # lazy-init OTel counters (mcp.invalid_requests, mcp.blocked_requests)
      service-fetch.ts # unified transport — TRANSPORT_CONFIGS derived from PROVIDER_REGISTRY + SSRF-safe fetch
      safe-fetch.ts   # SSRF/DNS-rebinding-safe fetch (node:https); validates all A/AAAA records
      retry.ts        # retryWithDelays(), isRetriableNetworkError(), retryAfterDelayMs(), sleep()
      rate-limit.ts   # checkRateLimit() — atomic upsert into RateLimitBucket; injectable DB for tests
      image-utils.ts  # image/video download helpers (uses media-body.ts for streaming size limits)
      media-body.ts   # readBodyWithLimit(res, maxBytes, label) — streaming download with size cap
      email-parser.ts # email parsing utilities
      gmail.ts        # gmailFetch(), listGmailMessages(), getGmailMessage(), attachment helpers
      <service>.ts    # service-specific helpers (ahrefs, semrush, email, youtube, …)
      tools/
        fetch-tool.ts # createFetchTool() / createFetchTools() — declarative tool factory for REST endpoints
    auth.ts
    auth-middleware.ts   # AuthError / ForbiddenError / NotFoundError; requireAuth/requireProject helpers
    project-auth.ts      # project-level auth guards (verifies team membership)
    project-roles.ts     # PROJECT_ROLE constants; isProjectOwner()
    admin.ts             # isAdmin() helper (checks ADMIN_EMAIL env var)
    audit.ts             # recordAudit() — thin wrapper around mcp/audit-utils
    crypto.ts         # AES-256-GCM encrypt/decrypt (uses BETTER_AUTH_SECRET)
    oauth-flow.ts     # shared handleOAuthStart/handleOAuthCallback base logic
    oauth-state.ts    # HMAC-signed OAuth state (uses BETTER_AUTH_SECRET)
    oauth-callback-config.ts  # OAUTH_CALLBACK_REGISTRY — per-provider config factory (lazy-import)
    oauth-callback-route.ts   # createOAuthCallbackRoute(routeKey) — collapses OAuth callback boilerplate
    oauth-token-lifecycle.ts  # unified token refresh for all 26 providers; OAuthTokenError class; derives config from provider-registry
    token-refresh.ts  # cron token refresh service — PERMANENT_OAUTH_ERRORS, RefreshResult, refreshConnections(); injectable DB/clock for tests
    endpoint-permissions.ts   # createProjectEndpoint(), applyEndpointPermissions(), deleteEndpoint(), regenerateEndpointKey(), EndpointPermissionError
    cron-auth.ts              # checkCronAuth(request, secret?) — Bearer-token check for /api/cron/* routes; returns {ok:true} | {ok:false, status:401|500, error}
    provider-registry.ts      # PROVIDER_REGISTRY — single source of truth for all 26 providers (token strategy, transport, retry, permissions); add/remove a provider here only
    db.ts             # Prisma client
    provider-names.ts # OAuth provider display name map
  instrumentation.ts        # OTel hook (browser-safe entry point)
  instrumentation.node.ts   # OTel SDK init + PrismaInstrumentation (Node.js only)
prisma/
  schema.prisma       # User · Session · Account · Project · TeamMember ·
                      # ServiceConnection · McpEndpoint · EndpointPermission ·
                      # AuditLog · RateLimitBucket · Notification · InviteToken
docker/
  prisma.config.ts    # runtime Prisma config for migrate deploy (supplies DATABASE_URL; no dotenv)

Read the full file on GitHub · 185 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago Changed · +44 tokens per session d35774e8ab01
  2. 10d ago First seen · 185 lines · 7,433 tokens per session scan A f4f3e1e118d1

Subscribe to this mod's changes

scopegate CLAUDE.md is an instructions file published in the GitHub repository alifanov/scopegate (16 stars, last pushed today), licensed MIT. It adds 7,477 tokens to every session, about $0.0374 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other instructions, from other repositories

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,296 tokens

codex AGENTS.md

AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.

openai/codex · 5,153 tokens

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 6,785 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).

microsoft/vscode · 5,001 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,469 tokens

deepseek-harness AGENTS.md

AGENTS.md instructions for deepseek-ai/deepseek-harness, covering agents.md, pre-stable apis and released session data, repository layout, commands and host sandbox failures.

deepseek-ai/deepseek-harness · 3,735 tokens