/cc-authoring:claude-workflow-meta-markdownlint-pure-literal-breakfrom cc-authoring
Fix for a Claude Code Workflow script that fails to load with "meta must be a pure literal: non-literal node type in meta: BinaryExpression" even though the meta block looks fine and all its tests pass. Use when: (1) a workflow .js is rejected at load over meta/BinaryExpression; (2) workflow tests are green but the real Workflow tool rejects the script; (3) a long meta.description (or name) string; (4) the workflow code lives in or is documented inside a markdown file that a markdownlint/prettier pre-commit hook reformats. Root cause: line-length wrapping split a single string literal into `'a' + 'b'` concatenation.
Ships in cc-authoring. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
metaA Workflow .js that previously loaded (or whose meta you wrote as a plain string) starts
failing at load with:
Invalid workflow script: meta must be a pure literal: non-literal node type in meta: BinaryExpression
…and — the trap — its test suite still passes, so nothing warns you.
meta and BinaryExpression.meta.description (or another meta string) is long.The Workflow runtime AST-parses export const meta = {…} and rejects any non-literal node —
including a BinaryExpression (string + concatenation). A markdownlint MD013 (line-length)
or prettier reformat of a fenced code block will wrap a long single-line string literal into
concatenated pieces to satisfy the max line width:
// what you wrote (pure literal — OK):
description: "Multi-agent humanizer: analyze, revise, review, loop.",
// what the lint/format hook turned it into (BinaryExpression — REJECTED):
description:
"Multi-agent humanizer: analyze, " +
"revise, review, loop.",
Why tests don't catch it: the TDD harness (harness.mjs stripMetaBlock) locates
export const meta = {…} by brace-counting and deletes the whole block textually before
wrapping the body in an AsyncFunction. meta is never parsed or validated, so a broken
meta sails through every harness test.
meta strings as short single literals that fit under the line limit, so no
formatter is ever tempted to wrap them. This is the simplest durable fix.code_blocks: false
(or disable MD013 in the file) so it stops rewriting fenced code.meta purity — the harness can't. After any lint/format pass over
a file containing workflow code, grep the meta block for +, a template ${, or a
variable reference. If present, meta is broken regardless of green tests.Reproduced this session: a long single-line meta.description was silently split into three
+-joined literals when a subagent wrapped long lines to satisfy markdownlint on the plan
.md that contained the workflow code. All 5 harness tests passed; a manual read of the meta
block caught the +. Rewriting it as one short literal fixed the load without changing tests.
name or any string inside meta, and to template literals
(`${x}`) and variable references — anything that isn't a plain literal node.+ concatenation elsewhere in the workflow BODY (e.g. building a throw new Error(...)
message) is legal; only the meta object must be a pure literal.claude-workflow-authoring-gotchas (the pure-literal meta rule + args contract),
claude-workflow-tdd-harness (why the harness misses this), and
claude-workflow-plugin-distribution.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub cajias/claude-skills --plugin cc-authoring16 skills in this plugin
/apm-marketplace-authoring-gotchasEight APM-marketplace-authoring gotchas discovered during real
migrations from hand-authored .claude-plugin/marketplace.json to
APM-managed and from CC-native plugin authoring.
Use when: (1) running APM's packaging step (with or without
`--dry-run`) or its marketplace-check command in a repo with an
`apm.yml`; (2) wiring CI for an APM
marketplace; (3) the CI staleness check (repack, then `git diff
--quiet`) fails despite a clean local; (4) prettier reformats
`marketplace.json` after APM's packer writes it; (5) APM exit code 1 on
local-path-only marketplaces; (6) confused by `packages:` in apm.yml
vs `plugins:` in marketplace.json; (7) commitlint rejects a commit
with `footer-leading-blank` despite no apparent footer; (8) `apm
compile -t claude` exits 0 with zero output and no compiled plugin
appears; (9) husky+lint-staged pre-commit blocks the FIRST marketplace
commit with markdownlint `MD040/fenced-code-language` errors on a
SKILL.md file copied verbatim from `~/.claude/skills/`. The gotchas
form a chain — fixing one usually surfaces the next.
/apm-plugin-distribution-pathsCanonical authoring layout for an APM (microsoft/apm)
package, plus the decision matrix for whether you need a `marketplace:` block.
Use when: (1) you've run `apm init` and are unsure where SKILL.md / agent .md
/ command .md files belong (answer: under `.apm/`, NOT at repo root); (2)
you've authored CC-native files at `commands/agents/skills/` at repo root and
wonder if that's "right" (it works as fallback layout #3 "Claude plugin", but
it's not the canonical authoring path); (3) you're trying to choose between
the three layouts APM recognizes (one-skill repo, multi-primitive `.apm/`,
Claude plugin); (4) `apm targets` fails with "No such command" in CLI 0.12.1
(subcommand doesn't exist); (5) `apm validate` fails with "No such command"
in CLI 0.12.1 (use APM's packaging command in dry-run mode instead); (6) wondering whether
`apm compile -t claude` will generate output for a hand-authored CC-native
plugin (it won't; it's a no-op for layout #3); (7) wondering if you need a
`marketplace:` block in apm.yml (you don't, for a single-plugin repo).
Covers the canonical `.apm/` source layout, the source-to-plugin remap
table, the three-layout choice, and the four distribution paths.
/autoresearch-is-code-metric-optimizerThe `/autoresearch:autoresearch` Claude Code skill is a CODE-METRIC
OPTIMIZER (modify → verify → keep/discard loop). Use when: (1) you are
about to invoke `/autoresearch:autoresearch` to do literature / web
research (it does NOT fetch papers, search the web, or synthesize cited
reports — use `/deep-research` for that); (2) you have a measurable
target (test pass rate, perf delta, p&l, win rate, composite metric)
AND code-or-config that can be modified to hit it — that IS the right
use case, including non-traditional optimization targets like trading
strategy backtest results; (3) you're confused about when to reach for
the BASE skill vs the sub-skills `:reason` (adversarial debate) or
`:probe` (8-persona interrogation) — the base skill is for iterative
optimization with a clear verify function; the sub-skills are for
qualitative investigation when there is no verify function.
/cc-hooks-main-vs-subagentHow a Claude Code PreToolUse/PostToolUse hook can tell whether a tool call
came from the MAIN conversation thread or from a SUBAGENT (Task/Agent tool),
plus the gotchas of testing hooks via headless `claude -p`. Use when:
(1) building a hook that should apply only to the main thread (e.g.
orchestrator-only enforcement that denies Edit/Write in main but allows
subagents) or only to subagents; (2) wondering if hook input contains an
is_subagent / agent indicator — it does, but it's undocumented;
(3) a hook behaves differently than expected under `claude -p` because
CLAUDE_CODE_ENTRYPOINT is sdk-cli there and `env CLAUDE_CODE_ENTRYPOINT=cli`
does NOT survive (the CLI overwrites it); (4) a headless hook test shows
"Claude requested permissions ... but you haven't granted it yet" instead of
the hook's deny reason — the permission gate fires before the hook surfaces;
(5) you need to force the interactive code path in a headless test (use a
--settings file with an env block).
/cc-mid-session-registry-stalenessFix for two Claude Code mid-session staleness traps that fail Workflow runs
instantly (<15ms). Use when: (1) a Workflow agent() call fails with
"agent type '<name>' not found" listing only plugin/built-in agents, even
though .claude/agents/<name>.md exists with valid frontmatter — the agent
registry only loads .claude/agents/ at session START, so agent files created
mid-session are not resolvable via agentType/subagent_type until restart;
(2) re-invoking a saved workflow via Workflow({name}) runs STALE code after
you edited .claude/workflows/<name>.js — name resolution serves a cached
snapshot, so mid-session edits never reach it. Both failures look like your
code is wrong when it's actually registry caching. Fixes: launch via
Workflow({scriptPath: <live file path>}) to bypass the name cache, and
design workflow scripts with a registry-independent persona fallback
(prompt the agent to Read its own .claude/agents/<name>.md and adopt the
role) toggled by an arg like useAgentTypes:false.
/cc-plugin-cache-multi-version-not-recordedFix for Claude Code startup warning `Plugin "<name>" not cached at (not
recorded) — run /plugins to refresh`. Use when: (1) Claude Code prints a
`plugin-cache-miss` warning whose installPath is the literal string
`(not recorded)`; (2) `claude plugin list` shows the plugin as installed
with a valid version, AND
`~/.claude/plugins/installed_plugins.json` has a real `installPath` for
it, yet the warning still fires every session; (3) running `/plugins` or
reinstalling the plugin doesn't clear the warning; (4) the plugin's
cache directory at
`~/.claude/plugins/cache/<marketplace>/<plugin>/` contains TWO (or more)
version subdirectories — typically an old SHA-prefix dir and the
current one — left over from an in-place marketplace SHA bump.
Root cause: the Claude Code cache resolver (`fk8` in the binary) skips
any cache parent whose subdir count `!== 1`, returns null, and the
install-record fallback emits the warning with the hardcoded sentinel
`installPath: "(not recorded)"`. The phrase is NOT a missing config
field — it's a literal string in the error branch. Fix: delete every
stale version subdir under that plugin so exactly one remains (the one
recorded in `installed_plugins.json`).