Logo Testing

Testing

Tổ chứcPhổ biến
kortix-ai
testing

Use for every Kortix test task, behavior change, bug fix, refactor, API route change, CLI change, SDK change, browser journey, test failure, coverage question, local benchmark, or testing infrastructure change. Enforce the single local-first runner, black-box flow contracts, package-local SDK tests, browser-only Playwright tests, and real input/output verification.

Tổng quan

Nhà phát hànhkortix-ai
Kho mãCompanyOS
Tên kỹ năngtesting
Sao
20.8K
Bản fork
3.5K
Tệp đi kèm
4
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 4 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được kortix-ai công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Testing trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/kortix-ai/CompanyOS/tree/dev/.agents/skills/testing
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/kortix-ai/CompanyOS.git /tmp/CompanyOS
mkdir -p .claude/skills
cp -r /tmp/CompanyOS/.agents/skills/testing .claude/skills/testing
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Testing trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Testing ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Testing với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Testing

During development, never run a full suite or a whole package's tests. Run T0 (tsc, lint) for the packages you touched, the test files that cover your change named one by one (pnpm --filter <pkg> test <file>, or one flow with pnpm test -- --id <ID>), and the change itself through its real surface. Seconds, not minutes. Running a whole package's suite to check one file is the anti-pattern, and on a Mac every package test script refuses it (exit 2, scripts/test-guard.mjs) unless you name files or pass -- -t <name>. The full suite runs once, at Promote to Production, on the release pull request into prod: it is the only gate (AGENTS.md, "Testing philosophy").

Keep tests small and isolated. Every test file runs standalone in seconds. When the test that covers your change takes more than ~10 s, or needs setup unrelated to it, split it into a smaller isolated test in the same change. Fake the clock; never wait on real time. A test that breaks on a refactor with no bug is deleted, not updated.

The repository-level command is pnpm test; on a Mac only its targeted modes run (--id, --domain, --db-only <filter>, --sdk-only).

Read tests/README.md before changing the runner or adding a product flow. Read the sdk skill before editing the SDK.

Select the correct test

  • Add pure logic and internal invariant tests beside their package code.
  • Add a test that needs real PostgreSQL as a DB suite: integration-*.test.ts or *.integration.test.ts in apps/api/src, *.integration.test.ts in packages/db/scripts. Read TEST_DATABASE_URL; the db-suites lane gives every file its own fresh migrated database. Create every row you read. See tests/README.md "DB suites".
  • Never return early from a DB test when a fixture row is missing. Seed it. An early return passes with zero assertions: one suite borrowed an existing account and asserted nothing in CI for all 12 of its tests.
  • Prove a SQL guard (a WHERE predicate, a compare-and-set, a tombstone check) in a DB suite. A mocked db whose stub returns the receipt proves the stub, not the query. Keep mocked-collaborator tests for ordering and branching.
  • Add API and CLI product contracts to tests/spec/end-to-end.md and tests/src/flows.
  • Keep SDK tests in packages/sdk.
  • Add Playwright only when the assertion requires a browser.
  • Do not create another cross-cutting harness or ad hoc smoke script.

Keep unit tests fast

A unit test file is a millisecond test. On 2026-10-16, 89 % of the API tests ran under 10 ms, and 33 files of 1,188 took 262 of 388 s. Every one of the 33 waited on a real clock or did real process work.

  • Never wait on the real clock. Inject the delay (a parameter, a field, a set…ForTests setter next to the constant) and pass 1–10 ms. Or cap Bun.sleep with spyOn(Bun, 'sleep') and restore it in afterEach/afterAll. Or use jest.useFakeTimers() + jest.advanceTimersByTime (Bun 1.4.3 fakes setTimeout and Bun.sleep) with jest.useRealTimers() in afterEach. A deadline test starts near its deadline; it does not wait it out.
  • Keep each file short. bun test --parallel=N hands out whole files, so the slowest file is the floor of the suite. Split a file over ~10 s by describe (the kortixd OpenCode restore file was 130 s on one worker).
  • Start no process, server, clone or tsc in a unit test unless that process is the contract. A real binary (Claude Code, the CLI) belongs in a few contract tests, not in every case.
  • List a file of 1 s or more in apps/api/scripts/slow-tests.txt: the API suite runs those first, so no 80-file batch waits on one slow file.
  • Measure a file with bun test --isolate <file> and read Ran … [x s]. Per-file times for a suite: --reporter=junit --reporter-outfile=<f>.

