gen-test
Skill7 starsChanged 9 months agoMITView on GitHub
Generate test scaffolding for a Go file following oastools conventions. Usage: /gen-test <file.go> [function names...]
2 other projects use a version of this.
Adopted by
Most recently taken up by
- meshery/mesherytheir own version, first seen Oct 8, 2026
- mean-weasel/bullhorntheir own version, first seen Apr 14, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- meshery/meshery★ 12ksame name
- mean-weasel/bullhorn★ 4same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository9 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- plugin/CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- corpus-testSkill
- prepare-releaseSkill
- prereviewSkill
- publish-releaseSkill
- quality-gateSkill
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 7 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
Read the specified file and identify:
- Distinctive: line 35
Look for existing test patterns in the same package:
- Distinctive: line 43
Read 1-2 existing test files to understand:
- Very specific: line 46
Test helper usage (testutil, require, assert)
- Very specific: line 52
Create or append to the *_test.go file following these conventions:
- Very specific: line 57
Table-driven tests: Use tests := []struct{...} pattern
- Distinctive: line 59
Descriptive names: Test case names should describe the scenario
- Very specific: line 60
testutil helpers: Use testutil.LoadSpec() for loading OAS fixtures
- Distinctive: line 123
Always include test cases for:
- Distinctive: line 132
After generating, verify the tests compile:
- Very specific: line 142
Run the tests (go test -v ./path/to/package -run TestName)
- Distinctive: line 143
Add more test cases
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
gen-test
Generate test scaffolding for Go files following oastools testing conventions.
Usage:
/gen-test parser/resolver.go- Generate tests for all exported functions/gen-test validator/validate.go ValidateSpec- Generate test for specific function
Step 1: Analyze Target File
Read the specified file and identify:
- Package name
- Exported functions/methods to test
- Existing test file (if any)
- Dependencies and types used
Note: In the commands below,
$FILErefers to the path provided by the user when invoking the skill. For example, if the user runs/gen-test parser/resolver.go, then$FILE=parser/resolver.go.
# Check if test file already exists
# Example: parser/resolver.go -> parser/resolver_test.go
ls -la "${FILE%%.go}_test.go" 2>/dev/nullStep 2: Find Testing Patterns
Look for existing test patterns in the same package:
# Find existing tests in the package
# Example: parser/resolver.go -> parser/*_test.go
ls -la $(dirname "$FILE")/*_test.go 2>/dev/null | head -5Read 1-2 existing test files to understand:
- Table-driven test patterns used
- Test helper usage (
testutil,require,assert) - Fixture/testdata patterns
- Subtests structure
Step 3: Generate Test Scaffolding
Create or append to the *_test.go file following these conventions:
oastools Testing Conventions
- Use testify:
github.com/stretchr/testify/requireandassert - Table-driven tests: Use
tests := []struct{...}pattern - Subtests: Use
t.Run(tt.name, func(t *testing.T) {...}) - Descriptive names: Test case names should describe the scenario
- testutil helpers: Use
testutil.LoadSpec()for loading OAS fixtures
Template Structure
func TestFunctionName(t *testing.T) {
tests := []struct {
name string
input InputType
want OutputType
wantErr bool
}{
{
name: "valid input returns expected output",
input: validInput,
want: expectedOutput,
},
{
name: "invalid input returns error",
input: invalidInput,
wantErr: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := FunctionName(tt.input)
if tt.wantErr {
require.Error(t, err)
return
}
require.NoError(t, err)
assert.Equal(t, tt.want, got)
})
}
}For Methods on Types
func TestTypeName_MethodName(t *testing.T) {
// Setup
obj := NewTypeName(...)
// Test cases
tests := []struct {
name string
// ...
}{
// ...
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
// ...
})
}
}Step 4: Add Edge Cases
Always include test cases for:
- ✅ Happy path (valid input)
- ❌ Error cases (invalid input)
- 🔲 Nil/empty inputs
- 🔄 Boundary conditions
Step 5: Verify Tests Compile
After generating, verify the tests compile:
go test -c ./path/to/packageStep 6: Summary
Present the generated test scaffolding and ask if the user wants to:
- Run the tests (
go test -v ./path/to/package -run TestName) - Add more test cases
- Generate tests for additional functions
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

