@zimezone/z-command 1.0.1 → 1.1.1

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.
Files changed (217) hide show
  1. package/README.md +57 -38
  2. package/dist/cli.js +14 -2
  3. package/dist/cli.js.map +1 -1
  4. package/dist/commands/init.d.ts +1 -7
  5. package/dist/commands/init.d.ts.map +1 -1
  6. package/dist/commands/init.js +101 -23
  7. package/dist/commands/init.js.map +1 -1
  8. package/dist/commands/update.d.ts +11 -0
  9. package/dist/commands/update.d.ts.map +1 -0
  10. package/dist/commands/update.js +88 -0
  11. package/dist/commands/update.js.map +1 -0
  12. package/dist/platforms.d.ts +21 -0
  13. package/dist/platforms.d.ts.map +1 -0
  14. package/dist/platforms.js +137 -0
  15. package/dist/platforms.js.map +1 -0
  16. package/dist/types.d.ts +44 -0
  17. package/dist/types.d.ts.map +1 -0
  18. package/dist/types.js +6 -0
  19. package/dist/types.js.map +1 -0
  20. package/package.json +13 -5
  21. package/templates/agents/api-documenter.agent.md +161 -0
  22. package/templates/agents/architect-review.agent.md +146 -0
  23. package/templates/agents/arm-cortex-expert.agent.md +288 -0
  24. package/templates/agents/backend-architect.agent.md +309 -0
  25. package/templates/agents/backend-security-coder.agent.md +152 -0
  26. package/templates/agents/bash-pro.agent.md +285 -0
  27. package/templates/agents/c-pro.agent.md +35 -0
  28. package/templates/agents/c4-code.agent.md +320 -0
  29. package/templates/agents/c4-component.agent.md +227 -0
  30. package/templates/agents/c4-container.agent.md +248 -0
  31. package/templates/agents/c4-context.agent.md +235 -0
  32. package/templates/agents/conductor-validator.agent.md +245 -0
  33. package/templates/agents/csharp-pro.agent.md +38 -0
  34. package/templates/agents/customer-support.agent.md +148 -0
  35. package/templates/agents/database-admin.agent.md +142 -0
  36. package/templates/agents/database-architect.agent.md +238 -0
  37. package/templates/agents/database-optimizer.agent.md +144 -0
  38. package/templates/agents/debugger.agent.md +30 -0
  39. package/templates/agents/deployment-engineer.agent.md +0 -0
  40. package/templates/agents/devops-troubleshooter.agent.md +138 -0
  41. package/templates/agents/django-pro.agent.md +159 -0
  42. package/templates/agents/docs-architect.agent.md +77 -0
  43. package/templates/agents/dotnet-architect.agent.md +175 -0
  44. package/templates/agents/dx-optimizer.agent.md +63 -0
  45. package/templates/agents/elixir-pro.agent.md +38 -0
  46. package/templates/agents/error-detective.agent.md +32 -0
  47. package/templates/agents/event-sourcing-architect.agent.md +42 -0
  48. package/templates/agents/fastapi-pro.agent.md +171 -0
  49. package/templates/agents/firmware-analyst.agent.md +330 -0
  50. package/templates/agents/frontend-security-coder.agent.md +149 -0
  51. package/templates/agents/haskell-pro.agent.md +37 -0
  52. package/templates/agents/hr-pro.agent.md +105 -0
  53. package/templates/agents/incident-responder.agent.md +190 -0
  54. package/templates/agents/ios-developer.agent.md +198 -0
  55. package/templates/agents/java-pro.agent.md +156 -0
  56. package/templates/agents/javascript-pro.agent.md +35 -0
  57. package/templates/agents/julia-pro.agent.md +187 -0
  58. package/templates/agents/legal-advisor.agent.md +49 -0
  59. package/templates/agents/malware-analyst.agent.md +272 -0
  60. package/templates/agents/mermaid-expert.agent.md +39 -0
  61. package/templates/agents/minecraft-bukkit-pro.agent.md +104 -0
  62. package/templates/agents/mobile-security-coder.agent.md +163 -0
  63. package/templates/agents/monorepo-architect.agent.md +44 -0
  64. package/templates/agents/observability-engineer.agent.md +228 -0
  65. package/templates/agents/performance-engineer.agent.md +167 -0
  66. package/templates/agents/php-pro.agent.md +43 -0
  67. package/templates/agents/posix-shell-pro.agent.md +284 -0
  68. package/templates/agents/quant-analyst.agent.md +32 -0
  69. package/templates/agents/reference-builder.agent.md +167 -0
  70. package/templates/agents/reverse-engineer.agent.md +202 -0
  71. package/templates/agents/risk-manager.agent.md +41 -0
  72. package/templates/agents/ruby-pro.agent.md +35 -0
  73. package/templates/agents/rust-pro.agent.md +156 -0
  74. package/templates/agents/sales-automator.agent.md +35 -0
  75. package/templates/agents/scala-pro.agent.md +60 -0
  76. package/templates/agents/search-specialist.agent.md +59 -0
  77. package/templates/agents/security-auditor.agent.md +138 -0
  78. package/templates/agents/seo-authority-builder.agent.md +116 -0
  79. package/templates/agents/seo-cannibalization-detector.agent.md +103 -0
  80. package/templates/agents/seo-content-auditor.agent.md +63 -0
  81. package/templates/agents/seo-content-planner.agent.md +88 -0
  82. package/templates/agents/seo-content-refresher.agent.md +98 -0
  83. package/templates/agents/seo-content-writer.agent.md +76 -0
  84. package/templates/agents/seo-keyword-strategist.agent.md +75 -0
  85. package/templates/agents/seo-meta-optimizer.agent.md +72 -0
  86. package/templates/agents/seo-snippet-hunter.agent.md +94 -0
  87. package/templates/agents/seo-structure-architect.agent.md +88 -0
  88. package/templates/agents/service-mesh-expert.agent.md +41 -0
  89. package/templates/agents/sql-pro.agent.md +146 -0
  90. package/templates/agents/tdd-orchestrator.agent.md +183 -0
  91. package/templates/agents/temporal-python-pro.agent.md +349 -0
  92. package/templates/agents/terraform-specialist.agent.md +137 -0
  93. package/templates/agents/test-automator.agent.md +203 -0
  94. package/templates/agents/threat-modeling-expert.agent.md +44 -0
  95. package/templates/agents/tutorial-engineer.agent.md +118 -0
  96. package/templates/agents/ui-ux-designer.agent.md +188 -0
  97. package/templates/agents/ui-visual-validator.agent.md +192 -0
  98. package/templates/agents/vector-database-engineer.agent.md +43 -0
  99. package/templates/skills/angular-migration/SKILL.md +410 -0
  100. package/templates/skills/api-design-principles/SKILL.md +528 -0
  101. package/templates/skills/api-design-principles/assets/api-design-checklist.md +155 -0
  102. package/templates/skills/api-design-principles/assets/rest-api-template.py +182 -0
  103. package/templates/skills/api-design-principles/references/graphql-schema-design.md +583 -0
  104. package/templates/skills/api-design-principles/references/rest-best-practices.md +408 -0
  105. package/templates/skills/architecture-decision-records/SKILL.md +428 -0
  106. package/templates/skills/architecture-patterns/SKILL.md +494 -0
  107. package/templates/skills/async-python-patterns/SKILL.md +694 -0
  108. package/templates/skills/auth-implementation-patterns/SKILL.md +634 -0
  109. package/templates/skills/changelog-automation/SKILL.md +552 -0
  110. package/templates/skills/code-review-excellence/SKILL.md +520 -0
  111. package/templates/skills/competitive-landscape/SKILL.md +479 -0
  112. package/templates/skills/context-driven-development/SKILL.md +385 -0
  113. package/templates/skills/cost-optimization/SKILL.md +274 -0
  114. package/templates/skills/cqrs-implementation/SKILL.md +554 -0
  115. package/templates/skills/data-quality-frameworks/SKILL.md +587 -0
  116. package/templates/skills/data-storytelling/SKILL.md +453 -0
  117. package/templates/skills/database-migration/SKILL.md +424 -0
  118. package/templates/skills/dbt-transformation-patterns/SKILL.md +561 -0
  119. package/templates/skills/debugging-strategies/SKILL.md +527 -0
  120. package/templates/skills/defi-protocol-templates/SKILL.md +454 -0
  121. package/templates/skills/dependency-upgrade/SKILL.md +409 -0
  122. package/templates/skills/deployment-pipeline-design/SKILL.md +359 -0
  123. package/templates/skills/distributed-tracing/SKILL.md +438 -0
  124. package/templates/skills/dotnet-backend-patterns/SKILL.md +815 -0
  125. package/templates/skills/dotnet-backend-patterns/assets/repository-template.cs +523 -0
  126. package/templates/skills/dotnet-backend-patterns/assets/service-template.cs +336 -0
  127. package/templates/skills/dotnet-backend-patterns/references/dapper-patterns.md +544 -0
  128. package/templates/skills/dotnet-backend-patterns/references/ef-core-best-practices.md +355 -0
  129. package/templates/skills/e2e-testing-patterns/SKILL.md +547 -0
  130. package/templates/skills/employment-contract-templates/SKILL.md +507 -0
  131. package/templates/skills/error-handling-patterns/SKILL.md +636 -0
  132. package/templates/skills/event-store-design/SKILL.md +437 -0
  133. package/templates/skills/fastapi-templates/SKILL.md +567 -0
  134. package/templates/skills/git-advanced-workflows/SKILL.md +400 -0
  135. package/templates/skills/github-actions-templates/SKILL.md +333 -0
  136. package/templates/skills/go-concurrency-patterns/SKILL.md +655 -0
  137. package/templates/skills/grafana-dashboards/SKILL.md +369 -0
  138. package/templates/skills/helm-chart-scaffolding/SKILL.md +544 -0
  139. package/templates/skills/helm-chart-scaffolding/assets/Chart.yaml.template +42 -0
  140. package/templates/skills/helm-chart-scaffolding/assets/values.yaml.template +185 -0
  141. package/templates/skills/helm-chart-scaffolding/references/chart-structure.md +500 -0
  142. package/templates/skills/helm-chart-scaffolding/scripts/validate-chart.sh +244 -0
  143. package/templates/skills/javascript-testing-patterns/SKILL.md +1025 -0
  144. package/templates/skills/langchain-architecture/SKILL.md +338 -0
  145. package/templates/skills/llm-evaluation/SKILL.md +471 -0
  146. package/templates/skills/microservices-patterns/SKILL.md +595 -0
  147. package/templates/skills/modern-javascript-patterns/SKILL.md +911 -0
  148. package/templates/skills/monorepo-management/SKILL.md +622 -0
  149. package/templates/skills/nextjs-app-router-patterns/SKILL.md +544 -0
  150. package/templates/skills/nodejs-backend-patterns/SKILL.md +1020 -0
  151. package/templates/skills/nx-workspace-patterns/SKILL.md +452 -0
  152. package/templates/skills/openapi-spec-generation/SKILL.md +1028 -0
  153. package/templates/skills/paypal-integration/SKILL.md +467 -0
  154. package/templates/skills/pci-compliance/SKILL.md +466 -0
  155. package/templates/skills/postgresql/SKILL.md +204 -0
  156. package/templates/skills/projection-patterns/SKILL.md +490 -0
  157. package/templates/skills/prometheus-configuration/SKILL.md +392 -0
  158. package/templates/skills/prompt-engineering-patterns/SKILL.md +201 -0
  159. package/templates/skills/prompt-engineering-patterns/assets/few-shot-examples.json +106 -0
  160. package/templates/skills/prompt-engineering-patterns/assets/prompt-template-library.md +246 -0
  161. package/templates/skills/prompt-engineering-patterns/references/chain-of-thought.md +399 -0
  162. package/templates/skills/prompt-engineering-patterns/references/few-shot-learning.md +369 -0
  163. package/templates/skills/prompt-engineering-patterns/references/prompt-optimization.md +414 -0
  164. package/templates/skills/prompt-engineering-patterns/references/prompt-templates.md +470 -0
  165. package/templates/skills/prompt-engineering-patterns/references/system-prompts.md +189 -0
  166. package/templates/skills/prompt-engineering-patterns/scripts/optimize-prompt.py +279 -0
  167. package/templates/skills/python-packaging/SKILL.md +870 -0
  168. package/templates/skills/python-performance-optimization/SKILL.md +869 -0
  169. package/templates/skills/python-testing-patterns/SKILL.md +907 -0
  170. package/templates/skills/rag-implementation/SKILL.md +403 -0
  171. package/templates/skills/react-modernization/SKILL.md +513 -0
  172. package/templates/skills/react-native-architecture/SKILL.md +671 -0
  173. package/templates/skills/react-state-management/SKILL.md +429 -0
  174. package/templates/skills/risk-metrics-calculation/SKILL.md +555 -0
  175. package/templates/skills/rust-async-patterns/SKILL.md +517 -0
  176. package/templates/skills/secrets-management/SKILL.md +346 -0
  177. package/templates/skills/security-requirement-extraction/SKILL.md +677 -0
  178. package/templates/skills/shellcheck-configuration/SKILL.md +454 -0
  179. package/templates/skills/similarity-search-patterns/SKILL.md +558 -0
  180. package/templates/skills/slo-implementation/SKILL.md +329 -0
  181. package/templates/skills/sql-optimization-patterns/SKILL.md +493 -0
  182. package/templates/skills/stripe-integration/SKILL.md +442 -0
  183. package/templates/skills/tailwind-design-system/SKILL.md +666 -0
  184. package/templates/skills/temporal-python-testing/SKILL.md +158 -0
  185. package/templates/skills/temporal-python-testing/resources/integration-testing.md +455 -0
  186. package/templates/skills/temporal-python-testing/resources/local-setup.md +553 -0
  187. package/templates/skills/temporal-python-testing/resources/replay-testing.md +462 -0
  188. package/templates/skills/temporal-python-testing/resources/unit-testing.md +328 -0
  189. package/templates/skills/terraform-module-library/SKILL.md +249 -0
  190. package/templates/skills/terraform-module-library/references/aws-modules.md +63 -0
  191. package/templates/skills/threat-mitigation-mapping/SKILL.md +745 -0
  192. package/templates/skills/track-management/SKILL.md +593 -0
  193. package/templates/skills/typescript-advanced-types/SKILL.md +717 -0
  194. package/templates/skills/ui-ux-pro-max/SKILL.md +352 -0
  195. package/templates/skills/ui-ux-pro-max/data/charts.csv +26 -0
  196. package/templates/skills/ui-ux-pro-max/data/colors.csv +97 -0
  197. package/templates/skills/ui-ux-pro-max/data/icons.csv +101 -0
  198. package/templates/skills/ui-ux-pro-max/data/landing.csv +31 -0
  199. package/templates/skills/ui-ux-pro-max/data/products.csv +97 -0
  200. package/templates/skills/ui-ux-pro-max/data/prompts.csv +24 -0
  201. package/templates/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
  202. package/templates/skills/ui-ux-pro-max/data/styles.csv +59 -0
  203. package/templates/skills/ui-ux-pro-max/data/typography.csv +58 -0
  204. package/templates/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
  205. package/templates/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  206. package/templates/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
  207. package/templates/skills/ui-ux-pro-max/scripts/core.py +258 -0
  208. package/templates/skills/ui-ux-pro-max/scripts/design_system.py +547 -0
  209. package/templates/skills/ui-ux-pro-max/scripts/search.py +76 -0
  210. package/templates/skills/uv-package-manager/SKILL.md +831 -0
  211. package/templates/skills/vector-index-tuning/SKILL.md +521 -0
  212. package/templates/skills/wcag-audit-patterns/SKILL.md +555 -0
  213. package/templates/skills/workflow-orchestration-patterns/SKILL.md +316 -0
  214. package/templates/skills/workflow-patterns/SKILL.md +623 -0
  215. package/templates/agents/game-developer.agent.md +0 -57
  216. package/templates/agents/kubernetes-specialist.agent.md +0 -56
  217. package/templates/agents/market-researcher.agent.md +0 -47
