# Listener

> Listener is an open-source agent skill for developer tools. Gives the agent Sankhya @Listener persistence hooks for insert, update and delete events. 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/listener
- **Repository:** https://github.com/snk-devcenter/addon-studio
- **GitHub stars:** 7
- **License:** MIT
- **Skill name:** listener
- **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 guides an agent through writing, reviewing and standardizing Sankhya persistence listeners built with the @Listener annotation on a class that extends PersistenceEventAdapter. It covers reacting to before and after insert, update and delete events on any JAPE entity, including native instances, and explains how the listener is registered automatically without editing XML.

The guidance keeps listeners thin: they filter the event, adjust the DynamicVO and delegate business rules to injected services. It explains how to use ModifingFields to act only on changed fields, how to work with typed entities through EventEntity and EntityMapper so that update events do not wipe unrelated columns, and how to block a write or delete by throwing a typed exception in a before method. It also lists common pitfalls such as loops caused by writing to the same instance, synchronous external calls inside a transaction, and transaction propagation settings on called services.

The skill is written for Java 8 projects on the Sankhya Addon Studio 2.0 stack (Wildfly/EJB, JAPE SDK, Guice, Gradle), with Lombok logging and ISO-8859-1 source files.

## When your agent uses it

> Cria, revisa e padroniza listeners de persistência Sankhya com `@Listener` (classe estende `PersistenceEventAdapter`) — reage a eventos CRUD (before/after insert, update, delete) de qualquer entidade JAPE, inclusive instâncias nativas. Use ao criar, alterar, revisar, auditar ou padronizar reação a gravação/exclusão de registros, ao validar ou preencher campos automaticamente no insert/update, ao exigir campo preenchido/não vazio (sinal prático: o dev fala do campo *da tabela* no insert/update, não de payload nem de tela — vale para qualquer origem de gravação: REST, tela, job, integração; se for só o payload que chega no endpoint, é `controller`; se for `NOT NULL` na coluna, é `database`), ao implementar auditoria de alterações (quem mudou e quando) — inclusive em documento nativo, como gravar automaticamente quem mudou o status do pedido —, ao reagir a mudança de status de um registro, ao bloquear gravação ou exclusão com exceção em `before*`, ao trabalhar com classes `*Listener` de persistência, ou ao tocar

## 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/listener)
- [License: MIT](https://github.com/snk-devcenter/addon-studio/tree/HEAD/plugins/addon-studio/skills/listener)

## Features

- **Persistence event hooks:** Covers before and after insert, update and delete methods on a PersistenceEventAdapter subclass.
- **Changed-field filtering:** Shows how to react only when specific fields change using ModifingFields checks.
- **Typed entity updates:** Explains EventEntity usage so only the columns a rule changed are written back to the VO.
- **Write blocking:** Describes stopping inserts and deletes with typed business exceptions raised in before methods.
- **Transaction and loop safety:** Lists guidance on transaction propagation, after-commit tasks and guard clauses against event loops.
- **Common pitfalls checklist:** Provides an anti-pattern table and a checklist for creating a new listener.

## Good for

- Create a listener that recalculates a total when quantity or unit price changes
- Block deletion of a record when dependent data exists
- Audit who changed the status of an order and when
- Review an existing listener for loops or unsafe external calls
- Validate a required table field on insert regardless of where the write comes from

## 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/listener`:

```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/listener &&
cp -R "$tmp/plugins/addon-studio/skills/listener" ~/.claude/skills/listener &&
rm -rf "$tmp"
```

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

### Codex

Copy the skill folder to `~/.agents/skills/listener` 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/listener &&
cp -R "$tmp/plugins/addon-studio/skills/listener" ~/.agents/skills/listener &&
rm -rf "$tmp"
```

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

### Cursor

Copy the skill folder to `~/.cursor/skills/listener` 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/listener &&
cp -R "$tmp/plugins/addon-studio/skills/listener" ~/.cursor/skills/listener &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/listener` 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/listener
```

Or copy the folder to `~/.gemini/skills/listener` yourself.

### VS Code

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

```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/listener &&
cp -R "$tmp/plugins/addon-studio/skills/listener" ~/.copilot/skills/listener &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/listener` 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/listener` into your agent's skills folder as `listener`. Agents that support SKILL.md read one folder per skill.

## FAQ

### Which Sankhya entities can the listener watch?

Any JAPE entity, including the add-on's own entities and native system instances such as CabecalhoNota or Parceiro, named through the instanceNames attribute.

### Does the listener need manual XML registration?

No. The @Listener annotation registers it automatically.

### When should I use this instead of a BeforeLoadListener?

Use @Listener for reacting to insert, update or delete. Use @BeforeLoadListener for filtering reads and searches, which is covered by a separate skill.

### Can I call an external HTTP API from the listener?

The skill says synchronous external calls inside the listener are not allowed; it recommends writing to a queue table and processing it with a job or asynchronous worker.

### How do I install Listener in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/listener to use it in all your projects, or to .claude/skills/listener 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 Listener 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 Listener?

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 Listener?

The closest alternatives to Listener are Before load listener, Callback, Entity, Test and Job.

## Where this comes from

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

## Alternatives

- [Before load listener](https://ai-powered.com/skills/before-load-listener): Before load listener is an open-source agent skill for developer tools.
- [Callback](https://ai-powered.com/skills/callback): Callback is an open-source agent skill for developer tools.
- [Entity](https://ai-powered.com/skills/entity): Entity 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.
- [Job](https://ai-powered.com/skills/job): Job is an open-source agent skill for developer tools.
- [Type adapter](https://ai-powered.com/skills/type-adapter): Type adapter 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.
- [Java hibernate jpa](https://ai-powered.com/skills/java-hibernate-jpa): Java hibernate jpa is an open-source agent skill for databases.

---
Source: https://ai-powered.com/skills/listener
