Skip to content

Add AI Agent Skills support using the skills.sh convention - #1004

Open
benjaminloerincz wants to merge 9 commits into
jongpie:mainfrom
benjaminloerincz:skills
Open

Add AI Agent Skills support using the skills.sh convention#1004
benjaminloerincz wants to merge 9 commits into
jongpie:mainfrom
benjaminloerincz:skills

Conversation

@benjaminloerincz

Copy link
Copy Markdown

Summary

This PR introduces AI Agent Skills for Nebula Logger using the skills.sh convention and a structure similar to the approach used by forcedotcom/sf-skills.

The goal is to help AI coding assistants such as GitHub Copilot, Claude Code, Cursor, Windsurf, Gemini CLI, Cline, and other compatible agents understand how to correctly install, configure, and use Nebula Logger.

With this change, developers can install Nebula Logger-specific guidance directly into their AI-assisted development workflow via:

npx skills add jongpie/NebulaLogger

The implementation is intentionally documentation-only and does not introduce any runtime, packaging, metadata, or API changes.

Motivation

Nebula Logger has become one of the most widely used logging and observability frameworks in the Salesforce ecosystem.

As AI-assisted development becomes increasingly common, developers frequently ask coding agents questions such as:

  • How do I install Nebula Logger?
  • How should I implement logging in Apex?
  • How do I log from LWC, Flow, Aura, or OmniStudio?
  • What logging levels should I use in production?
  • How should I structure scenarios, tags, and retention policies?

Without project-specific guidance, AI assistants often generate generic Salesforce logging approaches rather than Nebula Logger best practices.

This PR aims to provide Nebula Logger-specific knowledge directly to AI agents using the emerging skills.sh ecosystem.

What This PR Adds

New skills/ Directory

skills/
├── nebula-logger-install/
│   └── SKILL.md
├── nebula-logger-apex-logging/
│   └── SKILL.md
└── nebula-logger-best-practices/
    └── SKILL.md

Skill: Installation & Configuration

nebula-logger-install

Covers:

  • Unlocked vs Managed package selection
  • Installation methods
  • Permission set assignments
  • LoggerSettings configuration
  • Common post-install troubleshooting

Skill: Apex, LWC, Aura, Flow & OmniStudio Usage

nebula-logger-apex-logging

Covers:

  • Apex logging patterns
  • Exception handling
  • Record association
  • Tags and scenarios
  • Parent-child transaction correlation
  • LWC logging
  • Aura logging
  • Flow logging
  • OmniStudio integration
  • Save method selection

Skill: Governance & Best Practices

nebula-logger-best-practices

Covers:

  • Team-wide logging standards
  • Environment-specific logging levels
  • Retention and purging strategies
  • Governor limit awareness
  • Review guidance and operational best practices

skills.sh Configuration

Adds a skills.sh.json configuration file to organize skills into:

  • Setup
  • Usage
  • Governance

README Enhancement

Adds a small "AI Agent Skills" section documenting how developers can install Nebula Logger skills using:

npx skills add jongpie/NebulaLogger

Inspiration

The initial idea for this contribution was inspired by the excellent community content around Nebula Logger.

In particular, Amit Chaudhary's (@amit-salesforce) Apex Hours article "Nebula Logger Salesforce: The Complete Setup, Usage & Best Practices Guide" did a fantastic job of bringing installation guidance, architecture concepts, practical implementation patterns, and operational best practices together in a single resource.

That article inspired the idea of making Nebula Logger knowledge available directly within AI-assisted development workflows.

The skill contents included in this PR were written specifically for this repository and are intended to complement the existing project documentation, README, and Wiki.

Many thanks to Amit for helping promote Nebula Logger across the Salesforce community.

Design Principles

This contribution was intentionally designed to be:

  • documentation-only
  • additive
  • low maintenance
  • non-invasive
  • backward compatible
  • easy to extend in the future

It does not alter:

  • Apex code
  • LWC code
  • metadata
  • package configuration
  • CI/CD workflows
  • release processes

Impact

Runtime Impact

None.

Package Impact

None.

Metadata Impact

None.

Breaking Changes

None.

Future Opportunities

Potential future skills could include:

  • Flow-focused implementation guidance
  • OmniStudio-focused guidance
  • Plugin Framework patterns
  • Reporting and observability dashboards
  • Advanced troubleshooting workflows
  • Enterprise logging governance

These ideas were intentionally left out of the initial contribution to keep the PR small, focused, and easy to review.

Feedback Welcome

I'd love to get feedback on whether maintaining AI Agent Skills within the Nebula Logger repository is something that would be valuable to the project long term.

The implementation is intentionally lightweight and can be adjusted to match the preferred documentation strategy of the project.

Thank you for taking the time to review this contribution!

Comment thread skills/nebula-logger-apex-logging/SKILL.md Outdated

1. Always call `Logger.saveLog()`.
2. Place `Logger.saveLog()` in `finally` blocks for transactional code paths.
3. Use the lowest effective logging level (`ERROR` for failures, `INFO` for business milestones, fine-grained levels for diagnostics).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parenthetical addendum is at odds with the spirit of this point (also, "business milestones" ? How perfectly vague!).

Perhaps a better way to put point 3:

