Agent js to ts migration
JavaScript to TypeScript migration best practices for developers converting existing JS codebases. This skill should be used when renaming .js files to .ts, adding type annotations, fixing TypeScript compiler errors, enabling strict mode, converting CommonJS to ESM, typing async code, writing type guards, or setting up the TypeScript toolchain.From its SKILL.md
npx -y skills add Nika-HISK/agent-js-to-ts-migrationAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its file declares
Copied from the file, not written here
The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
5.6 KB, ~1.3k tokens by cl100k_base, as published. Nobody here has run it
JavaScript to TypeScript Migration
Comprehensive migration guide for converting JavaScript codebases to TypeScript. Contains 34 rules across 10 categories, prioritized by impact to guide automated refactoring and code generation.
When to Apply
Reference these guidelines when:
- Setting up TypeScript in an existing JavaScript project
- Renaming
.jsfiles to.tsand fixing resulting errors - Adding type annotations to functions, classes, and objects
- Enabling and incrementally fixing
strictmode - Converting
require()/module.exportsto ES Moduleimport/export - Typing
Promisereturn values and async error handling - Writing type guards for API responses and external data
- Installing
@typespackages or writing declaration files - Reviewing migrated code for remaining
anytypes or type holes
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Setup & Configuration | CRITICAL | setup- |
| 2 | Type Annotations | CRITICAL | types- |
| 3 | Conversion Patterns | HIGH | convert- |
| 4 | Strict Mode | HIGH | strict- |
| 5 | Module System | HIGH | modules- |
| 6 | Classes & Interfaces | MEDIUM-HIGH | classes- |
| 7 | Async & Promises | MEDIUM-HIGH | async- |
| 8 | Generics | MEDIUM | generics- |
| 9 | Type Guards & Narrowing | MEDIUM | guards- |
| 10 | Third-party Types | LOW-MEDIUM | libs- |
Quick Reference
1. Setup & Configuration (CRITICAL)
setup-tsconfig-base- Start with a migration-ready tsconfig, not a minimal onesetup-incremental-migration- Migrate file-by-file using allowJs, not all at oncesetup-toolchain- Use tsx, tsc, and proper build scripts consistentlysetup-eslint-typescript- Configure typescript-eslint to catch migration anti-patterns
2. Type Annotations (CRITICAL)
types-avoid-any- Replace any with proper types or unknown at boundariestypes-explicit-return-types- Always annotate function return typestypes-object-shapes- Define interfaces and type aliases for every object shapetypes-array-typing- Type arrays, Maps, Sets, and tuples explicitly
3. Conversion Patterns (HIGH)
convert-require-to-import- Replace CommonJS require with ESM import/exportconvert-prototypes-to-classes- Convert prototype-based code to typed classesconvert-callbacks-to-typed-async- Replace callbacks with typed async/awaitconvert-dynamic-objects- Type dynamic object dictionaries with Record<K,V> or Map
4. Strict Mode (HIGH)
strict-enable-strict- Enable strict mode incrementally per file, not globallystrict-null-checks- Handle null and undefined explicitly with strictNullChecksstrict-no-implicit-any- Fix noImplicitAny errors with real types, not suppressionsstrict-property-initialization- Ensure class properties are initialized properly
5. Module System (HIGH)
modules-esm-imports- Use consistent ESM import/export syntax throughoutmodules-barrel-files- Type barrel index files with explicit named exportsmodules-path-aliases- Configure path aliases to eliminate deep relative imports
6. Classes & Interfaces (MEDIUM-HIGH)
classes-use-interfaces- Define interfaces to decouple consumers from implementationsclasses-access-modifiers- Use private/readonly/protected to enforce encapsulationclasses-abstract-base- Use abstract classes for shared typed behavior
7. Async & Promises (MEDIUM-HIGH)
async-type-promises- Always annotate Promise<T> return types on async functionsasync-error-types- Narrow caught errors before use — don't cast to anyasync-generics-in-async- Write generic async utilities without losing type safety
8. Generics (MEDIUM)
generics-reusable-functions- Make utility functions generic instead of using anygenerics-constrained-generics- Use extends to constrain type parametersgenerics-utility-types- Use Partial, Pick, Omit, Record instead of redefining types
9. Type Guards & Narrowing (MEDIUM)
guards-custom-type-guards- Write type predicates for unknown/union narrowingguards-discriminated-unions- Model multi-state values as discriminated unionsguards-assertion-functions- Use assertion functions to enforce invariants
10. Third-party Types (LOW-MEDIUM)
libs-install-types- Install @types packages for every untyped dependencylibs-declaration-files- Write .d.ts ambient declarations for untyped librarieslibs-module-augmentation- Augment existing types to add runtime-added properties
How to Use
Read individual rule files for detailed explanations and before/after code examples:
rules/setup-tsconfig-base.md
rules/types-avoid-any.md
rules/convert-require-to-import.md
rules/_sections.md
Each rule file contains:
- The rule name and impact level
- Explanation of why it matters during migration
- Incorrect JavaScript or poorly-typed TypeScript example
- Correct TypeScript example with full types
- Reference link to official documentation
Full Compiled Document
For the complete guide with all rules expanded: AGENTS.md
Installation
npx skills add yourusername/agent-js-to-ts-migration
What ships with it: 40 files
79.2 KB alongside SKILL.md, 1 of them executable
rules/
- async-error-types.md1.8 KB
- async-generics-in-async.md1.6 KB
- async-type-promises.md1.7 KB
- classes-abstract-base.md1.9 KB
- classes-access-modifiers.md1.8 KB
- classes-use-interfaces.md1.7 KB
- convert-callbacks-to-typed-async.md1.5 KB
- convert-dynamic-objects.md1.6 KB
- convert-prototypes-to-classes.md1.5 KB
- convert-require-to-import.md1.4 KB
- generics-constrained-generics.md1.7 KB
- generics-reusable-functions.md1.7 KB
- generics-utility-types.md1.8 KB
- guards-assertion-functions.md2.0 KB
- guards-custom-type-guards.md1.8 KB
- guards-discriminated-unions.md1.8 KB
- libs-declaration-files.md1.8 KB
- libs-install-types.md1.6 KB
- libs-module-augmentation.md1.9 KB
- modules-barrel-files.md1.5 KB
- modules-esm-imports.md1.5 KB
- modules-path-aliases.md1.5 KB
- _sections.md1.6 KB
- setup-eslint-typescript.md1.3 KB
- setup-incremental-migration.md1.5 KB
- setup-toolchain.md1.2 KB
- setup-tsconfig-base.md1.5 KB
- strict-enable-strict.md1.6 KB
- strict-no-implicit-any.md1.6 KB
- strict-null-checks.md1.6 KB
- strict-property-initialization.md1.8 KB
- _template.md713 B
- types-array-typing.md1.3 KB
- types-avoid-any.md1.5 KB
- types-explicit-return-types.md1.5 KB
- types-object-shapes.md1.4 KB
scripts/
- build.jsruns1.7 KB
- AGENTS.md13.5 KB
- metadata.json866 B
- README.md6.0 KB