craft-ts-service-migration

Migrates Angular services and direct DI to craftService and toCraftService patterns.

3|Updated Jan 9, 2026
One-click install
npx skills add https://github.com/craft-ts/craft-ts --skill craft-ts-service-migration-craft-ts
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: craft-ts-service-migration
Source: https://github.com/craft-ts/craft-ts/tree/main/.agents/skills/craft-ts-service-migration
Command: npx skills add https://github.com/craft-ts/craft-ts --skill craft-ts-service-migration-craft-ts

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Teams adopting @craft-ts/core must convert existing Angular @Injectable services, inject(...) calls, InjectionToken adapters, and framework dependencies like HttpClient and Router into craftService-based architecture without breaking route DI checks or tests. ## Core Features & Use Cases - Migration Workflow: Inventories existing Angular DI usage, classifies dependencies, and maps each to craftService or toCraftService with the correct scope. - Route DI Enforcement: Guides RouteCheckedDI checks using provider names, keeping ProvidedValues as never after migration. - ESLint Integration: Ensures rules like prefer-craft-service and brand-angular-deps-match stay enabled and GenDeps_* aliases are regenerated. - Use Case: When refactoring an Angular component that injects Router and an API service, this Skill rewrites consumption sites to use generated X() helpers and updates route-level providers accordingly. ## Quick Start Migrate this Angular service and its consumers to craftService following the craft-ts migration workflow.

Frequently Asked Questions about craft-ts-service-migration

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I migrate an Angular @Injectable service to craftService?▼

Rewrite business logic as craftService({ name, scope }, function* () { ... }) and replace consumption sites with the generated X() helper, typically called as yield* X(...). Remove direct inject(...) and constructor injection from migrated code.

How do I adapt Angular framework tokens like Router or HttpClient in craft-ts?▼

Adapt each Angular or third-party token exactly once with toCraftService({ name, scope, token }), or use the inject option for tokens requiring inject(...) internally. Expose only a narrowed interface rather than passing through the whole Angular service.

What scope should I choose for a craftService?▼

Use scope 'toProvide' or 'manuallyProvidedAtRoot' for dependencies provided per feature, route, or test. Keep route-level providers close to the route that owns the instance and re-export cumulative provider names only when child routes need them.

Should ProvidedValues include Angular tokens after migration?▼

No. After migration, route DI checks should rely on craft service provider names with ProvidedValues set to never. Treat unions of direct Angular tokens in route files as migration debt unless legacy support is explicitly required.

Which ESLint rules enforce the craft-ts service architecture?▼

Enable craft-ts/prefer-craft-service to block new @Injectable app services, craft-ts/prefer-craft-http-client for HTTP access, and brand-angular-gen-deps-required with brand-angular-deps-match to keep GenDeps_* aliases current. Route rules cover exception exhaustiveness and DI checks.