Agent skill

Jni Type Conversion

by nwjs in nwjs/chromium.src

How to use @JniType annotations for ergonomic JNI. An agent skill from nwjs/chromium.src.

BSD-3-ClauseAuto-check passed

Install Jni Type Conversion

skills CLI
$ npx skills add nwjs/chromium.src --skill jni-type-conversion -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install nwjs/chromium.src jni-type-conversion --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/nwjs/chromium.src.git skills-src && mkdir -p .claude/skills && cp -r skills-src/agents/skills/jni-type-conversion .claude/skills/jni-type-conversion && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
jni-type-conversion
GitHub stars
160
Token cost
~1.6k tokens
SKILL.md length
588 words
Files
1
Skills in repo
64
Repo updated
First seen
Licence
BSD-3-Clause

At a glance

How to use @JniType annotations for ergonomic JNI. An agent skill from nwjs/chromium.src.

  • Works in 7 steps: Identify Candidates: Look for JNI… → Discovery (CRITICAL): To see if a type… → Check C++ Implementation: Verify that… → …
  • SKILL.md covers Workflow, Common Recipes and Examples
  • Calls rg

What it does

Jni Type Conversion is an agent skill from nwjs/chromium.src. How to use @JniType annotations for ergonomic JNI. Relevant for Java files that use @NativeMethods or @CalledByNative.

Its SKILL.md is about 1.6k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It works with Java and C++. The repository describes itself as: Chromium codebase with NW.js modifications. Based on https://chromium.googlesource.com/chromium/src.git. The licence is BSD-3-Clause.

Example prompts

  • “/jni-type-conversion”

Workflow steps

