Token导航 LogoToken导航

Agent Skill · 开发规范

gatling-best-practices(加特林最佳实践)

gatling-best-practices 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

gatling-best-practices 是开发规范类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为执行命令;许可证信息还不明确,第三方扫描已通过,按安装量在开发规范类的 1,265 个 Skill 里排第 1,055。

总安装 267周安装 11GitHub Stars 4下载 87核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:gatling-best-practices(加特林最佳实践)
来源仓库:https://github.com/rcampos09/gatling-best-practices
仓库路径:skills/gatling-best-practices
安装命令:
npx skills add https://github.com/rcampos09/gatling-best-practices --skill gatling-best-practices
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/rcampos09/gatling-best-practices --skill gatling-best-practices

这个 Skill 是做什么的

开发规范类 Skill 用来统一代码风格、目录结构和评审口径,产出多为检查清单或改写建议。

gatling-best-practices 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息。适合在 Codex、Claude、Cursor、Gemini CLI 中围绕仓库状态、代码变更或协作事项进行整理。

通过 GitHub 安装,需确认权限范围和维护状态,避免触发联网或文件读写操作。建议结合原始 README 核验具体用法,确保安全合规使用。适用于需要自动化处理代码协作流程的场景。

来源仓库内路径:skills/gatling-best-practices

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/rcampos09/gatling-best-practices --skill gatli…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要执行命令,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

gatling-best-practices 怎么安装?

在终端执行 npx skills add https://github.com/rcampos09/gatling-best-practices --skill gatling-best-pr…。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

gatling-best-practices 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

gatling-best-practices 需要什么权限?

权限级别是执行命令。安装流程涉及命令执行,可能通过 npx skills add https://github.com/rcampos09/gatling-best-practices --skill gatling-best-practices 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

gatling-best-practices 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

gatling-best-practices 用的人多吗?

公开数据是累计安装 267 次,近一周安装 11 次,下载 87 次,GitHub 4 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

gatling-best-practices 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 需要执行命令,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理开发规范类任务、又不想每次都手写提示词的人。

不太适合

  • 不能接受 Skill 在你机器上执行命令的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

开发规范类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
vercel-react-best-practices

Vercel React 最佳实践 · Codex、Claude

8,490,72025,918操作浏览器MIT通过
web-design-guidelines

网页设计指南 · Codex、Claude

6,686,01625,885需要联网MIT有提醒
remotion-best-practices

Remotion 最佳实践 · Codex、Claude

6,505,6323,027操作浏览器MIT有提醒
supabase-postgres-best-practices

Supabase Postgres 最佳实践 · Codex、Claude

3,175,5232,030需要联网MIT通过
next-best-practices

Next.js 最佳实践 · Codex、Claude

1,848,240841操作浏览器MIT通过
gatling-best-practices

加特林最佳实践 · 本页

2674执行命令未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Gatling Scenario Builder

Enforces a consistent, production-ready pattern for Gatling simulations across all five officially supported languages: Java, Kotlin, Scala, JavaScript, and TypeScript.

Output Format

When producing or fixing a simulation, always deliver three things:

  1. A complete, runnable simulation file for the chosen language — never a partial snippet. The user should be able to copy it and run it immediately.
  2. The exact run command with the environment parameters needed (baseUrl, users, etc.).
  3. A one-line explanation of the injection profile chosen and why it fits the stated load goal.

Step 1 — Gather context

Ask only what is unknown. Typical questions:

  • Language: Java (most common) · Kotlin · Scala · JavaScript · TypeScript
  • Build tool: Maven · Gradle · npm (JS/TS only)
  • Protocol: HTTP/REST · WebSocket · MQTT · JMS
  • Goal: New project from scratch · Fix existing simulation · Specific DSL question

Only load references/PROTOCOLS.md when the user mentions WebSocket, MQTT, or JMS. Contains dependency declarations and DSL for those protocols — non-obvious setup steps the user will likely miss.

