Community코딩 & 개발github.com

tokio-문서

공식 Tokio 문서(tokio 1.54.1)에 기반하여 비동기 Rust 코드 작성, 리뷰, 디버깅 시 자주 실수하는 부분(취소 안전성, 블로킹 코드, 예상치 못한 기본값, 폐기된 API 등)에 대한 최신 지침을 제공합니다.

tokio-문서란 무엇인가요?

이 스킬은 Tokio 1.54.1 공식 문서의 내용을 바탕으로, 비동기 Rust 개발자가 Tokio를 사용할 때 흔히 저지르기 쉬운 실수와 함정에 대한 명확한 지침을 제공합니다. 취소 안전성(cancel safety), 런타임 블로킹 방지, 직관적이지 않은 기본 동작, 패닉 조건, 기존 API를 대체하는 최신 패턴 등을 중점적으로 다룹니다. 각 주장은 공식 문서 URL과 함께 제공되어 사용자가 직접 원본을 확인할 수 있습니다. 이 스킬은 Claude Code, Cursor, Codex와 같은 AI 에이전트에서 활용할 수 있으며, 참조 파일 구조를 통해 런타임, 태스크, 동기화 프리미티브, 채널, 시간, I/O, 프로세스, 시그널, 네임드 파이프 등 각 도메인별로 필요한 정보를 빠르게 찾을 수 있습니다. 코드 작성 시 가장 중요한 규칙(예: Builder 사용 시 enable_all() 호출, select! 내 손실 브랜치 처리, spawn_blocking 사용, 파일 flush 등)을 우선적으로 제시하고, 구체적인 사용 예제와 주의사항을 포함합니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/quentin-autret/claude-skills/tree/main/skills/tokio-docs

Installed? Explore more 코딩 & 개발 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

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

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

문서

tokio (1.54.1)

개요

이 스킬은 공식 Tokio 문서에서 흔히 잘못 사용되기 쉬운 내용을 담고 있습니다: 취소 안전성(cancel safety), 런타임 블로킹, 예상치 못한 기본값, 패닉, 그리고 기존 API를 대체하는 새로운 API들입니다. 모든 비동기 Rust 개발자가 아는 기본적인 내용은 생략합니다. references/의 모든 주장은 출처 문서 URL로 끝나므로 해당 페이지를 다시 열어볼 수 있습니다. https://docs.rs/tokio/latest/tokio/index.html

적용 버전

tokio 1.54.1, docs.rs/tokio/latest에서 제공되는 버전이며, tokio.rs 튜토리얼 및 토픽 페이지도 포함합니다. 불안정(Unstable) API는 --cfg tokio_unstable이 필요하고 1.x에서 호환되지 않을 수 있으므로, 프로젝트에서 이미 활성화하지 않는 한 제안하지 마십시오. https://docs.rs/tokio/latest/tokio/index.html#unstable-features

사용 방법

  1. 작성하거나 리뷰하는 코드의 도메인을 아래 표에서 찾으십시오.
  2. 해당 참조 파일만 여십시오. 각 파일은 독립적이며 상단에 목차가 있습니다.
  3. 그 기본 원칙을 적용하십시오. 명시된 조건이 충족될 때만 예외를 사용하십시오.
  4. 리뷰 시 해당 파일 끝에 있는 "이전 패턴(Old patterns)" 표가 있다면 함께 확인하고 대체 API를 제안하십시오.
  5. 답변에는 적용한 각 규칙의 문서 URL을 함께 제공하여 독자가 확인할 수 있도록 하십시오.

가장 중요한 규칙

참조

파일내용
references/runtime.md기능 플래그, Builder와 드라이버, LocalRuntime, 종료(shutdown), #[tokio::main] 및 #[tokio::test]
references/block-on-bridging.md런타임 구동, block_on과 Handle::block_on, EnterGuard와 Handle::current, 동기 코드에서 비동기 코드 호출, Unix fork
references/tasks.mdspawn과 그 제약 조건, JoinHandle, abort, JoinSet, spawn_blocking, block_in_place, 협력 예산(coop budget), LocalSet, spawn_local, task_local
references/sync-locks.mdstd와 tokio Mutex 비교, .await를 넘는 가드, RwLock, Semaphore, Notify, OnceCell, SetOnce, Barrier
references/channels.mdmpsc 역압(backpressure), 허가(permit)와 닫기, oneshot, broadcast 지연, watch 빌림 규칙
references/select-cancellation.mdselect! 규칙, 취소 안전성 목록, 루프 간 고정(pin), biased, join!, try_join!, graceful shutdown
references/time-testing.mdsleep, interval과 MissedTickBehavior, timeout, Instant, 일시 정지된 시간, 테스트에서 I/O 모킹
references/io-net.mdAsyncRead/AsyncWrite 확장 트레이트, BufWriter, split, io::copy, 프레이밍, TcpListener, TcpStream, TcpSocket, UdpSocket
references/fs-process.mdtokio::fs와 블로킹 풀, File flush와 드롭, Command, Child, kill_on_drop, stdio 파이프
references/signals-named-pipes.mdctrl_c, Unix 시그널, Windows 콘솔 이벤트, Windows 네임드 파이프 서버와 클라이언트

