with one click
r3-transform-class
// Transform an entire class or component file into the target framework structure.
// Transform an entire class or component file into the target framework structure.
[HINT] Download the complete skill directory including SKILL.md and all related files
| name | r3-transform-class |
| description | Transform an entire class or component file into the target framework structure. |
When to use: Converting a class, component, or module file from source to target technology
Purpose: Systematically transform a complete file while preserving functionality and structure.
🚨 CRITICAL: File Location
output/{target-app-name}/ directoryworkspace/src/UserService.java (READ ONLY)output/angular-app/src/app/services/user.service.ts (CREATE NEW)File creation:
output/{target-app-name}/Example:
Source: src/com/app/services/UserService.java (read from here)
Target: output/angular-app/src/app/services/user.service.ts (create here)
Map framework imports:
import javax.swing.JFrame;import { Component } from '@angular/core';Convert internal imports:
Add necessary target imports:
Convert syntax:
public class UserService { }export class UserService { }Map decorators/annotations:
@Service → @Injectable()@Component → @Component({ })@RestController → Express router setupApply naming conventions:
For each field:
Convert with type mapping (use Skill R2):
private String name;
→
private name: string;
Map access modifiers:
private → privatepublic → publicprotected → protectedpublic (TypeScript)Convert initialization:
String name = "default"; → name: string = "default";Handle fields with decorators:
@Autowired → constructor injection@Input() → @Input()@ViewChild() → @ViewChild()Java:
public UserService(UserRepository repo) {
this.userRepository = repo;
}
TypeScript:
constructor(private userRepository: UserRepository) {
// Short-hand property declaration
}
Convert parameter injection:
Preserve initialization logic:
For each method:
Convert signature:
public User getUserById(int id) { }
→
getUserById(id: number): User { }
Map lifecycle methods:
onCreate() → ngOnInit()componentDidMount() → ngOnInit()onDestroy() → ngOnDestroy()Convert method body (use Skill R4)
Preserve method modifiers:
static → staticasync → asyncabstract → abstractAdd exports:
export class UserService { }
Add decorators:
@Injectable({
providedIn: 'root'
})
Add interface implementations:
implements OnInitextends BaseClassAdd metadata:
Complete, syntactically correct file in target language/framework.
package com.app.service;
import com.app.model.User;
import org.springframework.stereotype.Service;
@Service
public class UserService {
private final UserRepository userRepo;
public UserService(UserRepository userRepo) {
this.userRepo = userRepo;
}
public User findById(int id) {
return userRepo.findById(id).orElse(null);
}
}
import { Injectable } from '@angular/core';
import { User } from '../models/user.model';
import { UserRepository } from '../repositories/user.repository';
@Injectable({
providedIn: 'root'
})
export class UserService {
constructor(private userRepo: UserRepository) {}
findById(id: number): User | null {
return this.userRepo.findById(id) || null;
}
}