Skip to content
Skill

Before load listener

Adds dynamic search filters to Sankhya entity finders before the query runs

Before load listener is an open-source agent skill for developer tools. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

Scripts
None
Platforms
Claude Code, Codex, Cursor
GitHub stars
7
Last commit
License
MIT
Listing updated

Similar skills

About Before load listener

This skill guides an agent through creating, reviewing and standardizing a FinderListener annotated with @BeforeLoadListener in a Sankhya Addon Studio 2.0 project. The listener intercepts every read or load of one entity through JAPE and can append criteria to the WHERE clause, such as a per-user or multi-tenant restriction applied transversally rather than in each query. The skill covers the rules for composing the clause without overwriting existing filters, the required this. prefix on fields, and keeping the beforeExecute method lightweight because it runs on every search.

It also explains how this annotation differs from @Listener, which handles insert, update and delete events, and from @Criteria, which applies to a single repository query. The guidance points out that the target entity must be declared in the data dictionary, either through XML or a JapeEntity annotation, and that the listener only works on the add-on's own instances, not native system entities. A checklist and anti-pattern table help with reviews, including the rule of one listener per entity and the transaction type to check on services called from the listener.

The content is written in Portuguese and targets Java 8, Gradle, Wildfly/EJB, Guice injection and the JAPE SDK.

When your agent uses it

Cria, revisa e padroniza interceptadores de busca Sankhya com `@BeforeLoadListener` (interface `FinderListener` + método `beforeExecute`) — injeta filtros/critérios dinâmicos no Finder JAPE antes da query chegar ao banco. Use ao criar, alterar, revisar, auditar ou padronizar interceptação de buscas/carregamento de entidades, ao implementar `beforeExecute`, ao aplicar filtro de segurança/multi-tenant transversal a uma entidade (só trazer os registros da empresa do usuário logado, sem depender de quem chama e sem repetir o filtro em cada consulta), ao trabalhar com classes `*FinderListener`, ou ao tocar em código com `@BeforeLoadListener`/`FinderListener`. NÃO usar para reagir a gravação/exclusão (eventos CRUD insert/update/delete, `PersistenceEventAdapter`) — isso é `@Listener`, skill `listener`.

From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.

What it can access

From a static check of its 1 file (14 KB) on GitHub on 4 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.

Check another skill before you install it.

Install

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

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

Or copy only this skill to ~/.claude/skills/before-load-listener:

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

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

Claude Code docs on skills

Copy the skill folder to ~/.agents/skills/before-load-listener to use it in every repository:

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

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

Codex docs on skills

Copy the skill folder to ~/.cursor/skills/before-load-listener to use it in every project:

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

For one project only, put the folder in .cursor/skills/before-load-listener inside it instead.

Cursor docs on skills

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

gemini skills install https://github.com/snk-devcenter/addon-studio.git --path plugins/addon-studio/skills/before-load-listener

Or copy the folder to ~/.gemini/skills/before-load-listener yourself.

Gemini CLI docs on skills

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

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

For one project only, put the folder in .github/skills/before-load-listener inside it instead.

VS Code docs on skills

Get the folder:

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

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

The SKILL.md format

What it does

Search interception setup
Explains how to annotate a FinderListener so it runs before every search on one add-on entity.
Safe WHERE clause composition
Shows how to append criteria to the existing clause so earlier filters are not discarded.
Per-user filtering
Demonstrates restricting results to the logged-in user's records using the session context.
Dictionary and scope checks
Lists the prerequisites: entity declared in the data dictionary and limited to add-on instances.
Performance guidance
Advises keeping the method lightweight and caching stable configuration since it runs on every search.
Review checklist
Provides a step-by-step checklist and anti-pattern table for new or reviewed listeners.

Good for

  • Restrict search results of a custom entity to the records of the logged-in user's company
  • Add a soft-delete or active-status filter to every query on an add-on entity
  • Review an existing FinderListener for clause handling and naming mistakes
  • Create a new before-load listener that injects a service through Guice

Before load listener FAQ

Can this be used on native Sankhya entities like Parceiro or Produto?

No. The skill states that the listener may only intercept instances created by the add-on itself, not native system instances.

Should I use this for validating records on save or delete?

No. The skill directs save and delete reactions to the separate listener skill, since this annotation only intercepts reads.

Why must the new filter be appended instead of set directly?

Because setWhere replaces the entire WHERE clause, so the skill recommends combining the existing clause from getWhere with the new criterion using AND.

What does the instance attribute refer to?

It is the logical entity name from the JapeEntity annotation or the XML instance name, not the database table name.

How do I install Before load listener in Claude Code?

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

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

Where this comes from

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

More from snk-devcenter/addon-studio

  1. Guides writing Sankhya commercial business rules with @BusinessRule for sales documents

    • Open source
    • 7 GitHub stars
    • Enterprise it
  2. Lets agents write, review and refactor Sankhya document callbacks with @Callback hooks

    • Open source
    • 7 GitHub stars
    • Developer tools
  3. Builds and reviews Sankhya REST endpoints with @Controller, DTOs and transactions

    • Open source
    • 7 GitHub stars
    • Developer tools
  4. Sets up global Sankhya exception handlers with rollback, error DTOs and HTTP status

    • Open source
    • 7 GitHub stars
    • Developer tools
  5. Generates Sankhya CRUD screens from table XML in datadictionary/ with no JS or HTML

    • Open source
    • 7 GitHub stars
    • Developer tools
  6. Creates and audits dual MSSQL/Oracle database migration scripts for Sankhya addons

    • Open source
    • 7 GitHub stars
    • Databases