claude-code-superkit 0.0.0-stage → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +374 -2
- package/bin/cli.js +153 -0
- package/bin/inject-tokens.js +224 -0
- package/bin/measure-tokens.js +17 -0
- package/bin/superkit-counts-verify.sh +30 -0
- package/lib/codex.js +246 -0
- package/lib/docs-scaffold.js +147 -0
- package/lib/installer.js +499 -0
- package/lib/prompts.js +51 -0
- package/lib/settings-builder.js +51 -0
- package/lib/superpowers.js +99 -0
- package/lib/utils.js +117 -0
- package/lib/validator.js +84 -0
- package/package.json +49 -4
- package/packages/codex/AGENTS.md +396 -0
- package/packages/codex/INSTALL.md +342 -0
- package/packages/codex/config.toml +22 -0
- package/packages/codex/hooks/superkit.mjs +203 -0
- package/packages/codex/hooks.json +30 -0
- package/packages/codex/legacy-baseline.json +88 -0
- package/packages/codex/native-skills.txt +65 -0
- package/packages/codex/rules/default.rules +565 -0
- package/packages/codex/skills/ai-slop-cleaner/SKILL.md +44 -0
- package/packages/codex/skills/api-contract-sync/SKILL.md +96 -0
- package/packages/codex/skills/architect/SKILL.md +49 -0
- package/packages/codex/skills/audit-backend/SKILL.md +80 -0
- package/packages/codex/skills/audit-frontend/SKILL.md +82 -0
- package/packages/codex/skills/audit-infra/SKILL.md +87 -0
- package/packages/codex/skills/audit-orchestrator/SKILL.md +114 -0
- package/packages/codex/skills/behavioral-nudge-engine/SKILL.md +110 -0
- package/packages/codex/skills/benchmark/SKILL.md +49 -0
- package/packages/codex/skills/bot-reviewer/SKILL.md +94 -0
- package/packages/codex/skills/code-reviewer/SKILL.md +67 -0
- package/packages/codex/skills/codebase-onboarding-engineer/SKILL.md +46 -0
- package/packages/codex/skills/comment-rot-analyzer/SKILL.md +75 -0
- package/packages/codex/skills/commit-helper/SKILL.md +101 -0
- package/packages/codex/skills/critic/SKILL.md +56 -0
- package/packages/codex/skills/database-reviewer/SKILL.md +79 -0
- package/packages/codex/skills/debug-observer/SKILL.md +107 -0
- package/packages/codex/skills/dependency-checker/SKILL.md +69 -0
- package/packages/codex/skills/design-system-reviewer/SKILL.md +121 -0
- package/packages/codex/skills/dev-orchestrator/SKILL.md +304 -0
- package/packages/codex/skills/docs-reviewer/SKILL.md +86 -0
- package/packages/codex/skills/drizzle-orm-expert/SKILL.md +246 -0
- package/packages/codex/skills/e2e-test-generator/SKILL.md +95 -0
- package/packages/codex/skills/evaluator/SKILL.md +63 -0
- package/packages/codex/skills/frontend-perf-reviewer/SKILL.md +95 -0
- package/packages/codex/skills/frontend-ui-color-reviewer/SKILL.md +68 -0
- package/packages/codex/skills/frontend-ui-design-critic/SKILL.md +99 -0
- package/packages/codex/skills/frontend-ui-interaction-reviewer/SKILL.md +102 -0
- package/packages/codex/skills/frontend-ui-motion-reviewer/SKILL.md +85 -0
- package/packages/codex/skills/frontend-ui-reviewer/SKILL.md +81 -0
- package/packages/codex/skills/frontend-ui-typography-reviewer/SKILL.md +62 -0
- package/packages/codex/skills/gltf-debugging/SKILL.md +128 -0
- package/packages/codex/skills/go-benchmark/SKILL.md +217 -0
- package/packages/codex/skills/go-concurrency-reviewer/SKILL.md +113 -0
- package/packages/codex/skills/go-error-reviewer/SKILL.md +107 -0
- package/packages/codex/skills/go-grpc-patterns/SKILL.md +285 -0
- package/packages/codex/skills/go-modernizer/SKILL.md +111 -0
- package/packages/codex/skills/go-observability-reviewer/SKILL.md +121 -0
- package/packages/codex/skills/go-performance-reviewer/SKILL.md +112 -0
- package/packages/codex/skills/go-reviewer/SKILL.md +109 -0
- package/packages/codex/skills/go-samber-do/SKILL.md +158 -0
- package/packages/codex/skills/go-samber-lo/SKILL.md +178 -0
- package/packages/codex/skills/go-samber-oops/SKILL.md +174 -0
- package/packages/codex/skills/goal-verifier/SKILL.md +53 -0
- package/packages/codex/skills/health-checker/SKILL.md +109 -0
- package/packages/codex/skills/html-to-3d-texture/SKILL.md +153 -0
- package/packages/codex/skills/impeccable-craft/SKILL.md +101 -0
- package/packages/codex/skills/lint-runner/SKILL.md +85 -0
- package/packages/codex/skills/migrate/SKILL.md +60 -0
- package/packages/codex/skills/migration-reviewer/SKILL.md +88 -0
- package/packages/codex/skills/minimal-change-engineer/SKILL.md +44 -0
- package/packages/codex/skills/new-migration/SKILL.md +59 -0
- package/packages/codex/skills/nextjs-supabase-auth/SKILL.md +227 -0
- package/packages/codex/skills/output-enforcement/SKILL.md +71 -0
- package/packages/codex/skills/plan-checker/SKILL.md +53 -0
- package/packages/codex/skills/postgresql-optimization/SKILL.md +159 -0
- package/packages/codex/skills/pre-deploy-validator/SKILL.md +111 -0
- package/packages/codex/skills/presentation-reviewer/SKILL.md +88 -0
- package/packages/codex/skills/product-3d-lighting/SKILL.md +137 -0
- package/packages/codex/skills/project-architecture/SKILL.md +52 -0
- package/packages/codex/skills/py-reviewer/SKILL.md +100 -0
- package/packages/codex/skills/r3f-scene-reviewer/SKILL.md +88 -0
- package/packages/codex/skills/r3f-scroll-driven-3d/SKILL.md +162 -0
- package/packages/codex/skills/reality-checker/SKILL.md +61 -0
- package/packages/codex/skills/redis-patterns/SKILL.md +260 -0
- package/packages/codex/skills/review-orchestrator/SKILL.md +151 -0
- package/packages/codex/skills/rs-reviewer/SKILL.md +98 -0
- package/packages/codex/skills/ru-text/SKILL.md +132 -0
- package/packages/codex/skills/scaffold-endpoint/SKILL.md +44 -0
- package/packages/codex/skills/security-scanner/SKILL.md +94 -0
- package/packages/codex/skills/silent-failure-hunter/SKILL.md +176 -0
- package/packages/codex/skills/telegram-bot-builder/SKILL.md +120 -0
- package/packages/codex/skills/test-generator/SKILL.md +79 -0
- package/packages/codex/skills/test-runner/SKILL.md +101 -0
- package/packages/codex/skills/threejs-color-management/SKILL.md +97 -0
- package/packages/codex/skills/tree-generator/SKILL.md +63 -0
- package/packages/codex/skills/ts-reviewer/SKILL.md +90 -0
- package/packages/codex/skills/ui-design-reviewer/SKILL.md +89 -0
- package/packages/codex/skills/ui-reviewer/SKILL.md +103 -0
- package/packages/codex/skills/visual-reviewer/SKILL.md +85 -0
- package/packages/codex/skills/writing-agents/SKILL.md +165 -0
- package/packages/codex/skills/writing-commands/SKILL.md +173 -0
- package/packages/core/CLAUDE.md +118 -0
- package/packages/core/INTERNAL-FILES +16 -0
- package/packages/core/agents/ai-slop-cleaner.md +187 -0
- package/packages/core/agents/api-contract-sync.md +127 -0
- package/packages/core/agents/architect.md +205 -0
- package/packages/core/agents/audit-backend.md +137 -0
- package/packages/core/agents/audit-frontend.md +129 -0
- package/packages/core/agents/audit-infra.md +182 -0
- package/packages/core/agents/behavioral-nudge-engine.md +170 -0
- package/packages/core/agents/code-reviewer.md +195 -0
- package/packages/core/agents/codebase-onboarding-engineer.md +172 -0
- package/packages/core/agents/comment-rot-analyzer.md +115 -0
- package/packages/core/agents/critic.md +172 -0
- package/packages/core/agents/database-reviewer.md +201 -0
- package/packages/core/agents/debug-observer.md +261 -0
- package/packages/core/agents/dependency-checker.md +199 -0
- package/packages/core/agents/docs-reviewer.md +206 -0
- package/packages/core/agents/e2e-test-generator.md +261 -0
- package/packages/core/agents/evaluator.md +141 -0
- package/packages/core/agents/goal-verifier.md +130 -0
- package/packages/core/agents/health-checker.md +194 -0
- package/packages/core/agents/migration-reviewer.md +161 -0
- package/packages/core/agents/minimal-change-engineer.md +219 -0
- package/packages/core/agents/plan-checker.md +139 -0
- package/packages/core/agents/pre-deploy-validator.md +189 -0
- package/packages/core/agents/reality-checker.md +175 -0
- package/packages/core/agents/scaffold-endpoint.md +162 -0
- package/packages/core/agents/security-scanner.md +236 -0
- package/packages/core/agents/silent-failure-hunter.md +276 -0
- package/packages/core/agents/test-generator.md +146 -0
- package/packages/core/agents/tree-generator.md +141 -0
- package/packages/core/agents/ui-reviewer.md +172 -0
- package/packages/core/agents/visual-reviewer.md +211 -0
- package/packages/core/commands/audit.md +166 -0
- package/packages/core/commands/benchmark.md +130 -0
- package/packages/core/commands/commit.md +148 -0
- package/packages/core/commands/dev.md +302 -0
- package/packages/core/commands/docs-init.md +75 -0
- package/packages/core/commands/lint.md +137 -0
- package/packages/core/commands/migrate.md +146 -0
- package/packages/core/commands/new-migration.md +182 -0
- package/packages/core/commands/pair.md +209 -0
- package/packages/core/commands/review.md +195 -0
- package/packages/core/commands/security-scan.md +142 -0
- package/packages/core/commands/superkit-evolve.md +231 -0
- package/packages/core/commands/superkit-init.md +274 -0
- package/packages/core/commands/test.md +108 -0
- package/packages/core/commands/workflow.md +150 -0
- package/packages/core/docs/guide/01-getting-started.md +41 -0
- package/packages/core/docs-templates/README.md +33 -0
- package/packages/core/docs-templates/adr-template.md +62 -0
- package/packages/core/docs-templates/architecture/api-contracts.md +26 -0
- package/packages/core/docs-templates/architecture/api-reference.md +48 -0
- package/packages/core/docs-templates/architecture/auth-and-sessions.md +38 -0
- package/packages/core/docs-templates/architecture/backend-layers.md +42 -0
- package/packages/core/docs-templates/architecture/data-flow.md +26 -0
- package/packages/core/docs-templates/architecture/database-schema.md +51 -0
- package/packages/core/docs-templates/architecture/deployment.md +41 -0
- package/packages/core/docs-templates/architecture/frontend-state.md +46 -0
- package/packages/core/helpers/statusline.cjs +370 -0
- package/packages/core/hooks/CHAIN-SEMANTICS.md +84 -0
- package/packages/core/hooks/audit-settings-source.sh +98 -0
- package/packages/core/hooks/audit-trail.sh +120 -0
- package/packages/core/hooks/block-dangerous-git.sh +189 -0
- package/packages/core/hooks/bundle-import-check.sh +64 -0
- package/packages/core/hooks/compact-state-inject.sh +84 -0
- package/packages/core/hooks/config-protection.sh +68 -0
- package/packages/core/hooks/console-log-warning.sh +28 -0
- package/packages/core/hooks/context-monitor.sh +35 -0
- package/packages/core/hooks/dev-edit-counter.sh +59 -0
- package/packages/core/hooks/dev-marker-set.sh +55 -0
- package/packages/core/hooks/dev-required-on-commit.sh +426 -0
- package/packages/core/hooks/doc-check-on-commit.sh +396 -0
- package/packages/core/hooks/edit-streak-check.sh +63 -0
- package/packages/core/hooks/evolve-check.sh +78 -0
- package/packages/core/hooks/gateguard-pre-edit.sh +154 -0
- package/packages/core/hooks/gateguard-record-facts.sh +37 -0
- package/packages/core/hooks/intake-classifier.py +449 -0
- package/packages/core/hooks/lib/profile.sh +141 -0
- package/packages/core/hooks/loop-guard.sh +75 -0
- package/packages/core/hooks/migration-safety.sh +56 -0
- package/packages/core/hooks/plan-completion-gate.sh +61 -0
- package/packages/core/hooks/pre-compact-save.sh +89 -0
- package/packages/core/hooks/security-patterns.sh +119 -0
- package/packages/core/hooks/session-context-restore.sh +76 -0
- package/packages/core/hooks/subagent-stop-validate.sh +73 -0
- package/packages/core/hooks/superkit-counts-verify.sh +346 -0
- package/packages/core/hooks/superkit-update.sh +367 -0
- package/packages/core/hooks/tests/README.md +42 -0
- package/packages/core/hooks/tests/audit-trail-chain_test.sh +62 -0
- package/packages/core/hooks/tests/block-dangerous-git_test.sh +144 -0
- package/packages/core/hooks/tests/chain-semantics/h1.sh +11 -0
- package/packages/core/hooks/tests/chain-semantics/h2.sh +9 -0
- package/packages/core/hooks/tests/chain-semantics/h3.sh +11 -0
- package/packages/core/hooks/tests/chain-semantics/run-experiment.sh +65 -0
- package/packages/core/hooks/tests/chain-semantics/settings-experiment.json +15 -0
- package/packages/core/hooks/tests/counts-verify_test.sh +118 -0
- package/packages/core/hooks/tests/dev-required-on-commit_test.sh +207 -0
- package/packages/core/hooks/tests/dev-required-wip-on-main_test.sh +20 -0
- package/packages/core/hooks/tests/doc-check-on-commit_test.sh +122 -0
- package/packages/core/hooks/tests/edit-streak-check_test.sh +106 -0
- package/packages/core/hooks/tests/internal-manifest_test.sh +130 -0
- package/packages/core/hooks/tests/json-path_test.sh +108 -0
- package/packages/core/hooks/tests/mirror-invariants_test.sh +139 -0
- package/packages/core/hooks/tests/nudge-throttle_test.sh +95 -0
- package/packages/core/hooks/tests/profile-helper_test.sh +21 -0
- package/packages/core/hooks/tests/run-all.sh +47 -0
- package/packages/core/hooks/tests/session-key-helper_test.sh +17 -0
- package/packages/core/hooks/tests/superkit-update_test.sh +311 -0
- package/packages/core/hooks/tests/warn-visibility_test.sh +59 -0
- package/packages/core/hooks/user-intent-detect.sh +44 -0
- package/packages/core/hooks/verify-hooks.sh +69 -0
- package/packages/core/rules/auto-commands.md +124 -0
- package/packages/core/rules/coding-style.md +68 -0
- package/packages/core/rules/dev-workflow.md +77 -0
- package/packages/core/rules/documentation.md +106 -0
- package/packages/core/rules/frontend-aesthetics.md +53 -0
- package/packages/core/rules/git-workflow.md +14 -0
- package/packages/core/rules/security.md +29 -0
- package/packages/core/rules/superkit-integrity.md +114 -0
- package/packages/core/settings.json +229 -0
- package/packages/core/skills/drizzle-orm-expert/SKILL.md +260 -0
- package/packages/core/skills/nextjs-supabase-auth/SKILL.md +259 -0
- package/packages/core/skills/postgresql-optimization/SKILL.md +150 -0
- package/packages/core/skills/project-architecture/SKILL.md +31 -0
- package/packages/core/skills/project-scanner/SKILL.md +132 -0
- package/packages/core/skills/redis-patterns/SKILL.md +261 -0
- package/packages/core/skills/ru-text/SKILL.md +156 -0
- package/packages/core/skills/telegram-bot-builder/SKILL.md +145 -0
- package/packages/core/skills/writing-agents/SKILL.md +220 -0
- package/packages/core/skills/writing-commands/SKILL.md +176 -0
- package/packages/core/skills/writing-hooks/SKILL.md +335 -0
- package/packages/extras/bot-reviewer.md +279 -0
- package/packages/extras/design-system-reviewer.md +234 -0
- package/packages/extras/red-blue-auditor/README.md +117 -0
- package/packages/extras/red-blue-auditor/agent.md +128 -0
- package/packages/extras/red-blue-auditor/patterns/agent-config.txt +4 -0
- package/packages/extras/red-blue-auditor/patterns/hook-injection.txt +8 -0
- package/packages/extras/red-blue-auditor/patterns/mcp-risk.txt +5 -0
- package/packages/extras/red-blue-auditor/patterns/permission-abuse.txt +6 -0
- package/packages/extras/red-blue-auditor/patterns/secrets.txt +17 -0
- package/packages/extras/red-blue-auditor/scan.sh +88 -0
- package/packages/extras/skillsmp-search/SKILL.md +134 -0
- package/packages/frontend-3d/README.md +62 -0
- package/packages/frontend-3d/agents/frontend-perf-reviewer.md +164 -0
- package/packages/frontend-3d/agents/presentation-reviewer.md +146 -0
- package/packages/frontend-3d/agents/r3f-scene-reviewer.md +128 -0
- package/packages/frontend-3d/agents/ui-design-reviewer.md +169 -0
- package/packages/frontend-3d/commands/capture-screen.md +166 -0
- package/packages/frontend-3d/hooks/bundle-size-warn.sh +93 -0
- package/packages/frontend-3d/hooks/gsap-pattern-check.sh +74 -0
- package/packages/frontend-3d/hooks/r3f-color-check.sh +76 -0
- package/packages/frontend-3d/hooks/tailwind-version-guard.sh +98 -0
- package/packages/frontend-3d/rules/frontend-aesthetics-3d.md +81 -0
- package/packages/frontend-3d/rules/gsap-conventions.md +129 -0
- package/packages/frontend-3d/rules/threejs-conventions.md +116 -0
- package/packages/frontend-3d/skills/gltf-debugging/SKILL.md +145 -0
- package/packages/frontend-3d/skills/html-to-3d-texture/SKILL.md +183 -0
- package/packages/frontend-3d/skills/output-enforcement/SKILL.md +79 -0
- package/packages/frontend-3d/skills/product-3d-lighting/SKILL.md +166 -0
- package/packages/frontend-3d/skills/r3f-scroll-driven-3d/SKILL.md +209 -0
- package/packages/frontend-3d/skills/threejs-color-management/SKILL.md +111 -0
- package/packages/frontend-ui/NOTICE.md +99 -0
- package/packages/frontend-ui/README.md +59 -0
- package/packages/frontend-ui/agents/ui-color-reviewer.md +174 -0
- package/packages/frontend-ui/agents/ui-design-critic.md +198 -0
- package/packages/frontend-ui/agents/ui-interaction-reviewer.md +259 -0
- package/packages/frontend-ui/agents/ui-motion-reviewer.md +266 -0
- package/packages/frontend-ui/agents/ui-reviewer.md +251 -0
- package/packages/frontend-ui/agents/ui-typography-reviewer.md +222 -0
- package/packages/frontend-ui/hooks/tests/ui-animation-easing-check_test.sh +78 -0
- package/packages/frontend-ui/hooks/tests/ui-banned-fonts-check_test.sh +77 -0
- package/packages/frontend-ui/hooks/tests/ui-color-check_test.sh +75 -0
- package/packages/frontend-ui/hooks/ui-animation-easing-check.sh +86 -0
- package/packages/frontend-ui/hooks/ui-banned-fonts-check.sh +90 -0
- package/packages/frontend-ui/hooks/ui-color-check.sh +102 -0
- package/packages/frontend-ui/rules/color-and-contrast.md +230 -0
- package/packages/frontend-ui/rules/frontend-design-aesthetics.md +124 -0
- package/packages/frontend-ui/rules/interaction-polish.md +335 -0
- package/packages/frontend-ui/rules/motion-and-animation.md +283 -0
- package/packages/frontend-ui/rules/spatial-and-layout.md +212 -0
- package/packages/frontend-ui/rules/typography-guidelines.md +185 -0
- package/packages/frontend-ui/rules/ui-anti-patterns.md +309 -0
- package/packages/frontend-ui/settings.json +24 -0
- package/packages/frontend-ui/skills/impeccable-craft/SKILL.md +187 -0
- package/packages/gan/README.md +232 -0
- package/packages/gan/agents/gan-evaluator.md +214 -0
- package/packages/gan/agents/gan-generator.md +171 -0
- package/packages/gan/agents/gan-planner.md +206 -0
- package/packages/gan/rubrics/functionality.md +66 -0
- package/packages/gan/rubrics/ui-quality.md +77 -0
- package/packages/gan/skills/gan-evaluator/SKILL.md +91 -0
- package/packages/gan/skills/gan-generator/SKILL.md +72 -0
- package/packages/gan/skills/gan-planner/SKILL.md +93 -0
- package/packages/stack-agents/go/go-concurrency-reviewer.md +210 -0
- package/packages/stack-agents/go/go-error-reviewer.md +187 -0
- package/packages/stack-agents/go/go-modernizer.md +160 -0
- package/packages/stack-agents/go/go-observability-reviewer.md +185 -0
- package/packages/stack-agents/go/go-performance-reviewer.md +160 -0
- package/packages/stack-agents/go/go-reviewer.md +277 -0
- package/packages/stack-agents/go/references/benchmark-methodology.md +280 -0
- package/packages/stack-agents/go/references/channel-patterns.md +384 -0
- package/packages/stack-agents/go/references/cli-cobra-viper.md +190 -0
- package/packages/stack-agents/go/references/code-style.md +262 -0
- package/packages/stack-agents/go/references/context-propagation.md +317 -0
- package/packages/stack-agents/go/references/data-structures.md +315 -0
- package/packages/stack-agents/go/references/database-patterns.md +334 -0
- package/packages/stack-agents/go/references/design-patterns.md +411 -0
- package/packages/stack-agents/go/references/di-frameworks.md +146 -0
- package/packages/stack-agents/go/references/error-creation.md +251 -0
- package/packages/stack-agents/go/references/error-inspection.md +348 -0
- package/packages/stack-agents/go/references/error-wrapping.md +230 -0
- package/packages/stack-agents/go/references/gopls-driving.md +62 -0
- package/packages/stack-agents/go/references/goroutine-lifecycle.md +351 -0
- package/packages/stack-agents/go/references/graphql-patterns.md +221 -0
- package/packages/stack-agents/go/references/grpc-patterns.md +373 -0
- package/packages/stack-agents/go/references/modernize-guide.md +522 -0
- package/packages/stack-agents/go/references/module-management.md +191 -0
- package/packages/stack-agents/go/references/naming-conventions.md +176 -0
- package/packages/stack-agents/go/references/observability-pipeline.md +352 -0
- package/packages/stack-agents/go/references/performance-profiling.md +250 -0
- package/packages/stack-agents/go/references/refactoring-mechanics.md +127 -0
- package/packages/stack-agents/go/references/rest-openapi-patterns.md +160 -0
- package/packages/stack-agents/go/references/samber-do.md +201 -0
- package/packages/stack-agents/go/references/samber-libraries.md +363 -0
- package/packages/stack-agents/go/references/samber-lo.md +260 -0
- package/packages/stack-agents/go/references/samber-oops.md +200 -0
- package/packages/stack-agents/go/references/security-checklist.md +441 -0
- package/packages/stack-agents/go/references/standard-stdlib-now.md +181 -0
- package/packages/stack-agents/go/references/stay-updated.md +147 -0
- package/packages/stack-agents/go/references/structs-interfaces.md +312 -0
- package/packages/stack-agents/go/references/sync-primitives.md +395 -0
- package/packages/stack-agents/go/references/testing-patterns.md +483 -0
- package/packages/stack-agents/go/references/troubleshooting.md +98 -0
- package/packages/stack-agents/python/py-reviewer.md +194 -0
- package/packages/stack-agents/rust/rs-reviewer.md +188 -0
- package/packages/stack-agents/typescript/ts-reviewer.md +135 -0
- package/packages/stack-hooks/go/go-context-check-on-edit.sh +56 -0
- package/packages/stack-hooks/go/go-error-check-on-edit.sh +54 -0
- package/packages/stack-hooks/go/go-format-on-edit.sh +32 -0
- package/packages/stack-hooks/go/go-safety-check-on-edit.sh +54 -0
- package/packages/stack-hooks/go/go-vet-on-edit.sh +61 -0
- package/packages/stack-hooks/go/golangci-lint-on-edit.sh +54 -0
- package/packages/stack-hooks/python/ruff-on-edit.sh +67 -0
- package/packages/stack-hooks/rust/cargo-check-on-edit.sh +64 -0
- package/packages/stack-hooks/typescript/typecheck-on-edit.sh +76 -0
- package/packages/stack-rules/go/go-conventions.md +44 -0
- package/packages/stack-rules/go/go-safety.md +35 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# Staying Updated with Go
|
|
2
|
+
|
|
3
|
+
Go ships every 6 months. New features and standard library additions can replace third-party libs entirely. This reference covers how to keep code idiomatic.
|
|
4
|
+
|
|
5
|
+
## Track Go releases
|
|
6
|
+
|
|
7
|
+
- **Major release every 6 months** (Feb / Aug)
|
|
8
|
+
- Release notes: https://go.dev/doc/go${VERSION}
|
|
9
|
+
- Each major release is supported for **two cycles** (~1 year)
|
|
10
|
+
|
|
11
|
+
Subscribe to the [go-announce](https://groups.google.com/g/golang-announce) mailing list.
|
|
12
|
+
|
|
13
|
+
## Recent additions worth knowing (1.21+)
|
|
14
|
+
|
|
15
|
+
### 1.21
|
|
16
|
+
- `min`, `max`, `clear` built-ins
|
|
17
|
+
- `slices` package (`slices.Sort`, `slices.Index`, `slices.Contains`)
|
|
18
|
+
- `maps` package (`maps.Clone`, `maps.Equal`)
|
|
19
|
+
- Profile-Guided Optimization (PGO)
|
|
20
|
+
|
|
21
|
+
### 1.22
|
|
22
|
+
- `for range int` syntax: `for i := range 10 { }`
|
|
23
|
+
- New `math/rand/v2` (better defaults)
|
|
24
|
+
- `net/http.ServeMux` got method matching: `mux.HandleFunc("GET /users/{id}", ...)`
|
|
25
|
+
|
|
26
|
+
### 1.23
|
|
27
|
+
- Range over functions: `for x := range generator { }`
|
|
28
|
+
- `unique` package for canonicalization
|
|
29
|
+
- Timer leak fixes (`time.Timer.Reset` semantics)
|
|
30
|
+
|
|
31
|
+
### 1.24
|
|
32
|
+
- Generic type aliases
|
|
33
|
+
- Updated `os.Root` for safe file ops
|
|
34
|
+
- Updated runtime cleanup hooks
|
|
35
|
+
|
|
36
|
+
### 1.25
|
|
37
|
+
- `sync.WaitGroup.Go(f)` — spawn + track a goroutine in one call (replaces `Add(1)`/`go`/`defer Done()`)
|
|
38
|
+
- `testing/synctest.Test` now stable (was `synctest.Run` behind `GOEXPERIMENT=synctest` in 1.24)
|
|
39
|
+
- `net/http.CrossOriginProtection` — built-in CSRF defense for browser requests
|
|
40
|
+
- Container-aware `GOMAXPROCS` default — respects cgroup CPU limits (`go.uber.org/automaxprocs` now redundant)
|
|
41
|
+
- `reflect.TypeAssert[T](v)` — typed assertion off a `reflect.Value` without `.Interface()`
|
|
42
|
+
- Green Tea GC experimental (`GOEXPERIMENT=greenteagc`)
|
|
43
|
+
|
|
44
|
+
### 1.26
|
|
45
|
+
- `errors.AsType[E error](err)` — generic typed extraction, no pointer-to-target dance (see `error-inspection.md`)
|
|
46
|
+
- `slog.NewMultiHandler(...)` — stdlib fan-out to multiple handlers
|
|
47
|
+
- Green Tea GC now the default (no flag)
|
|
48
|
+
- `httputil.ReverseProxy.Rewrite` replaces the deprecated `.Director`
|
|
49
|
+
- `encoding/json/v2` experimental behind `GOEXPERIMENT=jsonv2` — keep `encoding/json`
|
|
50
|
+
|
|
51
|
+
## Standard library now replaces these third-party libs
|
|
52
|
+
|
|
53
|
+
| Was: | Now use: |
|
|
54
|
+
|------|----------|
|
|
55
|
+
| `github.com/google/uuid` (sometimes) | nothing — uuid is still external |
|
|
56
|
+
| `pkg/errors` | `errors.Wrap` → standard `fmt.Errorf("%w", err)` |
|
|
57
|
+
| `github.com/stretchr/objx` | `slices` / `maps` for most cases |
|
|
58
|
+
| `github.com/go-redis/cache` | depends — keep using |
|
|
59
|
+
| `github.com/google/wire` | still works for compile-time DI, but archived Aug 25 2025 — feature-complete and unmaintained |
|
|
60
|
+
| Manual rand seeding | `math/rand/v2` (auto-seeded) |
|
|
61
|
+
| Hand-written http muxers | `net/http.ServeMux` with method matching (1.22+) |
|
|
62
|
+
|
|
63
|
+
## go-modernize
|
|
64
|
+
|
|
65
|
+
The `go fix` tool is being replaced by `go fix -modernize`. Run it periodically:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Go 1.24+ tool directive: pin the version in go.mod, run reproducibly
|
|
69
|
+
go get -tool golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize
|
|
70
|
+
go tool modernize -fix ./...
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Catches:
|
|
74
|
+
- `for i := 0; i < n; i++` → `for i := range n`
|
|
75
|
+
- `sort.Slice(s, func(i,j int) bool { ... })` → `slices.SortFunc(s, ...)`
|
|
76
|
+
- `interface{}` → `any`
|
|
77
|
+
- Explicit zero comparisons that `clear` covers
|
|
78
|
+
|
|
79
|
+
## Linter discipline
|
|
80
|
+
|
|
81
|
+
`golangci-lint` aggregates many linters. Pin the version in CI:
|
|
82
|
+
|
|
83
|
+
```yaml
|
|
84
|
+
# .golangci.yml
|
|
85
|
+
linters:
|
|
86
|
+
enable:
|
|
87
|
+
- errcheck
|
|
88
|
+
- govet
|
|
89
|
+
- staticcheck
|
|
90
|
+
- revive
|
|
91
|
+
- gosimple
|
|
92
|
+
- ineffassign
|
|
93
|
+
- unused
|
|
94
|
+
- misspell
|
|
95
|
+
- prealloc
|
|
96
|
+
- gocritic
|
|
97
|
+
- gosec
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Run: `golangci-lint run --fix ./...`.
|
|
101
|
+
|
|
102
|
+
## Dependency freshness
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# Weekly:
|
|
106
|
+
go list -m -u all | grep -v indirect
|
|
107
|
+
go-mod-outdated -update -direct < <(go list -u -m -json all)
|
|
108
|
+
|
|
109
|
+
# Audit for CVEs:
|
|
110
|
+
govulncheck ./...
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Treat updates with judgment:
|
|
114
|
+
- Patch updates (1.2.3 → 1.2.4): usually safe to auto-merge
|
|
115
|
+
- Minor (1.2 → 1.3): read release notes
|
|
116
|
+
- Major (v1 → v2): plan carefully; module path changes
|
|
117
|
+
|
|
118
|
+
## When to upgrade Go version
|
|
119
|
+
|
|
120
|
+
Upgrade in your repo when:
|
|
121
|
+
- A specific new feature unlocks code you'd otherwise hand-write
|
|
122
|
+
- A CVE in the standard library forces it
|
|
123
|
+
- The version you're on is 2 releases behind (out of support)
|
|
124
|
+
|
|
125
|
+
Pin the Go version in `go.mod` (`go 1.23`) and in CI Docker image. Don't pin to `latest` — reproducible builds matter.
|
|
126
|
+
|
|
127
|
+
## Anti-patterns
|
|
128
|
+
|
|
129
|
+
- **Stuck on Go 1.18** because "it works" — you miss `slices`, `maps`, range int, ServeMux
|
|
130
|
+
- **Auto-upgrading deps in CI** without governance — supply-chain risk
|
|
131
|
+
- **Using `pkg/errors`** in new code — standard `errors.Is` / `errors.As` / `fmt.Errorf("%w")` covers it
|
|
132
|
+
- **Custom string slice helpers** when `slices.Contains` / `slices.Sort` exist
|
|
133
|
+
|
|
134
|
+
## Quarterly check
|
|
135
|
+
|
|
136
|
+
Every 3 months ask:
|
|
137
|
+
1. Are we on a supported Go version?
|
|
138
|
+
2. Did anything new in the stdlib (slices, maps, math/rand/v2, ServeMux) replace a third-party we're using?
|
|
139
|
+
3. Did `govulncheck` flag anything?
|
|
140
|
+
4. Did `modernize` find rewrites worth applying?
|
|
141
|
+
5. Are any dep major versions ready for a planned upgrade?
|
|
142
|
+
|
|
143
|
+
## See also
|
|
144
|
+
|
|
145
|
+
- `modernize-guide.md` — concrete migrations
|
|
146
|
+
- `module-management.md` — go.mod / go.sum / workspaces
|
|
147
|
+
- `samber-libraries.md` — wrapper libs worth knowing
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
# Structs and Interfaces
|
|
2
|
+
|
|
3
|
+
> Reference document for go-reviewer. Loaded on demand via Read tool.
|
|
4
|
+
|
|
5
|
+
## Interface Design Principles
|
|
6
|
+
|
|
7
|
+
### Small Interfaces (1-3 methods)
|
|
8
|
+
|
|
9
|
+
The larger the interface, the weaker the abstraction. Prefer many small interfaces over few large ones.
|
|
10
|
+
|
|
11
|
+
```go
|
|
12
|
+
// EXCELLENT — single method, maximum flexibility
|
|
13
|
+
type Reader interface {
|
|
14
|
+
Read(p []byte) (n int, err error)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// GOOD — 2-3 methods, clear contract
|
|
18
|
+
type UserStore interface {
|
|
19
|
+
FindByID(ctx context.Context, id int64) (*User, error)
|
|
20
|
+
Save(ctx context.Context, user *User) error
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// BAD — too large, violates ISP
|
|
24
|
+
type UserRepository interface {
|
|
25
|
+
FindByID(ctx context.Context, id int64) (*User, error)
|
|
26
|
+
FindByEmail(ctx context.Context, email string) (*User, error)
|
|
27
|
+
FindAll(ctx context.Context, filter Filter) ([]*User, error)
|
|
28
|
+
Create(ctx context.Context, user *User) error
|
|
29
|
+
Update(ctx context.Context, user *User) error
|
|
30
|
+
Delete(ctx context.Context, id int64) error
|
|
31
|
+
Count(ctx context.Context, filter Filter) (int64, error)
|
|
32
|
+
Exists(ctx context.Context, id int64) (bool, error)
|
|
33
|
+
}
|
|
34
|
+
// Split into: UserFinder, UserWriter, UserCounter
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Consumer-Side Interfaces
|
|
38
|
+
|
|
39
|
+
Define interfaces where they are **used**, not where they are implemented. This is the opposite of Java/C#.
|
|
40
|
+
|
|
41
|
+
```go
|
|
42
|
+
// package notification — CONSUMER defines what it needs
|
|
43
|
+
type UserFinder interface {
|
|
44
|
+
FindByID(ctx context.Context, id int64) (*User, error)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
type Service struct {
|
|
48
|
+
users UserFinder // accepts any type with FindByID
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// package user — PROVIDER just implements methods
|
|
52
|
+
type Repository struct {
|
|
53
|
+
db *pgxpool.Pool
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
func (r *Repository) FindByID(ctx context.Context, id int64) (*User, error) { ... }
|
|
57
|
+
func (r *Repository) FindAll(ctx context.Context) ([]*User, error) { ... }
|
|
58
|
+
func (r *Repository) Save(ctx context.Context, u *User) error { ... }
|
|
59
|
+
// Satisfies notification.UserFinder implicitly — no "implements" keyword
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Implicit Satisfaction
|
|
63
|
+
|
|
64
|
+
Go interfaces are satisfied implicitly. No `implements` keyword. A type satisfies an interface if it has all the methods.
|
|
65
|
+
|
|
66
|
+
```go
|
|
67
|
+
// Compile-time interface check (zero-cost)
|
|
68
|
+
var _ UserFinder = (*Repository)(nil)
|
|
69
|
+
var _ io.ReadCloser = (*MyReader)(nil)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Composition via Embedding
|
|
73
|
+
|
|
74
|
+
### Struct Embedding
|
|
75
|
+
|
|
76
|
+
Embeds fields and methods. The embedded type's methods are promoted to the outer type.
|
|
77
|
+
|
|
78
|
+
```go
|
|
79
|
+
type BaseEntity struct {
|
|
80
|
+
ID int64 `json:"id" db:"id"`
|
|
81
|
+
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
|
82
|
+
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
type User struct {
|
|
86
|
+
BaseEntity // promotes ID, CreatedAt, UpdatedAt
|
|
87
|
+
Name string `json:"name" db:"name"`
|
|
88
|
+
Email string `json:"email" db:"email"`
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Access promoted fields directly
|
|
92
|
+
u := User{Name: "Alice"}
|
|
93
|
+
u.ID = 42 // from BaseEntity
|
|
94
|
+
u.CreatedAt = now // from BaseEntity
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Embedding pitfalls:**
|
|
98
|
+
|
|
99
|
+
```go
|
|
100
|
+
// PITFALL 1 — Embedding a mutex exposes Lock/Unlock
|
|
101
|
+
type SafeCounter struct {
|
|
102
|
+
sync.Mutex // BAD: Lock() and Unlock() are exported
|
|
103
|
+
count int
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// CORRECT — use named field
|
|
107
|
+
type SafeCounter struct {
|
|
108
|
+
mu sync.Mutex // unexported, not promoted
|
|
109
|
+
count int
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// PITFALL 2 — Embedding for convenience, not "is-a"
|
|
113
|
+
type Server struct {
|
|
114
|
+
*http.Server // Promotes ALL http.Server methods — is that intended?
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Interface Embedding
|
|
119
|
+
|
|
120
|
+
Compose larger interfaces from smaller ones.
|
|
121
|
+
|
|
122
|
+
```go
|
|
123
|
+
type Reader interface {
|
|
124
|
+
Read(p []byte) (n int, err error)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
type Writer interface {
|
|
128
|
+
Write(p []byte) (n int, err error)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
type Closer interface {
|
|
132
|
+
Close() error
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
type ReadWriter interface {
|
|
136
|
+
Reader
|
|
137
|
+
Writer
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
type ReadWriteCloser interface {
|
|
141
|
+
Reader
|
|
142
|
+
Writer
|
|
143
|
+
Closer
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Type Assertions and Type Switches
|
|
148
|
+
|
|
149
|
+
### Prefer errors.As Over Type Assertion
|
|
150
|
+
|
|
151
|
+
```go
|
|
152
|
+
// WRONG — breaks on wrapped errors
|
|
153
|
+
if verr, ok := err.(*ValidationError); ok {
|
|
154
|
+
// won't match if err was wrapped with fmt.Errorf("%w", ...)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// CORRECT — traverses the error chain
|
|
158
|
+
var verr *ValidationError
|
|
159
|
+
if errors.As(err, &verr) {
|
|
160
|
+
log.Warn("validation failed", "fields", verr.Fields)
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Type Switch
|
|
165
|
+
|
|
166
|
+
```go
|
|
167
|
+
func describe(v any) string {
|
|
168
|
+
switch t := v.(type) {
|
|
169
|
+
case string:
|
|
170
|
+
return fmt.Sprintf("string of length %d", len(t))
|
|
171
|
+
case int:
|
|
172
|
+
return fmt.Sprintf("integer %d", t)
|
|
173
|
+
case []byte:
|
|
174
|
+
return fmt.Sprintf("bytes of length %d", len(t))
|
|
175
|
+
case nil:
|
|
176
|
+
return "nil"
|
|
177
|
+
case error:
|
|
178
|
+
return fmt.Sprintf("error: %s", t.Error())
|
|
179
|
+
default:
|
|
180
|
+
return fmt.Sprintf("unknown type %T", t)
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## noCopy Pattern
|
|
186
|
+
|
|
187
|
+
Prevent accidental copying of types that must not be copied (types with internal pointers to themselves, sync primitives).
|
|
188
|
+
|
|
189
|
+
```go
|
|
190
|
+
// noCopy is detected by go vet
|
|
191
|
+
type noCopy struct{}
|
|
192
|
+
func (*noCopy) Lock() {}
|
|
193
|
+
func (*noCopy) Unlock() {}
|
|
194
|
+
|
|
195
|
+
type Pool struct {
|
|
196
|
+
noCopy noCopy // go vet warns on copy of Pool
|
|
197
|
+
mu sync.Mutex
|
|
198
|
+
items []Item
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## Method Sets
|
|
203
|
+
|
|
204
|
+
The method set determines which interfaces a type satisfies.
|
|
205
|
+
|
|
206
|
+
| Receiver type | Method set includes |
|
|
207
|
+
|---------------|-------------------|
|
|
208
|
+
| Value `T` | Only value receiver methods |
|
|
209
|
+
| Pointer `*T` | Both value AND pointer receiver methods |
|
|
210
|
+
|
|
211
|
+
```go
|
|
212
|
+
type Counter struct {
|
|
213
|
+
n int
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
func (c Counter) Value() int { return c.n } // value receiver
|
|
217
|
+
func (c *Counter) Inc() { c.n++ } // pointer receiver
|
|
218
|
+
|
|
219
|
+
type Valuer interface {
|
|
220
|
+
Value() int
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
type Incrementer interface {
|
|
224
|
+
Inc()
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
var _ Valuer = Counter{} // OK: value has Value()
|
|
228
|
+
var _ Valuer = &Counter{} // OK: pointer has Value()
|
|
229
|
+
var _ Incrementer = &Counter{} // OK: pointer has Inc()
|
|
230
|
+
// var _ Incrementer = Counter{} // COMPILE ERROR: value doesn't have Inc()
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
**Decision table — value vs pointer receiver:**
|
|
234
|
+
|
|
235
|
+
| Condition | Receiver | Why |
|
|
236
|
+
|-----------|----------|-----|
|
|
237
|
+
| Method mutates state | `*T` | Must modify the actual instance |
|
|
238
|
+
| Large struct (> 64 bytes) | `*T` | Avoid copy overhead |
|
|
239
|
+
| Consistency (other methods use `*T`) | `*T` | All methods should use same receiver |
|
|
240
|
+
| Small, immutable type | `T` | Value semantics, safe for concurrent use |
|
|
241
|
+
| Needs to work in map keys | `T` | Values can be map keys |
|
|
242
|
+
|
|
243
|
+
**Rule: Don't mix receivers.** If any method uses pointer receiver, all methods should use pointer receiver.
|
|
244
|
+
|
|
245
|
+
## Zero Value Design
|
|
246
|
+
|
|
247
|
+
Design structs so their zero value is immediately usable without initialization.
|
|
248
|
+
|
|
249
|
+
```go
|
|
250
|
+
// GOOD — zero value is usable
|
|
251
|
+
type Buffer struct {
|
|
252
|
+
data []byte // nil slice: append works on nil
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
func (b *Buffer) Write(p []byte) {
|
|
256
|
+
b.data = append(b.data, p...) // works even when b.data is nil
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// GOOD — sync.Mutex zero value is an unlocked mutex
|
|
260
|
+
type SafeMap struct {
|
|
261
|
+
mu sync.Mutex // zero value: unlocked, ready to use
|
|
262
|
+
m map[string]int // nil: must lazy-init on first write
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
func (sm *SafeMap) Set(key string, value int) {
|
|
266
|
+
sm.mu.Lock()
|
|
267
|
+
defer sm.mu.Unlock()
|
|
268
|
+
if sm.m == nil {
|
|
269
|
+
sm.m = make(map[string]int)
|
|
270
|
+
}
|
|
271
|
+
sm.m[key] = value
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
## Struct Tags
|
|
276
|
+
|
|
277
|
+
| Tag | Package | Purpose | Example |
|
|
278
|
+
|-----|---------|---------|---------|
|
|
279
|
+
| `json` | encoding/json | JSON field name, omit rules | `json:"name,omitempty"` |
|
|
280
|
+
| `db` | sqlx, pgx | DB column name | `db:"user_id"` |
|
|
281
|
+
| `validate` | go-playground/validator | Validation rules | `validate:"required,email"` |
|
|
282
|
+
| `env` | caarlos0/env | Environment variable | `env:"PORT" envDefault:"8080"` |
|
|
283
|
+
| `mapstructure` | mitchellh/mapstructure | Config decoding | `mapstructure:"server_port"` |
|
|
284
|
+
|
|
285
|
+
```go
|
|
286
|
+
type User struct {
|
|
287
|
+
ID int64 `json:"id" db:"id"`
|
|
288
|
+
Name string `json:"name" db:"name" validate:"required,min=1,max=100"`
|
|
289
|
+
Email string `json:"email" db:"email" validate:"required,email"`
|
|
290
|
+
Password string `json:"-" db:"password_hash"` // json:"-" hides from JSON
|
|
291
|
+
IsActive bool `json:"is_active" db:"is_active"`
|
|
292
|
+
Role Role `json:"role,omitempty" db:"role"`
|
|
293
|
+
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
|
294
|
+
DeletedAt *time.Time `json:"deleted_at,omitempty" db:"deleted_at"` // nullable
|
|
295
|
+
}
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
**Go 1.24+ omitzero tag:**
|
|
299
|
+
|
|
300
|
+
```go
|
|
301
|
+
type Event struct {
|
|
302
|
+
Name string `json:"name"`
|
|
303
|
+
Timestamp time.Time `json:"timestamp,omitzero"` // omit if zero value
|
|
304
|
+
}
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
## When to Use
|
|
308
|
+
|
|
309
|
+
Apply when reviewing struct definitions, interface design, and type system usage. Flag violations as:
|
|
310
|
+
- **CRITICAL**: Mixing value/pointer receivers, exposing embedded mutex, large interfaces (6+ methods)
|
|
311
|
+
- **WARNING**: Provider-side interface definitions, missing compile-time checks, embedded type for convenience
|
|
312
|
+
- **SUGGESTION**: Zero value not usable, missing struct tags, type assertion instead of errors.As
|