$npx -y skills add TanStack/cli --skill maintain-custom-addons-dev-watchBuild and iterate custom add-ons/templates with tanstack add-on init, add-on compile, add-on dev, and tanstack create --dev-watch, including sync loop preconditions, watch-path validation, and project metadata constraints.
| 1 | # Maintain Custom Add-ons In Dev Watch |
| 2 | |
| 3 | Use this skill for local add-on authoring workflows where you continuously compile and sync package output into a target app. |
| 4 | |
| 5 | ## Setup |
| 6 | |
| 7 | ```bash |
| 8 | npx @tanstack/cli add-on init |
| 9 | npx @tanstack/cli add-on compile |
| 10 | ``` |
| 11 | |
| 12 | ## Core Patterns |
| 13 | |
| 14 | ### Run add-on dev loop while editing source |
| 15 | |
| 16 | ```bash |
| 17 | npx @tanstack/cli add-on dev |
| 18 | ``` |
| 19 | |
| 20 | ### Sync watched framework directory into a sandbox target app |
| 21 | |
| 22 | ```bash |
| 23 | # --dev-watch is a flag on `create`, not on `dev` |
| 24 | npx @tanstack/cli create my-sandbox --dev-watch ../path/to/framework-dir |
| 25 | ``` |
| 26 | |
| 27 | ### Re-run compile before apply when changing metadata |
| 28 | |
| 29 | ```bash |
| 30 | npx @tanstack/cli add-on compile |
| 31 | npx @tanstack/cli add my-custom-addon |
| 32 | ``` |
| 33 | |
| 34 | ## Common Mistakes |
| 35 | |
| 36 | ### HIGH Use --dev-watch with --no-install |
| 37 | |
| 38 | Wrong: |
| 39 | ```bash |
| 40 | npx @tanstack/cli create my-sandbox --dev-watch ../my-addon-package --no-install |
| 41 | ``` |
| 42 | |
| 43 | Correct: |
| 44 | ```bash |
| 45 | npx @tanstack/cli create my-sandbox --dev-watch ../my-addon-package |
| 46 | ``` |
| 47 | |
| 48 | Dev-watch rejects `--no-install`, so automated loops fail before any sync work starts. |
| 49 | |
| 50 | Source: packages/cli/src/dev-watch.ts:112 |
| 51 | |
| 52 | ### HIGH Start dev-watch without valid framework directory |
| 53 | |
| 54 | Wrong: |
| 55 | ```bash |
| 56 | npx @tanstack/cli create my-sandbox --dev-watch ../missing-or-invalid-dir |
| 57 | ``` |
| 58 | |
| 59 | Correct: |
| 60 | ```bash |
| 61 | npx @tanstack/cli create my-sandbox --dev-watch ../valid-framework-dir |
| 62 | ``` |
| 63 | |
| 64 | Watch setup validates that the path exists, is a directory, and contains at least one of `add-ons/`, `assets/`, or `framework.json`. Invalid targets fail before file syncing begins. |
| 65 | |
| 66 | Source: packages/cli/src/command-line.ts:599 |
| 67 | |
| 68 | ### CRITICAL Author add-on from code-router project |
| 69 | |
| 70 | Wrong: |
| 71 | ```bash |
| 72 | npx @tanstack/cli add-on init |
| 73 | ``` |
| 74 | |
| 75 | Correct: |
| 76 | ```bash |
| 77 | # Run add-on init from a file-router project |
| 78 | npx @tanstack/cli add-on init |
| 79 | ``` |
| 80 | |
| 81 | Custom add-on authoring expects file-router mode and exits when run from incompatible project modes. |
| 82 | |
| 83 | Source: packages/create/src/custom-add-ons/add-on.ts |
| 84 | |
| 85 | ### HIGH Run add-on workflows without scaffold metadata |
| 86 | |
| 87 | Wrong: |
| 88 | ```bash |
| 89 | npx @tanstack/cli add-on dev |
| 90 | ``` |
| 91 | |
| 92 | Correct: |
| 93 | ```bash |
| 94 | # Run in a project scaffolded by TanStack CLI (contains .cta.json), then: |
| 95 | npx @tanstack/cli add-on dev |
| 96 | ``` |
| 97 | |
| 98 | Custom add-on flows rely on persisted scaffold options, so missing metadata blocks initialization and update paths. |
| 99 | |
| 100 | Source: packages/create/src/custom-add-ons/shared.ts:158 |
| 101 | |
| 102 | ### HIGH Tension: Backwards support vs deterministic automation |
| 103 | |
| 104 | This domain's patterns conflict with add-addons-existing-app. Tooling assumes reusable automation, but hidden metadata preconditions from legacy support make add-on loops non-portable across repositories. |
| 105 | |
| 106 | See also: add-addons-existing-app/SKILL.md § Common Mistakes |