Skip to content

feat(best-practices): add scheduler expert skill#165

Open
Himanich wants to merge 10 commits into
mainfrom
feat/best-practices-expert-skills
Open

feat(best-practices): add scheduler expert skill#165
Himanich wants to merge 10 commits into
mainfrom
feat/best-practices-expert-skills

Conversation

@Himanich

@Himanich Himanich commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator

Introduces best-practices/scheduler/ as the first expert skill subdirectory, replacing the flat references/scheduler*.md files.

  • SKILL.md: lean control plane — classification, path-aware review checklist (cross-cutting / Path A / Path B separated), troubleshooting fingerprints, common pitfalls, modern alternatives
  • path-a.md: full Path A migration steps (A1–A9), property reference table including scheduler.period/scheduler.name, configurable-cron redirect to Path B, getServiceResourceResolver null-safety note, greenfield template
  • path-b.md: full Path B Sling Jobs steps (B1–B5), idempotency guard pattern, canRunConcurrently() drop note, complete import lists for both Scheduler and JobConsumer classes, @Activate/@Modified dual-annotation and separate-method lifecycle variants Old reference files are deleted in a later task
    after all five expert skills are in place

Description

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Introduces best-practices/scheduler/ as the first expert skill subdirectory,
replacing the flat references/scheduler*.md files.

- SKILL.md: lean control plane — classification, path-aware review checklist
  (cross-cutting / Path A / Path B separated), troubleshooting fingerprints,
  common pitfalls, modern alternatives
- path-a.md: full Path A migration steps (A1–A9), property reference table
  including scheduler.period/scheduler.name, configurable-cron redirect to
  Path B, getServiceResourceResolver null-safety note, greenfield template
- path-b.md: full Path B Sling Jobs steps (B1–B5), idempotency guard pattern,
  canRunConcurrently() drop note, complete import lists for both Scheduler and
  JobConsumer classes, @Activate/@Modified dual-annotation and separate-method
  lifecycle variants
Old reference files are deleted in a later task
after all five expert skills are in place

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 1, 2026

Copy link
Copy Markdown

Tessl Skill Lint

edge-delivery-services — clean

stardust — clean


✅ All 2 tile(s) clean.

Updated by tessl-lint for commit a1c7211.

… practices

path-a.md:
- Add resolver.commit() guidance for write-side schedulers with PersistenceException handling
- Add author-only run mode guard pattern using SlingSettingsService
- Add enabled flag + volatile field pattern to greenfield template
- Add @Designate-backed @Modified guidance for non-scheduling config updates
- Soften @deactivate checklist item to optional for stateless schedulers
- Replace {best-practices} placeholder with relative path

path-b.md:
- Fix idempotency guard: was a no-op after unscheduleExistingJobs(); restructured as
  explicit alternative pattern with stale-cron limitation warning
- Fix ConcurrentModificationException: wrap getScheduledJobs() in new ArrayList<>()
- Add missing import java.util.ArrayList to B1 code block
- Add missing import JobResult to B2 code block
- Add author-only run mode guard using SlingSettingsService in B1
- Remove unused JobBuilder import from B4; replace Collection with ArrayList
- Replace {best-practices} placeholder with relative path

references/scheduler*.md:
- Add deprecation notices pointing to scheduler/ expert skill

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Himani Chauhan and others added 2 commits June 3, 2026 11:40
Introduces best-practices/resource-change-listener/SKILL.md as the second
expert skill subdirectory, replacing the flat references/resource-change-listener.md
file.

Single-file SKILL.md (no split needed — one target architecture: lightweight
listener + JobConsumer). Covers:

- Two interface variants (ResourceChangeListener vs ExternalResourceChangeListener)
- Three CS-specific constraints (no Session in onChange, service-user resolver
  in consumer, filter at registration)
- Classification: skip / R1-R5 / R0+R1-R5 based on source type
- Complete before/after example (legacy JCR EventListener → RCL + JobConsumer)
- R0: convert from javax.jcr.observation.EventListener or resource-topic EventHandler
- R1: keep onChange lightweight, per-change try/catch mandatory
- R2: JobConsumer with resolver.commit() guidance, PersistenceException handling,
  author-only SlingSettingsService guard
- R3: ResourceChangeListener vs ExternalResourceChangeListener decision,
  multi-pod fan-out warning
- R4: full import diff
- R5: Repoinit + ServiceUserMapperImpl.amended config
- Review checklist (cross-cutting + listener + consumer + configuration)
- Troubleshooting fingerprints with grep-able log strings
- Common pitfalls (silent registration, topic mismatch, external-by-default,
  missing commit)
