test-helpers
Skill này làm gì
Skill này tạo code hàm hỗ trợ kiểm thử có thể tái sử dụng cho dự án game, khớp với engine và các hệ thống của dự án. Skill dành cho lập trình viên viết nhiều kiểm thử và muốn ít code thiết lập lặp lại hơn.
Khi nào nên dùng
- ✓Khi nhóm đã hoàn thành thiết lập kiểm thử và muốn có các hàm hỗ trợ dùng chung để viết kiểm thử.
- ✓Khi lập trình viên cứ lặp lại cùng một thiết lập và khẳng định qua nhiều kiểm thử.
- ✓Khi một thư mục kiểm thử engine mới cần các hàm hỗ trợ khởi đầu.
Liên kết skill
https://github.com/Donchitos/Claude-Code-Game-Studios/blob/main/.claude/skills/test-helpers/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Tạo các hàm hỗ trợ kiểm thử cho dự án Godot của tôi để nhóm cần ít code thiết lập lặp lại hơn.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill kiểm tra engine và ngôn ngữ của dự án, rồi viết các tệp hàm hỗ trợ cho thiết lập, khẳng định, factory và mock vào thư mục mà trình chạy kiểm thử của engine dùng. Skill hỏi trước khi thực hiện một số thay đổi nhất định.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
!bash "${CLAUDE_SKILL_DIR}/../../hooks/yaml-helper.sh" resolve_config --keys automation
Automation mode: Resolve modes.automation (project.local.yaml →
project.yaml → default collaborative). Every AskUserQuestion call and
every file write follows .claude/docs/automation-modes.md
(collaborative asks always · guided major-only · autonomous logs and proceeds;
automation_always_ask categories always prompt).
Test Helpers
Writing test cases is faster and more consistent when common setup, teardown,
and assertion patterns are abstracted into helpers. This skill generates a
tests/helpers/ library tailored to the project's actual engine, language,
and systems — so every developer writes less boilerplate and more assertions.
Output: engine-specific helper files in the engine's helper root —
the only place its test runner compiles them (.claude/docs/directory-structure.md):
| Engine | Helper root |
|---|---|
| Godot | tests/helpers/ |
| Unity | Assets/Tests/EditMode/Helpers/ — inside the EditModeTests assembly /test-setup creates. If PlayMode tests need the same helpers, ask before creating Assets/Tests/Helpers/TestHelpers.asmdef and referencing it from both test assemblies. |
| Unreal | Source/<Module>/Private/Tests/Helpers/ |
tests/helpers/ below means the helper root for the project's engine.
When to run:
- After
/test-setupscaffolds the framework (first time) - When multiple test files repeat the same setup boilerplate
- When starting to write tests for a new system
Assertions: use the project's test framework, never bare assert()
Generated helpers must assert through the configured test framework's assertion
API, resolved from testing.framework — not through GDScript's built-in
assert().
Two things go wrong with a bare assert() in a helper, and both are silent:
- It aborts the run instead of failing the test. A framework assertion
records a failure and continues, so one broken expectation yields one red test.
A bare
assert()halts execution, so the first failure hides every result after it. - It is stripped in release builds. A helper library built on
assert()stops asserting entirely in exactly the build you most want checked, and does so without any error — the tests still "pass".
Look up the assertion form for the configured framework before generating
code. Do not copy the forms in this file or in other skills' examples as
authoritative — they are illustrative and have drifted (assert_eq,
assert_true and assert_that all appear across the repo). If you cannot
confirm the correct API for the project's framework, say so and generate no
helper rather than guessing.
Helpers must not extend the framework's test-suite base class. A file in
tests/helpers/ that extends the suite type is discovered by the runner as a
test suite containing zero tests. Helpers are plain classes; only real test files
extend the suite.
1. Parse Arguments
Modes:
/test-helpers [system-name]— generate helpers for a specific system (e.g.,/test-helpers combat)/test-helpers all— generate helpers for all systems with test files/test-helpers scaffold— generate only the base helper library (no system-specific helpers); use this on first run- No argument — run
scaffoldif no helpers exist, elseall
2. Detect Engine and Language
Read from project.yaml first, falling back to .claude/docs/technical-preferences.md for any key that is absent or empty:
engine.name(else theEngine:value)engine.language(else theLanguage:value)testing.framework(elseFramework:from the Testing section)
If the engine is not configured in either source: "Engine not configured. Run /setup-engine first."
3. Load Existing Test Patterns
Scan the engine's test root for patterns already in use (Godot tests/, Unity
Assets/Tests/, Unreal Source/<Module>/Private/Tests/):
Glob pattern="tests/**/*_test.*" (Godot)
Glob pattern="Assets/Tests/**/*Tests.cs" (Unity)
Glob pattern="Source/*/Private/Tests/**/*.cpp" (Unreal)
For a representative sample (up to 5 files), read the test files and extract:
- Setup patterns (how
before_each/setUp/ fixtures are written) - Common assertion patterns (what is being asserted most often)
- Object creation patterns (how game objects or scenes are instantiated in tests)
- Mock/stub patterns (h
Câu hỏi thường gặp
Nó có hoạt động với mọi engine không?
Nó được điều chỉnh theo engine của dự án, như Godot, Unity hoặc Unreal, và mỗi engine có thư mục hỗ trợ riêng.
Có nên chạy thiết lập kiểm thử trước không?
Có. Các hàm hỗ trợ được xây trên framework kiểm thử, nên tốt nhất chạy thiết lập kiểm thử trước.
Skill có viết kiểm thử giúp tôi không?
Skill viết code hỗ trợ để giảm code lặp lại, còn các kiểm thử do lập trình viên tự viết.
Chi tiết
Mô tả gốc của tác giả
Generate engine-specific test helper libraries — assertion utilities, factory functions, mocks in the engine's test folder. Reduces boilerplate.
Độ phổ biến
- Sao GitHub
- 33k
- Vị trí xếp hạng
- #8503
- Giấy phép
- MIT
- Cập nhật
- 18/10/2026
Bình luận
- …
Thêm skill từ kho mã này
adopt
33kKiểm tra xem tài liệu của một dự án game hiện có có tuân theo định dạng của mẫu studio hay không, rồi viết một kế hoạch di chuyển có đánh số để sửa các khoảng trống.
architecture-decision
33kViết một bản ghi quyết định kiến trúc cho một lựa chọn kỹ thuật, gồm bối cảnh, các phương án thay thế và hệ quả, với xem xét từ các vai trò kỹ thuật phù hợp.
architecture-review
33kKiểm tra các quyết định kỹ thuật của bạn có bao phủ mọi yêu cầu thiết kế, không mâu thuẫn và phù hợp với phiên bản động cơ, với kết luận đạt hoặc có mối lo ngại rõ ràng.
art-bible
33kViết một art bible xác định bản sắc thị giác của game, để việc sản xuất tài nguyên tuân theo một bộ quy tắc phong cách rõ ràng.
Skill tương tự
test-driven-development
311kDạy agent của bạn viết kiểm thử thất bại trước, xem nó thất bại, rồi viết đoạn mã ngắn nhất để vượt qua trước khi làm bất kỳ tính năng hay bản sửa nào.
verification-before-completion
311kDạy agent của bạn chạy kiểm tra thực tế và đọc kết quả đầu ra trước khi khẳng định một việc, bản sửa hoặc bản build đã hoàn thành hay vượt qua.
migrate-to-shoehorn
310kThay các ép kiểu rủi ro trong tệp kiểm thử bằng thư viện shoehorn, để các bài kiểm thử dùng dữ liệu một phần vẫn qua được kiểm tra kiểu.