Only load references/DESIGN-PATTERNS.md when the user asks about folder structure, project architecture, separation of concerns, or how to scale beyond a single simulation file. Contains the modular layered pattern (Config → Requests → Scenarios → Simulations) with examples in Java, Scala, and TypeScript.

Step 2 — New project? Use the scaffold script

The scaffold script is interactive — it requires keyboard input and cannot be run non-interactively. Tell the user to run it themselves in their terminal; do NOT attempt to execute it with the Bash tool:

# macOS / Linux
bash scripts/scaffold.sh

# Windows
.\scripts\scaffold.ps1

If the user asks you to generate the project directly (without running the script), skip to Step 3 and create the files manually following the 5-block pattern.

Kotlin + Gradle — minimum required files:

build.gradle.kts — three omissions cause build failures every time:

plugins {
    kotlin("jvm") version "2.0.21"              // ① must come BEFORE the Gatling plugin
    id("io.gatling.gradle") version "3.14.5"
}

group = "perf"
version = "1.0.0-SNAPSHOT"

repositories {
    mavenCentral()                               // ② required — often forgotten
}

gatling {
    jvmArgs = listOf(
        "-Xms512m", "-Xmx2g",
        "--add-opens=java.base/java.lang=ALL-UNNAMED"  // ③ Java 21+ module restriction
    )
}

dependencies {
    gatling("io.gatling.highcharts:gatling-charts-highcharts:3.14.5")
}

Source directories (Gatling Gradle plugin — not src/test/):

  • Kotlin simulations → src/gatling/kotlin/<package>/
  • Resources (gatling.conf, feeders) → src/gatling/resources/

For JS/TS projects, the minimum required files are:

  • package.json with "type": "module" and deps @gatling.io/cli, @gatling.io/core, @gatling.io/http
  • src/<SimulationName>.gatling.js (or .gatling.ts) — file must be in src/ directly with the .gatling.js / .gatling.ts suffix (required by the CLI)
  • tsconfig.json — TypeScript only, required by esbuild-plugin-tsc; omitting it causes failed to open 'undefined' at bundle time

After scaffolding — or whenever the user shares an existing Gatling project — execute the validator with the Bash tool (do not read it, only the output consumes tokens):

bash scripts/validate.sh [project-dir]

Report the results. The script catches the five most common configuration problems before the user wastes time on a broken run.

Step 3 — Apply the 5-block pattern

Every simulation must have these five blocks in this order. Generate the complete skeleton for the chosen language first, then fill in the details — starting from a partial file leads to structural errors.

Block 1 → Protocol    baseUrl, headers, connection settings
Block 2 → Feeders     test data injected per virtual user
Block 3 → Scenario    ordered chain of requests with pauses and checks
Block 4 → Injection   how many users, at what rate, for how long
Block 5 → Assertions  pass/fail thresholds (success rate, response time p95)

Common Mistakes — Check Every Simulation for These

These five errors appear in almost every first-draft Gatling simulation. Scan for them before delivering any code.

1. Missing pause() between requests

Without think time, all requests fire at the maximum possible rate, generating 10–100× more load than real users would. This makes results meaningless and can crash the system under test.

// Wrong
scenario("Flow").exec(http("A").get("/a")).exec(http("B").get("/b"))

// Correct — add realistic think time between actions
scenario("Flow").exec(http("A").get("/a")).pause(1, 3).exec(http("B").get("/b"))

2. Hardcoded dynamic tokens

Hardcoded tokens mean every virtual user sends the same session — the server sees one user repeated, not many distinct users. CSRF tokens and JWTs are server-side validated; they must come from the actual login response.

// Wrong — static token shared across all users
.header("Authorization", "Bearer eyJhbGciOiJIUzI1NiJ9.abc123")

// Correct — extract per user from the login response
.exec(http("Login").post("/auth/login")
    .check(jsonPath("$.token").saveAs("token")))