Logging affects performance, but fine-grained log levels like FINEST and FINER can be used (in conjunction with Logger Settings) to skip logging statements in code-intensive path except when debugging.
Prefer higher-level logging (ERROR, WARN, and INFO) for only the most salient info.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the input. I like this direction and will update the text accordingly:

Use logging levels strategically. Fine-grained levels such as FINE, FINER, and FINEST can be combined with Logger Settings to avoid unnecessary logging overhead in performance-sensitive code paths and enable deeper diagnostics only when needed. Reserve higher-level logging (ERROR, WARN, and INFO) for information that is operationally significant.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. @jongpie and I will take a look and see whether any further changes are necessary

Comment thread skills/nebula-logger-install/SKILL.md Outdated
- Renamed the existing nebula-logger-apex-logging skill to nebula-logger-instrumentation and restructured it to cover Apex, LWC, Aura, Flow, and OmniStudio as peer runtime contexts (rather than Apex-first with the other runtimes appended)

- Added a new 'Optional Dependency via CallableLogger' subsection describing how ISVs can integrate with Nebula Logger dynamically without requiring their customers to install it

- Added a Supported API Surface section in nebula-logger-instrumentation as the canonical policy statement and cross-referenced it from the testing and plugin skills

- Added four new skills:
    1. nebula-logger-console: browsing logging data in the UI
    2. nebula-logger-purging-and-retention: LogRetentionDate__c, LogBatchPurger scheduling, per-scenario retention overrides
    3. nebula-logger-testing-your-code: writing subscriber-owned tests using only the global surface
    4. nebula-logger-plugin-development: extending Nebula Logger unlocked package via LoggerPlugin.Triggerable and LoggerPlugin.Batchable

- Updated skills.sh.json to group the seven skills under Setup, Usage, Operations, Governance, and Extending headings

- Updated all of the skills to only reference Nebula Logger's global Apex classes/methods and the exported c/logger LWC module. The plugin-development skill is a deliberate exception since the LoggerPlugin interfaces are public-by-design inside the unlocked package

- Added a top-level skills/README.md as the landing page for all of the skills, with a skill index and a note on the skills.sh publishing model
… ID and version number in skills/nebula-logger-install any time a new package version is created (just like how README.md is auto-updated). Managed package IDs will be updated manually for now (most of the managed package changes are done manually)

Also fixed the managed package version ID for v4.19.0 in nebula-logger/managed-package/sfdx-project.json, it had the wrong ID
@jongpie

jongpie commented Aug 12, 2026

Copy link
Copy Markdown
Owner

@benjaminloerincz thanks so much for submitting this PR, I think this is good idea to include in the repo (and thanks to @jamessimone for all of the feedback!).

I've just pushed some commits with a mix of changes:

  • Added 4 more skills (and renamed 1 of the existing skills) + expanded the contents of skills.sh.json
  • I also made a few changes to the content you had made
  • Updated some build scripts so that package IDs in the install skill are auto-updated so they hopefully don't become stale
  • Added a badge to README.md that will show installation counts of the skills from skills.sh

My hope is to try to merge this in the next few days, but if either of y'all have time to review the changes, I'd love to hear your thoughts.

@jamessimone

Copy link
Copy Markdown
Collaborator

I'll review tomorrow morning!

Comment thread skills/nebula-logger-testing-your-code/SKILL.md Outdated
Comment thread skills/nebula-logger-plugin-development/SKILL.md Outdated
@jongpie

jongpie commented Aug 17, 2026

Copy link
Copy Markdown
Owner

@benjaminloerincz and @jamessimone I've just pushed up some more changes (some to address @benjaminloerincz 's comments, and some other changes for issues/gaps I noticed).

If either of you have time to take a look, let me know if you have any other suggestions.

System.Assert.areEqual(1, entries.size());
System.Assert.areEqual('ERROR', entries[0].LoggingLevel__c);
System.Assert.areEqual(account.Id, entries[0].RecordId__c);
System.Assert.areEqual(thrownException.getMessage, entries[0].ExceptionMessage__c);

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parentheses are missing: It should be thrownException.getMessage() instead of thrownException.getMessage.

- Multiple `saveLog()` calls in a transaction are fine, and often the right choice. Reasonable places to save intermediate state include after each chunk in a batch, at the end of each iteration of a long-running loop's outer scope (never the inner scope - see below), before an async handoff (Queueable / Future / Batchable), and inside a `finally` block that catches an exception you're about to rethrow. Each save publishes only what's in the buffer at that moment, so the entries persist even if the rest of the transaction later blows up.
- What's wrong is calling `saveLog()` after every single log entry. That turns N log calls into N platform-event publishes, burns through `getLimitPublishImmediateDML()` (100 per transaction) fast, and eats into the org's daily platform event allocation for no operational benefit. If you find yourself typing `Logger.info(...); Logger.saveLog();` repeatedly, buffer the entries and save once after the group.
- Never call `saveLog()` inside the innermost body of a loop over records. Buffer entries in the loop and call `saveLog()` after the loop (or at safe checkpoints - after N iterations, after a chunk of work, etc.), not after each record.
- Place a `Logger.saveLog()` call in a `finally` block for transactional code paths so it still runs when an exception escapes the try. Pair it with `Logger.setSaveMethod(...)` at the top of the method if the default `EVENT_BUS` isn't right for that path (see the save-method notes in item 1).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"item 1" has changed due to this commit. Thus, this should be adjusted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants