Agent skill
formax-slash-command-workflow
Use when adding/modifying Formax slash commands (/permissions /agents /hooks /todos etc), especially output rendering (command sublines), overlay dismiss messages, and whether outputs are injected into the next LLM turn.
Install this agent skill to your Project
npx add-skill https://github.com/yusifeng/formax/tree/main/.codex/skills/formax-slash-command-workflow
SKILL.md
Formax slash command workflow
Goal
Use this skill when changing slash command discovery, dispatch, overlay dismissal output, or next-turn injection behavior.
Read First
docs/contracts/slash-command-contract.mddocs/contracts/semantics-contract.mdwhen command behavior crosses canonical UI messages or routingdocs/contracts/config-settings-contract.mdwhen the change touches/config
These docs are canonical. If stable behavior changes, update them before or with code.
Code Map
1) Command discovery + dispatch
packages/core/src/features/commands/registry.ts: command list/suggest/dispatch wiringpackages/core/src/features/commands/CommandStore.ts: disk scanning + precedence (project overrides user)packages/core/src/features/semantics/core/commandRouting.ts: exact/clear//compactand command-dispatch routing boundary
2) Command result contract (UI vs model)
packages/core/src/features/commands/contracts.ts:UiEffect/UiMessage/ModelEffectshapespackages/core/src/features/commands/adapter.ts: maps command execution output →CommandResultpackages/core/src/features/repl/controller/send/send.ts: consumed slash handling,local_async, and injected-block plumbing
3) Overlay dismissal “subline output”
packages/core/src/features/repl/controller/ui/overlays.ts: overlay open/close + append “dismissed” sublines
4) REPL message plumbing + rendering
packages/core/src/features/repl/controller/send/send.ts: appliesUiEffect.appendMessagestoMsgpackages/core/src/screens/REPL.tsx: rendermsg.ui.kind === 'command_subline'as⎿ ...(no⏺)packages/core/src/screens/REPL.slashSuggestions.test.tsx: duplicate command selection /preferredSlashSpecId
High-Signal Patterns
- Pattern A: one-line overlay dismissal
- append a single assistant
Msgwithui.kind='command_subline' - keep copy stable unless the user explicitly requests copy changes
- append a single assistant
- Pattern B: multi-line local output
- split output into multiple
command_sublinerows - this is UI only; model injection remains separately controlled
- split output into multiple
- Pattern C: inject-but-don't-spam
- when a command needs to inform the model, keep UI output minimal and preserve
recordForNextTurn/ injected-block behavior separately
- when a command needs to inform the model, keep UI output minimal and preserve
Minimal Workflow
- Classify the change first: discovery / precedence, local UI output, next-turn injection, or overlay dismiss behavior.
- Update the slash command contract first.
- Preserve “show in UI” vs “inject into model context” as separate concerns; local output alone must not imply injection.
- Use
command_sublinefor Claude-style sublines; do not invent new message shapes. - Run the minimum regression set below before review.
Minimum Regression
bun run test -- packages/core/src/features/commands/registry.test.ts packages/core/src/features/commands/CommandStore.test.ts packages/core/src/features/commands/adapter.test.ts packages/core/src/features/commands/contracts.test.tsbun run test -- packages/core/src/features/repl/controller/ui/overlays.test.tsxbun run test -- packages/core/src/features/repl/controller/send/send.test.ts packages/core/src/features/repl/useReplController.test.tsxbun run test -- packages/core/src/screens/REPL.slashSuggestions.test.tsx packages/core/src/screens/repl/inputHint.test.tsbun run type-checkwhen command shapes or routing plumbing changes
Guardrails
- Do not add bespoke
commandSubLines-style structures; useMsg.ui.kind='command_subline'. - Do not change UI copy / spacing / colors as a side-effect of routing changes.
- Do not patch only overlay output if the real bug is discovery or dispatch precedence.
- If behavior is unclear, add or extend an Ink test first; tests are not the only spec, but they should lock the visible key path.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
formax-dev-loop-workflow
Use when working on Formax code changes and you need a disciplined dev loop: keep a single mainline task, avoid scope drift, run only targeted tests (no coverage), avoid partial staging (MM), run mandatory review before commit, include an incremental optimization check, and keep commits small and reviewable.
formax-rework-convergence-workflow
Use when code has gone through repeated rework and may contain redundant logic, style drift, or tangled structure. Trigger when user asks for "返工收敛", "cleanup-pass", or requests a focused cleanup pass that reduces churn without changing behavior.
formax-tool-ui-blocks-workflow
Implement or refactor Formax tool transcript UI using the Tool UI Blocks (C-lite) pattern (ToolUiBlocks renderer + blocks presenters) to avoid touching many tool presenter files; use when adjusting ⏺/⎿ spacing, indent rules, or migrating additional tools to blocks presenters with targeted Ink/Vitest tests and Codex review before commit.
formax-web-css-convergence-workflow
Use when changing web CSS/UI styling so requirements, state ownership, and acceptance checks are locked before edits to prevent rework churn.
formax-config-settings-workflow
Use when implementing or extending /config (storage, prompt injection, request params, UI-only toggles) with tests and strict UI parity.
formax-semantics-parity-workflow
Use when implementing or modifying behavior that must stay consistent across TUI and Web (mode/input/tool/replay/order). Require canonical semantics first, then TUI/Web adapters, then renderer-specific UI.
Didn't find tool you were looking for?