From smalltalk-dev
Systematically debugs Pharo Smalltalk code via error diagnosis, incremental evaluation, intermediate value inspection, and stack trace analysis. Use for test failures, exceptions, timeouts, or hung operations.
How this skill is triggered — by the user, by Claude, or both
Slash command
/smalltalk-dev:smalltalk-debuggerThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Systematic debugging techniques for Pharo Smalltalk development using AI editors.
Systematic debugging techniques for Pharo Smalltalk development using AI editors.
When tests fail or errors occur, follow this systematic approach:
From error message, confirm:
Use /st-eval tool to execute relevant code incrementally.
Basic error capture pattern:
| result |
result := Array new: 2.
[ | ret |
ret := objA doSomething.
result at: 1 put: ret printString.
] on: Error do: [:ex | result at: 2 put: ex description].
^ result
Interpreting results:
result at: 1 - Normal result (success case)result at: 2 - Error description (failure case)Inspect state at each step:
| step1 step2 |
step1 := self getData.
step2 := step1 select: [:each | each isValid].
{
'step1 count' -> step1 size.
'step2 count' -> step2 size.
'step2 result' -> step2 printString
} asDictionary printString
import_packagerun_class_testWhen an MCP call times out, follow this escalation sequence:
Run a quick eval to verify Pharo is still responsive:
mcp__smalltalk-interop__eval: 'Smalltalk version'
If this succeeds, Pharo is alive — a debugger window may have opened (see below).
read_screenIf eval also times out, check the UI state:
mcp__smalltalk-interop__read_screen: target_type='world'
If read_screen responds, inspect the output for debugger windows (see "Detecting Hidden Debuggers" below).
If read_screen itself times out, Pharo has hung at the process level. MCP tools cannot recover from this state.
Ask the user to:
Use the read_screen tool to capture the Pharo UI state:
mcp__smalltalk-interop__read_screen: target_type='world'
This captures all morphs including debugger windows. Look for:
Note: The Pharo debugger cannot be controlled remotely through MCP tools. User intervention in the Pharo image is required.
For complete UI debugging guidance, see UI Debugging Reference.
Cause: Method doesn't exist or typo in method name Debug: Check spelling, search implementors
mcp__smalltalk-interop__search_implementors: 'methodName'
Cause: Accessing non-existent Dictionary key Debug: List keys, use at:ifAbsent:
dict keys printString
dict at: #key ifAbsent: ['default']
Cause: Collection index out of range Debug: Check size, use at:ifAbsent:
collection size printString
collection at: index ifAbsent: [nil]
Cause: Division by zero Debug: Check denominator before dividing
count = 0 ifTrue: [0] ifFalse: [sum / count]
Cause: Test expectation doesn't match actual
Debug: Execute test code with /st-eval, check if package imported
For complete error patterns and solutions, see Error Patterns Reference.
" Object class "
obj class printString
" Instance variables "
obj instVarNames
" Check method exists "
obj respondsTo: #methodName
" Size and elements "
collection size
collection printString
" Safe first/last "
collection ifEmpty: [nil] ifNotEmpty: [:col | col first]
" Keys and values "
dict keys
dict values
" Safe access "
dict at: #key ifAbsent: ['default']
For comprehensive inspection techniques, see Inspection Techniques Reference.
Break problems into incremental steps and verify each with /st-eval:
obj := MyClass new.
obj printString " Step 1: verify creation "
result := obj doSomething.
result printString " Step 2: verify method call "
Never assume - verify at each step:
intermediate := obj step1.
" Check here before proceeding "
result := intermediate step2.
When returning objects via JSON/MCP:
✅ obj printString
✅ collection printString
❌ obj " Don't return raw objects "
Always capture errors with on:do::
[
risky operation
] on: Error do: [:ex |
ex description
]
.st file → Import → TestUse Transcript crShow: with ##DEBUG##-prefixed format strings to log values. Read output via read_screen target_type='transcript'. For call-order tracing use DateAndTime current; for call-site tracing use thisContext shortStack or printStackOfSize:. Headless images: NonInteractiveTranscript file install (writes to PharoTranscript.log).
See Logging Techniques Reference for full examples.
/st-evalmcp__smalltalk-interop__eval: 'Smalltalk version'
mcp__smalltalk-interop__eval: 'MyClass new doSomething printString'
mcp__smalltalk-interop__get_class_source: 'ClassName'
mcp__smalltalk-interop__get_method_source: class: 'ClassName' method: 'methodName'
mcp__smalltalk-interop__search_implementors: 'methodName'
mcp__smalltalk-interop__search_references: 'methodName'
Error: Expected 'John Doe' but got 'John nil'
/st-eval to reproduce^ self missing?For complete debugging scenarios, see Debug Scenarios Examples.
When debugging, systematically check:
/st-eval to test incrementallyThis skill provides focused debugging guidance. For comprehensive information:
Core debugging cycle:
Error occurs → Identify error type → /st-eval incrementally
→ Inspect intermediate values → Identify root cause
→ Fix in Tonel → Re-import → Re-test → Success or repeat
Remember: Systematic approach, incremental testing, fix in Tonel, always re-import.
npx claudepluginhub mumez/smalltalk-dev-plugin --plugin smalltalk-devEvaluates Smalltalk expressions in Pharo via MCP for verifying object states, incremental debugging, connection checks, and quick experiments.
Diagnoses failures, fixes bugs, and investigates failing tests using systematic debugging: reproduce first, read before changing, assume nothing, find root cause.
Diagnoses errors, test failures, and unexpected behavior by capturing error messages, isolating failure locations, and guiding root cause analysis.