Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

chore: track claude skills in repo

Brad Barbinc6427c501a95
diff --git a/.claude/skills/debugging-difficult-bugs/SKILL.md b/.claude/skills/debugging-difficult-bugs/SKILL.md
new file mode 100644
index 0000000000..25d903cffa
--- /dev/null
+++ b/.claude/skills/debugging-difficult-bugs/SKILL.md
@@ -0,0 +1,179 @@
+---
+name: debugging-difficult-bugs
+description: Use early when debugging a medium or hard bug, especially when tests alone may not reveal the real runtime failure. Trigger this before extended TDD iteration when a bug involves runtime state, ordering, persistence, streaming, concurrency, UI/manual reproduction, external services, or when a red or newly passing test may not model the real issue. Skip only when the root cause is already directly proven by a stack trace or deterministic test that exercises the real runtime path.
+---
+
+# Debugging Difficult Bugs
+
+Use this skill early for medium or hard bugs where normal TDD may give false confidence because the test does not fully capture the real bug.
+
+Core idea: **instrument the actual runtime path, reproduce the real issue, then inspect append-only JSONL logs before deciding on a fix.**
+
+## When to Use
+
+Use this workflow near the start of debugging when any of these are true:
+
+- The bug is medium or hard complexity, especially if it spans multiple functions, packages, processes, or UI/runtime boundaries.
+- A test is red, but the failing test might be an incomplete model of the real bug.
+- You are tempted to make a second speculative fix without new runtime evidence.
+- The bug depends on runtime ordering, state, caching, streaming, concurrency, persistence, UI interaction, or external services.
+- The user says they can reproduce the issue manually.
+- The test passes after a change, but you are not confident it proves the actual reported bug is fixed.
+
+Do **not** keep iterating only on tests if you do not understand the runtime behavior.
+
+Skip this workflow only when the root cause is already directly proven by a stack trace or by a deterministic failing test that exercises the real runtime path. If you are tempted to make a second speculative fix, use this workflow.
+
+## Required Approach
+
+1. **State the uncertainty**
+ - Acknowledge that the current test may not capture the actual bug.
+ - Identify the real code path that must be observed.
+
+2. **Add temporary unconditional instrumentation**
+ - Add minimal but sufficient logs through the suspected code flow.
+ - Log boundaries, meaningful branch decisions, state transitions, async ordering points, return values, and caught errors; do not log every line.
+ - Logs must be unconditional: do **not** gate them behind an env var, debug flag, or log level.
+ - Each log point must append one JSON object per line to a `.jsonl` file in the current working directory.
+ - Include enough context to reconstruct the path: event name, timestamp, relevant ids, input shape, state transitions, branch decisions, return values, and caught errors.
+
+3. **Reproduce the real issue**
+ - Prefer to run the reproduction yourself if possible.
+ - If the issue requires the user's environment or manual interaction, ask the user to reproduce it after instrumentation is added.
+ - Tell the user exactly which `.jsonl` file to send or ask them to tell you when reproduction is complete so you can inspect it.
+
+4. **Analyze the log before fixing**
+ - Read the JSONL log chronologically.
+ - Compare expected flow vs actual flow.
+ - Identify the first point where state or behavior diverges.
+ - Only then implement the fix.
+
+5. **Clean up instrumentation**
+ - Remove all temporary unconditional logs after root cause is understood and the fix is verified.
+ - Remove debug imports, helper functions, generated `.jsonl` files, and any other temporary artifacts.
+ - Check the final diff for instrumentation remnants.
+ - Do not leave debug files, log helpers, or noisy runtime logging in the final diff unless the user explicitly asks.
+
+6. **Keep or improve tests**
+ - Add or adjust a focused regression test once the real bug is understood.
+ - Make the test assert the actual broken behavior discovered from logs, not the earlier incorrect assumption.
+
+## JSONL Logging Pattern
+
+Use append-only JSONL in `cwd` so it works across CLIs, dev servers, tests, and manual reproduction.
+
+### Node / TypeScript
+
+```ts
+import { appendFileSync } from 'node:fs';
+import { join } from 'node:path';
+
+function debugBug(event: string, data: Record<string, unknown> = {}) {
+ appendFileSync(
+ join(process.cwd(), 'debug-difficult-bug.jsonl'),
+ `${JSON.stringify({
+ ts: new Date().toISOString(),
+ event,
+ ...data,
+ })}\n`,
+ );
+}
+```
+
+Call it at every meaningful branch or state transition:
+
+```ts
+debugBug('workflow.start', { runId, stepId, inputKeys: Object.keys(input ?? {}) });
+
+debugBug('workflow.beforeStep', {
+ runId,
+ stepId,
+ status: step.status,
+ hasResumeData: Boolean(resumeData),
+});
+
+try {
+ const result = await executeStep();
+ debugBug('workflow.afterStep', { runId, stepId, resultShape: Object.keys(result ?? {}) });
+ return result;
+} catch (error) {
+ debugBug('workflow.stepError', {
+ runId,
+ stepId,
+ errorName: error instanceof Error ? error.name : typeof error,
+ errorMessage: error instanceof Error ? error.message : String(error),
+ });
+ throw error;
+}
+```
+
+## What to Log
+
+Prefer compact, structured data over huge dumps.
+
+Log:
+
+- Function or phase name.
+- Stable ids: request id, run id, thread id, resource id, step id, tool call id.
+- Input/output **shape**: keys, counts, lengths, statuses.
+- Branch decisions and the data that caused them.
+- State before and after mutation.
+- Error names/messages and relevant metadata.
+- Ordering markers for async, streaming, or concurrent flows.
+
+Avoid logging:
+
+- API keys, auth headers, tokens, cookies, credentials.
+- Full user content unless necessary and safe.
+- Large payloads that make the log unreadable.
+- Binary data or full model responses unless the bug requires it.
+
+Treat debug logs as potentially sensitive. Do not ask the user to paste them into public issues, PRs, or shared channels unless they have reviewed/redacted them first.
+
+If sensitive data might appear, log redacted summaries:
+
+```ts
+debugBug('request.received', {
+ hasAuthHeader: Boolean(headers.authorization),
+ bodyKeys: Object.keys(body ?? {}),
+ messageCount: body?.messages?.length,
+});
+```
+
+## Reproduction Handoff to User
+
+When the user needs to reproduce manually, say exactly this shape:
+
+```text
+I added temporary unconditional JSONL instrumentation. Please reproduce the issue once, then send me or point me at:
+
+<cwd>/debug-difficult-bug.jsonl
+
+After I inspect that log, I’ll remove the instrumentation and make the actual fix.
+```
+
+If multiple processes have different working directories, either:
+
+- log the absolute `process.cwd()`, process role, and pid at startup, or
+- write distinct files like `debug-server-flow.jsonl`, `debug-worker-flow.jsonl`, and `debug-client-flow.jsonl`.
+
+## Analysis Checklist
+
+Before writing the fix, answer:
+
+- Did the instrumented code path actually run?
+- What was the expected sequence of events?
+- What was the actual sequence?
+- What is the first incorrect state, missing value, duplicate event, or wrong branch?
+- Does the original red test capture that exact divergence?
+- If not, how should the regression test change?
+
+## Final Verification
+
+A difficult bug is not done until:
+
+- The real reproduction path passes.
+- The regression test fails before the fix and passes after the fix, when feasible.
+- Temporary unconditional instrumentation is removed.
+- The final diff contains only the fix and intentional tests.
+- You can explain the root cause using evidence from the JSONL log.
\ No newline at end of file
diff --git a/.claude/skills/pr-explainer/SKILL.md b/.claude/skills/pr-explainer/SKILL.md
new file mode 100644
index 0000000000..41eb120003
--- /dev/null
+++ b/.claude/skills/pr-explainer/SKILL.md
@@ -0,0 +1,151 @@
+---
+name: pr-explainer
+description: Use when creating an approachable, self-contained HTML review aid for a pull request; explaining what changed, why it matters, how it works, and how it fits into the broader system; turning PR diffs, commits, tests, and architecture context into a local `.pr-review/` HTML page for reviewers; or helping reviewers understand complex code changes without dumping the full diff.
+---
+
+# PR Explainer
+
+Create a local, self-contained HTML page that teaches a reviewer the PR story: what changed, why it matters, how it works, how it fits into the system, and how it was verified.
+
+## Required workflow
+
+1. **Understand the PR before writing HTML**
+ - Collect PR title/number, branch, link if available, base branch, commit range, changed files, and verification already performed.
+ - Inspect the current state with `git status --short`.
+ - Inspect recent commits with `git log --oneline -n 10`.
+ - Inspect scope with `git diff <base>...HEAD --stat` and `git diff <base>...HEAD`.
+ - If one commit carries the main change, inspect it with `git show --stat <commit>` and `git show <commit>`.
+
+2. **Find the explanation path**
+ - Do not explain files in raw diff order.
+ - Teach the change in this order when possible:
+ 1. problem,
+ 2. system context,
+ 3. before/after data or control flow,
+ 4. key code changes,
+ 5. proof from tests/builds/manual checks,
+ 6. reviewer takeaway.
+ - Classify changed files as core behavior, plumbing/integration, tests, release metadata, or incidental noise.
+ - Highlight only files that help explain the PR.
+
+3. **Write for approachability**
+ - Use plain language, short sections, concrete before/after examples, small focused snippets, diagrams, tables, and callouts.
+ - Explain the problem before implementation details.
+ - Define acronyms or package-specific terms before using them.
+ - Avoid dumping the full diff or assuming the reviewer already knows internal context.
+
+4. **Create a local self-contained HTML file**
+ - Put generated files in `.pr-review/`.
+ - Use one HTML file containing all CSS and content.
+ - Do not commit `.pr-review/` by default.
+ - Prefer repo ignore rules or `.git/info/exclude` so generated review pages stay out of commits.
+
+## Recommended HTML structure
+
+Use this structure unless the PR clearly needs a different teaching order:
+
+1. **Hero**
+ - PR number/title, one-sentence summary, branch/link/status.
+ - Small metrics: files changed, tests added, packages affected.
+
+2. **Problem**
+ - Previous behavior.
+ - Why it was wrong, confusing, missing, or risky.
+
+3. **System Context**
+ - Where the change sits in the product or architecture.
+ - Upstream callers, downstream behavior, and why this is the right layer.
+ - Behavior intentionally not changed.
+
+4. **Before/After Flow**
+ - Visual old path vs. new path when the PR changes flow, state, ownership, permissions, request handling, data transformation, or component relationships.
+
+5. **Code Walkthrough**
+ - Step-by-step explanation path.
+ - Focused diffs for important files only.
+ - Explain what each snippet accomplishes and why it is necessary.
+
+6. **Tests / Verification**
+ - Tests added or updated.
+ - Commands run for tests, build, typecheck, lint, or manual verification.
+ - Known unrelated warnings or failures, if any.
+
+7. **Reviewer Takeaway**
+ - The shortest useful mental model of the PR.
+ - What the reviewer should focus on while reviewing the actual diff.
+
+## Diagrams
+
+Add diagrams when they reduce cognitive load. Prefer simple HTML/CSS diagrams over external dependencies.
+
+Good diagram types:
+
+- Request flow: Client → Server → Handler → Service → Result
+- Before/after path: broken path vs. fixed path
+- Ownership map: package/module responsibility boundaries
+- Data transformation: input → normalized form → output
+- State machine: pending → running → complete/error
+
+Each diagram must answer: “What does this help the reviewer understand faster?”
+
+## Focused diff snippets
+
+Show snippets along the explanation path, not giant patches. Each important snippet should include:
+
+- file path,
+- relevant added/removed lines only,
+- visual styling for additions/removals,
+- a short explanation,
+- connection back to the PR story.
+
+Use this pattern:
+
+```html
+<div class="diff">
+ <div class="diff-title">packages/example/src/file.ts</div>
+ <pre>
+<span class="del">- old behavior</span>
+<span class="add">+ new behavior</span>
+ </pre>
+</div>
+```
+
+A reviewer should understand the PR without opening GitHub, but the page should not replace the final full diff review.
+
+## Verification requirements
+
+End with proof. Include exact commands when available, for example:
+
+```text
+pnpm --filter @scope/package test path/to/test.ts -- --run
+pnpm turbo build --filter ./packages/package
+```
+
+If verification was not run, say so clearly and list the recommended commands.
+
+## Final checklist
+
+Before calling the page done, confirm it has:
+
+- clear one-sentence summary,
+- problem statement,
+- before/after explanation,
+- broader system context,
+- visual diagram where useful,
+- step-by-step code walkthrough,
+- focused diffs with file paths,
+- tests and verification commands,
+- reviewer takeaway,
+- self-contained HTML/CSS,
+- stored in `.pr-review/`,
+- not staged or committed unless explicitly requested.
+
+## Default output
+
+When asked to create a PR explainer, produce or update a `.pr-review/*.html` file and summarize:
+
+1. output path,
+2. PR story covered,
+3. key sections included,
+4. verification evidence included,
+5. whether `.pr-review/` remains untracked or excluded.
\ No newline at end of file
diff --git a/.claude/skills/pr-splitter/SKILL.md b/.claude/skills/pr-splitter/SKILL.md
new file mode 100644
index 0000000000..34eb9ed87d
--- /dev/null
+++ b/.claude/skills/pr-splitter/SKILL.md
@@ -0,0 +1,113 @@
+---
+name: pr-splitter
+description: Use when breaking a large, complex, messy, or hard-to-review pull request into multiple smaller PRs; planning stacked PRs; extracting independent changes from a branch; splitting mixed refactor and behavior changes; managing drift after review feedback; rebasing follow-up PRs as earlier PRs change; or preserving original branch intent while shipping incrementally.
+---
+
+# PR Splitter
+
+Preserve the original PR as source material, build smaller reviewable PRs intentionally, and track drift locally as review feedback changes the stack.
+
+## Required workflow
+
+1. **Snapshot before touching history**
+ - Check `git status`.
+ - Create an immutable local reference to the original branch: `git branch backup/original-large-pr`.
+ - Do not delete or rewrite the original branch until the split is complete.
+
+2. **Inventory the original PR**
+ - Inspect `git diff --stat <base>...HEAD`, `git diff --name-only <base>...HEAD`, and `git log --oneline <base>..HEAD`.
+ - Classify changes by review unit: prep/refactor, API/type changes, behavior, tests, docs, cleanup, generated/lock files.
+
+3. **Create a local scratchpad**
+ - Write split notes to an uncommitted local file, preferably `.notes/pr-split.md`.
+ - Ensure `.notes/` is ignored or leave it untracked. Do not commit scratchpad notes unless the user explicitly asks.
+ - Track: original branch, base branch, planned PRs, files/hunks extracted, verification per PR, remaining original diff, and intentional drift from review feedback.
+
+4. **Choose the split shape**
+ - Use stacked PRs when later work depends on earlier work.
+ - Use parallel PRs only when changes are truly independent.
+ - Use foundation + parallel follow-ups when one shared prep change unlocks independent work.
+
+5. **Extract changes safely**
+ - Prefer fresh branches from the correct base plus selective restore over rewriting messy history.
+ - Use path-level extraction for clean file ownership: `git checkout backup/original-large-pr -- path/to/file`.
+ - Use hunk-level extraction for mixed files: `git restore -p --source backup/original-large-pr -- path/to/file`.
+ - Keep each PR independently buildable and reviewable.
+
+6. **Verify each PR independently**
+ - Run the narrowest relevant build, typecheck, lint, and tests for that PR's scope.
+ - Do not leave tests, docs, or generated files separated from the code they validate unless the split plan explicitly calls for it.
+
+7. **Manage drift deliberately**
+ - Treat reviewer-approved changes as the new source of truth for the stack.
+ - After changing an earlier PR, rebase dependent PRs onto it and resolve conflicts in favor of the reviewed direction, not blindly in favor of the original branch.
+ - Compare the evolving stack against `backup/original-large-pr` to find remaining intent, not to force byte-for-byte equality.
+ - Record intentional differences in `.notes/pr-split.md`.
+
+8. **Use range-diff for rewritten stacks**
+ - Use `git range-diff` after rebases, conflict resolution, or force-pushes to understand what changed.
+ - Summarize meaningful range-diff results for reviewers when updating a stacked PR.
+
+## PR description pattern
+
+Keep PR descriptions concise and reviewer-facing:
+
+```markdown
+## Summary
+
+This is PR N of M split from a larger change.
+
+## Scope
+
+- ...
+
+## Intentionally excluded
+
+- Follow-up PR will handle ...
+
+## Verification
+
+- ...
+```
+
+Do not put the full split ledger in PR descriptions. Keep detailed extraction notes and drift tracking in `.notes/pr-split.md`.
+
+## Scratchpad template
+
+```markdown
+# PR split scratchpad
+
+Original branch: backup/original-large-pr
+Base branch: main
+
+## Planned PRs
+
+1. branch-name
+ - Scope:
+ - Files/hunks extracted:
+ - Verification:
+ - Status:
+
+## Remaining original intent
+
+- ...
+
+## Drift notes
+
+- Date / branch / reason:
+```
+
+## Common failure modes
+
+Avoid splitting by file when behavior spans files, extracting tests without code, leaving follow-up PRs uncompilable, force-pushing without a reviewer summary, deleting the original branch early, and reverting review feedback while resolving stack conflicts.
+
+## Default output
+
+When asked to split a PR, produce:
+
+1. proposed PR sequence,
+2. branch strategy,
+3. scratchpad path and initial contents,
+4. extraction commands,
+5. verification plan for each PR,
+6. drift-management plan.
\ No newline at end of file
diff --git a/.claude/skills/ralph-plan/SKILL.md b/.claude/skills/ralph-plan/SKILL.md
new file mode 100644
index 0000000000..398479bc09
--- /dev/null
+++ b/.claude/skills/ralph-plan/SKILL.md
@@ -0,0 +1,165 @@
+---
+name: ralph-plan
+description: Interactive planning assistant that helps create focused, well-structured ralph-loop commands through collaborative conversation
+model: claude-opus-4-5
+---
+
+# Ralph Plan - Interactive Ralph Command Builder
+
+You are a planning assistant that helps users create well-structured ralph-loop commands. Your goal is to collaborate with the user to produce a focused, actionable ralph command with clear sections.
+
+## Your Role
+
+Guide the user through creating a ralph command by asking clarifying questions and helping them define each section. Be conversational and iterative - help them refine their ideas into a concrete plan.
+
+## Ralph Command Structure
+
+A ralph command consists of these sections:
+
+```xml
+<background>
+Context about the task, the user's expertise level, and overall goal.
+</background>
+
+<setup>
+Numbered steps to prepare the environment before starting work.
+Includes: activating relevant skills, exploring current state, research needed.
+</setup>
+
+<tasks>
+Numbered list of specific, actionable tasks to complete.
+Tasks should be concrete and verifiable.
+</tasks>
+
+<testing>
+Steps to verify the work is complete and working correctly.
+Includes: build commands, how to run/test, validation steps.
+</testing>
+
+Output <promise>COMPLETE</promise> when all tasks are done.
+```
+
+## Planning Process
+
+### Step 1: Understand the Goal
+
+Ask the user:
+
+- What is the high-level goal?
+- What area of the codebase does this involve?
+- Are there any constraints or requirements?
+
+### Step 2: Define Background
+
+Help establish:
+
+- What expertise/persona should the agent assume?
+- What is the core objective in one sentence?
+
+### Step 3: Plan Setup Steps
+
+Determine:
+
+- What skills or tools are needed?
+- What exploration/research is required first?
+- What environment setup is needed?
+
+### Step 4: Break Down Tasks
+
+Work with the user to:
+
+- Break the goal into concrete, numbered tasks
+- Ensure tasks are specific and verifiable
+- Order tasks logically (dependencies first)
+- Include implementation details where helpful
+
+### Step 5: Define Testing
+
+Establish:
+
+- How to build/compile changes
+- How to run and verify the work
+- What success looks like
+
+## Guidelines
+
+1. **Be Inquisitive**: Actively probe for details. Ask follow-up questions about implementation specifics, edge cases, and assumptions. Don't accept vague descriptions - dig deeper until you have clarity.
+
+2. **Identify Gaps**: Proactively call out anything that seems missing, unclear, or could cause problems later. Examples:
+ - "You mentioned creating an endpoint, but haven't specified the request/response format - what should that look like?"
+ - "This task depends on understanding how X works, but there's no research step for that - should we add one?"
+ - "What happens if the processor throws an error? Should the UI handle that case?"
+
+3. **Research the Codebase**: Don't just ask the user - proactively explore the codebase to fill in knowledge gaps. If the user mentions "add a tab like the tools tab", search for and read the tools implementation to understand the patterns, file structure, and conventions. Use this research to:
+ - Suggest specific file paths and function names in tasks
+ - Identify existing patterns to follow
+ - Discover dependencies or related code that needs modification
+ - Provide concrete implementation details rather than vague instructions
+
+4. **Be Iterative**: Don't try to produce the full command immediately. Ask questions, discuss options, refine.
+
+5. **Be Specific**: Vague tasks lead to confusion. Help users make tasks concrete.
+ - Bad: "Improve the UI"
+ - Good: "Create a '/processors' endpoint that lists processors, mimicking the '/tools' endpoint"
+
+6. **Include Context**: Setup steps should include research/exploration to understand existing code.
+
+7. **Reference Existing Patterns**: When possible, point to existing similar implementations to follow.
+
+8. **Consider Dependencies**: Order tasks so dependencies are completed first.
+
+9. **Keep Scope Focused**: A ralph command should have a clear, achievable scope. If the scope is too large, suggest breaking into multiple ralph commands.
+
+## Example Conversation Flow
+
+**User**: I want to add a new feature to the playground
+
+**Assistant**: Let's plan this out. Can you tell me more about:
+
+1. What feature are you adding?
+2. What part of the playground does it affect?
+3. Are there similar existing features I should look at for patterns?
+
+**User**: [provides details]
+
+**Assistant**: Got it. Let me draft the background section first:
+
+```xml
+<background>
+[Draft background based on discussion]
+</background>
+```
+
+Does this capture the goal correctly? Should I adjust anything?
+
+[Continue iteratively through each section...]
+
+## Output Format
+
+When the plan is finalized, present the complete ralph command in a code block that the user can copy directly.
+
+**Important**: Avoid using double quote (`"`) and backtick (`` ` ``) characters in the ralph command output, as these can interfere with formatting when the command is copied and executed. Use single quotes (`'`) instead, or rephrase to avoid quotes entirely.
+
+```
+<background>
+...
+</background>
+
+<setup>
+...
+</setup>
+
+<tasks>
+...
+</tasks>
+
+<testing>
+...
+</testing>
+
+Output <promise>COMPLETE</promise> when all tasks are done.
+```
+
+## Starting the Conversation
+
+Begin by asking the user what they want to accomplish. Listen to their goal, ask clarifying questions, and guide them through building each section of the ralph command collaboratively.
\ No newline at end of file
diff --git a/.claude/skills/self-review/SKILL.md b/.claude/skills/self-review/SKILL.md
new file mode 100644
index 0000000000..be5e0d4160
--- /dev/null
+++ b/.claude/skills/self-review/SKILL.md
@@ -0,0 +1,33 @@
+Critically review your own PR work before or just after opening the PR.
+
+Review the full branch diff, not just the most recent commit. If there is already an open PR for the current branch, use `gh pr view` and `gh pr diff`. If there is not, diff the current branch against `main` instead. If you already know the PR is open from earlier in the session, do not waste time re-proving it unless you need the PR number or metadata.
+
+Read the entire diff carefully. Do not skim. Re-read any tricky sections until you understand why they changed. When something looks subtle, risky, or surprising, read the surrounding code too and make sure the change really makes sense in context.
+
+As you review, actively look for problems and missing work:
+- bugs or logic mistakes
+- missing edge cases
+- unnecessary complexity
+- leftover debug code, logging, TODOs, or commented-out code
+- naming that could be clearer
+- inconsistent patterns
+- dead code or accidental churn
+- missing or weak tests
+- risky changes that are not obvious from the diff
+- PR scope/title/body not matching the actual change
+- things that technically work but still feel brittle or hard to maintain
+
+Be skeptical. Do not rubber-stamp your own work just because you wrote it.
+
+Make notes as you go, then produce a concise review with these sections:
+- Must fix
+- Risks / questions
+- Suggested improvements
+
+Call out missing things too, not just bad things that are already present in the diff.
+
+Be specific. Reference files and lines when possible. If you are not fully sure whether something is a real bug, include it anyway as a risk or question. Focus on what should be fixed, simplified, verified, or questioned before the PR is considered ready.
+
+Present the findings directly to the user so they can decide what to act on.
+
+End the response with a short TLDR that lists every item again in compact bullet form, grouped by section (`Must fix`, `Risks / questions`, `Suggested improvements`). Keep the TLDR concise and scannable.
\ No newline at end of file
diff --git a/.claude/skills/thermo-nuclear-review/SKILL.md b/.claude/skills/thermo-nuclear-review/SKILL.md
new file mode 100644
index 0000000000..e78551a910
--- /dev/null
+++ b/.claude/skills/thermo-nuclear-review/SKILL.md
@@ -0,0 +1,192 @@
+---
+name: thermo-nuclear-review
+description: Run an extremely strict maintainability review for abstraction quality, giant files, and spaghetti-condition growth. Use for a thermo-nuclear code quality review, thermonuclear review, deep code quality audit, or especially harsh maintainability review.
+disable-model-invocation: true
+---
+
+# Thermo-Nuclear Code Quality Review
+
+Use this skill for an unusually strict review focused on implementation quality, maintainability, abstraction quality, and codebase health.
+
+Above all, this skill should push the reviewer to be **ambitious** about code structure. Do not merely identify local cleanup opportunities. Actively search for "code judo" moves: restructurings that preserve behavior while making the implementation dramatically simpler, smaller, more direct, and more elegant.
+
+## Core Prompt
+
+Start from this baseline:
+
+> Perform a deep code quality audit of the current branch's changes.
+> Rethink how to structure / implement the changes to meaningfully improve code quality without impacting behavior.
+> Work to improve abstractions, modularity, reduce Spaghetti code, improve succinctness and legibility.
+> Be ambitious, if there is a clear path to improving the implementation that involves restructuring some of the codebase, go for it.
+> Be extremely thorough and rigorous. Measure twice, cut once.
+
+## Non-Negotiable Additional Standards
+
+Apply the baseline prompt above, plus these explicit review rules:
+
+0. **Be ambitious about structural simplification.**
+ - Do not stop at "this could be a bit cleaner."
+ - Look for opportunities to reframe the change so that whole branches, helpers, modes, conditionals, or layers disappear entirely.
+ - Prefer the solution that makes the code feel inevitable in hindsight.
+ - Assume there is often a "code judo" move available: a re-organization that uses the existing architecture more effectively and makes the change dramatically simpler and more elegant.
+ - If you see a path to delete complexity rather than rearrange it, push hard for that path.
+
+1. **Do not let a PR push a file from under 1k lines to over 1k lines without a very strong reason.**
+ - Treat this as a strong code-quality smell by default.
+ - Prefer extracting helpers, subcomponents, modules, or local abstractions instead of letting a file sprawl past 1000 lines.
+ - If the diff crosses that threshold, explicitly ask whether the code should be decomposed first.
+ - Only waive this if there is a compelling structural reason and the resulting file is still clearly organized.
+
+2. **Do not allow random spaghetti growth in existing code.**
+ - Be highly suspicious of new ad-hoc conditionals, scattered special cases, or one-off branches inserted into unrelated flows.
+ - If a change adds "weird if statements in random places", treat that as a design problem, not a stylistic nit.
+ - Prefer pushing the logic into a dedicated abstraction, helper, state machine, policy object, or separate module instead of tangling an existing path.
+ - Call out changes that make the surrounding code harder to reason about, even if they technically work.
+
+3. **Bias toward cleaning the design, not just accepting working code.**
+ - If behavior can stay the same while the structure becomes meaningfully cleaner, push for the cleaner version.
+ - Do not rubber-stamp "it works" implementations that leave the codebase messier.
+ - Strongly prefer simplifications that remove moving pieces altogether over refactors that merely spread the same complexity around.
+
+4. **Prefer direct, boring, maintainable code over hacky or magical code.**
+ - Treat brittle, ad-hoc, or "magic" behavior as a code-quality problem.
+ - Be skeptical of generic mechanisms that hide simple data-shape assumptions.
+ - Flag thin abstractions, identity wrappers, or pass-through helpers that add indirection without buying clarity.
+
+5. **Push hard on type and boundary cleanliness when they affect maintainability.**
+ - Question unnecessary optionality, `unknown`, `any`, or cast-heavy code when a clearer type boundary could exist.
+ - Prefer explicit typed models or shared contracts over loosely-shaped ad-hoc objects.
+ - If a branch relies on silent fallback to paper over an unclear invariant, ask whether the boundary should be made explicit instead.
+
+6. **Keep logic in the canonical layer and reuse existing helpers.**
+ - Call out feature logic leaking into shared paths or implementation details leaking through APIs.
+ - Prefer existing canonical utilities/helpers over bespoke one-offs.
+ - Push code toward the right package, service, or module instead of normalizing architectural drift.
+
+7. **Treat unnecessary sequential orchestration and non-atomic updates as design smells when the cleaner structure is obvious.**
+ - If independent work is serialized for no good reason, ask whether the flow should run in parallel instead.
+ - If related updates can leave state half-applied, push for a more atomic structure.
+ - Do not over-index on micro-optimizations, but do flag avoidable orchestration complexity that makes the implementation more brittle.
+
+## Primary Review Questions
+
+For every meaningful change, ask:
+
+- Is there a "code judo" move that would make this dramatically simpler?
+- Can this change be reframed so fewer concepts, branches, or helper layers are needed?
+- Does this improve or worsen the local architecture?
+- Did the diff add branching complexity where a better abstraction should exist?
+- Did a previously cohesive module become more coupled, more stateful, or harder to scan?
+- Is this logic living in the right file and layer?
+- Did this change enlarge a file or component past a healthy size boundary?
+- Are there repeated conditionals that signal a missing model or missing helper?
+- Is the implementation direct and legible, or does it rely on special cases and incidental control flow?
+- Is this abstraction actually earning its keep, or is it just a wrapper?
+- Did the diff introduce casts, optionality, or ad-hoc object shapes that obscure the real invariant?
+- Is this logic living in the canonical layer, or did the diff leak details across a boundary?
+- Is this orchestration more sequential or less atomic than it needs to be?
+
+## What to Flag Aggressively
+
+Escalate findings when you see:
+
+- A complicated implementation where a cleaner reframing could delete whole categories of complexity.
+- Refactors that move code around but fail to reduce the number of concepts a reader must hold in their head.
+- A file crossing 1000 lines due to the PR, especially if the new code could be split out.
+- New conditionals bolted onto unrelated code paths.
+- One-off booleans, nullable modes, or flags that complicate existing control flow.
+- Feature-specific logic leaking into general-purpose modules.
+- Generic "magic" handling that hides simple structure and makes the code harder to reason about.
+- Thin wrappers or identity abstractions that add indirection without simplifying anything.
+- Unnecessary casts, `any`, `unknown`, or optional params that muddy the real contract.
+- Copy-pasted logic instead of extracted helpers.
+- Narrow edge-case handling implemented in the middle of an already busy function.
+- Refactors that technically pass tests but make the code less modular or less readable.
+- "Temporary" branching that is likely to become permanent debt.
+- Bespoke helpers where the codebase already has a canonical utility for the job.
+- Logic added in the wrong layer/package when it should live somewhere more central.
+- Sequential async flow where obviously independent work could stay simpler and clearer with parallel execution.
+- Partial-update logic that leaves state less atomic than necessary.
+
+## Preferred Remedies
+
+When you identify a code-quality problem, prefer suggestions like:
+
+- Delete a whole layer of indirection rather than polishing it.
+- Reframe the state model so conditionals disappear instead of getting centralized.
+- Change the ownership boundary so the feature becomes a natural extension of an existing abstraction.
+- Turn special-case logic into a simpler default flow with fewer exceptions.
+- Extract a helper or pure function.
+- Split a large file into smaller focused modules.
+- Move feature-specific logic behind a dedicated abstraction.
+- Replace condition chains with a typed model or explicit dispatcher.
+- Separate orchestration from business logic.
+- Collapse duplicate branches into a single clearer flow.
+- Delete wrappers that do not meaningfully clarify the API.
+- Reuse the existing canonical helper instead of introducing a near-duplicate.
+- Make type boundaries more explicit so the control flow gets simpler.
+- Move the logic to the package/module/layer that already owns the concept.
+- Parallelize independent work when that also simplifies the orchestration.
+- Restructure related updates into a more atomic flow when partial state would be harder to reason about.
+
+Do not be satisfied with "maybe rename this" feedback when the real issue is structural.
+Do not be satisfied with a merely cleaner version of the same messy idea if there is a plausible path to a much simpler idea.
+
+## Review Tone
+
+Be direct, serious, and demanding about quality.
+Do not be rude, but do not soften major maintainability issues into mild suggestions.
+If the code is making the codebase messier, say so clearly.
+If the implementation missed an opportunity for a dramatic simplification, say that clearly too.
+
+Good phrases:
+
+- `this pushes the file past 1k lines. can we decompose this first?`
+- `this adds another special-case branch into an already busy flow. can we move this behind its own abstraction?`
+- `this works, but it makes the surrounding code more spaghetti. let's keep the behavior and restructure the implementation.`
+- `this feels like feature logic leaking into a shared path. can we isolate it?`
+- `this abstraction seems unnecessary. can we just keep the direct flow?`
+- `why does this need a cast / optional here? can we make the boundary more explicit instead?`
+- `this looks like a bespoke helper for something we already have elsewhere. can we reuse the canonical one?`
+- `i think there's a code-judo move here that makes this much simpler. can we reframe this so these branches disappear?`
+- `this refactor moves complexity around, but doesn't really delete it. is there a way to make the model itself simpler?`
+
+## Output Expectations
+
+Prioritize findings in this order:
+
+1. Structural code-quality regressions
+2. Missed opportunities for dramatic simplification / code-judo restructuring
+3. Spaghetti / branching complexity increases
+4. Boundary / abstraction / type-contract problems that make the code harder to reason about
+5. File-size and decomposition concerns
+6. Modularity and abstraction issues
+7. Legibility and maintainability concerns
+
+Do not flood the review with low-value nits if there are larger structural issues.
+Prefer a smaller number of high-conviction comments over a long list of cosmetic notes.
+
+## Approval Bar
+
+Do not approve merely because behavior seems correct.
+The bar for approval is:
+
+- no clear structural regression
+- no obvious missed opportunity to make the implementation dramatically simpler when such a path is visible
+- no unjustified file-size explosion
+- no obvious spaghetti-growth from special-case branching
+- no obviously hacky or magical abstraction that makes the code harder to reason about
+- no unnecessary wrapper/cast/optionality churn obscuring the real design
+- no clear architecture-boundary leak or avoidable canonical-helper duplication
+- no missed opportunity for an obvious decomposition that would materially improve maintainability
+
+Treat these as presumptive blockers unless the author can justify them clearly:
+
+- the PR preserves a lot of incidental complexity when there is a plausible code-judo move that would delete it
+- the PR pushes a file from below 1000 lines to above 1000 lines
+- the PR adds ad-hoc branching that makes an existing flow more tangled
+- the PR solves a local problem by scattering feature checks across shared code
+- the PR adds an unnecessary abstraction, wrapper, or cast-heavy contract that makes the design more indirect
+- the PR duplicates an existing helper or puts logic in the wrong layer when there is a clear canonical home
+
+If those conditions are not met, leave explicit, actionable feedback and push for a cleaner decomposition.
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 645d899b07..0dd484b7e9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,7 +15,8 @@ server/dist
public/dist
vite.config.ts.timestamp*
.claude-flow
-.claude
+.claude/settings.json
+.claude/settings.local.json
.mcp.json
opencode.json
.windsurf