weld-plan-debug
Skill2 starsChanged 5 months agoApache-2.0View on GitHub
Debugging workflow for welding planning failures in the Weldone project. Triggered when the user reports a planning error (e.g., "SolvePath Failed!", IndexOutOfRangeException in PrePlanScanWeldDualArmAsyncInSameExternal, ParseWeldSeamGroups failure, or "single seam works but multiple fails"). Covers dual-arm scan/weld transition planning, external axis pre-planning, and workpiece seam group parsing.
In this repository60 other files it gives its agents.
- .claude/CLAUDE.mdCLAUDE.md
- add-diag-instrumentationSkill
- add-diag-logsSkill
- archive-importSkill
- archive-sessionSkill
- archiveSkill
- ask-mattSkill
- build-publish-runSkill
- coarse-compensation-fitSkill
- codebase-designSkill
- code-simplifySkill
- commitSkill
- create-weld-docSkill
- DDD-reviewSkill
- diagnosing-bugsSkill
- domain-modelingSkill
- feishu-webhookSkill
- git-branch-mergeSkill
- gitlab-issueSkill
- gitlab-merge-requestSkill
- gitlab-opsSkill
- grillingSkill
- grill-meSkill
- grill-with-docsSkill
- handoffSkill
- implementSkill
- improve-codebase-architectureSkill
- knowledge-reorgSkill
- modelbase-fsmSkill
- modelbase-fsm-updateSkill
- opsx-reindexSkill
- opsx-searchSkill
- parallel-featureSkill
- periodic-reviewSkill
- prototypeSkill
- read-diag-capturesSkill
- robim-data-explorerSkill
- robimweld-release-checkSkill
- robimweld-source-debugSkill
- robot-to-worldSkill
- setup-matt-pocock-skillsSkill
- skill-creatorSkill
- superpowersSkill
- tddSkill
- teachSkill
- three-blazor-devSkill
- to-issuesSkill
- to-prdSkill
- triageSkill
- weldone-animationSkill
- weldone-current-urdfSkill
- weldone-db-migrationSkill
- weldone-hybrid-seam-replay-debugSkill
- weldone-mapmatrix-domain-knowledgeSkill
- weldone-project-logsSkill
- weldone-transition-line-domain-knowledgeSkill
- weldone-wsg-merge-domain-knowledgeSkill
- weld-seam-normal-vectorsSkill
- world-to-robotSkill
- writing-great-skillsSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. About 0 are common, 6 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 20
Before investigating, confirm the following are available:
- Distinctive: line 32
If the user only says "planning failed" without a stack trace, ask for the log first.
- Distinctive: line 37
Read the error message the user pasted.
- Very specific: line 44
If the root cause is not obvious, Grep for the method name to find all call sites.
- Distinctive: line 45
Stop here if unclear: Ask the user: "Hypothesis: [X].
- Very specific: line 55
Use ILogger (never Console.WriteLine).
- Very specific: line 61
Keep log templates structured: "[MethodName] {WsgId} arm={ArmIndex} exSearch={ExSearchTimes}".
- Very specific: line 64
Search openspec/ for the method or feature name.
- Distinctive: line 66
If code diverges from spec, prefer fixing the code to match the spec (not updating the spec).
- Distinctive: line 70
Do not refactor adjacent code unless it directly blocks the fix.
- Very specific: line 71
If the fix involves param changes (e.g., ExSearchTimes), ensure related params (ExParam.Resolution, FixDistance, banEx) are consistent.
- Very specific: line 74
Use mcp__ide__getDiagnostics on changed files.
- Very specific: line 75
Do not run dotnet build unless the user explicitly asks.
- Very specific: line 79
Use Chinese conventional commit format: fix(规划): 修复[具体症状]因[根因].
- Very specific: line 128
Verify: Run mcp__ide__getDiagnostics on RobotPlanSolver.cs.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Weld Planning Debug Workflow
1. Prerequisite Checks
Before investigating, confirm the following are available:
- Stack trace or error log from the user (production log, simulation log, or pasted exception).
- Key source files exist in the current working tree:
src/Robim.Devices.Robot/Plan/Solver/RobotPlanSolver.cs— solver core, throwsSolvePath Failed!src/Weldone.Application/Plan/PlanManager.DualArm.cs— dual-arm transition planningsrc/Weldone.Application/Robot/ExternalRobotAppService.cs— external axis pre-planningsrc/Weldone.Domain/WorkpieceManager/WorkpieceManagerBase.cs— seam group parsingsrc/Weldone.Application/Plan/SolveStrategy/DualArmStrategy.cs— dual-arm param builder
- ILogger instance is accessible in the failing class (verify
using Microsoft.Extensions.Logging;). - OpenSpec spec for the feature area exists under
openspec/specs/oropenspec/changes/(check for intended behavior).
If the user only says "planning failed" without a stack trace, ask for the log first.
2. Step-by-Step Procedure
Step 1 — Anchor on the stack trace (30 seconds)
- Read the error message the user pasted.
- Identify the topmost method name and line number in the Weldone/Robim namespace.
- Formulate a 2-sentence hypothesis about what went wrong and where.
Step 2 — Read the failing site and its caller (2 files max)
Readthe method at the line number from the stack trace.Readthe immediate caller one level up.- If the root cause is not obvious,
Grepfor the method name to find all call sites. - Stop here if unclear. Ask the user: "Hypothesis: [X]. I need to check [Y] to confirm. Proceed?"
Step 3 — Inspect planning parameters and state
Planning failures are almost always param/state mismatches. Check:
ExSearchTimesvalue and who last set it (DualArmStrategysets 50,DualArmTransitionWithAirWallPlanStrategysets 1, default is 1).LastJointPos/_armJointPosesstate — is it stale or mutated between seams?fixedIndicesandboundariesconsistency (for external axis planning).- Shared cache dictionaries (
ScanTransCaches,WeldTransCaches,ExternalCache) — are they cleared between planning runs?
Step 4 — Add diagnostic logging
Use ILogger (never Console.WriteLine). Add logs at:
- Method entry: log method name,
wsgId,armIndex, and key param values (ExSearchTimes,FixDistance,Externals). - Decision branches: log which branch was taken and why (e.g.,
skipP1={skipP1}, skipP2={skipP2}). - Validation results: log
ValidateSingle()outcome with process id/counts. - Loop iterations: log index,
ilIdx,WsgCount, and boundary values when iterating seam groups.
Keep log templates structured: "[MethodName] {WsgId} arm={ArmIndex} exSearch={ExSearchTimes}".
Step 5 — Cross-check with OpenSpec
- Search
openspec/for the method or feature name. - Compare intended behavior in the spec against the actual code.
- If code diverges from spec, prefer fixing the code to match the spec (not updating the spec).
Step 6 — Implement minimal fix
- Edit the narrowest possible scope to resolve the root cause.
- Do not refactor adjacent code unless it directly blocks the fix.
- If the fix involves param changes (e.g.,
ExSearchTimes), ensure related params (ExParam.Resolution,FixDistance,banEx) are consistent.
Step 7 — Verify without building
- Use
mcp__ide__getDiagnosticson changed files. - Do not run
dotnet buildunless the user explicitly asks. - Review the diff for accidental changes.
Step 8 — Commit
- Use Chinese conventional commit format:
fix(规划): 修复[具体症状]因[根因]. - Include the why, not just the what.
3. Common Pitfalls & Avoidance
| Pitfall | Why it happens | How to avoid |
| Reading >3 files before hypothesizing | Drifts into broad exploration; wastes context window | Enforce the 2-file limit. Use an agent for broad exploration if needed. |
Changing ExSearchTimes in isolation | Dual-arm strategy sets 50 for external axis search; transition strategy sets 1. Changing one without adjusting Resolution/FixDistance breaks planning silently. | Always check the strategy builder that owns the param. Change all related fields together. |
Stale LastJointPos / _armJointPoses | Transition planning reuses previous joint state. If a prior seam failed or was skipped, the state may be wrong. | Log lastJointPos at entry. Verify it matches the expected end pose of the previous segment. |
| Console.WriteLine for debug logs | Project rules require ILogger. Console output does not reach the frontend log panel and will be rejected in review. | Use logger.LogDebug/LogInformation. Inject ILogger if missing. |
IndexOutOfRange on fixedIndices | maxStartIdx/minEndIdx boundary logic assumes seam point counts match between paired weld seam groups. When WsgCount changes (dual-arm vs single), indices drift. | Log boundaries, fixedIndices, and nonFixedIndices before the solver call. Validate fixedIndices are within poseAndExternals.Count. |
| Shared cache pollution | ExternalCache, ScanTransCaches are not cleared between "一键规划" runs. Old results mask new failures. | Ensure cache reset at the start of each planning batch. |
| Fixing code to match buggy behavior | Developer assumes the current runtime behavior is correct and patches around it. | Always check OpenSpec first. The spec is the source of truth. |
4. Validation Criteria for Success
A welding planning debug session is complete only when:
- Root cause is identified with a specific file:line citation and a one-sentence explanation.
- Diagnostic logs are added at the failure path and at least one decision branch upstream.
- Fix aligns with OpenSpec (or a spec update is explicitly acknowledged by the user).
- LSP diagnostics are clean on all modified files.
- Commit is made with Chinese conventional commit message summarizing content and cause.
- No
dotnet buildwas run unless user explicitly requested it.
5. Scenario Simulation: "SolvePath Failed! with changed ExSearchTimes"
User report: "SolvePath Failed! 我在 PlanParamSetting.json 里把 ExSearchTimes 从 50 改成了 20。"
Skill-guided execution (autonomous):
- Parse error:
SolvePath Failed!is thrown atRobotPlanSolver.cs:507whenresult.ValidateSingle()returns false. - Read anchor file:
ReadRobotPlanSolver.cslines 490–510. Confirm the exception is thrown afterGeneratePlanData. - Hypothesis (2 sentences): The user reduced
ExSearchTimesfrom 50 to 20 inPlanParamSetting.json. In dual-arm planning,DualArmStrategy.Build()setsExSearchTimes = 50to allow broad external axis search. A lower value may cause the solver to exhaust search attempts before finding a valid path, resulting inValidateSingle()failure. - Check param ownership:
GrepforExSearchTimes =across the codebase. Find:DualArmStrategy.cs:70→_originParam.ExSearchTimes = 50;DualArmTransitionWithAirWallPlanStrategy.cs:87→_originParam.ExSearchTimes = 1;PlanConfigUtils.cs:144→ default1.
- Inspect related params:
ReadDualArmStrategy.cslines 66–90. Notice it also setsExParam.Resolution[2] = 2000andExParam.FixDistance. These are coupled withExSearchTimes. - Add diagnostic logging: In
RobotPlanSolver.csaround line 490, add:logger.LogDebug("[SolveProcess] ExSearchTimes={ExSearchTimes}, FixDistance={FixDistance}, ResolutionZ={ResolutionZ}", _currentParam.ExSearchTimes, _currentParam.ExParam.FixDistance, _currentParam.ExParam.Resolution[2]); - Check OpenSpec:
Grepopenspec/forExSearchTimes. Finddual-arm-strategy/spec.mdspecifyingExSearchTimesshould be 1 for transition and 50 for weld external search. The user's change to 20 contradicts the spec for dual-arm external axis search. - Implement fix: Revert
PlanParamSetting.jsonto 50 for the dual-arm procedure key. If the user truly needs 20, also reduceResolution[2]proportionally and re-test. - Verify: Run
mcp__ide__getDiagnosticsonRobotPlanSolver.cs. - Commit:
git commitwith message:fix(规划): 恢复 DualArmStrategy 的 ExSearchTimes 为 50 以匹配外部轴搜索规范 用户误将 PlanParamSetting.json 中的 ExSearchTimes 改为 20, 导致外部轴解算次数不足,触发 SolvePath Failed。 同时添加 ExSearchTimes/FixDistance/Resolution 的调试日志以便未来排查。
Result: User receives a clean fix, diagnostic logs for next time, and no manual intervention was needed.
6. Telemetry Suggestions for Auto-Generating Skills
To automatically derive skills like this in the future, capture per-session telemetry:
- Error taxonomy: Which exception types / error messages appeared (e.g.,
RobotSolveException,IndexOutOfRangeException,ArgumentOutOfRangeException). - File touch heatmap: Which files were
ReadandEditduring debugging sessions involving planning keywords. - Tool call sequences: The ordered chain of
Grep→Read→Edit→Readthat led to successful resolution. - User corrections: Moments where the user said "不对" / "不是这里" / "先判断error再merge" — these indicate friction points.
- Hypothesis confirmation latency: Time between initial hypothesis and user confirmation (or rejection). Long latencies signal vague hypotheses.
- Log injection pattern: Which methods received new
ILoggercalls during bug fixes. - Spec reference frequency: Which OpenSpec specs were consulted and whether the fix aligned with or contradicted the spec.
- Param mutation tracing: Which planning parameters (
ExSearchTimes,FixDistance,ToolScale) were changed during the session and in which files.
Store this telemetry in ~/.claude/telemetry/weld-plan-debug-sessions.jsonl with one entry per completed debug session. A periodic script can cluster patterns and emit new skill drafts when the same sequence appears 3+ times.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

