跳到正文
Skillpedia
测试48k · #5002

k6-load-testing

它能做什么

这个工具可以测试网站或应用在大量用户同时使用时的速度和稳定性。它会模拟大量用户访问你的系统,从而找出性能问题。

适用场景

  • ✓当你想知道网站能否承受大量同时访问时。
  • ✓当你需要设置自动化测试,检查更新后性能是否下降时。
  • ✓当你想了解系统在不同流量水平下的反应时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/k6-load-testing/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/k6-load-testing/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“模拟 100 个用户访问我的首页,持续 5 分钟,并告诉我网站是否会崩溃。”

每周 5 个新技能,1 分钟读完。

工作原理

工具会创建模拟真实用户行为的场景来访问你的系统。它会测量响应时间和错误率,并生成报告。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

k6 Load Testing

Detailed Guide

Read the detailed guide before executing this skill. It retains the complete procedure and reference material. Treat its safety, prerequisites, and validation requirements as mandatory. For focused work, load the relevant sections; for end-to-end work, read the guide completely.

When to Use This Skill

  • Use when you need to load test HTTP APIs, WebSocket endpoints, or browser scenarios
  • Use when setting up performance regression tests in CI/CD
  • Use when analyzing system behavior under various load conditions
  • Use when comparing performance between code changes
  • Use when validating SLA requirements and performance budgets

Examples

Example 1: Basic API Load Test

import http from 'k6/http';
import { check, sleep } from 'k6';

export const options = {
  vus: 50,
  duration: '2m',
  thresholds: {
    http_req_duration: ['p(95)<500'],
    http_req_failed: ['rate<0.01'],
  },
};

export default function () {
  const res = http.get('https://api.example.com/users');
  
  check(res, {
    'status is 200': (r) => r.status === 200,
    'response time < 500ms': (r) => r.timings.duration < 500,
  });
  
  sleep(1);
}

Example 2: Test with Authentication and Data Parameterization

import http from 'k6/http';
import { check } from 'k6';
import { SharedArray } from 'k6/data';

const users = new SharedArray('users', function () {
  return JSON.parse(open('./users.json'));
});

export default function () {
  const user = users[__VU % users.length];
  
  const loginRes = http.post('https://api.example.com/login',
    JSON.stringify({ email: user.email, password: user.password })
  );
  
  const token = loginRes.json('access_token');
  
  const headers = { 'Authorization': `Bearer ${token}` };
  const res = http.get('https://api.example.com/profile', { headers });
  
  check(res, { 'profile loaded': (r) => r.status === 200 });
}

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
常见问题

什么是“负载测试”?

这是一种测试,用于查看系统(比如网站)在许多人同时使用时的表现如何。

k6 是用来做什么的?

k6 是一个专门用于高效、自动化执行这类负载测试的工具。

使用它需要会编程吗?

设置测试时最好具备基础编程知识,不过工具也能帮你生成简单的脚本。

详情

作者的原始描述

Comprehensive k6 load testing skill for API, browser, and scalability testing. Write realistic load scenarios, analyze results, and integrate with CI/CD.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#5002
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能