hunter-party-go/doc-hunter-go/SKILL.md
Audit Go code for missing documentation where the "why" is not obvious — obscure calculations, non-trivial business rules, surprising behavior, implicit constraints, workarounds, and missing godoc on exported symbols. Finds where a comment would save the next reader significant time. Use when: reviewing Go code for long-term maintainability, onboarding new team members, auditing undocumented business logic, or preparing code for handoff.
npx skillsauth add skyosev/agent-skills doc-hunter-goInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Audit code for missing "why" documentation — places where the intent, constraints, or reasoning behind the code are not obvious from the code itself. The goal: every non-obvious decision has a concise inline explanation, every exported symbol has a godoc comment, and no comment restates what the code already says.
Document the why, never the what. A comment should answer "why is this here?" or "why this approach?" — never "what does this line do?". If the code needs a "what" comment, the code itself should be rewritten for clarity (simplicity-hunter territory, not doc-hunter).
Exported symbols require godoc (secondary concern). Go's tooling convention: every exported function, type,
method, constant, and variable should have a comment starting with the symbol's name. This is a real convention —
go doc and pkg.go.dev render these comments as the package's public documentation. However, godoc completeness
is secondary to this skill's primary focus on missing "why" documentation. Flag missing godoc, but prioritize
undocumented business rules, workarounds, and non-obvious algorithms over mechanical godoc coverage.
Package comments set the stage. Every package should have a package-level comment (in doc.go or atop any file)
that explains the package's purpose. The comment starts with "Package X ...".
Concise over comprehensive. The best inline comment is one sentence that captures the key insight. If a paragraph is needed, the logic may need extraction into a named function instead.
Context decays. The reason behind a workaround, a magic number, or a non-obvious branch is obvious to the author today and a mystery to everyone (including the author) in six months.
Not every line needs a comment. Straightforward code — standard patterns, clear naming, obvious control flow — should stand on its own. Only flag missing documentation where a competent Go developer would genuinely pause and ask "why?".
Exported functions, types, methods, constants, and variables without documentation comments.
Signals:
// FuncName ... comment on the line above// TypeName ... comment// MethodName ... comment// Package name ... commentAction: Add godoc comment starting with the symbol's name. For packages, add a doc.go file or top-level comment.
Comments should describe what the symbol does for godoc, and why it exists for inline context.
Conditionals, thresholds, or branching logic that encode domain rules not evident from the code alone.
Signals:
if age >= 26 — why 26? Legal requirement? Business policy?discount := 0.1 if total > 500 — what drives the 500 threshold?Action: Flag for a comment explaining the business rule, its source (regulation, product spec, stakeholder decision), and when it might change.
Literal values embedded in logic whose meaning or origin is unclear.
Signals:
timeout = retries * 1.5 + 3parts[2]Action: Flag for either a named constant with a descriptive name, or an inline comment explaining the value's origin and meaning.
Mathematical formulas, coordinate transforms, bit manipulation, or multi-step data transformations where the approach is not self-evident.
Signals:
<<, >>, &, |, ^) outside obvious flag-checking contextsAction: Flag for a comment explaining what the calculation achieves, what the inputs/outputs represent, and (for formulas) a reference to the source (spec, paper, algorithm name).
Code that exists to work around a bug, library limitation, OS quirk, or upstream constraint.
Signals:
//go:build constraints for platform-specific workarounds without explanationAction: Flag for a comment explaining what is being worked around, ideally with a link to the issue/bug tracker, and under what conditions the workaround can be removed.
Code where the execution order matters but isn't enforced by the type system or control flow.
Signals:
sync.Once usage where the initialization dependency isn't obviousAction: Flag for a comment explaining the ordering constraint and what breaks if violated.
Code whose behavior differs from what a reasonable reader would expect.
Signals:
context.Context values carrying non-obvious data that callers depend onAction: Flag for a comment explaining the surprising behavior and why it is intentional.
Exported functions or methods whose usage constraints are not captured by the type signature.
Signals:
percent float64 — is 0-1 or 0-100?)Action: Flag for godoc documenting the contract. For exported API, godoc is required; for internal functions, a brief inline comment suffices.
Exported API that would benefit from executable examples for documentation and testing.
Signals:
Example* functions in test files*_test.go filesAction: Flag for Example* test functions that serve as both documentation and regression tests.
main/master)BASE=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@' || echo main)
SCOPE=$(git diff --name-only $(git merge-base HEAD $BASE)...HEAD)
Constrain all subsequent scans to the resolved surface.EXCLUDE='--glob !**/*_test.go --glob !**/vendor/** --glob !**/testdata/**'
# Exported symbols (check for preceding comment)
rg '^func\s+[A-Z]|^type\s+[A-Z]|^var\s+[A-Z]|^const\s+[A-Z]' --type go $EXCLUDE
# Package comments
rg '^// Package\s+\w+' --type go $EXCLUDE
# Magic numbers in logic
rg --pcre2 '[^0-9][2-9]\d{1,}[^0-9]|0x[0-9a-f]{2,}|\d+\.\d+' --type go $EXCLUDE
# Regex literals
rg 'regexp\.(Compile|MustCompile)\(' --type go $EXCLUDE
# Bitwise operations
rg --pcre2 '<<|>>|[^&]&[^&]|[^|]\|[^|]|\^' --type go $EXCLUDE
# Timeouts and delays
rg 'time\.Sleep|time\.After|time\.NewTicker|Timeout|timeout' --type go $EXCLUDE
# Workaround signals
rg -i 'hack|workaround|fixme|todo|XXX' --type go $EXCLUDE
# Example functions
rg '^func Example' --type go --glob '*_test.go'
# Build constraints
rg '//go:build|// \+build' --type go $EXCLUDE
These are heuristic starting points. The primary method is reading the code and identifying where a competent reader would ask "why?" — no grep pattern can substitute for that judgment.
For each candidate, determine:
Classify each as:
Save as YYYY-MM-DD-doc-hunter-audit-{$LLM-name}.md in the project's docs folder (or project root if no docs folder exists).
# Doc Hunter Audit — {date}
## Scope
- Surface: {diff / path / codebase}
- Files: {count or list}
- Exclusions: {list}
## Findings
### Missing Godoc
| # | Symbol | Location | Type | Action |
| - | ------ | -------- | ---- | ------ |
| 1 | `ProcessOrder` | file:line | Exported func | Add `// ProcessOrder ...` godoc |
| 2 | `payment` package | pkg/payment/ | Package | Add `// Package payment ...` in doc.go |
### Unexplained Business Rules
| # | Location | Code | Missing Context | Suggested Comment |
| - | -------- | ---- | --------------- | ----------------- |
| 1 | file:line | `if age >= 26` | Why 26? | `// Minimum age for policy X per regulation Y` |
### Magic Numbers
| # | Location | Value | Context | Action |
| - | -------- | ----- | ------- | ------ |
| 1 | file:line | `1.5` in retry calc | Backoff multiplier — origin unclear | Name as constant or comment source |
### Non-Obvious Algorithms
| # | Location | Code | Missing Context | Action |
| - | -------- | ---- | --------------- | ------ |
| 1 | file:line | Haversine formula | No reference to formula name | Add `// Haversine distance — see <ref>` |
### Workarounds
| # | Location | Code | Missing Context | Action |
| - | -------- | ---- | --------------- | ------ |
| 1 | file:line | 200ms sleep before retry | Why the delay? | Comment with root cause and removal condition |
### Ordering Dependencies
| # | Location | Code | Missing Context | Action |
| - | -------- | ---- | --------------- | ------ |
| 1 | file:line | `Init()` must precede `Start()` | No indication of required ordering | Add comment or enforce via state |
### Surprising Behavior
| # | Location | Code | What's Surprising | Action |
| - | -------- | ---- | ----------------- | ------ |
| 1 | file:line | `Process()` mutates input slice | Name implies pure function | Comment or rename to `ProcessInPlace()` |
### API Contracts
| # | Location | Signature | Missing Contract | Action |
| - | -------- | --------- | ---------------- | ------ |
| 1 | file:line | `SetOpacity(value float64)` | Valid range? 0-1 or 0-100? | Add godoc with range |
### Missing Examples
| # | Package | Symbol | Action |
| - | ------- | ------ | ------ |
| 1 | auth | `Authenticate()` | Add ExampleAuthenticate in auth_test.go |
## Recommendations (Priority Order)
1. **Must-fix**: {missing godoc on public API, undocumented business rules, workarounds without context}
2. **Should-fix**: {non-obvious algorithms, surprising behavior, API contracts, magic numbers in core logic}
3. **Consider**: {ordering dependencies, example functions, minor magic numbers in non-critical paths}
file/path.go:line with the exact code.development
Transforms vague feature ideas into precise, codebase-grounded technical requirements. Use when requirements are ambiguous/incomplete, the user struggles to describe behavior, terminology is unclear, or multiple concepts are mixed. Output is a requirements spec—NOT an implementation plan.
tools
Audit TypeScript type definitions for design debt — duplicated shapes, missing derivations, over-engineered generics, under-constrained type parameters, reinvented utility types, and disorganized type architecture. Type structure and maintainability, not type enforcement. Use when: reviewing type definitions for maintainability, reducing type duplication, simplifying over-engineered type-level logic, or reorganizing type architecture after growth.
development
Audit TypeScript test code for quality gaps — missing coverage on critical paths, brittle tests coupled to implementation, over-mocking, assertion-free tests, missing edge cases, and duplicated test setup. Focuses on test effectiveness, not production code structure. Use when: reviewing TypeScript test suites for reliability, reducing false-positive test failures, improving coverage of critical business logic, or cleaning up test debt.
tools
Audit TypeScript class and interface design for SOLID violations — god classes, rigid extension points, broken substitutability, fat interfaces, and concrete dependency chains. Focuses on responsibility assignment and abstraction fitness. Use when: reviewing class hierarchies, preparing for extension with new variants, reducing coupling between services, or improving testability of class-heavy code.