@@ -0,0 +1,454 @@
1
+ ---
2
+ name: shellcheck-configuration
3
+ description: Master ShellCheck static analysis configuration and usage for shell script quality. Use when setting up linting infrastructure, fixing code issues, or ensuring script portability.
4
+ ---
5
+
6
+ # ShellCheck Configuration and Static Analysis
7
+
8
+ Comprehensive guidance for configuring and using ShellCheck to improve shell script quality, catch common pitfalls, and enforce best practices through static code analysis.
9
+
10
+ ## When to Use This Skill
11
+
12
+ - Setting up linting for shell scripts in CI/CD pipelines
13
+ - Analyzing existing shell scripts for issues
14
+ - Understanding ShellCheck error codes and warnings
15
+ - Configuring ShellCheck for specific project requirements
16
+ - Integrating ShellCheck into development workflows
17
+ - Suppressing false positives and configuring rule sets
18
+ - Enforcing consistent code quality standards
19
+ - Migrating scripts to meet quality gates
20
+
21
+ ## ShellCheck Fundamentals
22
+
23
+ ### What is ShellCheck?
24
+
25
+ ShellCheck is a static analysis tool that analyzes shell scripts and detects problematic patterns. It supports:
26
+ - Bash, sh, dash, ksh, and other POSIX shells
27
+ - Over 100 different warnings and errors
28
+ - Configuration for target shell and flags
29
+ - Integration with editors and CI/CD systems
30
+
31
+ ### Installation
32
+
33
+ ```bash
34
+ # macOS with Homebrew
35
+ brew install shellcheck
36
+
37
+ # Ubuntu/Debian
38
+ apt-get install shellcheck
39
+
40
+ # From source
41
+ git clone https://github.com/koalaman/shellcheck.git
42
+ cd shellcheck
43
+ make build
44
+ make install
45
+
46
+ # Verify installation
47
+ shellcheck --version
48
+ ```
49
+
50
+ ## Configuration Files
51
+
52
+ ### .shellcheckrc (Project Level)
53
+
54
+ Create `.shellcheckrc` in your project root:
55
+
56
+ ```
57
+ # Specify target shell
58
+ shell=bash
59
+
60
+ # Enable optional checks
61
+ enable=avoid-nullary-conditions
62
+ enable=require-variable-braces
63
+
64
+ # Disable specific warnings
65
+ disable=SC1091
66
+ disable=SC2086
67
+ ```
68
+
69
+ ### Environment Variables
70
+
71
+ ```bash
72
+ # Set default shell target
73
+ export SHELLCHECK_SHELL=bash
74
+
75
+ # Enable strict mode
76
+ export SHELLCHECK_STRICT=true
77
+
78
+ # Specify configuration file location
79
+ export SHELLCHECK_CONFIG=~/.shellcheckrc
80
+ ```
81
+
82
+ ## Common ShellCheck Error Codes
83
+
84
+ ### SC1000-1099: Parser Errors
85
+ ```bash
86
+ # SC1004: Backslash continuation not followed by newline
87
+ echo hello\
88
+ world # Error - needs line continuation
89
+
90
+ # SC1008: Invalid data for operator `=='
91
+ if [[ $var = "value" ]]; then # Space before ==
92
+ true
93
+ fi
94
+ ```
95
+
96
+ ### SC2000-2099: Shell Issues
97
+
98
+ ```bash
99
+ # SC2009: Consider using pgrep or pidof instead of grep|grep
100
+ ps aux | grep -v grep | grep myprocess # Use pgrep instead
101
+
102
+ # SC2012: Use `ls` only for viewing. Use `find` for reliable output
103
+ for file in $(ls -la) # Better: use find or globbing
104
+
105
+ # SC2015: Avoid using && and || instead of if-then-else
106
+ [[ -f "$file" ]] && echo "found" || echo "not found" # Less clear
107
+
108
+ # SC2016: Expressions don't expand in single quotes
109
+ echo '$VAR' # Literal $VAR, not variable expansion
110
+
111
+ # SC2026: This word is non-standard. Set POSIXLY_CORRECT
112
+ # when using with scripts for other shells
113
+ ```
114
+
115
+ ### SC2100-2199: Quoting Issues
116
+
117
+ ```bash
118
+ # SC2086: Double quote to prevent globbing and word splitting
119
+ for i in $list; do # Should be: for i in $list or for i in "$list"
120
+ echo "$i"
121
+ done
122
+
123
+ # SC2115: Literal tilde in path not expanded. Use $HOME instead
124
+ ~/.bashrc # In strings, use "$HOME/.bashrc"
125
+
126
+ # SC2181: Check exit code directly with `if`, not indirectly in a list
127
+ some_command
128
+ if [ $? -eq 0 ]; then # Better: if some_command; then
129
+
130
+ # SC2206: Quote to prevent word splitting or set IFS
131
+ array=( $items ) # Should use: array=( $items )
132
+ ```
133
+
134
+ ### SC3000-3999: POSIX Compliance Issues
135
+
136
+ ```bash
137
+ # SC3010: In POSIX sh, use 'case' instead of 'cond && foo'
138
+ [[ $var == "value" ]] && do_something # Not POSIX
139
+
140
+ # SC3043: In POSIX sh, use 'local' is undefined
141
+ function my_func() {
142
+ local var=value # Not POSIX in some shells
143
+ }
144
+ ```
145
+
146
+ ## Practical Configuration Examples
147
+
148
+ ### Minimal Configuration (Strict POSIX)
149
+
150
+ ```bash
151
+ #!/bin/bash
152
+ # Configure for maximum portability
153
+
154
+ shellcheck \
155
+ --shell=sh \
156
+ --external-sources \
157
+ --check-sourced \
158
+ script.sh
159
+ ```
160
+
161
+ ### Development Configuration (Bash with Relaxed Rules)
162
+
163
+ ```bash
164
+ #!/bin/bash
165
+ # Configure for Bash development
166
+
167
+ shellcheck \
168
+ --shell=bash \
169
+ --exclude=SC1091,SC2119 \
170
+ --enable=all \
171
+ script.sh
172
+ ```
173
+
174
+ ### CI/CD Integration Configuration
175
+
176
+ ```bash
177
+ #!/bin/bash
178
+ set -Eeuo pipefail
179
+
180
+ # Analyze all shell scripts and fail on issues
181
+ find . -type f -name "*.sh" | while read -r script; do
182
+ echo "Checking: $script"
183
+ shellcheck \
184
+ --shell=bash \
185
+ --format=gcc \
186
+ --exclude=SC1091 \
187
+ "$script" || exit 1
188
+ done
189
+ ```
190
+
191
+ ### .shellcheckrc for Project
192
+
193
+ ```
194
+ # Shell dialect to analyze against
195
+ shell=bash
196
+
197
+ # Enable optional checks
198
+ enable=avoid-nullary-conditions,require-variable-braces,check-unassigned-uppercase
199
+
200
+ # Disable specific warnings
201
+ # SC1091: Not following sourced files (many false positives)
202
+ disable=SC1091
203
+
204
+ # SC2119: Use function_name instead of function_name -- (arguments)
205
+ disable=SC2119
206
+
207
+ # External files to source for context
208
+ external-sources=true
209
+ ```
210
+
211
+ ## Integration Patterns
212
+
213
+ ### Pre-commit Hook Configuration
214
+
215
+ ```bash
216
+ #!/bin/bash
217
+ # .git/hooks/pre-commit
218
+
219
+ #!/bin/bash
220
+ set -e
221
+
222
+ # Find all shell scripts changed in this commit
223
+ git diff --cached --name-only | grep '\.sh$' | while read -r script; do
224
+ echo "Linting: $script"
225
+
226
+ if ! shellcheck "$script"; then
227
+ echo "ShellCheck failed on $script"
228
+ exit 1
229
+ fi
230
+ done
231
+ ```
232
+
233
+ ### GitHub Actions Workflow
234
+
235
+ ```yaml
236
+ name: ShellCheck
237
+
238
+ on: [push, pull_request]
239
+
240
+ jobs:
241
+ shellcheck:
242
+ runs-on: ubuntu-latest
243
+
244
+ steps:
245
+ - uses: actions/checkout@v3
246
+
247
+ - name: Run ShellCheck
248
+ run: |
249
+ sudo apt-get install shellcheck
250
+ find . -type f -name "*.sh" -exec shellcheck {} \;
251
+ ```
252
+
253
+ ### GitLab CI Pipeline
254
+
255
+ ```yaml
256
+ shellcheck:
257
+ stage: lint
258
+ image: koalaman/shellcheck-alpine
259
+ script:
260
+ - find . -type f -name "*.sh" -exec shellcheck {} \;
261
+ allow_failure: false
262
+ ```
263
+
264
+ ## Handling ShellCheck Violations
265
+
266
+ ### Suppressing Specific Warnings
267
+
268
+ ```bash
269
+ #!/bin/bash
270
+
271
+ # Disable warning for entire line
272
+ # shellcheck disable=SC2086
273
+ for file in $(ls -la); do
274
+ echo "$file"
275
+ done
276
+
277
+ # Disable for entire script
278
+ # shellcheck disable=SC1091,SC2119
279
+
280
+ # Disable multiple warnings (format varies)
281
+ command_that_fails() {
282
+ # shellcheck disable=SC2015
283
+ [ -f "$1" ] && echo "found" || echo "not found"
284
+ }
285
+
286
+ # Disable specific check for source directive
287
+ # shellcheck source=./helper.sh
288
+ source helper.sh
289
+ ```
290
+
291
+ ### Common Violations and Fixes
292
+
293
+ #### SC2086: Double quote to prevent word splitting
294
+
295
+ ```bash
296
+ # Problem
297
+ for i in $list; do done
298
+
299
+ # Solution
300
+ for i in $list; do done # If $list is already quoted, or
301
+ for i in "${list[@]}"; do done # If list is an array
302
+ ```
303
+
304
+ #### SC2181: Check exit code directly
305
+
306
+ ```bash
307
+ # Problem
308
+ some_command
309
+ if [ $? -eq 0 ]; then
310
+ echo "success"
311
+ fi
312
+
313
+ # Solution
314
+ if some_command; then
315
+ echo "success"
316
+ fi
317
+ ```
318
+
319
+ #### SC2015: Use if-then instead of && ||
320
+
321
+ ```bash
322
+ # Problem
323
+ [ -f "$file" ] && echo "exists" || echo "not found"
324
+
325
+ # Solution - clearer intent
326
+ if [ -f "$file" ]; then
327
+ echo "exists"
328
+ else
329
+ echo "not found"
330
+ fi
331
+ ```
332
+
333
+ #### SC2016: Expressions don't expand in single quotes
334
+
335
+ ```bash
336
+ # Problem
337
+ echo 'Variable value: $VAR'
338
+
339
+ # Solution
340
+ echo "Variable value: $VAR"
341
+ ```
342
+
343
+ #### SC2009: Use pgrep instead of grep
344
+
345
+ ```bash
346
+ # Problem
347
+ ps aux | grep -v grep | grep myprocess
348
+
349
+ # Solution
350
+ pgrep -f myprocess
351
+ ```
352
+
353
+ ## Performance Optimization
354
+
355
+ ### Checking Multiple Files
356
+
357
+ ```bash
358
+ #!/bin/bash
359
+
360
+ # Sequential checking
361
+ for script in *.sh; do
362
+ shellcheck "$script"
363
+ done
364
+
365
+ # Parallel checking (faster)
366
+ find . -name "*.sh" -print0 | \
367
+ xargs -0 -P 4 -n 1 shellcheck
368
+ ```
369
+
370
+ ### Caching Results
371
+
372
+ ```bash
373
+ #!/bin/bash
374
+
375
+ CACHE_DIR=".shellcheck_cache"
376
+ mkdir -p "$CACHE_DIR"
377
+
378
+ check_script() {
379
+ local script="$1"
380
+ local hash
381
+ local cache_file
382
+
383
+ hash=$(sha256sum "$script" | cut -d' ' -f1)
384
+ cache_file="$CACHE_DIR/$hash"
385
+
386
+ if [[ ! -f "$cache_file" ]]; then
387
+ if shellcheck "$script" > "$cache_file" 2>&1; then
388
+ touch "$cache_file.ok"
389
+ else
390
+ return 1
391
+ fi
392
+ fi
393
+
394
+ [[ -f "$cache_file.ok" ]]
395
+ }
396
+
397
+ find . -name "*.sh" | while read -r script; do
398
+ check_script "$script" || exit 1
399
+ done
400
+ ```
401
+
402
+ ## Output Formats
403
+
404
+ ### Default Format
405
+
406
+ ```bash
407
+ shellcheck script.sh
408
+
409
+ # Output:
410
+ # script.sh:1:3: warning: foo is referenced but not assigned. [SC2154]
411
+ ```
412
+
413
+ ### GCC Format (for CI/CD)
414
+
415
+ ```bash
416
+ shellcheck --format=gcc script.sh
417
+
418
+ # Output:
419
+ # script.sh:1:3: warning: foo is referenced but not assigned.
420
+ ```
421
+
422
+ ### JSON Format (for parsing)
423
+
424
+ ```bash
425
+ shellcheck --format=json script.sh
426
+
427
+ # Output:
428
+ # [{"file": "script.sh", "line": 1, "column": 3, "level": "warning", "code": 2154, "message": "..."}]
429
+ ```
430
+
431
+ ### Quiet Format
432
+
433
+ ```bash
434
+ shellcheck --format=quiet script.sh
435
+
436
+ # Returns non-zero if issues found, no output otherwise
437
+ ```
438
+
439
+ ## Best Practices
440
+
441
+ 1. **Run ShellCheck in CI/CD** - Catch issues before merging
442
+ 2. **Configure for your target shell** - Don't analyze bash as sh
443
+ 3. **Document exclusions** - Explain why violations are suppressed
444
+ 4. **Address violations** - Don't just disable warnings
445
+ 5. **Enable strict mode** - Use `--enable=all` with careful exclusions
446
+ 6. **Update regularly** - Keep ShellCheck current for new checks
447
+ 7. **Use pre-commit hooks** - Catch issues locally before pushing
448
+ 8. **Integrate with editors** - Get real-time feedback during development
449
+
450
+ ## Resources
451
+
452
+ - **ShellCheck GitHub**: https://github.com/koalaman/shellcheck
453
+ - **ShellCheck Wiki**: https://www.shellcheck.net/wiki/
454
+ - **Error Code Reference**: https://www.shellcheck.net/