Borrowing it
Nothing to install: this file belongs to shenjingnan/home-mcp. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/shenjingnan/home-mcp/main/.claude/commands/test-create.mdgit clone --depth 1 https://github.com/shenjingnan/home-mcpWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/commands/shenjingnan/home-mcp/test-create)<a href="https://agentmods.dev/commands/shenjingnan/home-mcp/test-create"><img src="https://agentmods.dev/badge/commands/shenjingnan/home-mcp/test-create/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/commands/shenjingnan/home-mcp/test-create"><img src="https://agentmods.dev/badge/commands/shenjingnan/home-mcp/test-create.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00005 | $0.02086 |
| Opus 5.5 | $0.00002 | $0.00834 |
| Sonnet 5.5 | $0.00001 | $0.00417 |
| Haiku 4.5 | $0.00001 | $0.00209 |
Grade A, and why
test-create scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 306 lines — stays where its author put it; the contents beside it link to each section on GitHub.
$1 $2
我需要为项目中的代码创建测试用例。请帮我生成完整的测试文件:
1. 分析测试需求
基于我提供的测试类型 <test-type> 和目标文件/模块 <target-file-or-module>:
- 确定测试范围:分析目标代码的功能和接口
- 识别测试场景:正常流程、边界条件、错误处理
- 设计Mock策略:需要模拟的外部依赖和数据
2. 支持的测试类型
mcp-tool - MCP工具测试
- 目标:MCP工具服务类的完整测试
- 测试重点:
- 参数验证(Zod schema)
- Home Assistant API调用
- 设备查找和过滤逻辑
- 错误处理和用户友好的错误消息
- Mock对象:HassService、设备状态数据
service - 服务类测试
- 目标:业务逻辑服务类的单元测试
- 测试重点:
- 业务逻辑正确性
- 数据转换和处理
- 异常处理流程
- 性能和边界条件
- Mock对象:外部API、数据库连接
utility - 工具函数测试
- 目标:纯函数和工具方法的测试
- 测试重点:
- 输入输出正确性
- 边界值处理
- 类型安全性
- 算法效率
- Mock对象:通常无需Mock,纯函数测试
type - 类型定义测试
- 目标:TypeScript类型和接口的测试
- 测试重点:
- 类型构造函数
- 类型守卫函数
- 错误类型定义
- 常量和配置对象
- Mock对象:根据具体需求定
3. 测试文件结构模板
基于项目测试配置和现有测试模式:
3.1 基础结构
import { describe, expect, it, beforeEach, afterEach, vi } from "vitest";
// 导入要测试的模块
import { {TargetClass}, {TargetFunction} } from "../{target-module}";
// 导入类型定义
import type { {TargetType} } from "../{target-module}";
describe("{测试描述}", () => {
// 测试设置和清理
beforeEach(() => {
// 测试前的准备工作
});
afterEach(() => {
// 测试后的清理工作
vi.clearAllMocks();
});
// 测试用例分组
describe("{功能分组}", () => {
it("应该正确处理基本场景", async () => {
// 基础功能测试
});
it("应该正确处理边界条件", async () => {
// 边界条件测试
});
it("应该正确处理错误情况", async () => {
// 错误处理测试
});
});
});
3.2 Mock设置模式
// Mock外部依赖
vi.mock("../{dependency-module}", () => ({
{DependencyClass}: vi.fn(),
{dependencyFunction}: vi.fn(),
}));
// Mock数据生成
const createMock{TargetType} = (overrides: Partial<{TargetType}> = {}): {TargetType} => ({
// 默认Mock数据
...overrides,
});
4. 测试覆盖要求
基于项目覆盖率阈值(80%函数、行、语句,70%分支):
4.1 必须覆盖的场景
- 正常流程:所有主要功能路径
- 边界条件:最小值、最大值、空值、null/undefined
- 错误处理:所有异常分支和错误码
- 异步操作:Promise、async/await的各种状态
4.2 测试数据设计
- 有效数据:符合预期的正常输入
- 无效数据:各种格式错误的输入
- 边界数据:临界值和极值
- 特殊数据:null、undefined、空字符串、空数组
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2mo ago First seen · 306 lines · 0 tokens per session scan A 27236477eadb
test-create is a command published in the GitHub repository shenjingnan/home-mcp (23 stars, last pushed 9mo ago), licensed MIT. It adds 5 tokens to every session and 2,086 once invoked, about $0.0000 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
test-create compared with commands from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| test-createshenjingnan/home-mcp | Command | 23 | 9mo ago | MIT | A | 5 | Claude Code |
| sessionproffesor-for-testing/agentic-qe | Command | 525 | yesterday | MIT | A | 0 | Claude Code |
| test-tddguanyang/open-agent-hub | Command | 986 | yesterday | MIT | A | 32 | Claude Code |
| kill-mutantsswingerman/engineer | Command | 162 | 10d ago | MIT | A | 29 | Claude Code |
| lg:nodeTheLobbi/claude | Command | 21 | 7d ago | MIT | A | 34 | Claude Code |
| test-auditacaprino/daodan | Command | 9 | 4d ago | MIT | A | 88 | Claude Code |
| story-and-testepam/ai-dial-ui-kit | Command | 10 | today | Apache-2.0 | A | 0 | Claude Code, Cursor |