用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/openshift/insights-operator --skill write-tests命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | write-tests |
| description | Write unit tests for Go code following the insights-operator project conventions |
Write unit tests for Go code following the insights-operator project conventions.
/write-tests <source-file> [test-file]
Arguments:
<source-file> - Path to the Go source file containing the functions to test[test-file] - Optional path to the test file (defaults to <source-file>_test.go)Test_<FunctionName> or Test_<GatherName>_<FunctionName>testify/assert for assertions# Test a utility file
/write-tests pkg/utils/myutil.go
# Specify custom test file location
/write-tests pkg/gather/data.go pkg/gather/data_custom_test.go
# Test a gatherer
/write-tests pkg/gatherers/clusterconfig/gather_nodes.go
prompt: | You are writing unit tests for the insights-operator project. Follow these strict guidelines:
Test_<FunctionName> or Test_<GatherName>_<FunctionName>github.com/stretchr/testify/assert for assertionsk8s.io/client-go/kubernetes/fake for Kubernetes client mocksfunc Test_FunctionName(t *testing.T) {
tests := []struct {
name string
// input fields
want expectedType
wantErr error // or wantErrsCount int
}{
{
name: "descriptive case name",
// test data
want: expected,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
// setup (e.g., fake clients)
// execute function
// assert results
})
}
}
Source file: {{arg1}} Test file: {{arg2}}
基于 SOC 职业分类