Skip to content
Skill

Macros

Portable SQL macros for Sankhya addons that run on both Oracle and MSSQL

Macros 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 Macros

This skill documents the SQL macros interpreted by the Sankhya MacroTranslator, covering date, text, type conversion and null handling helpers such as dbDate, nullValue, ignorecase, normalizeText, truncMonth, yearMonth and addMonths. It is meant for Sankhya Addon Studio 2.0 projects that need one SQL syntax working against both database engines.

Beyond the reference tables, it gives the agent an anti-pattern list that maps native Oracle or MSSQL functions such as NVL, ISNULL, SYSDATE, GETDATE, SUBSTR and ADD_MONTHS to their macro equivalents. It also lists edge cases where macros are not fully portable, for example argument ordering in diffdays, ISNULL truncating defaults, and row limiting that cannot be expressed in plain SQL across both databases.

The guidance applies to queries in queries folders, data dictionary expressions, @Criteria and @NativeQuery annotations, and JSP query tags. It explicitly excludes dbscripts, where database specific tags are used instead. The skill is a plain documentation folder with no scripts, targeting Java 8, Gradle and ISO-8859-1 encoded addon projects.

When your agent uses it

Macros SQL do MacroTranslator Sankhya (`dbDate`, `nullValue`, `ignorecase`, `normalizeText`, `truncMonth`, `yearMonth`, `addMonths`) para portabilidade Oracle/MSSQL. Use ao escrever, revisar, auditar ou portar SQL em `queries/`, `datadictionary/` ou `@NativeQuery`, ao ver `NVL`, `ISNULL`, `COALESCE`, `SYSDATE`, `GETDATE`, `TRUNC(`, `SUBSTR` ou `UPPER` em SQL do addon, ao identificar oportunidades de substituir SQL específico de banco por macro, ou ao diagnosticar diferenças de comportamento entre Oracle e MSSQL. NÃO usar em `dbscripts/` — lá cada tag `<mssql>`/`<oracle>` usa a sintaxe nativa do banco (skill `database`).

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/macros:

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

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

Claude Code docs on skills

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

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

Codex docs on skills

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

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

Or copy the folder to ~/.gemini/skills/macros yourself.

Gemini CLI docs on skills

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

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

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

The SKILL.md format

What it does

Date and time macros
Helpers for current database time, truncation to month, quarter or year, and month arithmetic.
Text comparison helpers
Accent and case insensitive comparison and normalized text search across both engines.
Type conversion macros
Portable conversions to numeric, float, varchar, timestamp and datetime values.
Null handling macro
A single replacement for NVL and ISNULL with notes on default value pitfalls.
Native SQL anti-patterns
A mapping from vendor-specific functions to the macros that should replace them.
Portability caveats
Documented edge cases where macros behave differently between Oracle and MSSQL.

Good for

  • Rewrite an Oracle-only query so it also runs on MSSQL
  • Review addon SQL for NVL, SYSDATE or SUBSTR calls that should become macros
  • Build a monthly sales ranking query with truncMonth and ignorecase
  • Find why a date difference returns the wrong sign on SQL Server
  • Add a calculated data dictionary field that replaces nulls with a default

Macros FAQ

Which environment does Macros target?

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

Where should these macros not be used?

In dbscripts, where each mssql or oracle tag must use the native syntax of that database instead of macros.

Can macros limit the number of returned rows?

Not portably. The skill advises applying limits outside the SQL, for example with Pageable in @Criteria, because maxLines puts different clauses in incompatible positions.

Does the skill change the way Oracle NVL is handled?

It notes that NVL(x, '') in Oracle is effectively a no-op and should be translated to x rather than to nullValue.

How do I install Macros in Claude Code?

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

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

The closest alternatives to Macros are Sankhya utils, Data dictionary, Jsp, Repository and SQL code review.

Where this comes from

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

More from snk-devcenter/addon-studio

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

    • Open source
    • 7 GitHub stars
    • Developer tools
  2. Guides writing Sankhya commercial business rules with @BusinessRule for sales documents

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

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

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

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

    • Open source
    • 7 GitHub stars
    • Developer tools