.exec(http("API Call").get("/data")
    .header("Authorization", "Bearer #{token}"))

3. atOnceUsers for load tests

atOnceUsers fires all users simultaneously. It is only appropriate for smoke tests (2–5 users). Using it for real load tests generates an unrealistic spike that tells you nothing about capacity.

// Wrong — not a load test, just a spike
setUp(scn.injectOpen(atOnceUsers(100)))

// Correct — ramp up, then hold to measure steady-state capacity
setUp(scn.injectOpen(
    rampUsers(100).during(60),
    constantUsersPerSec(10).during(120)
))

4. No assertions

Without assertions, Gatling exits with code 0 (success) even if every request returns 500. This means CI/CD pipelines never catch performance regressions. Define what "passing" looks like before the test runs.

// Wrong — always exits 0 regardless of results
setUp(scn.inject(...).protocols(httpProtocol))

// Correct — fail the build if thresholds are breached
setUp(scn.inject(...).protocols(httpProtocol))
    .assertions(
        global().successfulRequests().percent().gt(99.0),
        global().responseTime().percentile(95).lt(1000)
    )

5. .queue() feeder strategy for long tests

.queue() consumes each CSV record once, in order. When the file runs out, the test fails mid-run. Use .circular() for any test that may run longer than the number of records allows.

// Wrong — crashes when file is exhausted
FeederBuilder<String> f = csv("data/users.csv").queue()

// Correct for sustained tests — loops back to the start
FeederBuilder<String> f = csv("data/users.csv").circular()

// Use .queue() only when each record must be unique (e.g., user registration)

6. Check failure marks the request as FAILED

A .check() that doesn't find its target fails the entire request — even if the server responded 200. This silently inflates error rates and hides the real problem: the field was absent or the path was wrong.

// Wrong — if $.token is absent (e.g., login failed), request is marked FAILED
.check(jsonPath("$.token").saveAs("token"))

// Correct — validate existence first so the error message is meaningful
.check(status().is(200))
.check(jsonPath("$.token").exists())
.check(jsonPath("$.token").saveAs("token"))

// When the field is genuinely optional — use .optional() to avoid false failures
.check(jsonPath("$.refreshToken").optional().saveAs("refreshToken"))

7. Missing Content-Type when sending a request body

Forgetting Content-Type on POST/PUT requests causes the server to reject with 415 Unsupported Media Type. Use .asJson() — it sets both Content-Type and Accept headers in one call.

// Wrong — server returns 415
.post("/api/users").body(StringBody("""{"name":"#{name}"}"""))

// Correct — use .asJson() shorthand (Java / Kotlin only)
.post("/api/users").body(StringBody("""{"name":"#{name}"}""")).asJson()

// Equivalent explicit form
.post("/api/users")
    .header("Content-Type", "application/json")
    .body(StringBody("""{"name":"#{name}"}"""))

Scala note: .asJson() does not chain after .body() in Scala — it causes a compile error. Set Content-Type on the protocol instead:

// Scala — set contentTypeHeader on the protocol, not per-request
val httpProtocol = http
  .baseUrl(sys.props.getOrElse("baseUrl", "https://api.example.com"))
  .acceptHeader("application/json")
  .contentTypeHeader("application/json")  // applies to all requests

// Then just use .body() without .asJson():
http("POST Login").post("/api/auth/login")
  .body(StringBody("""{"email":"#{email}","password":"#{password}"}"""))
  .check(status.is(200))

The 5-Block Pattern — Reference

Block 1: Protocol

// Java / Kotlin
HttpProtocolBuilder httpProtocol = http
    .baseUrl(System.getProperty("baseUrl", "https://api.example.com"))
    .acceptHeader("application/json")
    .contentTypeHeader("application/json");
// Scala
val httpProtocol = http
  .baseUrl(sys.props.getOrElse("baseUrl", "https://api.example.com"))
  .acceptHeader("application/json")
