Tuning Oak Query Indexes logo

Tuning Oak Query Indexes

Organization
adobe
tuning-oak-query-indexes

AEM Cloud Service expert skill — check a JCR/Oak query is actually served by an index and, when it is not, propose the property/Lucene index-definition change so the query is answered by the index instead of in-memory filtering or sorting. Use for "query is slow", "traversal warning", "is my query indexed", "tune oak index", or a scan that flags a JCR/QueryBuilder query. The analyzer locates every query-construction site (createQuery, getQueryManager, Sling findResources / queryResources, PredicateGroup.create / new PredicateGroup); the recipe assesses each flagged query against the supplied index definition(s). Resolution is user-supplied: the index definition(s) are required input — if none is provided the whole pattern is deferred, never guessed. Guided fix — the developer reviews and applies the proposed index change; never auto-apply.

Overview

Publisheradobe
Repositoryskills
Skill nametuning-oak-query-indexes
Stars
298
Forks
92
Bundled files
3
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 3 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by adobe on GitHub. Read the source before you install it.

Installation

Install the Tuning Oak Query Indexes AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/adobe/skills/tree/main/plugins/aem/cloud-service/skills/code-assessment/tuning-oak-query-indexes
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/adobe/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/plugins/aem/cloud-service/skills/code-assessment/tuning-oak-query-indexes .claude/skills/tuning-oak-query-indexes
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Tuning Oak Query Indexes in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Tuning Oak Query Indexes on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Tuning Oak Query Indexes is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Tuning Oak query indexes — AEM as a Cloud Service

This pattern is executed by the code-assessment runbook — follow ../references/runbook.md for the full flow. This skill supplies the detection + recipe the runbook applies.

Overview

An Oak query only uses an index for the parts the index actually covers. Any WHERE/ORDER BY/fulltext field without a matching, correctly-flagged property definition gets evaluated node-by-node in memory — same for a wrong nodetype or path scope, even if every field is indexed. An uncovered query traverses the repository: slow, traversal-warning-logged, and a load risk at scale. This pattern finds exactly which fields/conditions aren't covered and what index-definition change fixes each one.

Classification — confirm this pattern applies

  • A JCR/QueryBuilder query is slow, logs a traversal/TraversingIndex warning, or you're adding/changing a query and need to confirm it's served by an index rather than in-memory filtering or sorting.
  • The user asks "is my query indexed", "tune the oak index", "why is this query slow", or a scan flagged a query-construction site (createQuery / PredicateGroup.create).
  • Not this pattern: an explicitly unbounded query (p.limit=-1 / setLimit(-1)) — that's unbounded-query; this pattern is about index coverage, not result-set size. (A query can be both — assess index coverage here, bound it there.)

Discovery

Detection is performed by the analyzer (../scripts/analyze.sh), run by the runbook:

bash
bash ../scripts/analyze.sh <workspace-root> --pattern tuning-oak-query-indexes

Match criteria (what the detector flags) — query-construction sites, matched on written names (parse-level, no type resolution). These mirror the Java-API anchors the folded extracting JCR queries guide used, so moving detection from grep to code keeps the same capture:

  • any invocation named createQuery — JCR QueryManager.createQuery(...) and AEM QueryBuilder builder.createQuery(...).
  • any invocation named getQueryManager — the JCR query entry point (Workspace.getQueryManager()).
  • any invocation named findResources or queryResources — the Sling ResourceResolver query APIs, which run a real indexed repository query.
  • PredicateGroup.create(...) (a create invocation whose receiver's trailing simple name is PredicateGroup) and new PredicateGroup(...) — QueryBuilder predicate-group construction.

One finding per distinct source line, with the call as the snippet. The detector locates where queries are built; it does not judge coverage — that requires the query text (read the surrounding code) and the index definition(s) (see Resolution contract).

Known limits (out of a parse-level Java detector's reach — use the extracting guide's manual fallback): non-Java queries (XPath/SQL2 in JSP/HTL/config, stored dam:query / Smart-Collection predicate strings, query-string form) and queries hidden behind a non-JCR wrapper method whose body has no direct query call.

Resolution contract

user-supplied — the required input is the Oak/Lucene index definition(s) the query could use. The whole assessment is a comparison of the query against its candidate index definition(s), so:

  • Required input — the index definition(s). This skill does not run without them. Accept any of: a FileVault .content.xml under an /apps/.../install package, a JSON export, or the live dump at GET /system/console/status-oak-index-defn.json (admin auth).
  • If no index definition is available, DEFER THE WHOLE PATTERN with a single line — e.g. tuning-oak-query-indexes: deferred — index definition not provided. Do not emit a per-query skip for every finding, and do not emit a coverage assessment from the query alone (a guess reads as a finding and gets acted on as one).
  • When index definitions ARE supplied, assess each flagged query's coverage and propose the index-definition change where a field is uncovered. fix: guided — never auto-apply: write the corrected definition out for the developer to review and apply.

Recipe

Read recipe.md in full before assessing or proposing any change: the input contract, the Section A/B segregation, the field-construct → required-flag table, the two scoping gotchas, the index-size/storage pitfalls, the common mistakes, the target-index selection, explain verification, and the two-section report shape. Ground truth for every claim is the bundled AI agent indexing guide; build a query inventory from scratch with the bundled extracting JCR queries guide.

Handoff

The skill never commits and never applies an index change to a live instance. See ../references/runbook.md for the full flow and handoff.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Tuning Oak Query Indexes AI skill do?

AEM Cloud Service expert skill — check a JCR/Oak query is actually served by an index and, when it is not, propose the property/Lucene index-definition change so the query is answered by the index instead of in-memory filtering or sorting. Use for "query is slow", "traversal warning", "is my query indexed", "tune oak index", or a scan that flags a JCR/QueryBuilder query. The analyzer locates every query-construction site (createQuery, getQueryManager, Sling findResources / queryResources, PredicateGroup.create / new PredicateGroup); the recipe assesses each flagged query against the supplie...

Why use Tuning Oak Query Indexes on TypingMind?

Because you install it once and use it with any model. Tuning Oak Query Indexes is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Tuning Oak Query Indexes in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/adobe/skills/tree/main/plugins/aem/cloud-service/skills/code-assessment/tuning-oak-query-indexes. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Tuning Oak Query Indexes?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Tuning Oak Query Indexes?

As many as you like. As long as a model supports skills, you can use Tuning Oak Query Indexes with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Tuning Oak Query Indexes AI skill free?

Yes. It is published on GitHub by adobe under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