$npx -y skills add Rune-kit/rune --skill graftClone, port, or convert features from any GitHub repo into your project. Use when stealing patterns from external repos or porting proven code. Understand before copy, challenge before implement. 4 modes: port (rewrite), compare (analysis), copy (transplant), improve (copy + opti
| 1 | # graft |
| 2 | |
| 3 | ## Purpose |
| 4 | |
| 5 | External code intelligence — structured workflow for learning from, adapting, and integrating features from any public repository into your project. Graft is NOT a copy-paste tool. It enforces understanding before adoption through a mandatory challenge gate that evaluates license compatibility, stack fit, scope, quality, and maintenance health before any code touches your codebase. |
| 6 | |
| 7 | ## Core Rule: The Tree is a Menu, Not the Meal |
| 8 | |
| 9 | When you clone a repo you see hundreds of files. **That tree is a menu — options to order from, not a meal to eat.** Grafting the whole tree is how context windows die and foreign patterns leak into your codebase. |
| 10 | |
| 11 | - Read the README + the **2-5 files that implement the target feature**. Skip the rest. |
| 12 | - If you cannot name the specific files you need before reading, you do not know what you want yet — go back to Step 0 and narrow scope. |
| 13 | - `WebFetch` on raw GitHub URLs beats `git clone` whenever you know the exact files. Use clone only when discovery is genuinely needed. |
| 14 | |
| 15 | **Reading to understand is not grafting.** The discipline above caps the **graft scope** — the files you actually transplant, port, or improve into your codebase (2-5, hard-cap 10). It does NOT cap how many files you may *read to learn a pattern*. Studying a 24-skill library to extract one convention legitimately reads dozens of files but grafts almost none. Keep the two counts separate: a wide read with a narrow graft is thorough; a wide graft is the failure mode. |
| 16 | |
| 17 | This menu discipline applies to the **transplant modes** (port, copy, improve). Copy mode is not an excuse to import a directory wholesale — you still select files deliberately. **Compare mode and survey scope (`--deep`)** are exempt from the read cap by design: their job is breadth of understanding, not transplant. They still must NOT import code wholesale — wide reading, narrow (or zero) graft. |
| 18 | |
| 19 | <HARD-GATE> |
| 20 | Challenge gate (Step 4) MUST complete before adaptation planning (Step 5). |
| 21 | No implementation without confronting trade-offs. This applies to ALL modes except compare. |
| 22 | Skip only with --fast flag (user accepts full responsibility). |
| 23 | </HARD-GATE> |
| 24 | |
| 25 | ## Modes |
| 26 | |
| 27 | ### Port (default) |
| 28 | Rewrite the target feature using YOUR stack and patterns. Source code is a reference, not a template. Output is idiomatic to your codebase. |
| 29 | |
| 30 | **When**: Different tech stack (Vue→React, Django→FastAPI), or source patterns conflict with your conventions. |
| 31 | |
| 32 | ### Compare |
| 33 | Side-by-side analysis only. No code changes. Outputs a structured comparison report. |
| 34 | |
| 35 | **When**: Evaluating whether to adopt a feature, benchmarking your implementation against another, or learning patterns without importing code. |
| 36 | |
| 37 | ### Copy |
| 38 | Pure transplant with minimal adaptation. Stays as close to the original as possible — only changes imports, paths, and config to fit your project structure. |
| 39 | |
| 40 | **When**: Same tech stack, source code is high quality, you want the exact implementation. |
| 41 | |
| 42 | ### Improve |
| 43 | Copy the feature, then refactor and optimize. Fix anti-patterns, add missing tests, adapt to your codebase conventions, upgrade deprecated APIs. |
| 44 | |
| 45 | **When**: Same stack but source has quality issues, or you want the feature but better. |
| 46 | |
| 47 | ## Speed Options |
| 48 | |
| 49 | | Flag | Research | Challenge Gate | User Approval | |
| 50 | |------|----------|---------------|---------------| |
| 51 | | (default) | ✅ Full | ✅ Yes | ✅ Each step | |
| 52 | | `--auto` | ✅ Full | ✅ Yes | ❌ Auto-approve | |
| 53 | | `--fast` | ❌ Skip | ❌ Skip | ❌ Auto-approve | |
| 54 | |
| 55 | **`--fast` warning**: Skipping challenge gate means no license check, no quality assessment. User accepts full responsibility. Announce: "Fast mode: skipping challenge gate. You are responsible for license and quality review." |
| 56 | |
| 57 | ## Scope Depth |
| 58 | |
| 59 | Orthogonal to mode and speed. Controls how widely you may read. |
| 60 | |
| 61 | | Scope | Read budget | Graft scope | When | |
| 62 | |-------|-------------|-------------|------| |
| 63 | | (default) | 2-5 files, hard-cap 10 | the feature's files | Transplant one feature/module | |
| 64 | | `--deep` (survey) | unbounded reads, full clone OK | narrow — patterns extracted, not files copied | Study a whole repo/library to learn architecture or compare many components | |
| 65 | |
| 66 | **`--deep` is for understanding, not importing.** Use it when the goal is "what can I learn from this repo" rather than "port this function." Pairs naturally with `compare` mode. It relaxes the read cap and the scope-guard warning — but the transplant discipline still holds: extract the *pattern*, then graft narrowly (often into multiple existing |