# Type adapter

> Type adapter is an open-source agent skill for developer tools. Guides writing Sankhya @GlobalTypeAdapter classes for JSON and Jape conversion. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/snk-devcenter/addon-studio/tree/main/plugins/addon-studio/skills/type-adapter
- **Repository:** https://github.com/snk-devcenter/addon-studio
- **GitHub stars:** 7
- **License:** MIT
- **Skill name:** type-adapter
- **Collection:** https://github.com/snk-devcenter/addon-studio
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-04

## About

This skill covers creating, reviewing and refactoring global type adapters in the Sankhya Addon Studio 2.0 stack, which define once how a given Java type is serialized to JSON, deserialized from JSON and mapped to database values. It explains when a global adapter is warranted, which of the TypeAdapter, JsonSerializer and JsonDeserializer interfaces to implement, and how the global-over-native precedence works.

The guide walks through a complete example for a java.time type, shows how a value object can be used in an entity column, and lists the adapters the SDK already provides with their Java and database types. It also sets out the rules that matter in practice: handle nulls, throw a parse exception instead of returning null silently, and never put business logic inside an adapter. A checklist and a table of anti-patterns support reviews.

The skill expects a Java 8 project built with Gradle on the Sankhya Addon Studio 2.0 runtime, using Gson for JSON. Its content is written in Portuguese, and it points to related skills for entities, repositories, controllers and Guice wiring.

## When your agent uses it

> Cria, revisa e refatora adaptadores de tipo Sankhya com `@GlobalTypeAdapter` (`TypeAdapter`, `JsonSerializer`/`JsonDeserializer`, tipos nativos, conversão JSON↔Java) — define, num lugar só, como um tipo serializa e desserializa em todo o addon. Use ao criar, alterar, revisar, auditar ou padronizar adaptadores de serialização JSON, ao corrigir formato de data/número no JSON de resposta, ao trabalhar com arquivos `*Adapter.java`, ou ao tocar em código com `@GlobalTypeAdapter`/`TypeAdapter`. NÃO usar para converter DTO↔Entidade campo a campo — isso é `mapstruct`.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/snk-devcenter/addon-studio/tree/HEAD/plugins/addon-studio/skills/type-adapter)
- [License: MIT](https://github.com/snk-devcenter/addon-studio/tree/HEAD/plugins/addon-studio/skills/type-adapter)

## Features

- **Adapter scope decisions:** Explains when a type needs a global adapter and when the SDK's native adapters already cover it.
- **JSON serializer and deserializer:** Shows how to convert a type to and from JSON with Gson interfaces and strict error handling.
- **Database value mapping:** Covers fromVO and toVO conversions between Java objects and Jape database values.
- **Value object columns:** Describes exposing a domain type in an entity column while the table keeps its primitive.
- **Native adapter reference:** Tabulates the built-in adapters for types such as dates, UUIDs, URLs and booleans.
- **Review checklist:** Provides a step list and anti-pattern table for creating or auditing adapters.

## Good for

- Create a JSON adapter for a java.time type in a Sankhya addon
- Fix date or number formatting in an API response
- Review existing *Adapter.java classes for null handling and error behavior
- Map a value object to a database column in an entity
- Audit a Sankhya addon for adapters that duplicate native ones

## Install

### Claude Code

This skill ships in the `addon-studio` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add snk-devcenter/addon-studio
/plugin install addon-studio@snk-devcenter
```

Or copy only this skill to `~/.claude/skills/type-adapter`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/snk-devcenter/addon-studio.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/type-adapter &&
cp -R "$tmp/plugins/addon-studio/skills/type-adapter" ~/.claude/skills/type-adapter &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/type-adapter` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/type-adapter` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/snk-devcenter/addon-studio.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/type-adapter &&
cp -R "$tmp/plugins/addon-studio/skills/type-adapter" ~/.agents/skills/type-adapter &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/type-adapter` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/type-adapter` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/snk-devcenter/addon-studio.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/type-adapter &&
cp -R "$tmp/plugins/addon-studio/skills/type-adapter" ~/.cursor/skills/type-adapter &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/type-adapter` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/snk-devcenter/addon-studio.git --path plugins/addon-studio/skills/type-adapter
```

Or copy the folder to `~/.gemini/skills/type-adapter` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/type-adapter`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/snk-devcenter/addon-studio.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/type-adapter &&
cp -R "$tmp/plugins/addon-studio/skills/type-adapter" ~/.copilot/skills/type-adapter &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/type-adapter` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/snk-devcenter/addon-studio.git
```

Then copy `addon-studio/plugins/addon-studio/skills/type-adapter` into your agent's skills folder as `type-adapter`. Agents that support SKILL.md read one folder per skill.

## FAQ

### When should I use a global type adapter?

When a type has no native support in the SDK or Gson, or when a native behavior needs to be overridden. The global adapter takes precedence over the native one.

### Which interfaces should an adapter implement?

Only those the use case needs. JSON-only DTO types need JsonSerializer and JsonDeserializer, while types used in a @JapeEntity also need TypeAdapter.

### Can a value object be passed to a @Criteria parameter?

No. The SDK does not apply the adapter to @Criteria parameters, so the method should receive the primitive value, for example via getDigits().

### Does the adapter need a Guice binding?

The adapter itself does not need one, since the SDK discovers it through the annotation. Services injected into the adapter do need Guice wiring.

### How do I install Type adapter in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/type-adapter to use it in all your projects, or to .claude/skills/type-adapter in one project. Or install the addon-studio plugin, which includes it: /plugin marketplace add snk-devcenter/addon-studio, then /plugin install addon-studio@snk-devcenter.

### Does Type adapter run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Type adapter?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Type adapter?

The closest alternatives to Type adapter are Entity, Mapstruct, Test, Dependency injection and Controller advice.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Entity](https://ai-powered.com/skills/entity): Entity is an open-source agent skill for developer tools.
- [Mapstruct](https://ai-powered.com/skills/mapstruct): Mapstruct is an open-source agent skill for developer tools.
- [Test](https://ai-powered.com/skills/test-snk-devcenter): Test is an open-source agent skill for developer tools.
- [Dependency injection](https://ai-powered.com/skills/dependency-injection): Dependency injection is an open-source agent skill for developer tools.
- [Controller advice](https://ai-powered.com/skills/controller-advice): Controller advice is an open-source agent skill for developer tools.
- [Repository](https://ai-powered.com/skills/repository): Repository is an open-source agent skill for developer tools.
- [Retrofit](https://ai-powered.com/skills/retrofit): Retrofit is an open-source agent skill for developer tools.
- [Sankhya utils](https://ai-powered.com/skills/sankhya-utils): Sankhya utils is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/type-adapter
