# Controller advice

> Controller advice is an open-source agent skill for developer tools. Sets up global Sankhya exception handlers with rollback, error DTOs and HTTP status. It is available on Claude Code.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code
- **Website:** https://github.com/snk-devcenter/addon-studio/tree/main/plugins/addon-studio/skills/controller-advice
- **Repository:** https://github.com/snk-devcenter/addon-studio
- **GitHub stars:** 7
- **License:** MIT
- **Skill name:** controller-advice
- **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 the creation, review and consolidation of a single global exception handling layer for Sankhya Addon Studio 2.0 projects, built on a ControllerAdvice class with ExceptionHandler methods. It covers the rules that make these handlers work: handlers must return an object or primitive rather than void, each exception should map to exactly one handler across the project, and generic catch-all handlers for Exception should be avoided.

The skill also sets out a standard error response shape with a code, message, status and timestamp, and insists that stack traces stay in server logs rather than reaching the client. It includes a suggested log level table for common Sankhya and Java exceptions, plus an anti-pattern list and a checklist for adding a new advice class.

It expects a Java 8 Gradle project using the Addon Studio web and Lombok annotations, and it refers to a related controller skill for the endpoints that raise these exceptions. The content is written in Portuguese.

## When your agent uses it

> Cria, revisa e padroniza handlers globais de exceção Sankhya com `@ControllerAdvice` + `@ExceptionHandler` — rollback automático, DTO de erro, mapeamento de status HTTP, inclusive para violação de `@Valid` vinda do controller. Declarar a constraint no DTO é `controller`; aqui mora a resposta HTTP da violação e de qualquer exceção do addon. Use ao criar, alterar, revisar, auditar ou consolidar tratamento de exceções globais em projetos Sankhya Addon Studio, quando exceção do addon volta stacktrace cru para o cliente ou cada endpoint trata erro do seu jeito, ou ao tocar em código com `@ControllerAdvice`/`@ExceptionHandler`.

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

## Features

- **Global exception advice:** Shows how to centralize handling for all controllers in one ControllerAdvice class.
- **Standard error response:** Provides a DTO with code, message, status and timestamp fields for client-facing errors.
- **Handler design rules:** Explains constraints such as non-void return types and one handler per exception.
- **Log level guidance:** Suggests logging levels for common entity, validation, integration and IO exceptions.
- **Anti-pattern checklist:** Lists practices to avoid, such as catch-all handlers and exposed stack traces.

## Good for

- Create a global exception handler for an Addon Studio project
- Review existing controllers for inconsistent error responses
- Consolidate duplicate exception handlers across the codebase
- Map service exceptions to proper HTTP status codes
- Stop stack traces from leaking to API clients

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

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

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

### Codex

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

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

### Cursor

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

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

Or copy the folder to `~/.gemini/skills/controller-advice` yourself.

### VS Code

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

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

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

## FAQ

### Does a caught exception in an exception handler roll back the transaction?

Yes. Catching an exception marks the active transaction for rollback automatically, so no manual action is needed.

### Can an ExceptionHandler method return void?

No. Handlers must return an object or primitive because the result is serialized to JSON with Gson.

### Should I use a catch-all handler for Exception?

No. The skill advises declaring specific exception classes, since a generic handler can take over exceptions meant for more specific handlers.

### What does the skill require from the environment?

It targets Sankhya Addon Studio 2.0 with Wildfly/EJB and JAPE SDK, Java 8, Gradle and ISO-8859-1 encoding.

### How do I install Controller advice in Claude Code?

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

Claude Code. It reads skills in the SKILL.md format; the install steps on this page show where to put the folder.

### What are the best alternatives to Controller advice?

The closest alternatives to Controller advice are Controller, Type adapter, Test, Callback and Retrofit.

## Where this comes from

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

## Alternatives

- [Controller](https://ai-powered.com/skills/controller): Controller 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.
- [Test](https://ai-powered.com/skills/test-snk-devcenter): Test 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.
- [Retrofit](https://ai-powered.com/skills/retrofit): Retrofit 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.
- [Repository](https://ai-powered.com/skills/repository): Repository 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/controller-advice