// TypeScript / JavaScript
// File must be named *.gatling.ts / *.gatling.js and placed directly in src/
import {
  simulation, scenario, rampUsers, csv, global,
  StringBody, jsonPath, getEnvironmentVariable,  // ← jsonPath and StringBody live here, NOT in @gatling.io/http
} from "@gatling.io/core";
import { http, status } from "@gatling.io/http";  // ← do NOT import jsonPath from here — it is not exported

// process.env is NOT available at GraalVM runtime — use getEnvironmentVariable instead
const httpProtocol = http
  .baseUrl(getEnvironmentVariable("BASE_URL", "https://api.example.com"))
  .acceptHeader("application/json");

Block 2: Feeders

csv("data/users.csv").circular()  // sustained tests: loops forever (recommended)
csv("data/users.csv").random()    // picks records randomly, allows repeats
csv("data/users.csv").queue()     // each record used once — only for unique data
csv("data/users.csv").shuffle()   // random order, each used once

// Programmatic feeder — when each user needs a unique generated value
Iterator<Map<String, Object>> feeder =
    Stream.generate(() -> Map.<String, Object>of("id", UUID.randomUUID().toString()))
          .iterator();

Block 3: Scenario

// Java
ScenarioBuilder scn = scenario("My Flow")
    .feed(userFeeder)
    .exec(http("POST Login")
        .post("/auth/login")
        .body(StringBody("""{"username":"#{username}","password":"#{password}"}"""))
        .check(status().is(200))
        .check(jsonPath("$.token").saveAs("token")))   // extract token for reuse
    .pause(1, 3)                                        // think time
    .exec(http("GET Data")
        .get("/data")
        .header("Authorization", "Bearer #{token}")    // inject extracted token
        .check(status().is(200))
        .check(jsonPath("$.id").saveAs("resourceId")))
    .pause(1)
    .exec(http("POST Action")
        .post("/actions")
        .header("Authorization", "Bearer #{token}")
        .body(StringBody("""{"resourceId":"#{resourceId}"}"""))
        .check(status().is(201)));
// TypeScript
const scn = scenario("My Flow")
  .feed(userFeeder)
  .exec(http("POST Login").post("/auth/login")
    .body(StringBody('{"username":"#{username}","password":"#{password}"}'))  // ← StringBody required; raw string causes NullPointerException
    .asJson()                                                                   // ← sets Content-Type: application/json
    .check(status().is(200))
    .check(jsonPath("$.token").exists())
    .check(jsonPath("$.token").saveAs("token")))
  .pause(1, 3)
  .exec(http("GET Data").get("/data")
    .header("Authorization", "Bearer #{token}")
    .check(status().is(200)));

Loops and conditionals:

repeat(3).on(exec(http("Poll").get("/status")))                    // fixed iterations
during(Duration.ofSeconds(30)).on(                                  // time-based loop
    exec(http("Ping").get("/ping")).pause(5))
doIf("#{isPremium}").then(exec(http("VIP").get("/vip")))           // conditional branch
randomSwitch().on(                                                   // weighted paths
    percent(60.0).exec(http("Browse").get("/products")),
    percent(40.0).exec(http("Search").get("/search")))
group("Checkout Flow").on(                                          // group for cleaner reports
    exec(http("Cart").get("/cart"))
        .exec(http("Pay").post("/pay")))

Block 4: Injection Profiles

Choose the profile that matches the test goal — using the wrong one produces misleading results.

injectOpen — controls *arrival rate* (new users/second). Default for web APIs and stateless services.

ProfileCommandWhen to use
Spike (smoke only)atOnceUsers(5)Verify the test runs — not a load test
RamprampUsers(100).during(60)Standard load test
Steady rateconstantUsersPerSec(20).during(120)Capacity / soak test
AcceleratingrampUsersPerSec(5).to(50).during(60)Finding the breaking point
Stress peakstressPeakUsers(500).during(30)Stress test
StairsincrementUsersPerSec(5).times(5).eachLevelLasting(30)Progressive capacity

