@hivehub/rulebook 2.1.0 → 3.0.0

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 (187) hide show
  1. package/README.md +779 -661
  2. package/dist/cli/commands.d.ts +22 -0
  3. package/dist/cli/commands.d.ts.map +1 -1
  4. package/dist/cli/commands.js +291 -8
  5. package/dist/cli/commands.js.map +1 -1
  6. package/dist/core/claude-mcp.d.ts +32 -0
  7. package/dist/core/claude-mcp.d.ts.map +1 -0
  8. package/dist/core/claude-mcp.js +92 -0
  9. package/dist/core/claude-mcp.js.map +1 -0
  10. package/dist/core/config-manager.d.ts.map +1 -1
  11. package/dist/core/config-manager.js +27 -6
  12. package/dist/core/config-manager.js.map +1 -1
  13. package/dist/core/generator.d.ts.map +1 -1
  14. package/dist/core/generator.js +98 -49
  15. package/dist/core/generator.js.map +1 -1
  16. package/dist/core/migrator.d.ts +13 -0
  17. package/dist/core/migrator.d.ts.map +1 -1
  18. package/dist/core/migrator.js +76 -9
  19. package/dist/core/migrator.js.map +1 -1
  20. package/dist/core/openspec-migrator.d.ts +1 -1
  21. package/dist/core/openspec-migrator.d.ts.map +1 -1
  22. package/dist/core/openspec-migrator.js +14 -7
  23. package/dist/core/openspec-migrator.js.map +1 -1
  24. package/dist/core/workflow-generator.js +297 -261
  25. package/dist/core/workflow-generator.js.map +1 -1
  26. package/dist/index.js +40 -1
  27. package/dist/index.js.map +1 -1
  28. package/dist/mcp/rulebook-server.d.ts.map +1 -1
  29. package/dist/mcp/rulebook-server.js +255 -74
  30. package/dist/mcp/rulebook-server.js.map +1 -1
  31. package/dist/memory/hnsw-index.d.ts +63 -0
  32. package/dist/memory/hnsw-index.d.ts.map +1 -0
  33. package/dist/memory/hnsw-index.js +421 -0
  34. package/dist/memory/hnsw-index.js.map +1 -0
  35. package/dist/memory/memory-cache.d.ts +33 -0
  36. package/dist/memory/memory-cache.d.ts.map +1 -0
  37. package/dist/memory/memory-cache.js +85 -0
  38. package/dist/memory/memory-cache.js.map +1 -0
  39. package/dist/memory/memory-hooks.d.ts +42 -0
  40. package/dist/memory/memory-hooks.d.ts.map +1 -0
  41. package/dist/memory/memory-hooks.js +193 -0
  42. package/dist/memory/memory-hooks.js.map +1 -0
  43. package/dist/memory/memory-manager.d.ts +55 -0
  44. package/dist/memory/memory-manager.d.ts.map +1 -0
  45. package/dist/memory/memory-manager.js +209 -0
  46. package/dist/memory/memory-manager.js.map +1 -0
  47. package/dist/memory/memory-search.d.ts +42 -0
  48. package/dist/memory/memory-search.d.ts.map +1 -0
  49. package/dist/memory/memory-search.js +166 -0
  50. package/dist/memory/memory-search.js.map +1 -0
  51. package/dist/memory/memory-store.d.ts +59 -0
  52. package/dist/memory/memory-store.d.ts.map +1 -0
  53. package/dist/memory/memory-store.js +394 -0
  54. package/dist/memory/memory-store.js.map +1 -0
  55. package/dist/memory/memory-types.d.ts +69 -0
  56. package/dist/memory/memory-types.d.ts.map +1 -0
  57. package/dist/memory/memory-types.js +7 -0
  58. package/dist/memory/memory-types.js.map +1 -0
  59. package/dist/memory/memory-vectorizer.d.ts +29 -0
  60. package/dist/memory/memory-vectorizer.d.ts.map +1 -0
  61. package/dist/memory/memory-vectorizer.js +104 -0
  62. package/dist/memory/memory-vectorizer.js.map +1 -0
  63. package/dist/types.d.ts +7 -0
  64. package/dist/types.d.ts.map +1 -1
  65. package/package.json +107 -106
  66. package/templates/commands/rulebook-memory-save.md +48 -0
  67. package/templates/commands/rulebook-memory-search.md +47 -0
  68. package/templates/commands/rulebook-task-apply.md +2 -2
  69. package/templates/commands/rulebook-task-archive.md +2 -2
  70. package/templates/commands/rulebook-task-create.md +2 -2
  71. package/templates/commands/rulebook-task-list.md +2 -2
  72. package/templates/commands/rulebook-task-show.md +2 -2
  73. package/templates/commands/rulebook-task-validate.md +2 -2
  74. package/templates/git/CI_CD_PATTERNS.md +4 -4
  75. package/templates/git/GITHUB_ACTIONS.md +3 -3
  76. package/templates/git/GITLAB_CI.md +4 -4
  77. package/templates/git/SECRETS_MANAGEMENT.md +4 -4
  78. package/templates/hooks/COMMIT_MSG.md +4 -4
  79. package/templates/hooks/POST_CHECKOUT.md +3 -3
  80. package/templates/hooks/PREPARE_COMMIT_MSG.md +3 -3
  81. package/templates/hooks/PRE_COMMIT.md +4 -4
  82. package/templates/hooks/PRE_PUSH.md +4 -4
  83. package/templates/modules/MEMORY.md +63 -0
  84. package/templates/skills/cli/aider/SKILL.md +59 -0
  85. package/templates/skills/cli/amazon-q/SKILL.md +35 -0
  86. package/templates/skills/cli/auggie/SKILL.md +42 -0
  87. package/templates/skills/cli/claude/SKILL.md +42 -0
  88. package/templates/skills/cli/claude-code/SKILL.md +146 -0
  89. package/templates/skills/cli/cline/SKILL.md +42 -0
  90. package/templates/skills/cli/codebuddy/SKILL.md +30 -0
  91. package/templates/skills/cli/codeium/SKILL.md +30 -0
  92. package/templates/skills/cli/codex/SKILL.md +31 -0
  93. package/templates/skills/cli/continue/SKILL.md +44 -0
  94. package/templates/skills/cli/cursor-cli/SKILL.md +38 -0
  95. package/templates/skills/cli/factory/SKILL.md +28 -0
  96. package/templates/skills/cli/gemini/SKILL.md +45 -0
  97. package/templates/skills/cli/kilocode/SKILL.md +28 -0
  98. package/templates/skills/cli/opencode/SKILL.md +28 -0
  99. package/templates/skills/core/agent-automation/SKILL.md +194 -0
  100. package/templates/skills/core/dag/SKILL.md +314 -0
  101. package/templates/skills/core/documentation-rules/SKILL.md +47 -0
  102. package/templates/skills/core/quality-enforcement/SKILL.md +78 -0
  103. package/templates/skills/frameworks/angular/SKILL.md +46 -0
  104. package/templates/skills/frameworks/django/SKILL.md +93 -0
  105. package/templates/skills/frameworks/electron/SKILL.md +157 -0
  106. package/templates/skills/frameworks/flask/SKILL.md +48 -0
  107. package/templates/skills/frameworks/flutter/SKILL.md +65 -0
  108. package/templates/skills/frameworks/jquery/SKILL.md +42 -0
  109. package/templates/skills/frameworks/laravel/SKILL.md +48 -0
  110. package/templates/skills/frameworks/nestjs/SKILL.md +53 -0
  111. package/templates/skills/frameworks/nextjs/SKILL.md +137 -0
  112. package/templates/skills/frameworks/nuxt/SKILL.md +50 -0
  113. package/templates/skills/frameworks/rails/SKILL.md +76 -0
  114. package/templates/skills/frameworks/react/SKILL.md +48 -0
  115. package/templates/skills/frameworks/react-native/SKILL.md +57 -0
  116. package/templates/skills/frameworks/spring/SKILL.md +49 -0
  117. package/templates/skills/frameworks/symfony/SKILL.md +46 -0
  118. package/templates/skills/frameworks/vue/SKILL.md +46 -0
  119. package/templates/skills/frameworks/zend/SKILL.md +45 -0
  120. package/templates/skills/ides/copilot/SKILL.md +47 -0
  121. package/templates/skills/ides/cursor/SKILL.md +53 -0
  122. package/templates/skills/ides/jetbrains-ai/SKILL.md +45 -0
  123. package/templates/skills/ides/replit/SKILL.md +46 -0
  124. package/templates/skills/ides/tabnine/SKILL.md +39 -0
  125. package/templates/skills/ides/vscode/SKILL.md +50 -0
  126. package/templates/skills/ides/windsurf/SKILL.md +46 -0
  127. package/templates/skills/ides/zed/SKILL.md +42 -0
  128. package/templates/skills/languages/ada/SKILL.md +68 -0
  129. package/templates/skills/languages/c/SKILL.md +343 -0
  130. package/templates/skills/languages/cpp/SKILL.md +753 -0
  131. package/templates/skills/languages/csharp/SKILL.md +427 -0
  132. package/templates/skills/languages/dart/SKILL.md +342 -0
  133. package/templates/skills/languages/elixir/SKILL.md +464 -0
  134. package/templates/skills/languages/erlang/SKILL.md +371 -0
  135. package/templates/skills/languages/go/SKILL.md +655 -0
  136. package/templates/skills/languages/haskell/SKILL.md +187 -0
  137. package/templates/skills/languages/java/SKILL.md +617 -0
  138. package/templates/skills/languages/javascript/SKILL.md +641 -0
  139. package/templates/skills/languages/julia/SKILL.md +107 -0
  140. package/templates/skills/languages/kotlin/SKILL.md +521 -0
  141. package/templates/skills/languages/lisp/SKILL.md +110 -0
  142. package/templates/skills/languages/lua/SKILL.md +84 -0
  143. package/templates/skills/languages/objectivec/SKILL.md +100 -0
  144. package/templates/skills/languages/php/SKILL.md +426 -0
  145. package/templates/skills/languages/python/SKILL.md +692 -0
  146. package/templates/skills/languages/r/SKILL.md +360 -0
  147. package/templates/skills/languages/ruby/SKILL.md +431 -0
  148. package/templates/skills/languages/rust/SKILL.md +487 -0
  149. package/templates/skills/languages/sas/SKILL.md +83 -0
  150. package/templates/skills/languages/scala/SKILL.md +358 -0
  151. package/templates/skills/languages/solidity/SKILL.md +590 -0
  152. package/templates/skills/languages/sql/SKILL.md +147 -0
  153. package/templates/skills/languages/swift/SKILL.md +476 -0
  154. package/templates/skills/languages/zig/SKILL.md +275 -0
  155. package/templates/skills/modules/atlassian/SKILL.md +265 -0
  156. package/templates/skills/modules/context7/SKILL.md +64 -0
  157. package/templates/skills/modules/figma/SKILL.md +277 -0
  158. package/templates/skills/modules/github-mcp/SKILL.md +74 -0
  159. package/templates/skills/modules/grafana/SKILL.md +338 -0
  160. package/templates/skills/modules/memory/SKILL.md +73 -0
  161. package/templates/skills/modules/notion/SKILL.md +257 -0
  162. package/templates/skills/modules/playwright/SKILL.md +100 -0
  163. package/templates/skills/modules/rulebook-mcp/SKILL.md +166 -0
  164. package/templates/skills/modules/serena/SKILL.md +347 -0
  165. package/templates/skills/modules/supabase/SKILL.md +233 -0
  166. package/templates/skills/modules/synap/SKILL.md +79 -0
  167. package/templates/skills/modules/vectorizer/SKILL.md +73 -0
  168. package/templates/skills/services/azure-blob/SKILL.md +194 -0
  169. package/templates/skills/services/cassandra/SKILL.md +249 -0
  170. package/templates/skills/services/dynamodb/SKILL.md +318 -0
  171. package/templates/skills/services/elasticsearch/SKILL.md +357 -0
  172. package/templates/skills/services/gcs/SKILL.md +188 -0
  173. package/templates/skills/services/influxdb/SKILL.md +275 -0
  174. package/templates/skills/services/kafka/SKILL.md +351 -0
  175. package/templates/skills/services/mariadb/SKILL.md +193 -0
  176. package/templates/skills/services/memcached/SKILL.md +252 -0
  177. package/templates/skills/services/minio/SKILL.md +211 -0
  178. package/templates/skills/services/mongodb/SKILL.md +278 -0
  179. package/templates/skills/services/mysql/SKILL.md +368 -0
  180. package/templates/skills/services/neo4j/SKILL.md +257 -0
  181. package/templates/skills/services/oracle/SKILL.md +300 -0
  182. package/templates/skills/services/postgresql/SKILL.md +336 -0
  183. package/templates/skills/services/rabbitmq/SKILL.md +296 -0
  184. package/templates/skills/services/redis/SKILL.md +302 -0
  185. package/templates/skills/services/s3/SKILL.md +308 -0
  186. package/templates/skills/services/sqlite/SKILL.md +304 -0
  187. package/templates/skills/services/sqlserver/SKILL.md +304 -0
