$npx -y skills add AGI-comming/functional-skill-creator --skill migrateMigrate lane for fskill-creator; analyzes a legacy skill directory into behavior map, function split proposal, and source evidence.
| 1 | # fskill-creator-migrate |
| 2 | |
| 3 | ## Goal |
| 4 | |
| 5 | Analyze a large or hard-to-maintain legacy skill directory into structured migration context while preserving behavior. This sub-skill only performs migration pre-analysis and does not directly write final functional skill files; final artifact generation, runtime capability provisioning, file writing, and validation are handled by the main `fskill-creator`. |
| 6 | |
| 7 | Invoked by the main skill when the user has an existing monolithic skill and wants to "refactor into functional", "migrate to functional skill", or "restructure into functions/references/scripts". |
| 8 | |
| 9 | ## Principles |
| 10 | |
| 11 | - Preserve existing behavior first, then optimize structure. |
| 12 | - Load the whole legacy skill package, not only `SKILL.md`. |
| 13 | - Keep source section and file evidence so reviewers can trace migrated content. |
| 14 | - Only output `migration_context`; must not directly write target skill files. |
| 15 | - Duplicated rules, schemas, and vocabulary move to `reference_plan`. |
| 16 | - Existing `references/`, `scripts/`, and `tools/` are inventoried before proposing splits. |
| 17 | - Deterministic parsing, formatting, validation, or mechanical transforms are identified as `script_plan`, to be generated or preserved later by the main skill. |
| 18 | - Optional viewers only enter `tool_plan`; final files are generated uniformly by the main skill's `add_runtime_capabilities`. |
| 19 | |
| 20 | ## References |
| 21 | |
| 22 | | Resource | Load Timing | Purpose | |
| 23 | |---|---|---| |
| 24 | | `shared_glossary` | On demand | Stable migration terminology and output fields. | |
| 25 | | `script_rules` | Before proposing scripts | Rules for deciding what belongs in `scripts/`. | |
| 26 | |
| 27 | ## External Inputs |
| 28 | |
| 29 | | Field | Source | Description | |
| 30 | |---|---|---| |
| 31 | | `legacy_skill_dir` | user or repository | Path to the legacy skill directory containing `SKILL.md`. | |
| 32 | | `legacy_skill_path` | user or repository | Deprecated alias for `legacy_skill_dir`; may also be a direct path to `SKILL.md`, which resolves to its parent directory. | |
| 33 | | `legacy_skill_content` | user or repository | Existing skill markdown content when the directory is inaccessible. | |
| 34 | | `migration_constraints` | user | Constraints such as preserving file names, tone, or platform rules. | |
| 35 | | `known_testcases` | user or repository | Existing examples, traces, or expected behaviors. | |
| 36 | | `existing_scripts` | repository | Existing helper scripts associated with the legacy skill. | |
| 37 | | `include_viewers` | user | Whether to suggest generating `tools/log_viewer.mjs` and `tools/tester_viewer.mjs`. | |
| 38 | | `script_runtime` | environment | Whether this sub-skill's own Node.js scripts can be run. | |
| 39 | |
| 40 | ## Execution Pipeline |
| 41 | |
| 42 | | Step | Function | Purpose | Input | Output | |
| 43 | |---:|---|---|---|---| |
| 44 | | 1 | `load_legacy_skill` | Load and normalize the legacy skill package. | `legacy_skill_dir`<br>`legacy_skill_path`<br>`legacy_skill_content` | `legacy_skill` | |
| 45 | | 2 | `map_existing_behavior` | Identify goals, rules, inputs, outputs, and behaviors that must be preserved. | `legacy_skill`<br>`migration_constraints` | `behavior_map` | |
| 46 | | 3 | `propose_function_split` | Propose function boundaries, script opportunities, optional viewer tools, and target file layout. | `legacy_skill`<br>`behavior_map`<br>`script_rules`<br>`include_viewers`<br>`script_runtime` | `migration_proposal`<br>`script_plan`<br>`tool_plan` | |
| 47 | | 4 | `extract_shared_references` | Move duplicated or shared rules into references. | `legacy_skill`<br>`migration_proposal`<br>`script_plan` | `reference_plan` | |
| 48 | |
| 49 | ## Output |
| 50 | |
| 51 | The main skill combines the above outputs into: |
| 52 | |
| 53 | | Field | Description | |
| 54 | |---|---| |
| 55 | | `migration_context.legacy_skill` | Loaded source skill package data. | |
| 56 | | `migration_context.behavior_map` | Behaviors that must be preserved. | |
| 57 | | `migration_context.migration_proposal` | Function split and target structure proposal. | |
| 58 | | `migration_context.reference_plan` | Terms, rules, and schemas that should go into shared references. | |
| 59 | | `migration_context.script_plan` | Deterministic helpers to generate, preserve, or refactor. | |
| 60 | | `migration_context.tool_plan` | Optional viewer choices. | |
| 61 | | `migration_context.source_evidence` | Legacy source sections, companion files, and behavior preservation evidence. | |
| 62 | |
| 63 | ## Output Scope |
| 64 | |
| 65 | Only output migration context; must not directly write target skill files or delete the legacy skill. |