- Modern alternatives decision matrix

Cross-cutting fix (scheduler):
- Remove /system/console URL references from scheduler troubleshooting; describe
  component runtime state instead. Felix Web Console is not accessible on
  AEMaaCS production — use Developer Console in Cloud Manager. Same approach
  applied to RCL troubleshooting.

Deprecation notice added to references/resource-change-listener.md pointing to
the new expert skill.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…eedback

Apply reviewer feedback to bring RCL skill to expert-skill standards for AEMaaCS:

- Soften absolute "all business logic must be offloaded" wording in Overview and
  R1; allow small in-memory operations (metrics, lightweight filtering, enqueue)
  in onChange() while keeping the strong rule against repository access, I/O,
  and expensive computation
- Add AEM Eventing to Modern Alternatives as the supported path for notifying
  external systems (Adobe I/O Events, App Builder, webhooks); RCL clarified as
  in-process pattern
- Add cluster-coordination warning to author-only consumer pattern: run mode
  check does not guarantee single execution on author clusters
- Strengthen ExternalResourceChangeListener guidance with explicit pre-selection
  checklist (idempotency, duplicate-processing tolerance, intentional per-node
  execution)
- Soften "not recommended" wording for javax.jcr.observation.EventListener;
  preserve escalation path (Adobe support case for documented platform needs)
- Add PROPERTY_NAMES_HINT semantics note: optimization hint, not a contract;
  application code must validate actual ResourceChange data
- Add Common Pitfalls: event storms from broad PATHS, recursive self-triggering
  when consumer writes to observed subtree
- Add Troubleshooting rows: repeated self-triggering, excessive job volume
- Add Expert Guidance section: idempotency principles for distributed AEMaaCS
  (event batching, retries, cluster coordination, derive state from repository)