Write product flows

  1. Assign or reuse one stable flow ID.
  2. Describe the complete contract in tests/spec/end-to-end.md.
  3. Implement the contract through HTTP or a real CLI process.
  4. Write each ctx.step() as one natural-language action and result.
  5. Cover authentication, setup, the action, read-back proof, negative paths, and cleanup when the contract includes them.
  6. List every touched API route in meta.routes.
  7. Regenerate tests/spec/routes.generated.json after route changes.

Do not import API handlers into a product flow. Do not mock the product boundary. Use reusable local database and bare Git fixtures unless the contract requires resource isolation.

Run tests

bash
pnpm test                       # Whole core suite; refused on a Mac (CI and Linux only)
pnpm test -- --id ACC-4        # One flow
pnpm test -- --domain access   # One domain
pnpm test -- --sdk-only        # SDK only
pnpm test -- --db-only [path-filter ...] # PostgreSQL-backed suites only
pnpm test -- --browser-only    # Browser only; owns the deterministic local stack
pnpm test -- --browser-only --browser-shard=1/4 # One browser shard
pnpm test -- --packages-only   # Every app/package test and publish contract
pnpm test -- --agentic-only tests/example.e2e.ts # Opt-in browser-agent pilot
pnpm test -- --full            # Browser plus all app/package tests
pnpm test -- --target-smoke    # Deployed staging API SHA and Playwright smoke
pnpm test -- --target-full     # Every deployed staging flow and browser journey

Plain pnpm test runs the whole core suite: flows, DB suites, runner units, route coverage, worktree units, the SDK, and package quality. It runs in CI and on Linux. On a Mac it exits 2 (below). A box without Docker drops the two DB lanes and logs them as skipped, never as a pass.

Full mode also builds, dry-packs, and install-smokes publishable npm packages. Do not replace this package contract with a separate CI workflow.

The e2e evaluation and runbook defines the opt-in browser-agent pilot. Keep it outside the default/full/release gates until its reliability and false-pass criteria are measured. Preserve all existing lanes.

Browser and full modes start local Supabase, migrations, API, gateway, and web. They reuse a running API only when it proves the deterministic test profile. Browser runs use two Playwright workers, locally and in each CI shard.

No hook or dev merge gate requires a test run, and nothing records one: the attestation system was removed on 2026-10-16. Write in the PR body what you ran and why.

Run the narrowest relevant command. A diff that no test reads (docs, a skill, a standalone script) needs no run.

A Mac runs targeted tests only. On macOS the runner refuses a suite-wide run (plain pnpm test, --full, --packages-only, --browser-only, --db-only with no path filter) and exits 2. 2026-10-16: five agent sessions ran the suite at once on one laptop (load average 112, swap full). Run one flow, one DB suite path, the SDK, or one package's test file. The whole suite runs in CI: add the test label once, or set KORTIX_FULL_TEST=1 when a person asks.

Prove the result

  • Report the exact command, exit code, pass count, fail count, and duration.
  • Use tests/test-results/<runId>/results.json for request and fixture counts.
  • Distinguish parallel flow workers from serialized external provisioning.
  • Open report.html when a REST or CLI flow fails.
  • For browser behavior, assert the DOM result and the relevant network request.
  • State every external flow excluded by the local profile.
  • Never describe an excluded or skipped flow as passed.

Each root run writes a benchmark to tests/test-results/local/benchmark-<timestamp>.json.

