Communitygithub.com

lguidolin/performance-and-scale

성능 및 확장성 문제(핫 경로, 목록 엔드포인트, 페이지네이션, 루프 내 데이터 액세스, 공개 인터페이스/스키마 작업 시)를 해결하기 위한 스킬입니다. 증상: 무제한 쿼리, N+1 액세스, 대기 시간 예산 없음, 측정 없는 최적화, 여러 소비자가 의존하는 인터페이스 변경. 키워드: 페이지네이션, N+1, 하이럼의 법칙, 성능 예산, 번들 크기.

performance-and-scale란 무엇인가요?

이 스킬은 소프트웨어 시스템의 성능과 확장성을 유지하기 위한 원칙과 실용적인 지침을 제공합니다. 예산을 설정하고 측정하며, 최적화 전에 실제 병목 지점을 찾고, 모든 목록에 기본적으로 페이지네이션을 적용하고, N+1 쿼리 패턴을 방지하며, 공개 인터페이스의 변경을 신중히 다루는 방법을 설명합니다. Claude Code, Cursor, Codex 등 다양한 AI 에이전트 플랫폼에서 사용할 수 있으며, SKILL.md 문서를 기반으로 CI(지속적 통합)에서 번들 크기나 쿼리 비용 한도를 자동으로 검사하고 코드 리뷰 시 페이지네이션 및 N+1 회피 여부를 판단하는 기준을 제시합니다. 하이럼의 법칙(Hyrum's Law)을 강조하여 관찰 가능한 모든 동작이 예기치 않은 계약이 될 수 있음을 경고하고, 기존 필드를 수정하기보다 새 필드를 추가하고 이전(deprecate)하는 방식을 권장합니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/lguidolin/agent-skills/tree/main/skills/performance-and-scale

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

성능 및 확장성

개요

성능은 예산이 있는 기능입니다. 측정하고, 한계를 정하고, 오늘의 동작이 내일의 계약이 된다는 점을 존중하세요. 시스템은 설계한 처리량에서 무너지는 경우가 드뭅니다. 인덱싱하지 않은 쿼리와 페이지네이션하지 않은 목록에서 무너집니다.

원칙

  • 예산을 설정하고 이에 대해 측정하세요. 대기 시간 목표(관찰 가능성 및 SLO의 SLO와 연결됨)와 클라이언트 예산(예: 번들 크기)을 설정합니다. 예산을 초과한 회귀는 버그입니다.
  • 최적화하기 전에 측정하세요. 코드를 변경하기 전에 프로파일, 쿼리 계획, 추적을 통해 실제 병목 지점을 찾으세요. 추측에 의한 최적화는 하지 마세요.
  • 기본적으로 페이지네이션하세요. 커질 수 있는 모든 목록은 최대 페이지 크기가 정해진 페이지네이션을 적용합니다. 무제한 결과 집합은 대기 시간 및 서비스 거부 위험입니다.
  • N+1 액세스 패턴을 주의하세요. 루프에서 데이터를 가져오는 것이 가장 흔한 확장성 실패입니다. 대신 배치(batch)나 조인(join)을 사용하세요. (이 스택에서는: 행별 해결 대신 GraphQL 계층의 look-ahead/DataLoader를 사용하세요.)
  • 하이럼의 법칙은 현실입니다: 인터페이스의 관찰 가능한 모든 동작은 충분한 소비자가 생기면 누군가가 의존하는 계약이 됩니다. 여기에는 의도치 않은 동작(순서, null 허용 여부, 오류 형태, 타이밍)도 포함됩니다. 공개 인터페이스(특히 API/스키마)를 계약으로 취급하세요: 조용히 변경하지 말고 추가하고 폐기(deprecate)하세요. graphql-contract-testing의 계약 테스트는 여러분이 선택한 동작을 고정합니다. 규율은 선택하지 않은 동작을 보호합니다.

빠른 참조

문제 상황해결 방법
루프 안의 쿼리배치 또는 조인; look-ahead 사용
제한 없는 목록 엔드포인트최대 크기가 정해진 페이지네이션 추가
측정 없이 "최적화해 보겠습니다"먼저 프로파일; 실제 병목 지점 찾기
필드의 타입/nullability/순서 변경계약 변경입니다 — 새로 추가하고, 이전 것은 폐기
대기 시간 또는 번들 목표 없음예산 설정; 회귀를 버그로 처리

시행: 기계화 가능한 부분(번들 크기 제한, 쿼리 비용 제한)은 CI에서 예산을 확인합니다. 페이지네이션 및 N+1 회피는 부하 테스트와 쿼리 계획 검토를 기반으로 한 리뷰어의 판단에 맡깁니다.

전체 근거: engineering-constitution/references/engineering-constitution.md에 번들된 헌법 제11조.

Individual skills in this repo

This repo contains 18 individual skills — each has its own dedicated page.

lguidolin/change-hygiene-and-code-craft

Use when writing or refactoring code, structuring a commit or PR, or deciding whether to abstract duplication. Symptoms — mixing reorg with logic changes, a PR doing several things at once, a file growing large, the second copy of similar code, or unsure whether to DRY something up.

lguidolin/cloud-delivery-aks

Use when deploying to Kubernetes or Azure Kubernetes Service (AKS), configuring cloud secrets, setting up progressive rollout/canary, per-PR ephemeral environments, or k8s health probes. Keywords — Kubernetes, AKS, Key Vault, Argo Rollouts, Flagger, canary, blue-green, liveness, readiness, PodDisruptionBudget, HPA, rollback, GHCR.

lguidolin/commit-history-rewrite

Use when an existing repository has messy commit history that needs to conform to conventional commits before adopting release-please, or when intermediate WIP/fixup/merge commits need to be cleaned up.

lguidolin/conventional-commits-and-releases

Use when committing, writing a commit message, opening a PR that will be squash-merged, or configuring automated versioning/changelogs. Keywords — conventional commits, release-please, semver, feat/fix/chore, breaking change, changelog.

lguidolin/defense-in-depth-security

Use when handling untrusted input, secrets, authentication/authorization, or dependencies — or threat-modeling a new surface. Keywords — STRIDE, threat model, least privilege, secrets management, supply chain, dependency scanning, input validation, audit log, defense in depth.

lguidolin/designing-before-building

Use when starting a feature, fixing a non-trivial bug, or about to write implementation code — before any code exists. Symptoms you need this: "this is simple, I'll just code it", reaching for the editor before a design is approved, or an idea that hasn't been turned into a spec and plan.

lguidolin/engineering-constitution

Use when starting work in a project that follows the engineering constitution, orienting to its rules, or deciding which engineering practice applies to a task — spec writing, commits, testing, security, deploys, database, or UI work.

lguidolin/graphql-contract-testing

Use when writing a GraphQL query/mutation that the UI and a test will share, or building route/schema contract or smoke tests. Symptoms — copying a query into a test, a test asserting on query text, schema change that didn't break the UI build, or RLS/permission drift. Keywords — graphql-codegen, typed document, contract test, route smoke test.

lguidolin/init-repo-CI

Use when setting up a new repository with conventional commits, release-please, and CI automation, or when retrofitting an existing repository that lacks automated versioning and PR validation workflows.

lguidolin/interface-craft-and-accessibility

Use when building or styling UI — components, layouts, forms, design tokens — or making accessibility decisions. Keywords — a11y, WCAG, keyboard navigation, focus state, contrast, design system, minimalist UI, component reuse, ARIA, semantic HTML.

lguidolin/merge-gates-and-automation

Use when setting up or changing CI, pre-push hooks, or a task runner, or deciding what must pass before merge. Symptoms — tempted to put authoritative checks only in a local hook, skip CI, bypass with --no-verify, or unsure what gates a merge vs. runs locally.

lguidolin/observability-and-slos

Use when adding logging, metrics, tracing, health checks, SLOs, or alerting — or when building a service surface that needs to be operable and debuggable. Keywords — structured logs, OpenTelemetry, correlation id, RED metrics, liveness, readiness, SLI, SLO, error budget, alerting.

lguidolin/postgres-postgraphile-rls-and-sql

Use when writing PostgreSQL, PostGraphile config, Row-Level Security policies, SQL schema files, or working on the Browser→App→PostGraphile→Postgres data path. Keywords — RLS, SECURITY DEFINER, search_path, pgSettings, grants, roles, GraphQL depth limit, query cost, statement_timeout, SQL file organization.

lguidolin/recording-decisions

Use when a design or architecture decision has been made and needs to be captured — writing a decision record or ADR, updating a decision index, noting a deferred idea, or superseding a past decision. Keywords — ADR, decision record, rationale, rejected alternatives, dependency index.

lguidolin/resilience-and-deploy-safety

Use when planning a deploy, designing a rollback, or responding to an incident or writing a postmortem. Keywords — deploy safety, rollback, immutable artifact, progressive delivery, canary, blast radius, incident response, blameless postmortem, error budget.

lguidolin/ship-it

Use when the user wants to ship work — push, PR, archive decision records, merge, and clean up. Handles the full lifecycle from committing final changes through post-merge cleanup including converting specs/plans to compact decision records.

lguidolin/tests-as-a-control

Use when writing or modifying tests, when a test breaks during a refactor, or when testing permission/role rules. Symptoms — tempted to edit a test to make it pass, testing only the happy path, a deny-test that started passing, flaky tests, or unsure what to assert.

lguidolin/zero-downtime-migrations

Use when changing a database schema where data must survive the change — adding/removing/renaming columns, constraints, indexes, or backfilling. Symptoms — a destructive migration bundled with a code deploy, a NOT NULL column with a backfill, a table-locking UPDATE, or a rename. Keywords — expand/contract, parallel change, backfill, NOT VALID, CREATE INDEX CONCURRENTLY, graphile-migrate.

관련 스킬