From enonic-skills
Debug Enonic XP application errors. Analyzes build failures (Gradle, TypeScript) and server runtime errors (Nashorn/JS stack traces in server.log). Use when the user asks to debug, troubleshoot, or fix errors in an XP app, or pastes XP log output containing ERROR or WARN entries.
How this skill is triggered — by the user, by Claude, or both
Slash command
/enonic-skills:xp-app-debuggerThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
1. **Never skip analysis** -- Do not jump to a fix before completing Phase 2 (Analyze). Understand the full error context first.
build/resources/main/ contains what XP actually executes. Always check compiled output when
debugging runtime errors, then trace back to source.log object: log.info(), log.error(), log.warning(), log.debug(). There is no
console.log on the server.server.log in the main context. Spawn a haiku subagent to extract ERROR/WARN
entries../gradlew deploy or equivalent without explicit user approval.ls ..) for related apps or libraries that may contribute to the error.$XP_HOME/logs/server.log. Use a haiku subagent for large files (see Reading Large Logs below).server.log for the app name (e.g.
grep -i "com.enonic.app.myapp" $XP_HOME/logs/server.log | tail -20). If there are zero matches, the app was never seen by XP — this
points to a deploy path mismatch, not an app error. Actual failures (incompatible version, broken code) always produce log entries../gradlew deploy.src/main/resources/) and compiled (build/resources/main/).Gate: Present findings — error type, location, relevant files. Ask user before proceeding to analysis.
references/known-patterns.md for matching heuristics.xp-app-creator for XP API/domain knowledge (see XP Domain Knowledge table below).https://github.com/enonic/xp via gh if error points to XP internals.ls .. for related apps/libs that may be involved.Gate: Present analysis — root cause, evidence, reasoning. Ask user before proceeding to fix.
Gate: Fix applied. Ask user whether to redeploy and verify.
references/known-patterns.md if the pattern is reusable.| Log | Typical path | Contains |
|---|---|---|
| Server log | $XP_HOME/logs/server.log | Runtime errors, Nashorn stack traces, app lifecycle events |
| Build output | Terminal / Gradle console | Compilation errors, dependency issues |
| Sandbox log | ~/.enonic/sandboxes/<name>/home/logs/server.log | Same as server log, sandbox-specific path |
$XP_HOME is usually ~/.enonic/sandboxes/<name>/home when running via CLI sandbox.
When an error points to a file, look in the right place:
| Error references | Check source at | Check compiled at |
|---|---|---|
.js controller | src/main/resources/**/<name>.ts or .js | build/resources/main/**/<name>.js |
.xml descriptor | src/main/resources/**/<name>.xml | Same (copied as-is) |
| Java class (XP internals) | https://github.com/enonic/xp via gh | N/A |
node_modules / lib path | Check build.gradle dependencies | build/resources/main/lib/ |
When server.log is large (>500 lines), use a haiku subagent to extract relevant entries:
Task tool call:
subagent_type: "Bash"
model: "haiku"
prompt: "Run this command and return only the matching blocks:
tail -1000 $XP_HOME/logs/server.log | grep -E 'ERROR|WARN|Exception|at ' --context=3"
The subagent should return only ERROR/WARN blocks with surrounding context. Do not read full log files in the main context.
Add temporary logging to narrow down issues:
// JS
log.info('Debug: value = %s', JSON.stringify(value));
log.error('Failed at step: %s', stepName);
// TS
log.info('Debug: value = %s', JSON.stringify(value));
log.error('Failed at step: %s', stepName);
The log object is globally available in all XP controllers. Format strings use %s for string substitution.
To deploy and test changes:
CLAUDE.md, README.md, or package.json scripts../gradlew deploy if no specific instructions exist.tail -f $XP_HOME/logs/server.logAlways ask user before deploying.
XP projects often have related apps or libraries in the same parent directory. Before deep-diving into a single app:
ls ..
Check if the error might originate from a shared library or companion app.
Don't duplicate XP knowledge — load from xp-app-creator references when needed:
| Topic | Reference file |
|---|---|
| Controller patterns (JS/TS) | ../xp-app-creator/references/controllers.md |
| Component structure (pages, parts, layouts) | ../xp-app-creator/references/components.md |
| Build system (Gradle, tsup, webpack) | ../xp-app-creator/references/build-system.md |
| Content API | ../xp-app-creator/references/content-api.md |
| Content types and schemas | ../xp-app-creator/references/content-types.md |
| Input types | ../xp-app-creator/references/input-types.md |
| Site configuration | ../xp-app-creator/references/site-config.md |
| Project structure | ../xp-app-creator/references/project-structure.md |
Load references/known-patterns.md when analyzing errors. If a resolved bug matches a reusable pattern, suggest adding it to the file (
max ~5 lines per entry, prune at ~30 entries).
Provides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub enonic/ai-enonic-marketplace --plugin enonic-skills