plugins/aem/cloud-service/skills/code-assessment/inject-in-sling-model/SKILL.md
[BETA] AEM 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 HeroModel.java", "modernize my Sling Models", or when scanning an AEM project for @Inject misuse. Detailed decision table, companion-annotation handling, import management, and file-level skip policy are in recipe.md. This skill is in beta. Verify all outputs before applying them to production projects.
npx skillsauth add adobe/skills inject-in-sling-modelInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Beta Skill: This skill is in beta and under active development. Results should be reviewed carefully before use in production. Report issues at https://github.com/adobe/skills/issues
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.
tools
Use the run-workflow MCP to discover, compose, execute, publish, and save Adobe Firefly workflows. TRIGGER when: user asks what actions are available, what the MCP can do, how to process images/video/3D via workflow, wants to build/run/save/publish a workflow, OR pastes any workflow/batch/execution ID. BARE ID (UUID/workflowId/batchId) = INSPECT ONLY — call inspect_run, NEVER run_workflow_submit. ALWAYS call list_actions first for capability/discovery questions. DO NOT TRIGGER for direct Firefly API calls without MCP (use firefly-api-specs).
tools
Run predefined featured workflows via run-workflow MCP. TRIGGER when user names a featured workflow (retargeting, banners at scale, localization, packaging, banner advertising, etc.) or asks to run a known marketing/production workflow. Requires run-workflow MCP. ALWAYS call get_featured_workflow before compose_workflow. DO NOT TRIGGER for custom one-off workflows with no named template — use run-workflow skill.
tools
Migrate an Adobe Commerce App Builder project from the Integration Starter Kit or Checkout Starter Kit to the new App Management approach. Run from the root of the App Builder project to be migrated. Pass --auto to skip confirmation prompts (suitable for CI or batch use) — auto mode prints a summary of all Q&A questions answered with their defaults. Pass --doc-scan-only to scan README.md and env.dist for outdated content without modifying any files. Use when the user wants to migrate an App Builder project from the Integration Starter Kit or Checkout Starter Kit to the App Management approach, or mentions upgrading their Adobe Commerce extension architecture.
development
Add or modify webhook interceptors in an Adobe Commerce app. Use when the user wants to intercept Commerce operations to validate input, append data, or modify behavior — before or after execution. Requires a base app initialized with commerce-app-init.