- Add note that PATHS are chosen by the implementer from the business scope;
  do not ask customer for raw PATHS syntax

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
mandeep294 pushed a commit to mandeep294/skills that referenced this pull request Jun 3, 2026
Design doc for merging health-assessment into code-assessment as a single
code-quality skill with per-pattern expert skills (PR adobe#165 shape). MCP becomes
an optional accelerator with auto-fallback to local discovery; one shared engine
owns all repo-touching logic. Captures locked decisions (Q1 fallback, Q2
per-pattern resolution contract, Q3 single engine, Q5 report-all/apply-one) and
carries over shared-principles unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
mandeep294 pushed a commit to mandeep294/skills that referenced this pull request Jun 3, 2026
8-task plan to merge health-assessment into code-assessment as a single
MCP-optional skill with per-pattern expert skills (PR adobe#165 shape). Each task
ends in skills-ref validate + dangling-reference grep + commit. No manifest
edits (skills auto-discovered).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
mandeep294 pushed a commit to mandeep294/skills that referenced this pull request Jun 3, 2026
Task 1 of the umbrella-skill plan. Moves _template.md into code-assessment/
references/ and rewrites it to the per-pattern expert-skill shape (PR adobe#165).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Himani Chauhan and others added 2 commits June 8, 2026 14:49
Introduces best-practices/replication/SKILL.md as the third expert skill
subdirectory, replacing the flat references/replication.md file.

Single-file SKILL.md covering the Sling Distribution API (Distributor +
SimpleDistributionRequest) end-to-end:

- Migration from CQ Replicator (com.day.cq.replication.Replicator) and Sling
  Replication Agent (org.apache.sling.replication.agent.api) to the Sling
  Distribution API
- Predefined agents on AEMaaCS: publish (default) + preview (opt-in)
- ReplicationActionType → DistributionRequestType mapping table
- P1-P4 transformation steps with imports and service-user setup
- Repoinit + ServiceUserMapperImpl.amended with principal-name mapping;
  crx:replicate privilege requirement
- Author-only execution guard + author cluster coordination warning
- Greenfield template: agent iteration, defensive preview handling,
  isAgentNotConfigured helper, JobResult-style outcome classification
- Composition example: ResourceChangeListener → JobConsumer → Distributor
  with DistributionResponse → JobResult mapping (CANCEL for unrecoverable
  permission/agent errors; FAILED for transient queue/transport)
- Tree Activation workflow as Adobe's recommended path for bulk publishing
  (not custom loops)
- Distribution UI guidance: Tools > Deployment > Distribution, queue states
  (persisted → fully published), Queue items and Logs panels, blocked/paused
  agent status
- Async semantics emphasis: isSuccessful() means queued, not delivered
- Troubleshooting fingerprints with grep-able log strings (state=DROPPED,
  not authorized, no matching agent, ClassNotFoundException)
- Common pitfalls (legacy agent names, deep=true on broad paths, USER/PASSWORD
  auth maps, treating async as sync, building custom bulk loops, swallowing
  DistributionException)
- Expert Guidance with explicit Practical Engineering Notes subsection
  separating Adobe-documented behavior from engineering observations
  (de-duping, OSGi event topics)
- Modern Alternatives matrix including AEM Eventing for external notification

Deprecation notice added to references/replication.md pointing to the new
expert skill.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…e-listener

feat(best-practices): add resource-change-listener expert skill
feat(best-practices): add replication expert skill
Himani Chauhan and others added 3 commits June 8, 2026 15:41
Introduces best-practices/event-migration/SKILL.md as the fourth expert skill
subdirectory, replacing the flat references/event-migration*.md files
(router + path-a + path-b consolidated into one expert skill).

Single-file SKILL.md (~800 lines) covering the lightweight EventHandler +
JobConsumer pattern for non-resource OSGi Event Admin topics:

- Routing-first rules: resource events → resource-change-listener skill,
  external notification → AEM Eventing, only non-resource OSGi topics
  (replication, workflow, custom) belong in this skill
- Topic discovery guidance: canonical topic constants (ReplicationEvent,
  WorkflowEvent, NotificationConstants) and warning that typo'd topic
  strings silently subscribe to nothing
- Three CS-specific constraints: no JCR ops in handleEvent, service-user
  resolver in consumer, TopologyEventListener for leader-only execution
- Migration steps E0-E5 covering legacy JCR EventListener (rare) and OSGi
  EventHandler with inline logic
- Complete before/after example: ReplicationEvent handler with isLeader gate +
  separate JobConsumer with resolver.commit() and PersistenceException handling
- Workflow event variant: shows only the deltas from the replication example
  (topic, event-type discriminator, WorkflowEvent payload keys)
- Multi-topic / wildcard subscription pattern with event.getTopic() dispatch
- TopologyEventListener pattern: when to add leader election, when to skip,
  volatile field requirement, TOPOLOGY_INIT and TOPOLOGY_CHANGED handling
- Greenfield rules and JobConsumer template with JobResult outcome
  classification (CANCEL for missing required data, FAILED for transient,
  OK for success)
- Composition: EventHandler → JobConsumer → Distributor cross-reference to
  replication skill
- Repoinit + ServiceUserMapperImpl.amended with principal-name mapping
- Review checklist: cross-cutting + EventHandler + leader election +
  JobConsumer + configuration
- Troubleshooting fingerprints with grep-able log strings
- Common pitfalls: business logic in handleEvent, deprecated resource topics,
  run-mode as singleton guard, missing volatile on isLeader, topic constant
  mismatch, OSGi for external notification, TopologyEventListener without
  consuming topology
- Modern Alternatives with AEM Eventing for external systems
- Expert Guidance with idempotency principles for distributed AEMaaCS
- Practical Engineering Notes separating Adobe-documented behavior from
  engineering observations (TOPOLOGY_CHANGING reset, event ordering, LDAP
  filter syntax)

Deprecation notices added to references/event-migration.md, event-migration-path-a.md,
and event-migration-path-b.md pointing to the new expert skill.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Reverts the size-driven trims to the workflow variant, Greenfield template,
and Composition section. The trims removed redundancy but forced the LLM to
mentally reconnect patterns shown elsewhere, which is the actual hallucination
risk vector — not raw file size.

Restored:

- Workflow variant: full standalone EventHandler class (was: deltas-only). LLM
  can now copy-paste a workflow handler without reassembling from the
  replication After example.
- Greenfield template: full File 1 (EventHandler + TopologyEventListener) +
  File 2 (JobConsumer with outcome classification) (was: JobConsumer + rules
  only). LLM has a complete handler+consumer pair to pattern-match against.
- Composition section: full process() method with try-with-resources and
  exception handling (was: just the integration call). LLM gets the full
  pattern for EventHandler -> JobConsumer -> Distributor composition.

Trade-off accepted: file is back to ~930 lines (vs RCL 662 / replication 728).
Event-migration legitimately covers more (E0-E5 + workflow variant +
composition + leader election). Self-contained examples reduce
pattern-reconstruction errors when the LLM generates code for any of the
three use cases, which matters more than file length at this scale (Claude
4.x handles 900+ line skills comfortably).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

2 participants