gem-skill 0.1.1 → 0.1.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e549225e7af0a6d96b302304225a274d5f5aa6074e8546c64034b3aba056d675
4
- data.tar.gz: f2791cd10d4e1483763a890bb864cb5169ab6fc1c5239ae697e104d70ec1d898
3
+ metadata.gz: 81806de91a59a0b2f9144dedebda65f568d61629064f6182f753229fced49583
4
+ data.tar.gz: 444441e8f081192ceb5b6201bc8c2c9428b243729df896a4405db562d435ad7d
5
5
  SHA512:
6
- metadata.gz: 7a75fec793180d52a07e7eb42c84d79eca1ba720aec44c33ec13f6783678ec96770f0bbe0ce4789ecdfdafc6c7df882c392fcea9e48f55fb99d47877dff0b7b6
7
- data.tar.gz: d605f135da72c0bcdf5cb5f85c42b1f40bc5d13f46330264fd420401faa43dc67503949592c3dd15cfba0b62115b8a14a97d1850072a32309ad10a1833cbfb9c
6
+ metadata.gz: 39ed27eb70e0036d097b01576a78a20a13ed337ddf05abfc5f5a63a0279b65c79d327907cc70fa96d132d7e72ae3d47ce5cdb5a0bb50e30cbfbb441ce428611d
7
+ data.tar.gz: 6c0fd5f43ffeac14efe923f9b1742ab469d3e08c50f86dd521c38d45d003800fe45a8447dcb682df0014419d1421d1b2f20eb326d3b6c7f2d3b1d7d0210974bb
data/.envrc ADDED
@@ -0,0 +1 @@
1
+ export RR=`pwd`
@@ -0,0 +1,52 @@
1
+ name: Deploy Documentation to GitHub Pages
2
+ on:
3
+ push:
4
+ branches:
5
+ - main
6
+ - develop
7
+ paths:
8
+ - "docs/**"
9
+ - "mkdocs.yml"
10
+ - ".github/workflows/deploy-github-pages.yml"
11
+ workflow_dispatch:
12
+
13
+ permissions:
14
+ contents: write
15
+ pages: write
16
+ id-token: write
17
+
18
+ jobs:
19
+ deploy:
20
+ runs-on: ubuntu-latest
21
+ steps:
22
+ - name: Checkout code
23
+ uses: actions/checkout@v4
24
+ with:
25
+ fetch-depth: 0
26
+
27
+ - name: Setup Python
28
+ uses: actions/setup-python@v5
29
+ with:
30
+ python-version: 3.x
31
+
32
+ - name: Install dependencies
33
+ run: |
34
+ pip install mkdocs
35
+ pip install mkdocs-material
36
+ pip install mkdocs-macros-plugin
37
+ pip install mike
38
+
39
+ - name: Configure Git
40
+ run: |
41
+ git config --local user.email "action@github.com"
42
+ git config --local user.name "GitHub Action"
43
+
44
+ - name: Deploy to GitHub Pages
45
+ run: |
46
+ if [ "${{ github.ref }}" = "refs/heads/main" ]; then
47
+ echo "Deploying from main branch"
48
+ mkdocs gh-deploy --force --clean
49
+ else
50
+ echo "Deploying from develop branch"
51
+ mkdocs gh-deploy --force --clean
52
+ fi
data/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
+ # Changelog
2
+
3
+ All notable changes to gem-skill are documented here.
4
+ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
5
+
1
6
  ## [Unreleased]
2
7
 