7 steps, taken from the first numbered list in SKILL.md.

  1. Identify Candidates: Look for JNI methods (annotated with
  2. Discovery (CRITICAL): To see if a type already has a @JniType
  3. Check C++ Implementation: Verify that the C++ side performs explicit
  4. Verify Constraints: Do NOT convert if
  5. Annotate Java
  6. Update C++
  7. Validate (CRITICAL): Changes are INCOMPLETE until you have verified they

What it can do on your machine

Read from SKILL.md and the folder at commit a9e8946. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • rg

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Jni Type Conversion loads about 1.6k tokens when it runs. Until then it costs about 35 tokens; SKILL.md has 588 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~35
When it runs · the whole SKILL.md, loaded when a task matches
~1.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from nwjs/chromium.src at commit a9e8946, republished under its BSD-3-Clause licence (© nwjs). 588 words, ~1,643 tokens.

Download SKILL.mdSave it as .claude/skills/jni-type-conversion/SKILL.md (or your agent's skills folder).
name
jni-type-conversion
description
How to use @JniType annotations for ergonomic JNI. Relevant for Java files that use @NativeMethods or @CalledByNative.

JNI Type Conversion

This skill guides the process of replacing explicit JNI conversion logic (like ConvertJavaStringToUTF8) with @JniType annotations in Java and corresponding native types in C++.

You must first read the prerequisite skill: //third_party/jni_zero/skills/jni-zero.

Workflow

  1. Identify Candidates: Look for JNI methods (annotated with @NativeMethods or @CalledByNative) that take or return types that are currently being explicitly converted in C++.
  2. Discovery (CRITICAL): To see if a type already has a @JniType conversion defined, search the codebase for FromJniType or ToJniType definitions for that C++ type:
    bash
    rg -g "*.h" "\binline .*(From|To)JniType"
    If a conversion exists, note the header file where it is defined; you will need to include it from any C++ files that require the conversion.
  3. Check C++ Implementation: Verify that the C++ side performs explicit conversions using functions like:
    • ConvertJavaStringToUTF8 -> std::string
    • ConvertJavaStringToUTF16 -> std::u16string
    • JavaIntArrayToIntVector -> std::vector<int32_t>
    • ToJavaArrayOfStrings -> std::vector<std::string>
    • base::android::ConvertJavaStringToUTF8 -> std::string
  4. Verify Constraints: Do NOT convert if:
    • The conversion is conditional (e.g., inside an if block that might skip it).
    • The conversion happens inside a lambda (e.g., TRACE_EVENT macros). Moving these to @JniType makes the conversion eager, which can impact performance.
  5. Annotate Java:
    • Add @JniType("cpp_type") to the parameter or return type.
    • Integer Types: References to int in @JniType should always be int32_t (e.g., @JniType("std::vector<int32_t>") instead of @JniType("std::vector<int>")).
    • Collections: Prefer List<T> over object arrays (T[]) for collection parameters and return types (e.g., @JniType("std::vector") List<SuggestedTabInfo> suggestedTabs instead of SuggestedTabInfo[]), especially when Java passes or stores it as a List (avoiding Arrays.asList(...)).
    • @Nullable Types:
      • For String parameters, @JniType("std::string") automatically converts Java null to C++ "". Prefer this over std::optional<std::string> unless the C++ logic specifically distinguishes between null and empty.
      • For array parameters, @JniType("std::vector") automatically converts Java null to an empty vector. Prefer empty containers over std::optional<> unless the C++ logic specifically distinguishes between null and empty, since std::optional<> has larger binary size.
      • For all other types, leave them as jni_zero::JavaRef, unless they are already converted to std::optional<T>, in which case use @JniType("std::optional<...>") @Nullable.
    • Ensure org.jni_zero.JniType is imported.
  6. Update C++:
    • Change the C++ parameter type to the native type (e.g., const std::string&, std::vector<int32_t>&, base::OnceClosure).
    • Remove the explicit conversion calls and intermediate variables.
    • Remove Unused JNIEnv: If the JNIEnv* env parameter used to be used, but is no longer used after @JniType additions, it should be removed from the C++ function signature.
    • Remove Unused Callers: For non-static @NativeMethods, the caller parameter is usually unnecessary. Remove it from Java and C++ to reduce boilerplate.
    • Remove Unused using statements: Aliases of conversion functions might no longer have any uses (e.g., using base::android::ConvertStringToUTF8;).
    • Include Order: Specialization headers MUST be included before the generated _jni.h file.
    • Include the header file that defines the FromJniType / ToJniType conversion functions:
      • E.g., include base/android/jni_string.h for all string conversions.
      • E.g., include third_party/jni_zero/default_conversions.h for containers (std::vector, std::optional, base::span).
      • E.g., include base/android/callback_android.h for callback conversions.
  7. Validate (CRITICAL): Changes are INCOMPLETE until you have verified they build. Build all .cc and .java files to ensure JNI generation and compilation succeed.
    • Build using a command like: autoninja -C OUTPUT_DIR ../../path/to/foo.cc^ ../../path/to/Foo.java^ ...
      • Paths must be relative to OUTPUT_DIR (e.g. start with ../../)
      • The "^" suffix means "build all targets that have this input".
    • Do not guess the OUTPUT_DIR; you must have been told it.
    • If you cannot build, you MUST state this clearly and summarize the changes made.
Show full SKILL.md (51 more words)Show less

Common Recipes

base::Uuid Handling
  • Java: @JniType("std::string") String uuid
  • C++: base::Uuid::ParseLowercase(uuid_string) (incoming) or uuid.AsLowercaseString() (outgoing).
Collection Types (std::vector <-> List<T> / T[])
  • Prefer List<T> over object arrays (T[]) for collection parameters and return types.
  • @JniType("std::vector") (or @JniType("std::vector<...>")) works for both @CalledByNative and @NativeMethods parameters and return types.

Prefer:

java
@CalledByNative
private void onSuggestedTabsUpdated(@JniType("std::vector") List<SuggestedTabInfo> suggestedTabs) {
    mSuggestedTabsSupplier.set(suggestedTabs);
}

Over:

java
@CalledByNative
private void onSuggestedTabsUpdated(@JniType("std::vector") SuggestedTabInfo[] suggestedTabs) {
    mSuggestedTabsSupplier.set(Arrays.asList(suggestedTabs));
}

Examples

Callback Parameters

Java:

java
void zeroArg(@JniType("base::OnceClosure&&") Runnable c1);
void oneArg(@JniType("base::OnceCallback<void(int32_t)>&&") Callback<Integer> c2);
void twoArgs(@JniType("base::OnceCallback<void(bool, int32_t)>&&") Callback2<Boolean, Integer> c3);

C++:

cpp
#include "base/android/callback_android.h"
void JNI_MyClass_ZeroArg(base::OnceClosure&& callback) {
    std::move(callback).Run();
}
void JNI_MyClass_OneArg(base::OnceCallback<void(int32_t)>&& callback) {
    std::move(callback).Run(0);
}
void JNI_MyClass_TwoArgs(base::OnceCallback<void(bool, int32_t)>&& callback) {
    std::move(callback).Run(true, 67);
}

© nwjs, BSD-3-Clause. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in agents/skills/jni-type-conversion of nwjs/chromium.src.

Open the folder on GitHubat commit a9e8946

Compare with similar skills

Jni Type Conversion next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Jni Type Conversion compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Jni Type Conversion this skillnwjs/chromium.src160—~1.6kAutomated safety check: PassBSD-3-Clause
Fory Releaseapache/fory4.6k—~2.9kAutomated safety check: PassApache-2.0
Code Audit3stoneBrother/code-audit8931 repos~2.7kAutomated safety check: PassNone
CodeQL Security Scantrailofbits/skills7.4k—~4.6kAutomated safety check: NotesCC-BY-SA-4.0
Fory Version Bumpapache/fory4.6k—~1.1kAutomated safety check: PassApache-2.0
Fory Performance Optimizationapache/fory4.6k—~2.2kAutomated safety check: PassApache-2.0

Similar skills

  • Fory Release

    apache/fory

    Prepare an Apache Fory release candidate from a clean release branch, including the version bump, RC tag, JVM staging, ASF source artifacts, SVN upload, and vote email.

    4.6k GitHub stars~2.9k tokensUpdated yesterday
    Auto-check passed
  • Code Audit

    3stoneBrother/code-audit

    Professional code security audit skill covering 55+ vulnerability types.

    893 GitHub starsUsed in 1 repo~2.7k tokens
    SecurityAuto-check passed
  • CodeQL Security Scan

    trailofbits/skills

    Official

    Scans a codebase for vulnerabilities with CodeQL's data flow and taint tracking in run-all or important-only modes, including data extensions for project-specific sources and sinks.

    7.4k GitHub stars~4.6k tokensUpdated yesterday
    SecurityAuto-check: notes
  • Bump Apache Fory release or post-release development versions across Java, Kotlin, Scala, Python, Rust, Go, C++, C, Dart, JavaScript, Swift, integration tests, examples, and source docs.

    4.6k GitHub stars~1.1k tokensUpdated yesterday
    MobileAuto-check passed
  • Run profile-driven bottleneck optimization across Apache Fory implementations (Java, C++, Python/Cython, Go, Rust, Swift, C, JavaScript/TypeScript, Dart, Kotlin, Scala).

    4.6k GitHub stars~2.2k tokensUpdated yesterday
    MobileAuto-check passed
  • Ray

    Railly/tinte

    Generate code screenshots via ray.tinte.dev API. An agent skill from Railly/tinte.

    624 GitHub stars~712 tokensUpdated 2 mo ago
    Frontend & DesignAuto-check passed

More from nwjs/chromium.src

All 64 skills in this repo
  • Analyzing SQL Traces

    nwjs/chromium.src

    Extracts raw trace data from Perfetto traces, runs arbitrary SQL queries for custom follow-up analysis, and applies expert cognitive principles (Tiered Flow Analysis, Semantic Mismatch, Redundancy)…

    160 GitHub stars~2.9k tokensUpdated 5 days ago
    Auto-check passed
  • Autonomous multi-agent performance optimization loop for Chromium and V8.

    160 GitHub stars~4.2k tokensUpdated 5 days ago
    Auto-check passed
  • Automated Tracing

    nwjs/chromium.src

    Automated Tracing & Performance Telemetry in Chromium using Perfetto and Telemetry benchmarks.

    160 GitHub stars~1.5k tokensUpdated 5 days ago
    Auto-check passed
  • Chrome Releases

    nwjs/chromium.src

    Queries Chrome commit, version, release, and milestone metadata.

    160 GitHub stars~1.3k tokensUpdated 5 days ago
    Auto-check passed
  • Chromium Docs

    nwjs/chromium.src

    Search and reference Chromium documentation from the local docs index, including design docs, APIs, and development guides.

    160 GitHub stars~1.2k tokensUpdated 5 days ago
    Auto-check passed
  • Gn Deps Debugging

    nwjs/chromium.src

    Diagnose Chromium GN dependency and include-visibility failures, including BUILD.gn deps/publicdeps, DEPS include rules, private headers, and circular dependencies.

    160 GitHub stars~1.5k tokensUpdated 5 days ago
    Auto-check passed

Works with

Questions about Jni Type Conversion

What does Jni Type Conversion do?

How to use @JniType annotations for ergonomic JNI. An agent skill from nwjs/chromium.src. src. How to use @JniType annotations for ergonomic JNI.

How do I install Jni Type Conversion in Claude Code?

Run `npx skills add nwjs/chromium.src --skill jni-type-conversion -a claude-code`. Or copy the skill folder (agents/skills/jni-type-conversion in nwjs/chromium.src) into .claude/skills/jni-type-conversion in your project. Claude Code loads it when a task matches its description.

How do I install Jni Type Conversion in Codex?

Run `npx skills add nwjs/chromium.src --skill jni-type-conversion -a codex`. Or copy the skill folder (agents/skills/jni-type-conversion in nwjs/chromium.src) into .agents/skills/jni-type-conversion in your project. Codex loads it when a task matches its description.

Can I use Jni Type Conversion in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add nwjs/chromium.src --skill jni-type-conversion -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/jni-type-conversion, .gemini/skills/jni-type-conversion, .github/skills/jni-type-conversion and .opencode/skills/jni-type-conversion in your project.

What does Jni Type Conversion need to run?

Going by SKILL.md and its folder, Jni Type Conversion needs the command-line tools its instructions call (rg).

Does Jni Type Conversion access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Jni Type Conversion safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Jni Type Conversion use?

Jni Type Conversion is published under the BSD-3-Clause licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Jni Type Conversion use?

About 1.6k tokens (SKILL.md is roughly 6.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Jni Type Conversion?

Skills that share tags, products or a category with Jni Type Conversion: Fory Release (apache/fory, 4.6k stars), Code Audit (3stoneBrother/code-audit, 893 stars), CodeQL Security Scan (trailofbits/skills, 7.4k stars) and Fory Version Bump (apache/fory, 4.6k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Jni Type Conversion?

nwjs (a GitHub organization) maintains it in nwjs/chromium.src, which has 160 GitHub stars. The repository holds 64 skills in this directory. The repository was last updated on October 3, 2026.

Source: nwjs/chromium.src on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.