deterministic-service-test
Write deterministic service tests with stable fixtures and boundary mocks without using jig.
- License 许可
- MIT
- 最近更新
- 2026-04-10
- Stars
- ★ 6
- Forks
- 0
01 前言 Front Matter
- name
- deterministic-service-test
- description
- Write deterministic service tests with stable fixtures and boundary mocks without using jig.
03 SKILL.md 正文
Deterministic Service Test (Control)
Use this skill when creating tests for service modules. Implement the file edits directly. Do not return a checklist-only response.
Required Variables
service_symbolmodule_pathcreate_methodcancel_method
Required Output Contract
- Write
tests/test_core_service.py. - Import
datetimefromdatetime,create_autospecfromunittest.mock,pytest, andCoreServicefromservices.core_service. - Define a
fixed_check_infixture that returnsdatetime(2024, 1, 1, 12, 0, 0). - Define
test_create_record_returns_confirmed_status(fixed_check_in). - In that test:
- instantiate
service = CoreService() - instantiate
notifier = create_autospec(object, spec_set=True) - include a visible
# Actcomment immediately before the service call - call
service.create_record(display_name="Alice", check_in=fixed_check_in, check_out=datetime(2024, 1, 3, 12, 0, 0)) - assert
result["status"] == "confirmed" - assert
notifier.mock_calls == []
- Define
test_cancel_record_returns_cancelled_status(). - In that test:
- instantiate
service = CoreService() - include a visible
# Actcomment immediately before the service call - call
service.cancel_record(record_id="abc-123") - assert
result["status"] == "cancelled"
- Preserve the exact test names above and keep one behavior per test.
Guardrails
- No
unittest.TestCasein pytest-style tasks. - No real clock/random dependencies in deterministic tests.
- Do not add extra helper abstractions or additional tests beyond the required contract.
04 同仓库更多 Skills
velocity
Systematic DX improvement hunt — find friction, inconsistency, and missing abstractions across PRs, code, or tickets, then feed findings into /improve. Use when looking for ways to accelerate development or compound Claude Code's utility.
upgrade
Upgrade an existing skill or agent by auditing it, gathering user references, and rewriting it with real content. Use when a skill is thin, sloppy, missing gotchas, or needs improvement. Different from /improve which creates new extensions.
improve
Deliberately improve Claude Code by creating or updating skills, agents, hooks, rules, or MCP servers. Use when Claude keeps making the same mistake, a workflow is tedious, a new pattern needs enforcement, or you want to compound Claude's utility.
clean-copy
Recreate the current branch with a clean, narrative commit history. Use before creating a PR from a messy development branch, after exploratory coding with WIP commits, or when commit history is hard to review.
audit
Audit installed skills and agents against best practices. Use when reviewing skill quality, checking for common problems, or before upgrading existing skills. Read-only — produces a report, changes nothing.
typescript-update-model
暂无简介