읽은 모든 페이지는 SOURCES.md에 나열되어 있습니다.

Individual skills in this repo

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

eslint-docs

Teaches current ESLint 10 practices drawn from the official documentation. Use when writing, reviewing or fixing an eslint.config.js (flat config, defineConfig, files, ignores, globalIgnores, extends, languageOptions, globals, parsers, processors), configuring ESLint rules and severities, disable comments and inline config, running the CLI in CI (--fix, --cache, --quiet, --max-warnings, bulk suppressions, formatters, feature flags, MCP server), writing custom rules (meta, schema, fixes, suggestions, selectors, scope, code paths) and testing them with RuleTester, building plugins, shareable configs, custom parsers, processors or formatters, using the Node.js API (ESLint, Linter), or migrating to ESLint 9 or 10 from eslintrc. Triggers on eslint, eslint.config.js, flat config, .eslintrc, .eslintignore, @eslint/js, js/recommended, eslint-disable, no-unused-vars, no-restricted-imports, no-restricted-syntax, RuleTester, eslint-plugin, eslint-config, FlatCompat, context.getScope is not a function, ESLint 10.

grafana-cloud-docs

Grafana Cloud pitfalls, defaults, limits and current patterns from the Grafana, Mimir, Loki and Tempo docs, each tied to its docs URL. Use when sending OpenTelemetry data to Grafana Cloud, writing PromQL, LogQL or TraceQL, controlling cardinality and cost, designing alert rules, routing notifications, provisioning alerting, building Synthetic Monitoring checks, using the /apis dashboard API, choosing access policy tokens or service accounts, or migrating off API keys, the Loki Exporter and legacy /api routes.

javascript-docs

Teaches current JavaScript (ECMAScript) practice drawn from the MDN JavaScript documentation. Use when writing, reviewing or fixing modern JavaScript, choosing a built-in API, or replacing a deprecated pattern. Covers equality and coercion, let/const and the temporal dead zone, strict mode, ASI, functions, classes and private fields, objects, prototypes, Proxy, Reflect, Symbol, eval, operators (??, ?., spread, BigInt arithmetic), statements, Promise, async/await, Promise.try, iterators and iterator helpers, generators, using/await using, DisposableStack, WeakRef, Array (toSorted, at, groupBy, fromAsync), Map, Set methods, WeakMap, strings and Unicode, encodeURIComponent, RegExp (v flag, RegExp.escape, lastIndex), Number, Math, BigInt, JSON (rawJSON, revivers), typed arrays, ArrayBuffer, base64, SharedArrayBuffer, Atomics, Temporal, Date, Intl (DateTimeFormat, NumberFormat, Collator, Segmenter, PluralRules), errors (cause, Error.isError), ES modules, import attributes, import.meta, dynamic import.

next-intl-docs

Teaches current next-intl 4 practices for internationalizing Next.js apps, drawn from the official documentation. Use when setting up next-intl with the App Router, writing i18n/request.ts, adding a [locale] segment with defineRouting, createMiddleware in proxy.ts (formerly middleware.ts), building locale switchers with createNavigation, translating with useTranslations or getTranslations, passing messages to NextIntlClientProvider, writing ICU messages (plurals, select, rich text), formatting dates, numbers and lists with useFormatter, translating metadata, Server Actions, Route Handlers, localized 404 and error pages, static rendering with next/root-params, type-safe messages through AppConfig, testing with Jest, Vitest, Storybook, or extracting inline messages with useExtracted. Triggers on next-intl, useTranslations, getTranslations, NextIntlClientProvider, getRequestConfig, i18n routing, locale prefix, localePrefix, NEXT_LOCALE, hreflang, setRequestLocale, ICU messages, App Router internationalization.

nodejs-docs