@@ -0,0 +1,431 @@
1
+ ---
2
+ name: "Ruby"
3
+ description: "Execute these commands after EVERY implementation (see AGENT_AUTOMATION module for full workflow)."
4
+ version: "1.0.0"
5
+ category: "languages"
6
+ author: "Rulebook"
7
+ tags: ["languages", "language"]
8
+ dependencies: []
9
+ conflicts: []
10
+ ---
11
+ <!-- RUBY:START -->
12
+ # Ruby Project Rules
13
+
14
+ ## Agent Automation Commands
15
+
16
+ **CRITICAL**: Execute these commands after EVERY implementation (see AGENT_AUTOMATION module for full workflow).
17
+
18
+ ```bash
19
+ # Complete quality check sequence:
20
+ bundle exec rubocop # Linting and formatting
21
+ bundle exec rspec # All tests (100% pass)
22
+ bundle exec rspec --format documentation # Test coverage
23
+
24
+ # Security audit:
25
+ bundle audit # Vulnerability scan
26
+ bundle outdated # Check outdated deps
27
+ ```
28
+
29
+ ## Ruby Configuration
30
+
31
+ **CRITICAL**: Use Ruby 3.2+ with RuboCop and modern tooling.
32
+
33
+ - **Version**: Ruby 3.2+
34
+ - **Recommended**: Ruby 3.3+
35
+ - **Style Guide**: Ruby Style Guide (RuboCop)
36
+ - **Testing**: RSpec (recommended) or Minitest
37
+ - **Type Checking**: RBS + Steep (optional but recommended)
38
+
39
+ ### Gemfile Requirements
40
+
41
+ ```ruby
42
+ source 'https://rubygems.org'
43
+
44
+ ruby '>= 3.2.0'
45
+
46
+ # Production dependencies
47
+ gem 'rake', '~> 13.0'
48
+
49
+ # Development dependencies
50
+ group :development do
51
+ gem 'rubocop', '~> 1.60', require: false
52
+ gem 'rubocop-performance', require: false
53
+ gem 'rubocop-rspec', require: false
54
+ end
55
+
56
+ # Test dependencies
57
+ group :test do
58
+ gem 'rspec', '~> 3.12'
59
+ gem 'simplecov', require: false
60
+ gem 'simplecov-lcov', require: false
61
+ end
62
+
63
+ # Both development and test
64
+ group :development, :test do
65
+ gem 'pry'
66
+ gem 'pry-byebug'
67
+ end
68
+ ```
69
+
70
+ ### Gemspec Requirements (for gems)
71
+
72
+ ```ruby
73
+ Gem::Specification.new do |spec|
74
+ spec.name = 'your_gem'
75
+ spec.version = '0.1.0'
76
+ spec.authors = ['Your Name']
77
+ spec.email = ['you@example.com']
78
+
79
+ spec.summary = 'Brief summary'
80
+ spec.description = 'Longer description'
81
+ spec.homepage = 'https://github.com/you/your_gem'
82
+ spec.license = 'MIT'
83
+ spec.required_ruby_version = '>= 3.2.0'
84
+
85
+ spec.files = Dir.glob('{lib,bin}/**/*') + %w[README.md LICENSE.txt]
86
+ spec.bindir = 'exe'
87
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
88
+ spec.require_paths = ['lib']
89
+
90
+ spec.add_dependency 'rake', '~> 13.0'
91
+
92
+ spec.add_development_dependency 'rspec', '~> 3.12'
93
+ spec.add_development_dependency 'rubocop', '~> 1.60'
94
+ end
95
+ ```
96
+
97
+ ## Code Quality Standards
98
+
99
+ ### Mandatory Quality Checks
100
+
101
+ **CRITICAL**: After implementing ANY feature, you MUST run these commands in order.
102
+
103
+ **IMPORTANT**: These commands MUST match your GitHub Actions workflows to prevent CI/CD failures!
104
+
105
+ ```bash
106
+ # Pre-Commit Checklist (MUST match .github/workflows/*.yml)
107
+
108
+ # 1. Lint (MUST pass with no warnings - matches workflow)
109
+ bundle exec rubocop
110
+
111
+ # 2. Run all tests (MUST pass 100% - matches workflow)
112
+ bundle exec rspec
113
+ # or: bundle exec rake test (for Minitest)
114
+
115
+ # 3. Check coverage (MUST meet threshold - matches workflow)
116
+ COVERAGE=true bundle exec rspec
117
+
118
+ # 4. Security audit (matches workflow)
119
+ bundle exec bundler-audit check --update
120
+
121
+ # 5. Build gem (if gem project - matches workflow)
122
+ gem build *.gemspec
123
+
124
+ # If ANY fails: ❌ DO NOT COMMIT - Fix first!
125
+ ```
126
+
127
+ **If ANY of these fail, you MUST fix the issues before committing.**
128
+
129
+ **Why This Matters:**
130
+ - Running different commands locally than in CI causes "works on my machine" failures
131
+ - CI/CD workflows will fail if commands don't match
132
+ - Example: Using `rubocop -a` (auto-correct) locally but `rubocop` in CI = failure
133
+ - Example: Missing security audit locally = CI catches vulnerabilities in dependencies
134
+
135
+ ### Linting with RuboCop
136
+
137
+ - Configuration in `.rubocop.yml`
138
+ - Must pass with no offenses
139
+ - Auto-correct safe offenses only
140
+
141
+ Example `.rubocop.yml`:
142
+ ```yaml
143
+ require:
144
+ - rubocop-performance
145
+ - rubocop-rspec
146
+
147
+ AllCops:
148
+ TargetRubyVersion: 3.2
149
+ NewCops: enable
150
+ Exclude:
151
+ - 'vendor/**/*'
152
+ - 'tmp/**/*'
153
+ - 'bin/**/*'
154
+
155
+ Style/StringLiterals:
156
+ EnforcedStyle: single_quotes
157
+
158
+ Metrics/MethodLength:
159
+ Max: 15
160
+ Exclude:
161
+ - 'spec/**/*'
162
+
163
+ Metrics/BlockLength:
164
+ Exclude:
165
+ - 'spec/**/*'
166
+ - '*.gemspec'
167
+ ```
168
+
169
+ ### Testing
170
+
171
+ - **Framework**: RSpec (recommended) or Minitest
172
+ - **Location**: `/spec` (RSpec) or `/test` (Minitest)
173
+ - **Coverage**: SimpleCov (80%+ threshold)
174
+ - **Focus**: Write descriptive specs
175
+
176
+ Example RSpec test:
177
+ ```ruby
178
+ # spec/my_class_spec.rb
179
+
180
+ RSpec.describe MyClass do
181
+ let(:instance) { described_class.new(value: 'test') }
182
+
183
+ describe '#process' do
184
+ context 'with valid input' do
185
+ it 'returns processed value' do
186
+ result = instance.process('input')
187
+ expect(result).to eq('PROCESSED: input')
188
+ end
189
+
190
+ it 'handles empty strings' do
191
+ expect(instance.process('')).to be_nil
192
+ end
193
+ end
194
+
195
+ context 'with invalid input' do
196
+ it 'raises ArgumentError' do
197
+ expect { instance.process(nil) }.to raise_error(ArgumentError)
198
+ end
199
+ end
200
+ end
201
+
202
+ describe '#validate' do
203
+ it 'returns true for valid data' do
204
+ expect(instance.validate('valid')).to be true
205
+ end
206
+
207
+ it 'returns false for invalid data' do
208
+ expect(instance.validate('')).to be false
209
+ end
210
+ end
211
+ end
212
+ ```
213
+
214
+ Example Minitest:
215
+ ```ruby
216
+ # test/my_class_test.rb
217
+
218
+ require 'test_helper'
219
+
220
+ class MyClassTest < Minitest::Test
221
+ def setup
222
+ @instance = MyClass.new(value: 'test')
223
+ end
224
+
225
+ def test_process_returns_expected_value
226
+ result = @instance.process('input')
227
+ assert_equal 'PROCESSED: input', result
228
+ end
229
+
230
+ def test_process_handles_empty_strings
231
+ assert_nil @instance.process('')
232
+ end
233
+
234
+ def test_process_raises_on_nil
235
+ assert_raises(ArgumentError) { @instance.process(nil) }
236
+ end
237
+ end
238
+ ```
239
+
240
+ ### Coverage Configuration
241
+
242
+ Create `spec/spec_helper.rb`:
243
+ ```ruby
244
+ if ENV['COVERAGE']
245
+ require 'simplecov'
246
+ require 'simplecov-lcov'
247
+
248
+ SimpleCov::Formatter::LcovFormatter.config.report_with_single_file = true
249
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
250
+ SimpleCov::Formatter::HTMLFormatter,
251
+ SimpleCov::Formatter::LcovFormatter
252
+ ])
253
+
254
+ SimpleCov.start do
255
+ add_filter '/spec/'
256
+ add_filter '/test/'
257
+
258
+ minimum_coverage 80
259
+ minimum_coverage_by_file 70
260
+ end
261
+ end
262
+
263
+ require 'your_gem'
264
+
265
+ RSpec.configure do |config|
266
+ config.expect_with :rspec do |expectations|
267
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
268
+ end
269
+
270
+ config.mock_with :rspec do |mocks|
271
+ mocks.verify_partial_doubles = true
272
+ end
273
+
274
+ config.shared_context_metadata_behavior = :apply_to_host_groups
275
+ config.filter_run_when_matching :focus
276
+ config.example_status_persistence_file_path = 'spec/examples.txt'
277
+ config.disable_monkey_patching!
278
+ config.warnings = true
279
+
280
+ config.default_formatter = 'doc' if config.files_to_run.one?
281
+ config.profile_examples = 10
282
+ config.order = :random
283
+ Kernel.srand config.seed
284
+ end
285
+ ```
286
+
287
+ ## Dependency Management
288
+
289
+ ### Using Bundler
290
+
291
+ ```bash
292
+ # Install dependencies
293
+ bundle install
294
+
295
+ # Update dependencies
296
+ bundle update
297
+
298
+ # Check for outdated gems
299
+ bundle outdated
300
+
301
+ # Security audit
302
+ bundle exec bundler-audit check --update
303
+ ```
304
+
305
+ ### Gemfile.lock
306
+
307
+ - **MUST** commit Gemfile.lock for applications
308
+ - For gems: Add to `.gitignore`
309
+ - Ensures reproducible builds
310
+
311
+ ## Best Practices
312
+
313
+ ### DO's ✅
314
+
315
+ - **USE** meaningful variable and method names
316
+ - **FOLLOW** Ruby naming conventions (snake_case)
317
+ - **WRITE** descriptive tests with context blocks
318
+ - **HANDLE** exceptions explicitly
319
+ - **VALIDATE** inputs
320
+ - **DOCUMENT** public APIs
321
+ - **USE** symbols for hash keys when possible
322
+ - **FREEZE** string literals in Ruby 3+
323
+
324
+ ### DON'Ts ❌
325
+
326
+ - **NEVER** use global variables
327
+ - **NEVER** monkey-patch core classes without extreme caution
328
+ - **NEVER** skip tests
329
+ - **NEVER** commit `.byebug_history` or debug files
330
+ - **NEVER** use `eval` unless absolutely necessary
331
+ - **NEVER** ignore RuboCop offenses without justification
332
+ - **NEVER** commit with failing tests
333
+
334
+ Example code style:
335
+ ```ruby
336
+ # ✅ GOOD: Clean Ruby code
337
+ class DataProcessor
338
+ def initialize(options = {})
339
+ @threshold = options.fetch(:threshold, 0.5)
340
+ @verbose = options.fetch(:verbose, false)
341
+ end
342
+
343
+ def process(data)
344
+ validate_input!(data)
345
+
346
+ log('Processing data...') if @verbose
347
+
348
+ data.select { |item| item[:value] > @threshold }
349
+ end
350
+
351
+ private
352
+
353
+ def validate_input!(data)
354
+ raise ArgumentError, 'Data must be an array' unless data.is_a?(Array)
355
+ raise ArgumentError, 'Data cannot be empty' if data.empty?
356
+ end
357
+
358
+ def log(message)
359
+ puts "[#{Time.now.iso8601}] #{message}"
360
+ end
361
+ end
362
+
363
+ # ❌ BAD: Poor practices
364
+ class DataProcessor
365
+ def process(data)
366
+ $threshold = 0.5 # DON'T use globals!
367
+
368
+ if data == nil # Use nil? method
369
+ return false
370
+ end
371
+
372
+ result = []
373
+ for item in data # Use .each or .map
374
+ if item[:value] > $threshold
375
+ result.push(item)
376
+ end
377
+ end
378
+
379
+ puts result # DON'T print in library code
380
+ result
381
+ end
382
+ end
383
+ ```
384
+
385
+ ## CI/CD Requirements
386
+
387
+ Must include GitHub Actions workflows:
388
+
389
+ 1. **Testing** (`ruby-test.yml`):
390
+ - Test on ubuntu-latest, windows-latest, macos-latest
391
+ - Ruby versions: 3.2, 3.3
392
+ - Upload coverage to Codecov
393
+
394
+ 2. **Linting** (`ruby-lint.yml`):
395
+ - RuboCop checks
396
+ - Bundler audit for security
397
+
398
+ 3. **Build** (`ruby-build.yml`):
399
+ - Build gem
400
+ - Verify gem structure
401
+
402
+ ## Publishing to RubyGems
403
+
404
+ ### Prerequisites
405
+
406
+ 1. Create account at https://rubygems.org
407
+ 2. Get API key: `gem signin`
408
+ 3. Add `RUBYGEMS_API_KEY` to GitHub secrets
409
+
410
+ ### Publishing Workflow
411
+
412
+ ```bash
413
+ # 1. Update version in gemspec or version.rb
414
+ # 2. Update CHANGELOG.md
415
+ # 3. Run all quality checks
416
+ bundle exec rubocop
417
+ bundle exec rspec
418
+ gem build *.gemspec
419
+
420
+ # 4. Create git tag
421
+ git tag -a v1.0.0 -m "Release version 1.0.0"
422
+
423
+ # 5. Push (manual if SSH password)
424
+ # git push origin main
425
+ # git push origin v1.0.0
426
+
427
+ # 6. Publish to RubyGems (or use GitHub Actions)
428
+ gem push your_gem-1.0.0.gem
429
+ ```
430
+
431
+ <!-- RUBY:END -->