An API performance change reports a measured before/after from apps/api/scripts/prompt-latency-bench.ts. The runbook and the baseline are in references/api-latency-baseline.md.

Where tests run: one tree, one run

The philosophy is in AGENTS.md ("Testing philosophy"). A pull request into dev runs no GitHub Actions job by itself, and a push to dev runs no Tests lane. Before the merge you run T0 and the tests that cover your change, and you use the change for real. The contract lanes run nightly on dev (no browser); a red night comments the failing lanes and suspect commits once per new set of failing lanes. CI and CodeQL run weekly on dev. The pull request into staging runs nothing. The release PR into prod runs the release suite once — contract lanes, deployed smoke, browser journeys against staging, CI, CodeQL, scanners — and it is the only gate. In the rare case you want CI before a dev merge, add a label: test runs the lanes once (~20 min), preview deploys once (~7 min) with no tests. A push re-runs neither. Never add them by default. tests/unit/sandbox-workflow.test.ts fails when a workflow other than the label-gated tests.yml and deploy-preview.yml triggers on a pull request into dev: put a new check on push: dev or on the release pull requests.

Before a dev merge, run the narrowest relevant command first. Add the local equivalent of every CI job your change touches:

Change touchesCI job (post-merge / release)Run locally before the merge
shared code, the API, the SDK, a migration, the runtimeTests lanes nightly on dev and in the release suitethe package's test file, pnpm test -- --id <ID>
browser-visible behaviorrelease-suite browser journeys against stagingdrive the page with agent-browser
apps/apiTests packages-api lane → API typecheck and lintpnpm --filter kortix-api typecheck and pnpm --filter kortix-api lint (after fixing a violation: lint:prune)
apps/webCI → Frontend buildpnpm --filter ./apps/web build
apps/kortix-sandbox-agent-serverCI → Sandbox agent buildbun run typecheck && bun run lint && bun run test:architecture in that directory
packages/db/migrationsDB Migrationsthe four commands in packages/db/MIGRATIONS.md → "CI gates"
apps/web/translationsi18n-catalogsnode apps/web/scripts/i18n-catalogs.mjs check
infra/terraformTerraform CIterraform fmt -check -recursive infra/terraform
a package.jsoninstall in every lanepnpm install --frozen-lockfile --lockfile-only --ignore-scripts

Secrets and customer terms need no extra command: the .githooks pre-commit hook encrypts .env files and runs scripts/check-blocked-terms.sh.

The nightly Tests run on dev blocks nothing. A red run comments the failing lanes and every commit since the last green run on the commit. The author whose commit broke dev fixes forward; after 1 hour red, anyone may revert the culprit PR. The only required check in the repository is tests-release.yml's full suite + quality gates, on a pull request into prod, and it tests DEPLOYED staging.

No quarantine

No quarantine exists for any test: browser journey, API flow, or DB suite (testing reset, 2026-10-16; the mechanism is deleted). A test that fails twice without a bug is fixed at its root or deleted the same day. A test that fails because of a Kortix defect stays red until the defect is fixed. A test that depends on a third party (OAuth pages, a real model reply) asserts only what Kortix controls, or it goes.

Run CI lanes natively on GitHub-hosted runners

Keep the test commands unchanged. .github/workflows/tests.yml runs seven lanes in parallel, each on one runner (CI_RUNNER_L, fallback ubuntu-24.04: 4 vCPU / 16 GB on this public repo). Two core lanes split the core run: pnpm test -- --core-group=flows and pnpm test -- --core-group=db (DB suites, runner units, route coverage, worktree tests, then the SDK). Five package lanes run pnpm test -- --packages-only --package-group=<api|cli|kortixd|publish|rest>, one slice of package quality each; publish builds, packs and install-tests the npm packages, and rest holds the repo-wide checks and the other package tests. No browser journey runs in tests.yml: the money-path specs run once, in the release suite, against deployed staging (tests-release.yml, two Playwright workers).

  • Check out the requested SHA with fetch-depth: 1: the nightly dev HEAD, or a release pull request's head.
  • Run pnpm install --frozen-lockfile.
  • Export KORTIX_PACKAGE_SKIP_SDK_TESTS=1 for the packages-* lanes; the SDK tests run in the core-db lane.
  • Keep the guard step and the artifact upload if: always().
  • Do not reintroduce a cloud-sandbox worker for these lanes. The Platinum/Daytona path (tests/bin/sandbox-ci.ts) was removed on 2026-08-26 after the provider chain failed on its own on about every third lane. deploy-preview.yml keeps a sandbox because a preview needs a public HTTPS origin.