injectClosed — controls *concurrent count* (users active simultaneously). Use for systems with connection pools, queues, or session limits.

ProfileCommandWhen to use
Constant concurrentconstantConcurrentUsers(50).during(120)Fixed connection pool size
Ramp concurrentrampConcurrentUsers(10).to(50).during(60)Gradual concurrency increase
Stairs concurrentincrementConcurrentUsers(5).times(5).eachLevelLasting(30)Progressive capacity (closed)

Scala note: use .inject(...) — Scala has no injectOpen/injectClosed distinction at the call site; the step type determines the model.

Throttling — cap RPS regardless of user count:

Use .throttle() when the goal is to test at a fixed request rate rather than a fixed user count. It overrides injection and is useful for SLA compliance tests.

setUp(scn.injectOpen(constantUsersPerSec(50).during(Duration.ofMinutes(10))))
    .throttle(
        reachRps(100).in(Duration.ofSeconds(10)),  // ramp to 100 RPS over 10s
        holdFor(Duration.ofMinutes(5))              // hold at 100 RPS for 5 min
    )
    .protocols(httpProtocol);

Pause distributions — choose based on realism needed:

.pause(1, 3)                                    // uniform: between 1-3s (default)
.pause(Duration.ofSeconds(2),
       PauseType.EXPONENTIAL)                   // exponential: closer to real user behavior
.pace(Duration.ofSeconds(5))                    // cadence: fixed cycle regardless of response time

Block 5: Assertions

Assertions turn the test into a pass/fail gate. Without them, the test is just an observation. Include at minimum the first line; add per-endpoint assertions for critical paths.

.assertions(
    global().failedRequests().count().lt(1L),           // minimum: zero errors
    global().successfulRequests().percent().gt(99.0),   // success rate
    global().responseTime().percentile(95).lt(1000),    // p95 < 1s
    global().responseTime().percentile(99).lt(2000),    // p99 < 2s
    global().requestsPerSec().gt(50.0),                 // throughput floor
    details("POST Login").responseTime().percentile(99).lt(500)  // per-endpoint
)

Use percentile(95) and percentile(99), not mean(). Mean hides the tail: a p99 of 10 seconds is invisible when mean is 200ms.

Kotlin note: percentile() requires a Double argument — write .percentile(95.0).lt(1000), not .percentile(95).lt(1000) (Int causes a compile error in Kotlin even though Java accepts it via widening).

Scala note: assertion methods (global, responseTime, successfulRequests, percent) are zero-arg methods with an implicit GatlingConfiguration parameter. Call them without parentheses — global() is a compile error in Scala:

// Wrong — compile error: "not enough arguments for method global"
global().successfulRequests().percent().gt(99.0)

// Correct — no () on zero-arg methods with implicit params
global.successfulRequests.percent.gt(99.0)
global.responseTime.percentile(95).lt(800)
details("POST Login").responseTime.percentile(99).lt(300)

Run Commands

# Maven
mvn gatling:test -Dgatling.simulationClass=perf.MySimulation \
                 -DbaseUrl=https://staging.example.com -Dusers=50

# Gradle — plugin 3.14+ supports Gradle 9; use ./gradlew (or gradle) directly
./gradlew gatlingRun                              # runs all simulations
./gradlew gatlingRun-perf.MySimulation            # specific class (plugin ≥ 3.14 only)

# TypeScript / JavaScript  (use simulation name, not file path)
BASE_URL=https://staging.example.com USERS=50 \
  npx gatling run --simulation MySimulation

Reports open at: target/gatling/<simulation>-<timestamp>/index.html


References

平台分布

Codex

35.13%
按下载量换算31

Claude

28.74%
按下载量换算25

Cursor

18.75%
按下载量换算16

Gemini CLI

8.9%
按下载量换算8

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/rcampos09/gatling-best-practices --skill gatling-best-practices 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills