go-analyzer-dev

Define structured Go analyzer development workflows using the go/analysis framework.

4|Updated Sep 6, 2013
One-click install
npx skills add https://github.com/mway/dotfiles --skill go-analyzer-dev
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: go-analyzer-dev
Source: https://github.com/mway/dotfiles/tree/main/home/dot_codex/skills/go-analyzer-dev
Command: npx skills add https://github.com/mway/dotfiles --skill go-analyzer-dev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Developing, maintaining, and auditing Go analyzers (go/analysis) is complex and error-prone without a structured workflow. This Skill provides a clear guide, reference materials, and a repeatable process to design, implement, test, and review analyzers.

Core Features & Use Cases

  • Analyzer Contract: define purpose, scope, non-goals, diagnostics, and rules for generated-file handling and nolint behavior.
  • AST/Types Strategy: enumerate visited node kinds, required TypesInfo behavior, and guard nil/partial data; prefer narrow inspectors.
  • Fix Safety Rules: ensure correctness from local context, preserve comments and formatting, minimize edits, and respect token boundaries.
  • Scenario Matrix & Testing: maintain per-analyzer scenario matrices with test mappings, unit tests using analysistest and RunWithSuggestedFixes, and update golden files as needed.
  • Integration & Performance: run analyzers together safely, avoid expensive traversals, and reuse computed maps.
  • Risk & Unknowns: list policy decisions and residual risks for unsupported scenarios.
  • Deliverables: maintain updated analyzer contracts, test coverage, integration tests, and evidence notes.

Quick Start

Initialize a new analyzer by defining contract, AST/Types strategy, fix rules, and tests, then run integration checks to validate behavior.

Frequently Asked Questions about go-analyzer-dev

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

FAQPage Schema
How do I structure a Go analyzer using the go/analysis framework?▼

To develop a Go analyzer, define an analyzer contract for scope and diagnostics, enumerate AST/Types strategies, establish fix safety rules, and implement tests using analysistest with golden files.

What is the best way to test suggested fixes in Go static analysis?▼

Testing Go analyzer suggested fixes requires unit tests using analysistest and RunWithSuggestedFixes, mapping test cases via a scenario matrix, and updating golden files to validate behavioral changes.

How do I ensure fix safety when updating Go analyzers?▼

Ensuring fix safety requires verifying correctness from local context, preserving comments and formatting, minimizing edits, and respecting token boundaries to prevent invalid code generation.

How do I avoid expensive traversals when running multiple Go analyzers together?▼

Avoid expensive traversals by preferring narrow inspectors, reusing computed maps, and following integration guidelines to run multiple Go analyzers together safely without redundant AST walks.

What should be included in a Go analyzer contract?▼

A Go analyzer contract defines purpose, scope, non-goals, diagnostics, and rules for generated-file handling and nolint behavior, establishing explicit boundaries for analyzer operations.

Do I need to handle nil or partial TypesInfo data when developing Go analyzers?▼

Handling nil or partial TypesInfo data is required when developing Go analyzers; the AST/Types strategy must enumerate visited node kinds and guard nil or partial data to prevent runtime panics.