- Skill ID
- moonrepo/moon/debug-task
- Publisher
- moonrepo
- Repository
- moon
- Installs
- 0
- Files
- 5
- License
- MIT
- Requires
- >-
- Synced
- Sep 23, 2026
Open any RiverX project, open the Skills panel in the chat, and search for this identifier. The files are fetched from the source repository at install time.
moonrepo/moon/debug-taskInstalls these files- SKILL.md
- references/cache-issues.md
- references/config-mistakes.md
- references/decision-tree.md
- references/environment-debug.md
What this skill tells the agent
moon task debugger
A workflow-oriented diagnostic skill for troubleshooting moon tasks. This is not a reference manual — it guides you through a structured debugging flow so you can isolate the problem quickly.
For conceptual background, see the moon documentation.
Before you start: Ask the user for the <project>:<task> target to debug. If they haven't provided a specific target, prompt them for it — the diagnostic flow requires a concrete target to inspect.
Quick-start: 5-step diagnostic flow
Work through these steps in order. Most issues resolve by step 3.
Step 1: Inspect the resolved task configuration
The first thing to check is whether the task is configured the way the user expects. moon merges configuration from multiple sources (global tasks, project config, inheritance), so the resolved result can surprise people.
# Show the fully resolved task config (with inheritance applied)
moon task <project>:<task>
# Machine-readable version for programmatic inspection
moon task <project>:<task> --jsonWhat to verify:
commandvsscript— if the command contains pipes (|), redirects (>), chained commands (&&), or complex syntax, it must usescript, notcommand.inputs— are they too broad (**/*captures everything) or too narrow (missing source files)? Checkstate.defaultInputs(true = using default**/*) andstate.emptyInputs(true = explicitly set to[]). Both keys are omitted from the JSON entirely when false, as isstate.setRunInCi.outputs— are they declared for build tasks? Missing outputs means the cache can never hydrate artifacts. In v2.3+, outputs also affect the default `cacheStrategy` of any task that depends on this one (see Step 4).toolchains— is the correct toolchain(s) assigned? An incorrect toolchain means wrong tool versions.deps— are task dependencies correct and complete? In v2.3+, each dep entry can carry acacheStrategy(hash/ignored/outputs) that controls whether the dep contributes to this task's cache hash. If omitted, the default depends on whether the dep declares outputs.options— checkpersistent,runInCI,cache,affectedFiles,mutex,timeout,retryCount,allowFailure, andos.env— in v2.5+, environment variables can also be inherited from a workspace-level `env` in.moon/tasks/**/*(merged into the project'senv, project wins), and the project can change the merge behavior viaworkspace.mergeStrategies.env. A variable with a surprising value may come from a layer outside the task.checks<sup>v2.4+</sup> — shell scripts that run before the task. Their type determines the outcome: arequirementfailing makes the task fail, allconditionchecks passing makes the task skip, and afingerprintfolds script output into the task hash. A surprising fail, skip, or cache invalidation often traces back to a check.tags<sup>v2.3+</sup> — labels for grouping tasks. Affects targets like:#qualityand MQLtaskTagqueries. If a task isn't matched by a#tagtarget you expected, check this list.type—build(has outputs),test(default), orrun(persistent)preset—serverorutilityapply multiple option defaults at once.
Red flags:
command: 'eslint . && prettier --check .'— shell syntax incommandis a parse error in v2. Usescriptinstead.- Empty
outputson a build task — cache will never restore artifacts. inputs: ['**/*']— too broad, cache invalidates on every change.- A
persistenttask in adepschain — moon produces a hard error at runtime. command: 'noop'ornop/no-op— the task is intentionally a no-op and does nothing. moon treats these specially.runInCI: 'only'— task runs in CI but NOT locally (common surprise).runInCI: 'skip'— task is skipped in CI but relationships remain valid.osset to a platform the user isn't on — the task is rewritten to a passing no-op at build time (moon task --jsonshowscommand: noopwith cleared args/outputs).allowFailure: true— the failure is still recorded and displayed, but the pipeline continues and moon exits successfully, so it's easy to miss.- A
conditioncheck present <sup>v2.4+</sup> — the task will skip whenever all conditions pass. A task that "never runs" may have a condition that always passes. - A
fingerprintcheck present <sup>v2.4+</sup> — its script output is hashed, so volatile output (timestamps, versions) causes cache misses on every run.
Step 2: Run with maximum verbosity
If the config looks right, run the task with debug logging to see what moon is actually doing under the hood.
# Debug-level logging with cache bypass
moon run <project>:<task> --log debug --force
# Deep debugging: reveal env vars and stdin passed to the process
MOON_DEBUG_PROCESS_ENV=true MOON_DEBUG_PROCESS_INPUT=true moon run <project>:<task> --log trace --forceWhat to look for in the logs:
- Toolchain resolution — is the right version of node/deno/bun/etc being used?
- Hash generation — what sources are being hashed?
- Affected status — is the task being skipped because it's "not affected"?
- Process execution — what command is actually being spawned?
Visualize the execution graph to spot dependency issues:
moon action-graph <project>:<task>
moon action-graph <project>:<task> --dot # DOT format (useful for agents)For all graph commands and output formats, see references/environment-debug.md.Step 3: Inspect cache state
If the task runs but produces wrong results, or runs when it shouldn't, or doesn't run when it should, the cache is the likely culprit.
# Inspect a hash manifest to see what inputs were hashed
moon hash <hash>
# Compare two hashes to see what changed between runs
moon hash <hash1> <hash2>
# Short-form hashes work too
moon hash 0b55b234 2388552fFor cache file locations, hash interpretation, and the--forcevs--cache offcomparison, seereferences/cache-issues.md.
Step 4: Diagnose the problem type
Use this table to jump to the right reference:
| Symptom | Likely cause | Quick check | Reference |
|---|---|---|---|
| Task doesn't exist | Inheritance not applied — check inheritedBy conditions in .moon/tasks/**/* against project's toolchains, stack, layer, tags via moon project <name> --json | moon task <target> --json | references/config-mistakes.md |
| "Nothing to do" | --affected + no changes, runInCI: false, or inheritedBy mismatch (global task not inherited) | Check flags, options.runInCI, and inheritedBy | references/decision-tree.md |
Use this skill in a project
Open any RiverX project, search the Skills panel for moonrepo/moon/debug-task, and install it in one click.
