agentleFS
HeathWangHeathWang/hw-cc-plugin/skills/java-to-nextjs/SKILL.md

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.

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
  1. Distinctive:

    Default: All properties are optional unless explicitly marked non-null.

    line 39
  2. Very specific:

    Interface Extension (recommended): use extends when parent is reused across multiple children

    line 66
  3. Very specific:

    Use JSDoc (/ */) for interfaces, inline // for properties

    line 74
  4. Distinctive:

    If inheritance exists → read parent class files

    line 79
  5. Distinctive:

    Create interface with PascalCase name

    line 81

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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 TypeTypeScript Type
int / Integer / long / Longnumber
float / Float / double / Doublenumber
boolean / Booleanboolean
Stringstring
BigDecimal / decimalstring (default) or number (with @BigDecimalToNumber)
Datestring (ISO 8601)
Timestampnumber (unix) or string (ISO, with @TimestampFormat)
List<T>T[]
Map<K,V>Record<K, V>
Object / JSONObjectRecord<string, any>

Nullability Rules

Java AnnotationTypeScript
@NonNull / @NotNullRequired field (name: string)
No annotation / @NullableOptional 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

  1. Identify parent classes and trace the full chain
  2. If parent is BaseReq or BaseResponse → EXCLUDE all their properties (handled by HTTP middleware)
  3. Choose approach:
    • Interface Extension (recommended): use extends when parent is reused across multiple children
    • Flattened Interface: copy all properties into one interface when standalone

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

  1. Analyze Java class — properties, annotations, types, inheritance
  2. If inheritance exists → read parent class files
  3. Handle BaseReq/BaseResponse exclusion if applicable
  4. Create interface with PascalCase name
  5. Apply type mapping (including @BigDecimalToNumber, @TimestampFormat)
  6. Apply nullability (@NonNull → required, else optional)
  7. Preserve property names exactly as in API
  8. Migrate comments preserving original language

Validation Checklist

  • @NonNull/@NotNull properties 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/BaseResponse properties excluded if applicable
  • Type mappings correct (especially BigDecimal, Date, arrays)
  • Documentation migrated in original language
  • Output is markdown code block only (no file modifications)

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.