brainstorming
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).
inject-in-sling-modelAEM Cloud Service expert skill — migrate javax.inject.@Inject fields in Sling Model (@Model) classes to injector-specific annotations (@ValueMapValue / @OSGiService / @SlingObject). Self-discoverable (scan for @Model classes with field-level @Inject); the replacement is chosen deterministically from each field's declared type. Use for "fix @Inject in HeroMo…
Independent GitHub snapshot · Automated classification · Original documentation governs
This pattern is executed by the code-assessment runbook — follow
../references/runbook.mdfor the full flow (preflight → plan → apply → verify, run log). This skill supplies the detection + recipe the runbook applies.
javax.inject.@Inject on fields of @Model classes is discouraged by the Apache Sling Models documentation. Removing @Inject without a replacement breaks injection, so each field is migrated to an injector-specific annotation chosen from its declared type.
*.java file whose class is annotated @Model, with at least one field annotated @Inject.@Inject are out of scope (trigger the file-level skip).Detection is performed by the analyzer (../scripts/analyze.sh), run by
the runbook:
bash ../scripts/analyze.sh <workspace-root> --pattern inject-in-sling-model
Match criteria (what the detector flags): a class annotated @Model
(org.apache.sling.models.annotations.Model, confirmed import-aware) with at least one field
annotated @Inject (javax.inject.Inject or jakarta.inject.Inject). One finding per matching
field. Constructor/setter @Inject and non-@Model classes are not flagged. The replacement
annotation is chosen from the field's declared type by the decision table in recipe.md.
self-evident — the replacement annotation is fully determined by the field's declared Java type via the decision table in recipe.md. No external input is required.
Resource / ResourceResolver / request / response) → @SlingObject, not @Self@Named merged into the new annotation's name; @Default / @Via preserved@Optional → per-field injectionStrategy = InjectionStrategy.OPTIONAL (never a class-level defaultInjectionStrategy change)Read recipe.md in full before editing: input contract, decision table, companion annotations, import management, unlocatable / skip-file policy, per-file procedure, before/after example, editing strategy.
The skill never commits. See ../references/git-workflow.md for git vs in-place handoff and the suggested commit message.