From go-specialist
Generates .golangci.yml configuration for golangci-lint in Go projects with 90+ linters enabled by default. Supports --force to overwrite and --dry-run for preview.
How this command is triggered — by the user, by Claude, or both
Slash command
/go-specialist:gen-linter [--force] [--dry-run]This command is limited to the following tools:
The summary Claude sees in its command listing — used to decide when to auto-load this command
# Generate golangci-lint Configuration Command Instantly create a professional `.golangci.yml` configuration for Go projects with comprehensive linting coverage. This command converts the multi-step `linter` skill into a one-command solution. ## Why This Command Exists **Problem**: Setting up golangci-lint requires manually creating YAML configuration, understanding 90+ linter options, and balancing strict quality checks with pragmatic development - a 15-30 minute process prone to over-configuration. **Solution**: One-command generation that: - Creates battle-tested `.golangci.yml` (224...
Instantly create a professional .golangci.yml configuration for Go projects with comprehensive linting coverage. This command converts the multi-step linter skill into a one-command solution.
Problem: Setting up golangci-lint requires manually creating YAML configuration, understanding 90+ linter options, and balancing strict quality checks with pragmatic development - a 15-30 minute process prone to over-configuration.
Solution: One-command generation that:
.golangci.yml (224 lines)CRITICAL: When generating any content (configuration files, commit messages, or any other output):
Critical checks before proceeding:
Validate Git repository:
git rev-parse --git-dir
Validate Go project:
test -f go.mod
Check existing configuration:
test -f .golangci.yml || test -f .golangci.yaml
existingConfig = true and existingFile = <filename>existingConfig = falseCheck for golangci-lint binary (non-blocking):
command -v golangci-lint
linterNotInstalled = true (will show warning later)golangci-lint --version and store for reportVerify command assets directory:
${CLAUDE_PLUGIN_ROOT}/commands/assets/linter/.golangci.yml existsParse command arguments from $argument string:
Supported flags:
--force: Skip confirmation if .golangci.yml already exists--dry-run: Show preview without writing fileParsing logic:
arguments = split($argument by space)
for each arg in arguments:
if arg == "--force": set forceMode = true
if arg == "--dry-run": set dryRunMode = true
File Selection:
.golangci.yml (224 lines)Read template file from command assets directory:
Template location:
${CLAUDE_PLUGIN_ROOT}/commands/assets/linter/.golangci.ymlReading logic:
Use Read tool to read: ${CLAUDE_PLUGIN_ROOT}/commands/assets/linter/.golangci.yml
Store content as: templateContent
Verify: content is not empty and starts with "# golangci-lint"
Error handling:
No variable substitution required - the template is copied as-is.
Build preview message:
📋 golangci-lint Configuration Preview
Files to be created:
.golangci.yml (224 lines, ~6.5 KB)
Configuration features:
• Enables all linters by default (90+)
• Disables overly strict linters (goerr113, wrapcheck, etc.)
• 5-minute timeout for large projects
• Fast mode with caching enabled
• Parallel execution across all CPUs
• Project-agnostic settings
Excluded linters (too opinionated):
• depguard, exhaustruct, gci, gochecknoglobals
• godox, goerr113, inamedparam, maintidx
• nonamedreturns, testpackage, wrapcheck, wsl
Integration ready:
✓ GitHub Actions (via gen-github-dir)
✓ GitLab CI (via gen-gitlab-ci)
✓ Task runner (via gen-taskfiles)
✓ Pre-commit hooks
✓ VS Code, GoLand, Vim/Neovim
<CONDITIONAL WARNINGS>
Conditional warnings:
If existingConfig = true:
⚠️ WARNING: Existing configuration detected
File: <existingFile>
This will OVERWRITE your existing linter configuration.
Consider backing up your current settings before proceeding.
If linterNotInstalled = true:
ℹ️ INFO: golangci-lint binary not found
Configuration will be created, but you'll need to install golangci-lint to use it:
• macOS: brew install golangci-lint
• Other: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
After installation, verify with: golangci-lint --version
Confirmation logic:
If dryRunMode = true:
[DRY RUN MODE - No files will be written]
Skip to Phase 6 (report preview only)
If forceMode = true:
[--force mode enabled, skipping confirmation]
Proceed to Phase 5
If existingConfig = true and forceMode = false:
Use AskUserQuestion:
Question: "Overwrite existing .golangci.yml configuration?"
Options:
- "Yes, overwrite configuration" (proceed to Phase 5)
- "No, cancel operation" (exit with message "Operation cancelled by user")
If existingConfig = false:
Use AskUserQuestion:
Question: "Create .golangci.yml in project root?"
Options:
- "Yes, create configuration" (proceed to Phase 5)
- "No, cancel operation" (exit with message "Operation cancelled by user")
Write configuration file:
Use Write tool to create:
File: .golangci.yml (in project root, not in .github/)
Content: <templateContent from Phase 3>
Writing logic:
Use Write tool:
file_path: ./.golangci.yml (absolute path to project root)
content: templateContent (no modifications, copy as-is)
Error handling:
Verify file creation:
test -f .golangci.yml && wc -l .golangci.yml
Success report:
If dryRunMode = true:
✅ [DRY RUN] Preview completed successfully
Would create:
• .golangci.yml (224 lines)
To create files, run without --dry-run flag.
If normal execution:
✅ golangci-lint configuration created successfully!
Created files:
✓ .golangci.yml (224 lines)
Next steps:
1. Run initial lint check:
golangci-lint run ./...
2. Auto-fix issues where possible:
golangci-lint run --fix ./...
3. See verbose output with active linters:
golangci-lint run -v ./...
4. Test specific linter:
golangci-lint run --disable-all --enable=govet ./...
5. Customize configuration:
Edit .golangci.yml to adjust enabled linters, timeouts, or exclusions
6. Integrate with CI/CD:
• GitHub Actions: Run /gen-github-dir (includes linter workflow)
• GitLab CI: Run /gen-gitlab-ci (includes lint job)
• Task runner: Run /gen-taskfiles (includes lint tasks)
7. Configure editor integration:
• VS Code: Install Go extension, set "go.lintTool": "golangci-lint"
• GoLand: Settings → Tools → File Watchers → Add golangci-lint
• Vim/Neovim: Configure ale plugin with golangci-lint
Configuration features:
✓ 90+ linters enabled by default
✓ Balanced quality vs. pragmatism
✓ Fast execution with caching
✓ Parallel processing
✓ CI/CD ready
📚 Need help with advanced customization?
Visit: https://golangci-lint.run/usage/configuration/
If linterNotInstalled = true, append:
⚠️ Remember to install golangci-lint:
• macOS: brew install golangci-lint
• Other: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
Verify: golangci-lint --version
This command works seamlessly with other go-specialist commands:
Before gen-linter:
After gen-linter:
/gen-github-dir - Includes linter workflow using this configuration/gen-gitlab-ci - Includes lint job using this configuration/gen-taskfiles - Includes lint tasks for local development/verify-task - Validates task quality using linter outputTypical workflow:
# 1. Generate linter config
/gen-linter
# 2. Fix initial issues
golangci-lint run --fix ./...
# 3. Set up CI/CD
/gen-github-dir # or /gen-gitlab-ci
# 4. Add task automation
/gen-taskfiles
Configuration maintenance:
.golangci.yml when upgrading golangci-lint versions--fast flag firstCI/CD integration:
--timeout=5m for large projectsLocal development:
golangci-lint run ./...golangci-lint run --fix ./...Team adoption:
Golangci-lint installation:
Configuration style:
Performance considerations:
--fast flag for quick checks during developmentCI/CD requirements:
If linter fails after generation:
golangci-lint --versiongolangci-lint run --helpgolangci-lint run --disable-all --enable=govet ./...yamllint .golangci.ymlIf too many issues reported:
golangci-lint run --fix ./...--exclude patterns for known issuesIf conflicts with existing tooling:
.golangci.yml disable listOfficial documentation:
Related commands:
/gen-github-dir - GitHub Actions with linter workflow/gen-gitlab-ci - GitLab CI with lint jobs/gen-taskfiles - Task automation with lint tasksCommunity resources:
npx claudepluginhub sgaunet/claude-plugins --plugin go-specialist/lint-fixAuto-fixes Go linting issues using golangci-lint, gofmt, and goimports. Supports [path], --check (report only), --staged, and --fix-unsafe options.
/lintSets up linting and code standards with ESLint, Prettier, Biome, Ruff, golangci-lint; configures justified rules, formatters, pre-commit hooks (Husky/lint-staged), auto-fixes violations, generates style guide, editor settings, and CI enforcement. Supports tool-specific flags.
/repo-toolingConfigures linting (ESLint/Ruff), formatting (Prettier), git hooks (Husky/pre-commit), and GitHub Actions CI/CD based on detected project language (TypeScript/Next.js or Python).
/lint-checkRuns project linting across JS/TS, Python, Go, and Rust projects, detects configs, categorizes issues by severity, and optionally auto-fixes style problems.