一键导入
go-error-cleanup
Removes error returns and replaces with mylog.Check/Check2/Call. Invoke when user wants to clean up error handling in Go files.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Removes error returns and replaces with mylog.Check/Check2/Call. Invoke when user wants to clean up error handling in Go files.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Generates Go bindings from C headers and creates DLL bindings with unit tests. Invoke when user wants to add a new C library binding (WinDivert, Everything-SDK, zydis, keystone etc.) or when TestGenerate needs to be run for bindgen.
Checks Go implementation consistency with C++ HyperDbg. Invoke when comparing Go test code with C++ Libhyperdbg implementation or debugging IOCTL structure mismatches.
Generates interface method implementations for structs. Invoke when user wants to implement interface methods in a struct, automatically detecting missing methods and signature mismatches.
Guide for implementing Go version of pdbex PDB parser. Invoke when developing PDB parsing, symbol extraction, or type reconstruction features.
Generates unit test skeletons from Go interface definitions. Invoke when user wants to create test files with empty test functions based on interface methods.
Comprehensive guide for creating gio/ux UIs. Invoke when developing any gio/ux UI, creating widgets, layouts, or troubleshooting panics and compilation errors.
| name | go-error-cleanup |
| description | Removes error returns and replaces with mylog.Check/Check2/Call. Invoke when user wants to clean up error handling in Go files. |
This skill removes error returns and replaces error handling with mylog utilities across Go files in the workspace.
mylog.Check() for simple error handlingmylog.Check2() for functions returning valuesmylog.Call() wrapperfmt (if only used for error formatting)provider.go to other files// Before
func foo() error
func foo() (int, error)
func foo() (string, error)
// After
func foo()
func foo() int
func foo() string
// Before
type MyInterface interface {
Foo() error
Bar() (int, error)
}
// After
type MyInterface interface {
Foo()
Bar() int
}
// Before
err := someFunc()
if err != nil {
return fmt.Errorf("failed: %w", err)
}
// After
mylog.Check(someFunc())
// Before
val, err := someFunc()
if err != nil {
return err
}
return val
// After
val := mylog.Check2(someFunc())
return val
// Before
defer func() {
if r := recover(); r != nil {
if err, ok := r.(error); ok {
// handle error
}
}
}()
// After
mylog.Call(func() {
// code that might panic
})
// Before
func foo() error {
err := bar()
if err != nil {
return err
}
return nil
}
// After
func foo() {
mylog.Check(bar())
}
// Before - Wrapper method that delegates to interface
func (s *MyStruct) SomeMethod() error {
return s.interface.Method()
}
// After - Remove error return and use mylog.Check
func (s *MyStruct) SomeMethod() {
mylog.Check(s.interface.Method())
}
// Before - Wrapper method returning value
func (s *MyStruct) GetValue() (int, error) {
return s.interface.GetValue()
}
// After - Use mylog.Check2 for value-returning methods
func (s *MyStruct) GetValue() int {
return mylog.Check2(s.interface.GetValue())
}
// WRONG - Don't wrap methods that already use mylog internally
func (s *MyStruct) SomeMethod() {
mylog.Check(s.interface.Method()) // Method() already uses mylog.Check internally
}
// CORRECT - Just call the method directly
func (s *MyStruct) SomeMethod() {
s.interface.Method() // Method() already handles errors with mylog.Check
}
// Example: provider.go already processed
// SendBuffer and ReceiveBuffer already use mylog.Check internally
// So in packet.go, just call them directly:
func (p *Packet) EPTHook(address uint64, size uint32, hookType EPTHookType) {
if !p.IsConnected() {
slog.Warn("driver not available")
return
}
buffer := make([]byte, 24)
binary.LittleEndian.PutUint64(buffer[0:8], address)
binary.LittleEndian.PutUint32(buffer[8:12], size)
binary.LittleEndian.PutUint32(buffer[12:16], uint32(hookType))
p.driver.SendBuffer(buffer, IoctlDebuggerRegisterEvent) // Already uses mylog.Check
}
.go files (including subdirectories)type X interface)return s.someInterface.Method() with mylog.Check(s.someInterface.Method())return s.someInterface.Method() with mylog.Check2(s.someInterface.Method()) for methods returning valuestype X interface { ... } definitionsfunc (s *Wrapper) Foo() { return s.embedded.Foo() }mylog/*.go - Don't modify the mylog package itself*_test.go) - Tests may need explicit error handlingAfter processing, report: