ruby-gem-scaffolder
# Ruby Gem Scaffolder Skill
What this skill does
# Ruby Gem Scaffolder Skill Intelligent gem creation and scaffolding following Ruby best practices. ## When to Activate This skill activates when: - User requests to create a new gem - User asks to scaffold a Ruby library - User wants to extract code into a gem - User mentions "gemspec" or "gem structure" ## Core Capabilities ### 1. Create New Gem **Using Bundler (Recommended):** ```bash bundle gem gem_name # With RSpec bundle gem gem_name --test=rspec # With MIT license bundle gem gem_name --mit # With code of conduct bundle gem gem_name --coc # All together bundle gem gem_name --test=rspec --mit --coc ``` **Interactive Creation:** When user requests: "Create a new gem called my_awesome_gem" Ask clarifying questions: 1. Test framework? (rspec/minitest) 2. License? (MIT/Apache-2.0/GPL-3.0) 3. CI? (GitHub Actions/CircleCI/None) 4. Code of Conduct? (yes/no) Then scaffold appropriately. ### 2. Standard Gem Structure ``` my_gem/ ├── .github/ │ └── workflows/ │ └── ci.yml # GitHub Actions CI ├── lib/ │ ├── my_gem/ │ │ └── version.rb # Version constant │ └── my_gem.rb # Main entry point ├── spec/ │ ├── spec_helper.rb # RSpec configuration │ └── my_gem_spec.rb # Tests ├── .gitignore # Git ignores ├── .rubocop.yml # RuboCop config ├── CHANGELOG.md # Version history ├── CODE_OF_CONDUCT.md # Community guidelines ├── Gemfile # Development dependencies ├── LICENSE.txt # License text ├── README.md # Documentation ├── Rakefile # Rake tasks └── my_gem.gemspec # Gem specification ``` ### 3. Generate Gemspec **Template gemspec:** ```ruby # frozen_string_literal: true require_relative "lib/my_gem/version" Gem::Specification.new do |spec| spec.name = "my_gem" spec.version = MyGem::VERSION spec.authors = ["Your Name"] spec.email = ["[email protected]"] spec.summary = "Brief description of your gem" spec.description = "Longer description of what your gem does" spec.homepage = "https://github.com/username/my_gem" spec.license = "MIT" spec.required_ruby_version = ">= 3.0.0" spec.metadata["homepage_uri"] = spec.homepage spec.metadata["source_code_uri"] = "https://github.com/username/my_gem" spec.metadata["changelog_uri"] = "https://github.com/username/my_gem/blob/main/CHANGELOG.md" # Specify which files should be added to the gem when it is released. spec.files = Dir.glob("lib/**/*") + %w[ README.md LICENSE.txt CHANGELOG.md ] spec.require_paths = ["lib"] # Runtime dependencies # spec.add_dependency "example-gem", "~> 1.0" # Development dependencies spec.add_development_dependency "rake", "~> 13.0" spec.add_development_dependency "rspec", "~> 3.12" spec.add_development_dependency "rubocop", "~> 1.50" end ``` ### 4. Create Main Entry Point **lib/my_gem.rb:** ```ruby # frozen_string_literal: true require_relative "my_gem/version" module MyGem class Error < StandardError; end # Your code goes here... # Optional: Configuration class << self attr_accessor :configuration end def self.configure self.configuration ||= Configuration.new yield(configuration) end class Configuration attr_accessor :option1, :option2 def initialize @option1 = "default_value" @option2 = "default_value" end end end ``` **lib/my_gem/version.rb:** ```ruby # frozen_string_literal: true module MyGem VERSION = "0.1.0" end ``` ### 5. Set Up Testing **spec/spec_helper.rb:** ```ruby # frozen_string_literal: true require "my_gem" RSpec.configure do |config| # Enable flags like --only-failures and --next-failure config.example_status_persistence_file_path = ".rspec_status" # Disable RSpec exposing methods globally on `Module` and `main` config.disable_monkey_patching! config.expect_with :rspec do |c| c.syntax = :expect end end ``` **spec/my_gem_spec.rb:** ```ruby # frozen_string_literal: true RSpec.describe MyGem do it "has a version number" do expect(MyGem::VERSION).not_to be nil end describe ".configure" do it "yields configuration block" do MyGem.configure do |config| config.option1 = "custom_value" end expect(MyGem.configuration.option1).to eq("custom_value") end end end ``` ### 6. Add Rake Tasks **Rakefile:** ```ruby # frozen_string_literal: true require "bundler/gem_tasks" require "rspec/core/rake_task" require "rubocop/rake_task" RSpec::Core::RakeTask.new(:spec) RuboCop::RakeTask.new task default: %i[spec rubocop] ``` **Usage:** ```bash rake spec # Run tests rake rubocop # Run linter rake # Run both (default) rake build # Build gem rake install # Install gem locally rake release # Release to RubyGems ``` ### 7. CI Configuration **GitHub Actions (.github/workflows/ci.yml):** ```yaml name: CI on: push: branches: [ main ] pull_request: branches: [ main ] jobs: test: runs-on: ubuntu-latest strategy: matrix: ruby-version: ['3.0', '3.1', '3.2'] steps: - uses: actions/checkout@v3 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby-version }} bundler-cache: true - name: Run tests run: bundle exec rake spec - name: Run RuboCop run: bundle exec rake rubocop ``` ### 8. Documentation Templates **README.md structure:** ```markdown # MyGem Brief description of what your gem does. ## Installation Add this line to your application's Gemfile: ```ruby gem 'my_gem' ``` And then execute: $ bundle install Or install it yourself as: $ gem install my_gem ## Usage ```ruby require 'my_gem' # Basic usage MyGem.do_something # With configuration MyGem.configure do |config| config.option1 = "value" end ``` ## Development After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. To install this gem onto your local machine, run `bundle exec rake install`. ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/username/my_gem. ## License The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). ``` **CHANGELOG.md structure:** ```markdown # Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] ### Added - Initial release - Core functionality ## [0.1.0] - 2025-01-15 ### Added - Initial release ``` ### 9. Common Gem Patterns **Pattern: CLI Gem** ```ruby # lib/my_gem/cli.rb require 'optparse' module MyGem class CLI def self.start(args) new(args).execute end def initialize(args) @args = args @options = {} end def execute parse_options # Your CLI logic here end private def parse_options OptionParser.new do |opts| opts.banner = "Usage: my_gem [options]" opts.on("-v", "--version", "Print version") do puts MyGem::VERSION exit end opts.on("-h", "--help", "Print help") do puts opts exit end end.parse!(@args) end end end ``` **Pattern: Library with Data Objects** ```ruby # lib/my_gem/data_object.rb module MyGem class DataObject attr_reader :attribute1, :attribute2 def self.build(attributes) new( attribute1: attributes[:attribute1], attribute2: attributes[:attribute2] ) end def initialize(attribute1:, attribute2:) @attribute1 = attribute1 @attribute2 = attribute2 end def to_h { attribute1: attribute1, attribute2
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.