java-to-nextjs
Skill1 starsChanged 3 months agoMITView on GitHub
Use when converting Java 1.8 classes to Next.js TypeScript interface definitions - handling type mapping, nullability, inheritance, naming conventions, and BaseReq/BaseResponse exclusions.
In this repository13 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- bug-analysisSkill
- cavemanSkill
- code-review-with-filesSkill
- diagnoseSkill
- fetch-yuque-docSkill
- git-commit-workflowSkill
- handoffSkill
- improve-codebase-architectureSkill
- ios-i18n-workflowSkill
- java-to-swiftSkill
- question-answerSkill
- reconstructing-ui-from-screenshotsSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 39
Default: All properties are optional unless explicitly marked non-null.
- Very specific: line 66
Interface Extension (recommended): use extends when parent is reused across multiple children
- Very specific: line 74
Use JSDoc (/ */) for interfaces, inline // for properties
- Distinctive: line 79
If inheritance exists → read parent class files
- Distinctive: line 81
Create interface with PascalCase name
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Java to Next.js TypeScript Conversion
Overview
Converts Java 1.8 classes to TypeScript 5.0+ interface definitions for Next.js 14+. Output as markdown code blocks only — never modify project files.
Core Constraint
CRITICAL: Output TypeScript interface definitions as markdown code blocks only. Do NOT modify, edit, or alter any project files.
Type Mapping
| Java Type | TypeScript Type |
int / Integer / long / Long | number |
float / Float / double / Double | number |
boolean / Boolean | boolean |
String | string |
BigDecimal / decimal | string (default) or number (with @BigDecimalToNumber) |
Date | string (ISO 8601) |
Timestamp | number (unix) or string (ISO, with @TimestampFormat) |
List<T> | T[] |
Map<K,V> | Record<K, V> |
Object / JSONObject | Record<string, any> |
Nullability Rules
| Java Annotation | TypeScript |
@NonNull / @NotNull | Required field (name: string) |
No annotation / @Nullable | Optional field (name?: string) |
Default: All properties are optional unless explicitly marked non-null.
Naming Conventions
Interface names: PascalCase with meaningful suffixes (SaveEmailData, LoginRequest, UserProfileResponse)
Property names: ⚠️ KEEP IDENTICAL TO JAVA/API — do NOT convert between camelCase and snake_case.
// ✅ Correct
interface SaveEmailData {
inviteCode: string; // matches API
invite_url?: string; // preserves snake_case
}
// ❌ Wrong
interface SaveEmailData {
InviteCode: string; // changed to PascalCase
inviteUrl?: string; // changed snake_case to camelCase
}Inheritance Handling
- Identify parent classes and trace the full chain
- If parent is
BaseReqorBaseResponse→ EXCLUDE all their properties (handled by HTTP middleware) - Choose approach:
- Interface Extension (recommended): use
extendswhen parent is reused across multiple children - Flattened Interface: copy all properties into one interface when standalone
- Interface Extension (recommended): use
Documentation
Migrate Java comments to TypeScript preserving original language:
- Chinese comments → keep Chinese
- English comments → keep English
- Use JSDoc (
/** */) for interfaces, inline//for properties
Step-by-Step Workflow
- Analyze Java class — properties, annotations, types, inheritance
- If inheritance exists → read parent class files
- Handle
BaseReq/BaseResponseexclusion if applicable - Create interface with PascalCase name
- Apply type mapping (including
@BigDecimalToNumber,@TimestampFormat) - Apply nullability (
@NonNull→ required, else optional) - Preserve property names exactly as in API
- Migrate comments preserving original language
Validation Checklist
@NonNull/@NotNullproperties are required (no?)- All other properties are optional (
?) - Interface uses PascalCase naming
- Property names match API contract exactly
- Inheritance detected and parent classes analyzed
BaseReq/BaseResponseproperties excluded if applicable- Type mappings correct (especially
BigDecimal,Date, arrays) - Documentation migrated in original language
- Output is markdown code block only (no file modifications)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

