Class: LcpRuby::Generators::ClaudeSkillsGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/lcp_ruby/claude_skills_generator.rb

Overview

Legacy skills-only in-app entry. Installs LCP-specific AI authoring skills into all supported agent skill directories by copying them from the gem’s bundled ‘.claude/skills/` source. Re-running refreshes the skills to the version shipped with the currently installed gem (useful after `bundle update lcp`) and prunes any `lcp-*` skills the gem no longer ships. Non-`lcp-*` skills are never touched.

This is the skills-only in-app entry; ‘lcp_ruby:agent_setup` uses the same targets and additionally writes the CLAUDE.md/AGENTS.md entrypoint. Both call the installer directly (no generator-calls-generator).

Instance Method Summary collapse

Instance Method Details

#install_skillsObject



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/generators/lcp_ruby/claude_skills_generator.rb', line 21

def install_skills
  @results = {}
  LcpRuby::SkillsInstaller.agent_skill_targets(root: destination_root).each do |agent, target|
    result = LcpRuby::SkillsInstaller.new(target: target).call
    @results[agent] = result

    relative_target = File.join(LcpRuby::SkillsInstaller::AGENT_DIRECTORIES.fetch(agent), "skills")
    result.created.each { |n| say_status :create, "#{relative_target}/#{n}", :green }
    result.updated.each { |n| say_status :update, "#{relative_target}/#{n}", :yellow }
    result.removed.each { |n| say_status :remove, "#{relative_target}/#{n}", :red }
  end
end

#show_post_install_messageObject



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/generators/lcp_ruby/claude_skills_generator.rb', line 34

def show_post_install_message
  return if @results.nil? || @results.values.none?(&:any_changes?)

  installed = @results.values.flat_map { |result| result.created + result.updated }.uniq.sort
  say ""
  say "Installed #{installed.size} LCP Ruby AI agent skill(s):", :green
  installed.each { |n| say "  - #{n}" }
  say ""
  say "Skills auto-trigger in Claude Code and Codex based on context (description keywords)."
  say "List available skills via /skills inside Claude Code or the Codex skills list."
  say ""
  say "Preferred refresh after `bundle update lcp`:"
  say "  bin/rails generate lcp_ruby:agent_setup"
  say ""
end