본문으로 건너뛰기
cccskills
무료GitHub에 공개

scalability-review

Review whether a change still behaves correctly as users, data, and backend instances grow — unbounded reads, missing indexes, replica-unsafe in-memory state and crons, request-path work that belongs on a queue, connection and provider budgets. Use when a change adds or modifies list endpoints, queries on growing tables, @Cron tasks, BullMQ producers/consumers, process-local state, or LLM/embedding/crawl provider calls.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ayunis-core/ayunis-core스타 34(GitHub 34 + cccskills 0)
연동 도구PostgreSQLRedis

실행 점수 미검증

설치 방법 보기

포함된 파일(1)

  • SKILL.md5.9 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Scalability Review

Answer one question per change: does this still behave correctly at 10× the users and data, and with more than one backend instance? This is not a general performance pass — flag only failure modes that grow with load or instance count.

As of 2026-10-13 the backend runs as one replica (production replica count is owned by ayunis-infra; staging by this repo's deploy script). Check the current count before calling a replica bug latent. At one replica it is a hazard for the first scale-out rather than a live bug — flag it rather than growing the set already tracked in AYC-1258.

When it applies

Load this skill when the diff touches any of:

  • A query on a table that grows with usage (threads, messages, sources, embeddings, usage, storage objects) or a list endpoint / frontend picker backed by one
  • @Cron tasks, BullMQ producers or consumers
  • Module-level or class-level state: maps, caches, cooldowns, isRunning flags, in-flight promise chains
  • Calls to LLM, embedding, crawl, or other external providers
  • Upload, document, or file processing

Skip it for copy, styling, and pure domain logic.

Checklist

1. Bounded reads

  • Every list query has pagination or a LIMIT; nothing loads a user's or org's full history into memory.
  • A new query on a growing table has an acceptable measured cost at expected volume. Check with EXPLAIN (ANALYZE, BUFFERS) on seeded volume, not by reading the query. Judge the cost, not the plan type: a sequential scan is fine for a broad query that reads most of the table.
  • Add an index (via the typeorm-migrations skill) only when that plan shows one is needed. An existing selective index may already cover the query, and a non-selective column doesn't earn one.

2. Round trips

Delegate to persistence-query-review for N+1 access, check-then-act races, and avoidable reloads. Don't duplicate its rules here.

3. Replica safety

Assume a second instance will run the same code against the same Postgres and Redis.

  • Crons fire on every instance. An in-process isRunning flag only prevents overlap within one process. A new @Cron must be single-flight across instances — see AYC-1258 for the agreed mechanism — or be provably idempotent and cheap when run N times concurrently.
  • Process-local state diverges. Caches, cooldowns, rate limiters, and dedup maps are per instance. State why per-instance behavior is acceptable (as iam/budget-alerts documents for its cooldown), or move it to Postgres/Redis.
  • Side effects before persistence duplicate. Sending an email or calling a provider before recording that it happened is at-least-once per instance. Prefer a unique constraint or conditional insert that claims the work first.

4. Request path vs. queue

Work that is slow or bursty and can finish asynchronously — the user does not wait on the response — belongs on BullMQ. Interactive work such as streamed chat stays in the request path; bound it with timeouts and the budgets in section 5 instead. Queued work follows domain/sources/infrastructure/queue (producer/consumer split, bullmq-job.helpers.ts defaults: bounded attempts with backoff, bounded job retention, explicit concurrency). For a queued job check:

  • Each side effect is safe to repeat on retry: idempotent, claimed in persistence before it runs (unique constraint or conditional insert), or sent with a provider idempotency key. A deduplicated job id only prevents duplicate enqueues, not repeated side effects when an attempt fails partway and retries.
  • Its concurrency is explicit and sized against the provider and DB budgets below.
  • A job stuck mid-processing is recovered: sources stuck in processing past a timeout are marked failed (stale-processing-cleanup.task.ts). Copy that recovery behavior, not its scheduling — the task is a @Cron guarded by a process-local isRunning flag, which is the replica-unsafe pattern from section 3.

5. Connection and provider budgets

  • Postgres connections = backend instances × POSTGRES_POOL_SIZE (default 20). BullMQ consumers run in-process and share that pool, so raising consumer concurrency competes with HTTP requests for connections. Don't hold a transaction open across an LLM call, stream, or HTTP request to another service.
  • Streaming responses must not pin a DB connection for their duration.
  • Provider calls handle 429s with backoff and respect per-org limits; a burst from one org must not starve others.

6. Evidence

A scalability claim needs a measurement, not reasoning:

  • Query changes: EXPLAIN output on seeded volume.
  • Hot-path or queue changes: name the metric (Prometheus via prom-client, AppSignal) that will show regression, adding one if none exists.
  • Production behavior: query it with the appsignal-logs skill; state the environment the evidence came from.

Classification

Feed findings into the Proportional Workflow:

  • New replica-unsafe state, a new cron, or new queue/consumer behavior → High-Risk Path (concurrency-sensitive background work).
  • New query or list endpoint on a growing table → at least Standard Path.

Outcome

Report one Scale notes line in the review output: expected row counts or volume, indexes relied on, and replica safety (single-flight / idempotent / per-instance by design / n/a). When writing or updating a PR description, carry the line into it. If a finding is out of scope for the change, propose a follow-up ticket rather than expanding the change.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Query Ayunis deployed-environment telemetry in AppSignal — incidents, occurrence counts and error traces via the `appsignal-cli` binary; structured log attributes (user.id, org.id, nestjs.context, custom metadata) via the v2 logs API. Use when investigating a production/staging incident or log data — NOT for local dev logs (see backend-debugging).

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ayunis-core/ayunis-core342026년 10월 26일 업데이트

Ayunis Core backend specifics — module boundaries, key files, and project conventions. Complements the nestjs-hexagonal-backend skill.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ayunis-core/ayunis-core342026년 10월 26일 업데이트

Frontend development in ayunis-core. Use when creating, modifying, or debugging frontend code (React, Feature-Sliced Design, API client).

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ayunis-core/ayunis-core342026년 10월 26일 업데이트

Debug backend runtime errors (500s, crashes, unexpected behavior). Use when something is broken at runtime — not for writing new code.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ayunis-core/ayunis-core342026년 10월 26일 업데이트

Shared test fixtures for backend specs — port mock factories, domain builders, and shared IDs in a per-module testing/ folder. Use when a module's *.use-case.spec.ts files repeat the same mock-repository literal, inline entity construction, or hardcoded UUIDs across files.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ayunis-core/ayunis-core342026년 10월 26일 업데이트

Analyze Cursor Bugbot PR comments through a root-cause lens: is the finding valid, and is the suggested fix the real fix or a bandaid over a deeper problem? Use when the user asks to check, assess, or triage bugbot comments.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ayunis-core/ayunis-core342026년 10월 26일 업데이트

ayunis-core의 스킬 모두 보기

이 스킬의 문제 신고