本文へ移動
cccskills
無料GitHub で公開

inject-in-sling-model

[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.

インストール方法を見る

含まれるファイル(2)

  • SKILL.md3.6 KB
  • recipe.md11.7 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

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

@Inject in Sling Models — AEM as a Cloud Service

This pattern is executed by the code-assessment runbook — follow ../references/runbook.md for the full flow (preflight → plan → apply → verify, run log). This skill supplies the detection + recipe the runbook applies.

Overview

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.

Classification — confirm this pattern applies

  • A *.java file whose class is annotated @Model, with at least one field annotated @Inject.
  • Constructor-parameter and setter-method @Inject are out of scope (trigger the file-level skip).

Discovery

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.

Resolution contract

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.

Review checklist

  • Each migrated field maps to exactly one injector-specific annotation per the decision table
  • Sling objects (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)
  • Unused imports removed; new imports added and ordered per the file's convention
  • File-level skip respected — no partial migration of a file with any ambiguous field

Recipe

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.

Handoff

The skill never commits. See ../references/git-workflow.md for git vs in-place handoff and the suggested commit message.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Analyzes a multi-step conversion funnel to find where visitors drop off and which steps have the worst leakage. Use this skill when someone describes a journey and asks about conversion rates, drop-off, fallout, or step completion. Trigger for "analyze our checkout funnel," "where are visitors dropping off," "what's our add-to-cart to purchase conversion rate," "funnel analysis," "show me fallout between steps," or "which step loses the most visitors."

日本語の概要は準備中です。原文の説明を表示しています。

aemgdc/aemdev22026年10月11日 更新

Generates a concise, executive-ready performance summary covering key metrics, trends, and what's driving movement. Use this skill when someone needs to produce a briefing, executive summary, performance narrative, or stakeholder readout — for example, "write an exec summary of last week's performance," "create a performance briefing for our leadership team," "produce a monthly business review summary," "what should I tell executives about our metrics," or "generate a performance narrative." Also trigger for "QBR summary," "weekly business review," or "stakeholder briefing."

日本語の概要は準備中です。原文の説明を表示しています。

aemgdc/aemdev22026年10月11日 更新

Produces a compact KPI digest showing how key metrics changed over a period and what's driving the movement. Use this skill when someone asks for a performance summary, a weekly recap, a morning briefing, a KPI update, or any variation of "how did we do this week/month." Also trigger for "give me a performance overview," "what moved in the last 7 days," "pull our AA KPI report," or "summarize our metrics."

日本語の概要は準備中です。原文の説明を表示しています。

aemgdc/aemdev22026年10月11日 更新

Compares the performance of two or more audience segments across key metrics side by side. Use this skill when someone wants to compare audiences or visitor groups — for example, "how do mobile visitors compare to desktop on conversion," "compare new vs. returning visitors," "show me the difference between these two segments," "compare these audiences on our KPIs," or "which segment performs better." Also trigger for "segment comparison" or "audience comparison."

日本語の概要は準備中です。原文の説明を表示しています。

aemgdc/aemdev22026年10月11日 更新

Identifies which items (pages, campaigns, products, channels, regions) had the biggest increases or decreases for a key metric between two time periods. Use this skill when someone asks "what's up and what's down," "which campaigns moved the most," "top gainers and losers," "what pages are trending," "show me what changed by channel," or any variation of identifying the biggest movers and decliners for a metric.

日本語の概要は準備中です。原文の説明を表示しています。

aemgdc/aemdev22026年10月11日 更新

Scan an AEM Edge Delivery Services page for WCAG 2.1 AA accessibility violations and generate specific fixes. Identifies missing alt text, heading hierarchy issues, link text problems, color contrast concerns, and EDS-specific accessibility patterns. Use when fixing accessibility issues, preparing for compliance audits, or remediating WCAG violations.

日本語の概要は準備中です。原文の説明を表示しています。

aemgdc/aemdev22026年10月11日 更新

aemgdc のスキルをすべて見る

このスキルの問題を報告する