Before a production merge, run pnpm test -- --target-smoke against the exact staging hosts for a narrow rehearsal. The production release gate runs pnpm test -- --target-full. It fails when any selected API flow is skipped, todo, or failed. Both commands require RELEASE_SOURCE_SHA to match the API and gateway health commits. Keep the Vercel bypass header for Playwright. Reject development and production targets.

Do not add CI-only test logic. Change pnpm test when local and CI behavior must change together.

Run a full-stack pull request preview

The preview label is not part of the development flow: verify a change on your worktree's local stack. These rules govern the preview infrastructure for the rare explicit request.

  • Add preview only after a writer reviews the exact same-repository PR SHA.
  • Build the API, gateway, and frontend without credentials in separate jobs.
  • Run the trusted preview controller from the default branch (dev).
  • Run on Platinum only: the preview host and every session inside it. A Platinum failure fails the preview. Never fall back to Daytona.
  • Live-sandbox flows declare requires: ['sandbox'] (KE2E_CAP_SANDBOX). The capability means a real Platinum sandbox, the reference provider; a preview enables it from PLATINUM_API_KEY. Daytona is a legacy fallback and E2B support is discontinued: never make either a test default.
  • Generate the regular kortix self-host Compose distribution in the sandbox.
  • Give each preview a fresh PostgreSQL and Supabase data plane.
  • On a dispatch, run pnpm test -- --target-full against the sandbox HTTPS origin.
  • Post the preview URL and /_tests/ report URL in one sticky PR comment.
  • Keep a failed product-test sandbox. Do not hide its failure with fallback.
  • Deploy only when the label is added or the workflow is dispatched. A push starts nothing. Run --target-full only on a dispatch.
  • Delete the sandbox on unlabel or branch deletion. Closing the PR does not.
  • Tag every preview session box with its host: the preview API runs with KORTIX_INSTANCE_ID=<host sandbox name> (Platinum kortix.instance) and its deadline reaper on. Teardown and replacement stop the host's session boxes. Each deploy and the hourly reconcile stop session boxes whose host is gone or that idled over 6 hours (tests/src/core/preview-session-reaper.ts). A suite stops the session boxes it created when it ends, on a branch environment too.
  • Reconcile stale previews each hour. It stops hosts of closed pull requests and hosts idle over 1 hour. Previews hold no Daytona credential.

The preview warm image can contain dependencies and Docker layers. It must not contain a database or runtime secret. Keep the runtime secret allowlist in tests/src/core/preview-stack.ts. Use the dedicated preview GitHub App for the managed repository and CLI push flows. OAuth initiation remains an explicit preview exclusion until a stable callback broker exists.

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Testing làm được gì?

Use for every Kortix test task, behavior change, bug fix, refactor, API route change, CLI change, SDK change, browser journey, test failure, coverage question, local benchmark, or testing infrastructure change. Enforce the single local-first runner, black-box flow contracts, package-local SDK tests, browser-only Playwright tests, and real input/output verification.

Vì sao nên dùng Testing trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Testing là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Testing trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/kortix-ai/CompanyOS/tree/dev/.agents/skills/testing. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Testing?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Testing với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Testing với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Testing có miễn phí không?

Kỹ năng này được kortix-ai phát hành trên GitHub. Hãy xem điều khoản giấy phép trong kho mã. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