Teaches Node.js practice drawn from the official Node.js API documentation, with pitfalls, surprising defaults, deprecations and replacements, each backed by its nodejs.org URL. Use when writing, reviewing, debugging or upgrading Node.js code, or choosing a built-in module (fs, crypto, streams, http, process, CLI flags, node:test, ESM/CommonJS, package.json exports, TypeScript type stripping, child_process, worker_threads, node:sqlite, deprecations).

playwright-docs

Pitfalls, surprising defaults and recommended patterns of Playwright Test for JavaScript and TypeScript, distilled from the official docs. Use when writing, reviewing, debugging or configuring Playwright tests (@playwright/test, playwright.config.ts, npx playwright test), including flaky tests, locators (getByRole, filter, strict mode), web-first assertions (expect, toHaveText, toBeVisible, expect.poll, toPass), fixtures, storageState authentication, project dependencies, timeouts, retries, network mocking (page.route, routeFromHAR, routeWebSocket), API testing, clock, aria snapshots, toHaveScreenshot, axe accessibility scans, traces, UI mode, reporters, CI, Docker, sharding, test locks, component testing with stories and mount, codegen, Playwright MCP, playwright-cli and migration from Puppeteer, Protractor, Testing Library or older Playwright versions.

postgresql-docs

Pitfalls, surprising defaults, PostgreSQL 18 changes and recommended patterns from the official PostgreSQL 18 documentation, each backed by its postgresql.org URL. Use when writing or reviewing PostgreSQL SQL, schema design, migrations and ALTER TABLE locks, indexes, transactions, isolation levels and retries, locking, upsert and MERGE, COPY, JSONB, timestamptz, generated and identity columns, partitioning, EXPLAIN, vacuum, roles, row-level security, PL/pgSQL, full-text search, connection settings, and upgrades to PostgreSQL 18.

react-docs

Writes, reviews and upgrades React 19.3 code from the official react.dev documentation. Use when writing components and Hooks, removing unnecessary useEffect calls, fixing Effect dependencies with useEffectEvent, building forms with Actions (useActionState, useOptimistic, useFormStatus, form action), using Server Components, 'use client', 'use server' and Server Functions, Suspense, use(), useTransition, useDeferredValue, ViewTransition, Activity, adopting React Compiler and eslint-plugin-react-hooks, deciding on useMemo, useCallback and memo, server rendering and hydration (createRoot, hydrateRoot, renderToPipeableStream, prerender), or migrating from React 18 (forwardRef, Context.Provider, ReactDOM.render, propTypes, defaultProps). Triggers on React, JSX, hooks, useState, useEffect, useRef, useContext, Server Components, RSC, Actions, React Compiler, Strict Mode, hydration mismatch, React 19 upgrade.

rust-std-docs

Gives current guidance from the official Rust standard library docs (std 1.99.1 stable) on pitfalls, panics, platform differences, discouraged APIs and newer stable replacements. Use when writing, reviewing or refactoring Rust code that uses std, especially collections (Vec, HashMap, BTreeMap, BinaryHeap, entry, extract_if, sort), Option/Result/error handling (expect, ?, Error, ExitCode, panic), iterators (collect, flatten, Peekable, try_fold), Box/Rc/RefCell/Cow/Pin/mem::take, Arc/Mutex/RwLock/OnceLock/LazyLock/thread::scope/mpsc/Condvar/atomics, String/str/fmt/format!/OsString/CString, io/fs/path (BufWriter, OpenOptions, PathBuf::join), process/env/net/time (Command, set_var, TcpStream, Instant, Duration), From/TryFrom/AsRef/Ord/Drop/Deref/Clone, and unsafe raw pointers, MaybeUninit, transmute, NonNull or integer overflow and float ordering.

socketio-docs

Builds, configures and debugs Socket.IO 4.8 servers and clients from the official Socket.IO v4 documentation. Use when writing a Node.js Socket.IO server (Express, Fastify, Koa, Bun, uWebSockets.js) or a socket.io-client app, emitting events with acknowledgements, timeout() and emitWithAck, broadcasting to rooms and namespaces, authenticating in middleware with the auth option, configuring CORS, reverse proxies and sticky sessions, scaling with the Redis, Redis Streams, Postgres, MongoDB or Cluster adapter, enabling connection state recovery and delivery guarantees, tuning reconnection, writing tests, troubleshooting connection issues, or migrating from Socket.IO v2 or v3. Triggers on Socket.IO, socket.io, socket.io-client, io(), new Server, emit, emitWithAck, acknowledgements, rooms, namespaces, broadcast, io.use, middleware, CORS, Redis adapter, sticky sessions, connection state recovery, reconnection, connect_error, Session ID unknown. Not for plain WebSocket servers such as ws without Socket.IO.

tailwindcss-docs