8
+ ## [0.1.3] - 2026-06-17
9
+
10
+ ### Added
11
+ - `gem skill setup` subcommand — registers gem-skill as a Bundler plugin in one step
12
+ - `--version` / `-v` flag for both `gem skill` and `bundle skill`
13
+ - `post_install_message` guiding users to run `gem skill setup` after install
14
+ - `async` gem dependency — concurrent fiber-based LLM calls replace threads
15
+ - `Gem::Skill::Runner` module — shared `install_skill` core extracted from both CLI commands
16
+ - `test/support/cache_helpers.rb` — shared `stub_cache_root`/`restore_cache_root` test helpers
17
+ - MkDocs documentation site (`docs/`) with full reference for all commands, cache layout, skill file format, and architecture
18
+
19
+ ### Changed
20
+ - `bundle skill install` and `bundle skill refresh` now run all gems concurrently via `Async::Barrier` (previously sequential)
21
+ - `gem skill install` also migrated from threads to async fibers
22
+ - `Lockfile.gems` now includes runtime dependencies declared in gemspec files (via `gemspec` in `Gemfile`), not just direct `Gemfile` entries
23
+ - `.claude/skills/` symlinks now point to version directories (e.g. `~/.gem/skills/faraday/2.14.3/`) instead of individual `SKILL.md` files
24
+ - `GEMSKILL_DIR` environment variable controls the cache root (default: `~/.gem/skills`)
25
+ - `GEMSKILL_MODEL` environment variable controls the default LLM model
26
+ - `scripts/e2e_test` updated to exercise the full pipeline: Fetch → Runner → Cache → Linker
27
+
28
+ ### Removed
29
+ - `thor` runtime dependency (was declared but never used)
30
+
3
31
  ## [0.1.0] - 2026-06-16
4
32
 
5
33
  - Initial release
data/README.md CHANGED
@@ -1,7 +1,18 @@
1
1
  # gem-skill
2
2
 
3
- Generates Claude Code skill files from Ruby gem documentation and caches them
4
- globally so every project that uses a gem can share the same pre-built knowledge.
3
+ <p align="center">
4
+ <table style="width:38%;margin:0 auto;" border="0" cellpadding="8">
5
+ <tr>
6
+ <td width="40%"><img src="docs/assets/images/gem-skill.jpg" alt="gem-skill logo" width="100%"></td>
7
+ <td width="60%">
8
+ Generate Claude Code skill files from Ruby gem
9
+ documentation and caches them globally so every project that uses a gem
10
+ can share the same pre-built knowledge.<br><br>
11
+ <strong><a href="https://madbomber.github.io/gem-skill">Full documentation →</a></strong>
12
+ </td>
13
+ </tr>
14
+ </table>
15
+ </p>
5
16
 
6
17
  ## The problem it solves
7
18
 
@@ -31,7 +42,7 @@ Each project's `.claude/skills/` holds symlinks that point into this cache:
31
42
 
32
43
  ```
33
44
  your-app/.claude/skills/
34
- └── chunker-ruby.md → ~/.gem/skills/chunker-ruby/1.2.3/SKILL.md
45
+ └── chunker-ruby/ → ~/.gem/skills/chunker-ruby/1.2.3/
35
46
  ```
36
47
 
37
48
  Two projects that pin different versions of the same gem each get the right
@@ -41,17 +52,14 @@ skill; the underlying content is generated once and shared.
41
52
 
42
53
  ```bash
43
54
  gem install gem-skill
55
+ gem skill setup
44
56
  ```
45
57
 
46
- This gives you the `gem skill` subcommand.
58
+ `gem install` gives you the `gem skill` subcommand.
59
+ `gem skill setup` registers gem-skill as a Bundler plugin, enabling `bundle skill` in any project.
47
60
 
48
- For `bundle skill` support (project-aware, reads `Gemfile.lock`), also run:
49
-
50
- ```bash
51
- bundle plugin install gem-skill
52
- ```
53
-
54
- or add it to your `Gemfile`:
61
+ You only need to run `gem skill setup` once per machine. Alternatively, you can
62
+ add the plugin directly to a project's `Gemfile`:
55
63
 
56
64
  ```ruby
57
65
  plugin "gem-skill"
@@ -113,10 +121,23 @@ gem skill purge chunker-ruby 1.2.3
113
121
 
114
122
  # Remove all cached versions of a gem
115
123
  gem skill purge chunker-ruby --all
124
+
125
+ # Print the installed version
126
+ gem skill --version
116
127
  ```
117
128
 
118
129
  If a gem isn't installed locally, `gem skill install` will install it first.
119
130
 
131
+ ### `gem skill setup`
132
+
133
+ Run once after `gem install gem-skill` to enable `bundle skill` globally:
134
+
135
+ ```bash
136
+ gem skill setup
137
+ ```
138
+
139
+ This registers gem-skill as a Bundler plugin so `bundle skill` works in every project.
140
+
120
141
  ### `gem install --with-skill`
121
142
 
122
143
  Generate skills for gems as you install them:
@@ -144,10 +165,10 @@ bundle skill list
144
165
  # Options available on install and refresh
145
166
  bundle skill install --force
146
167
  bundle skill install --model claude-haiku-4-5
147
- ```
148
168
 
149
- The `install` and `refresh` commands stream LLM output as it is generated, so
150
- you see progress rather than a silent wait.
169
+ # Print the installed version
170
+ bundle skill --version
171
+ ```
151
172
 
152
173
  ## What gets generated
153
174
 
Binary file
data/docs/cache.md ADDED
@@ -0,0 +1,108 @@
1
+ # Cache
2
+
3
+ ## Location
4
+
5
+ The global skill cache lives at `~/.gem/skills` by default. Override with:
6
+
7
+ ```bash
8
+ export GEMSKILL_DIR="/path/to/your/cache"
9
+ ```
10
+
11
+ ## Structure
12
+
13
+ ```
14
+ ~/.gem/skills/
15
+ ├── debug_me/
16
+ │ └── 1.1.0/
17
+ │ ├── SKILL.md
18
+ │ └── metadata.json
19
+ ├── faraday/
20
+ │ ├── 2.12.0/
21
+ │ │ ├── SKILL.md
22
+ │ │ └── metadata.json
23
+ │ └── 2.14.3/
24
+ │ ├── SKILL.md
25
+ │ └── metadata.json
26
+ └── zeitwerk/
27
+ └── 2.8.2/
28
+ ├── SKILL.md
29
+ └── metadata.json
30
+ ```
31
+
32
+ Each gem can have multiple cached versions. They coexist without conflict — two
33
+ projects pinning different versions of the same gem each get the correct skill.
34
+
35
+ ## Files
36
+
37
+ ### `SKILL.md`
38
+
39
+ The generated skill file. Contains structured documentation tailored for
40
+ Claude Code. See [Skill Files](skill-files.md) for the format.
41
+
42
+ ### `metadata.json`
43
+
44
+ Stores provenance information:
45
+
46
+ ```json
47
+ {
48
+ "gem_name": "faraday",
49
+ "version": "2.14.3",
50
+ "model": "claude-sonnet-4-6",
51
+ "generated_at": "2026-06-17T10:23:45Z",
52
+ "sources": ["readme", "changelog", "rubygems"]
53
+ }
54
+ ```
55
+
56
+ ## Cache commands
57
+
58
+ ```bash
59
+ # List everything in the cache
60
+ gem skill list
61
+
62
+ # Remove a specific version
63
+ gem skill purge faraday 2.12.0
64
+
65
+ # Remove all versions of a gem
66
+ gem skill purge faraday --all
67
+ ```
68
+
69
+ ## Sharing the cache
70
+
71
+ You can share a skill cache across machines by pointing `GEMSKILL_DIR` at a
72
+ shared location:
73
+
74
+ ```bash
75
+ # Team-shared network drive
76
+ export GEMSKILL_DIR="/Volumes/team-shared/gem-skills"
77
+ ```
78
+
79
+ All machines with the same `GEMSKILL_DIR` will read and write to the same cache.
80
+ Skills generated on one machine are immediately available on others.
81
+
82
+ ## Project symlinks
83
+
84
+ Projects don't store skills locally — they hold symlinks into the global cache:
85
+
86
+ ```
87
+ your-project/.claude/skills/
88
+ ├── faraday → ~/.gem/skills/faraday/2.14.3/
89
+ └── zeitwerk → ~/.gem/skills/zeitwerk/2.8.2/
90
+ ```
91
+
92
+ Each symlink points to the **version directory**. Claude Code reads `SKILL.md`
93
+ from inside the linked directory.
94
+
95
+ `bundle skill refresh` updates symlinks when versions change after `bundle update`.
96
+ `bundle skill list` shows the status of all current symlinks.
97
+
98
+ ## Regenerating skills
99
+
100
+ Skills do not auto-expire. Regenerate explicitly when you want updated content:
101
+
102
+ ```bash
103
+ # Regenerate one gem
104
+ gem skill install faraday --force
105
+
106
+ # Regenerate all project gems with a better model
107
+ bundle skill install --force --model claude-opus-4-8
108
+ ```
@@ -0,0 +1,147 @@
1
+ # bundle skill
2
+
3
+ The `bundle skill` command is project-aware: it reads `Gemfile.lock` to
4
+ determine which gems and versions are in use, generates skills for all of them,
5
+ and links the results into `.claude/skills/` in the project root.
6
+
7
+ ## Global options
8
+
9
+ These flags work without a subcommand:
10
+
11
+ ```bash
12
+ bundle skill --version # print installed version and exit
13
+ bundle skill -v # same
14
+ ```
15
+
16
+ ## Prerequisites
17
+
18
+ Run once after installing gem-skill:
19
+
20
+ ```bash
21
+ gem skill setup
22
+ ```
23
+
24
+ Or add to the project `Gemfile`:
25
+
26
+ ```ruby
27
+ plugin "gem-skill"
28
+ ```
29
+
30
+ ## Subcommands
31
+
32
+ ### `bundle skill install`
33
+
34
+ Generate and link skills for all direct dependencies in `Gemfile.lock`.
35
+
36
+ ```bash
37
+ bundle skill install [OPTIONS]
38
+ ```
39
+
40
+ **Options:**
41
+
42
+ | Flag | Description |
43
+ |------|-------------|
44
+ | `--force` | Regenerate even if skills are already cached |
45
+ | `--model MODEL` | LLM model to use (overrides `GEMSKILL_MODEL`) |
46
+ | `--version`, `-v` | Print the installed gem-skill version and exit |
47
+
48
+ **Example:**
49
+
50
+ ```bash
51
+ cd your-project
52
+ bundle skill install
53
+ ```
54
+
55
+ **What it processes:**
56
+
57
+ - All gems listed in the `DEPENDENCIES` section of `Gemfile.lock`
58
+ - Runtime dependencies declared in any `gemspec` referenced by the `Gemfile` (via `gemspec` directive)
59
+
60
+ All gems are processed concurrently:
61
+
62
+ ```
63
+ ⠋ Installing skills (claude-sonnet-4-6)
64
+ ✓ rake 13.4.2 already cached
65
+ ✓ zeitwerk 2.8.2 done
66
+ ✓ ruby_llm 1.16.0 done
67
+ ```
68
+
69
+ After completion, each skill is symlinked into `.claude/skills/`:
70
+
71
+ ```
72
+ your-project/.claude/skills/
73
+ ├── rake → ~/.gem/skills/rake/13.4.2/
74
+ ├── ruby_llm → ~/.gem/skills/ruby_llm/1.16.0/
75
+ └── zeitwerk → ~/.gem/skills/zeitwerk/2.8.2/
76
+ ```
77
+
78
+ Claude Code automatically reads `SKILL.md` from each linked directory.
79
+
80
+ ---
81
+
82
+ ### `bundle skill refresh`
83
+
84
+ Re-sync `.claude/skills/` after `bundle update`.
85
+
86
+ ```bash
87
+ bundle skill refresh [OPTIONS]
88
+ ```
89
+
90
+ | Flag | Description |
91
+ |------|-------------|
92
+ | `--force` | Regenerate all skills, even those already at the correct version |
93
+ | `--model MODEL` | LLM model to use |
94
+
95
+ `refresh` skips gems that are already linked at the correct version (shows
96
+ `up to date`), regenerates gems whose version changed, and removes dead symlinks
97
+ for gems no longer in `Gemfile.lock`.
98
+
99
+ **Typical workflow:**
100
+
101
+ ```bash
102
+ bundle update
103
+ bundle skill refresh
104
+ ```
105
+
106
+ ---
107
+
108
+ ### `bundle skill list`
109
+
110
+ Show all skills currently linked in this project.
111
+
112
+ ```bash
113
+ bundle skill list
114
+ ```
115
+
116
+ **Example output:**
117
+
118
+ ```
119
+ Skills linked in .claude/skills/ (3 ok):
120
+
121
+ [ok ] rake 13.4.2
122
+ [ok ] ruby_llm 1.16.0
123
+ [ok ] zeitwerk 2.8.2
124
+ ```
125
+
126
+ A `BROKEN` status means the symlink target no longer exists in the cache —
127
+ run `bundle skill install` to regenerate.
128
+
129
+ ---
130
+
131
+ ## Typical project workflow
132
+
133
+ ```bash
134
+ # First time setup
135
+ bundle install
136
+ bundle skill install
137
+
138
+ # After bundle update
139
+ bundle update
140
+ bundle skill refresh
141
+
142
+ # Check what's linked
143
+ bundle skill list
144
+
145
+ # Force full regeneration (e.g. after model upgrade)
146
+ bundle skill install --force --model claude-opus-4-8
147
+ ```
@@ -0,0 +1,135 @@
1
+ # gem skill
2
+
3
+ The `gem skill` command manages the global skill cache at `~/.gem/skills`.
4
+ It works with any installed gem regardless of project context.
5
+
6
+ ## Subcommands
7
+
8
+ ### `gem skill install`
9
+
10
+ Generate and cache a `SKILL.md` for one or more gems.
11
+
12
+ ```bash
13
+ gem skill install GEM_NAME [GEM_NAME ...]
14
+ ```
15
+
16
+ **Options:**
17
+
18
+ | Flag | Description |
19
+ |------|-------------|
20
+ | `--force`, `-f` | Regenerate even if a skill is already cached |
21
+ | `--model MODEL`, `-m MODEL` | LLM model to use (overrides `GEMSKILL_MODEL`) |
22
+ | `--version`, `-v` | Print the installed gem-skill version and exit |
23
+
24
+ **Examples:**
25
+
26
+ ```bash
27
+ # Single gem (version auto-detected from installed gems)
28
+ gem skill install debug_me
29
+
30
+ # Multiple gems concurrently
31
+ gem skill install faraday zeitwerk dry-validation
32
+
33
+ # Force regeneration with a specific model
34
+ gem skill install rails --force --model claude-opus-4-8
35
+ ```
36
+
37
+ If a gem is not installed locally, gem-skill will install it automatically
38
+ before generating the skill.
39
+
40
+ ---
41
+
42
+ ### `gem skill --version`
43
+
44
+ Print the installed gem-skill version and exit.
45
+
46
+ ```bash
47
+ gem skill --version
48
+ # 0.1.3
49
+ gem skill -v
50
+ # 0.1.3
51
+ ```
52
+
53
+ All gems are processed concurrently — you'll see a live spinner per gem:
54
+
55
+ ```
56
+ ⠋ Generating skills (claude-sonnet-4-6)
57
+ ✓ debug_me 1.1.0 done
58
+ ✓ faraday 2.12.0 done
59
+ ⠋ zeitwerk 2.8.2
60
+ ```
61
+
62
+ ---
63
+
64
+ ### `gem skill setup`
65
+
66
+ Register gem-skill as a Bundler plugin (run once after `gem install gem-skill`).
67
+
68
+ ```bash
69
+ gem skill setup
70
+ ```
71
+
72
+ This enables `bundle skill` in any project on the machine. See
73
+ [Installation](../installation.md) for details.
74
+
75
+ ---
76
+
77
+ ### `gem skill list`
78
+
79
+ Show all skills currently in the global cache.
80
+
81
+ ```bash
82
+ gem skill list
83
+ ```
84
+
85
+ **Example output:**
86
+
87
+ ```
88
+ Cached skills in /Users/you/.gem/skills:
89
+
90
+ debug_me 1.1.0
91
+ faraday 2.12.0, 2.14.3
92
+ zeitwerk 2.8.2
93
+
94
+ 3 gem(s), 4 version(s) total.
95
+ ```
96
+
97
+ ---
98
+
99
+ ### `gem skill purge`
100
+
101
+ Remove a cached skill version.
102
+
103
+ ```bash
104
+ # Remove a specific version
105
+ gem skill purge GEM_NAME VERSION
106
+
107
+ # Remove all cached versions of a gem
108
+ gem skill purge GEM_NAME --all
109
+ ```
110
+
111
+ **Examples:**
112
+
113
+ ```bash
114
+ gem skill purge faraday 2.12.0
115
+ gem skill purge rails --all
116
+ ```
117
+
118
+ ---
119
+
120
+ ## `gem install --with-skill`
121
+
122
+ Generate skills automatically as you install gems:
123
+
124
+ ```bash
125
+ gem install faraday zeitwerk --with-skill
126
+ ```
127
+
128
+ All gems install normally first. Skills are then generated concurrently after
129
+ all installs complete — same spinner UI as `gem skill install`.
130
+
131
+ This works for any `gem install` command, including version-pinned installs:
132
+
133
+ ```bash
134
+ gem install rails --version "~> 7.1" --with-skill
135
+ ```
@@ -0,0 +1,75 @@
1
+ # Configuration
2
+
3
+ ## LLM provider API keys
4
+
5
+ gem-skill uses [RubyLLM](https://github.com/crmne/ruby_llm) to generate skills.
6
+ Set at least one provider API key before running any `install` command:
7
+
8
+ ```bash
9
+ export ANTHROPIC_API_KEY="sk-ant-..." # Claude models
10
+ export OPENAI_API_KEY="sk-..." # GPT models
11
+ export GEMINI_API_KEY="..." # Gemini models
12
+ ```
13
+
14
+ Other supported providers:
15
+
16
+ | Environment variable | Provider |
17
+ |------------------------|--------------|
18
+ | `ANTHROPIC_API_KEY` | Anthropic |
19
+ | `OPENAI_API_KEY` | OpenAI |
20
+ | `GEMINI_API_KEY` | Google Gemini|
21
+ | `MISTRAL_API_KEY` | Mistral |
22
+ | `DEEPSEEK_API_KEY` | DeepSeek |
23
+ | `OPENROUTER_API_KEY` | OpenRouter |
24
+ | `XAI_API_KEY` | xAI (Grok) |
25
+
26
+ ## gem-skill environment variables
27
+
28
+ ### `GEMSKILL_DIR`
29
+
30
+ Controls where generated skills are cached.
31
+
32
+ | | |
33
+ |---|---|
34
+ | **Default** | `~/.gem/skills` |
35
+ | **Example** | `export GEMSKILL_DIR="/Volumes/shared/gem-skills"` |
36
+
37
+ Useful for sharing a skill cache across machines via a network drive, or for
38
+ keeping skills in a non-standard location.
39
+
40
+ ### `GEMSKILL_MODEL`
41
+
42
+ Controls which LLM model is used when generating skills.
43
+
44
+ | | |
45
+ |---|---|
46
+ | **Default** | `gpt-5.5` |
47
+ | **Example** | `export GEMSKILL_MODEL="claude-opus-4-8"` |
48
+
49
+ The `--model` flag on any command overrides `GEMSKILL_MODEL` for that single
50
+ invocation only.
51
+
52
+ ## Recommended shell configuration
53
+
54
+ Add to your `~/.zshrc` or `~/.bashrc`:
55
+
56
+ ```bash
57
+ export ANTHROPIC_API_KEY="sk-ant-..."
58
+ export GEMSKILL_MODEL="claude-sonnet-4-6" # or whichever model you prefer
59
+ ```
60
+
61
+ ## Model selection guidance
62
+
63
+ | Model | Best for |
64
+ |-------|----------|
65
+ | Claude Opus 4.8 | Highest quality skills; comprehensive coverage |
66
+ | Claude Sonnet 4.6 | Good balance of quality and speed |
67
+ | Claude Haiku 4.5 | Fast, cheap; good for simple gems |
68
+ | GPT-5.5 | Default; strong general-purpose coverage |
69
+
70
+ Pass `--model MODEL` to any install command to override for one run:
71
+
72
+ ```bash
73
+ gem skill install rails --model claude-opus-4-8
74
+ bundle skill install --model claude-haiku-4-5
75
+ ```