invariant-hunter-go

Audit Go code for unchecked errors, nil dereferences, and unsafe type assertions.

5|Updated Jan 14, 2026
One-click install
npx skills add https://github.com/skyosev/agent-skills --skill invariant-hunter-go
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: invariant-hunter-go
Source: https://github.com/skyosev/agent-skills/tree/main/hunter-party-go/invariant-hunter-go
Command: npx skills add https://github.com/skyosev/agent-skills --skill invariant-hunter-go

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Audit Go code for weak invariants — unchecked errors, nil pointer risks, ignored context cancellation, unsafe type assertions, zero-value traps, panic/recover misuse, and missing validation at construction boundaries.

Core Features & Use Cases

  • Detect unchecked errors and discarded results to ensure every error is handled or justified.
  • Validate nil-safety across constructors, API boundaries, and data flows to prevent nil dereference panics.
  • Enforce construction-boundary validation so defaults and invariants are established early in object lifecycles.
  • Identify risky type assertions and improper context cancellation in long-running or I/O-heavy paths.
  • Document and guide remediation with actionable findings to raise overall safety discipline.

Quick Start

Run a targeted Go code audit to surface invariant violations and unsafe error handling, then prioritize fixes across constructors and boundaries.

Frequently Asked Questions about invariant-hunter-go

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I audit Go code for nil pointer dereferences and unchecked errors?

To audit Go code for nil pointer dereferences and unchecked errors, run a targeted scan across module boundaries and constructors. This surfaces discarded results and unsafe data flows, providing actionable findings to prevent panics and enforce safe error handling.

What are construction boundaries in Go and when do I need to validate invariants?

Construction boundaries in Go are the points where objects are initialized and defaults are established. You need to validate invariants at these boundaries early in the lifecycle to ensure nil-safety and prevent zero-value traps from propagating into API handlers and long-running routines.

How do I enforce safe context cancellation and panic recover usage in long-running Go routines?

Enforcing safe context cancellation and panic recover usage in long-running Go routines requires auditing I/O-heavy paths for ignored cancellations and improper recovery logic. The audit identifies risky patterns and guides remediation to raise overall safety discipline.

Can I use this Go error handling audit during a refactoring phase to tighten initial design?

Yes, you can use this Go error handling audit during refactoring to tighten initial design. It catches weak invariants, unsafe type assertions, and missing validation at construction boundaries, prioritizing fixes to raise overall safety discipline across the module.

What is the best way to fix risky type assertions and zero-value traps in Go API handlers?

The best way to fix risky type assertions and zero-value traps in Go API handlers is to run a targeted invariant audit. It identifies these specific weak invariants across API boundaries and documents actionable recommended fixes to ensure proper validation.