Teaches current Tailwind CSS v4 practices drawn from the official documentation. Use for any task that touches Tailwind CSS v4, even a small one, because many v3 habits silently break in v4. Use when writing or reviewing Tailwind CSS v4 code (utility classes, variants, arbitrary values, theme variables in @theme, @utility, @custom-variant, @apply, @reference, @source), setting up Tailwind in a framework or build tool (Vite plugin, PostCSS plugin, CLI, Next.js, SvelteKit, Nuxt, Angular, Laravel, Rails), customizing the theme (colors, fonts, breakpoints, spacing, animations), building dark mode with a class or data attribute, or migrating a project from Tailwind v3 (tailwind.config.js, @tailwind directives, darkMode class, safelist, bg-opacity, renamed shadow and outline utilities). Triggers on tailwindcss, @import "tailwindcss", @tailwindcss/vite, @tailwindcss/postcss, @tailwindcss/cli, @theme, @custom-variant dark, npx @tailwindcss/upgrade, upgrade to Tailwind v4.

tauri-docs

Tauri 2 apps, tauri.conf.json, capabilities and permissions, commands and invoke, events and channels, plugins, bundling, signing and the updater, migration from Tauri 1. Guides Tauri 2 work from the official v2 documentation, including scopes, managed state, plugin authoring, CSP and the isolation pattern, testing and debugging, Linux, Windows and macOS packages, and mobile and store releases. Use when writing or reviewing a Tauri 2 app, adding a plugin or a capability, fixing a "not allowed" or "forbidden path" error, wiring IPC between Rust and the webview, packaging, signing or publishing a desktop or mobile build, or upgrading a Tauri 1 or 2.0 beta project.

typescript-docs

Configures, writes and upgrades TypeScript 6.0 code and tsconfig.json from the official TypeScript documentation. Use when upgrading from TypeScript 5.x to 6.0 (strict, types, rootDir, baseUrl, moduleResolution node, target es5, outFile, esModuleInterop), choosing module and moduleResolution, writing package.json exports and imports, fixing ESM and CommonJS interop, enabling verbatimModuleSyntax or erasableSyntaxOnly, setting up project references and tsc --build, writing .d.ts files, checking JavaScript with JSDoc, or debugging narrowing, generics, mapped types, decorators and enums. Triggers on TypeScript, tsc, tsconfig, TS5112, ignoreDeprecations, nodenext, bundler, .d.ts, @ts-check, TypeScript 6 upgrade.

typesense-docs

Pitfalls, surprising defaults and recommended patterns of the Typesense search engine, distilled from the official docs. Use when designing a Typesense collection schema, writing search parameters (q, query_by, filter_by, sort_by, facet_by, group_by), tuning typo tolerance and ranking, building vector, semantic or hybrid search, conversational RAG or natural language search, creating API keys and scoped search keys for multi-tenancy, indexing and import (JSONL, upsert, emplace, dirty_values), syncing from a primary database, reindexing through aliases, managing synonyms (synonym sets), curation sets and stopwords, joins, analytics rules and query suggestions, InstantSearch, migrating from Algolia, or running, clustering, backing up and upgrading a Typesense server.

vite-docs

Teaches current Vite 8 practices drawn from the official documentation. Use when writing or fixing a vite.config, migrating from Vite 7 (Rolldown and Oxc replacing Rollup and esbuild), configuring the dev server, proxy or HMR, handling import.meta.env and modes, tuning the production build, library mode, SSR, writing a Vite plugin, using the HMR or JavaScript API, or the Environment API. Triggers on vite.config, defineConfig, rolldownOptions, import.meta.env, loadEnv, optimizeDeps, ssrLoadModule, ModuleRunner, this.environment, upgrade to Vite 8.

vitest-docs

Teaches current Vitest 5 practices drawn from the official documentation. Use when writing, reviewing or fixing Vitest tests (test, describe, expect, test.for, fixtures with test.extend, hooks, snapshots), mocking with vi (vi.fn, vi.spyOn, vi.mock, vi.when, fake timers, stubGlobal, stubEnv), configuring vitest.config or projects, choosing an environment or pool, filtering and running tests in CI, measuring coverage with v8 or istanbul, debugging slow or flaky suites, testing components in browser mode with Playwright, or migrating from Jest, Mocha or Vitest 4. Triggers on vitest, vi.mock, vi.fn, vitest.config, toMatchSnapshot, expect.poll, coverage thresholds, browser mode, @vitest/browser-playwright, jsdom, happy-dom, migrate Jest to Vitest, upgrade Vitest 5.

관련 스킬