Skip to content

matlab/agent-skills-playground / demos/ai-tutoring/skills/matlab-coach-debugging

matlab-coach-debugging

Verified

Use when tutoring a learner through MATLAB debugging, error interpretation, failed tests, incorrect outputs, array-shape problems, indexing mistakes, function argument issues, or code repair practice. Use for guided debugging sessions, debugging drills, teach-the-agent critique, and evidence-based MATLAB troubleshooting.

FileKindSize
SKILL.mdskill md4.1 KB
references/debugging-patterns.mdmarkdown2.2 KB

references/debugging-patterns.md

View on GitHub
# Debugging Patterns

Use these patterns when a MATLAB tutoring session is centered on a bug, failing
test, or unexpected output.

For instructors, the goal is to make debugging visible. Students should learn to
name the expectation, collect evidence, isolate the smallest failing case, and
then repair the code. The tutor should model that process every time.

## Diagnostic Prompts

- "What did you expect this line to produce?"
- "What did MATLAB produce instead?"
- "Which line first makes the value wrong?"
- "What are `size(x)`, `class(x)`, and the first few values?"
- "Can you make a three-line version that still fails?"
- "What test would pass if your hypothesis is correct?"

## Minimal Reproduction Template

```matlab
% Goal:
% Expected:
% Actual:

input = ...;
result = ...;

disp(result)
disp(size(result))
disp(class(result))
```

Ask the learner to remove unrelated loading, plotting, formatting, and long data
until the failure is isolated.

Instructor note: Minimal reproductions are especially useful in large lab files.
They reduce frustration and make it easier to identify whether the problem is
array shape, indexing, type, function scope, or data import.

## Teach-the-Agent Drill Template

```text
Here is a flawed AI explanation:
[short flawed explanation]

1. Which claim is wrong?
2. What MATLAB evidence would prove it?
3. What is the smallest corrected code or explanation?
4. What test distinguishes the flawed and corrected versions?
```

## Repair Feedback Template

```text
Partly correct.
Why: [tie the issue to MATLAB behavior].
Evidence: [size/class/value/error text].
Bug pattern: [name the pattern].
Next step: [one inspection, edit, or test].
```

## Common MATLAB Debugging Checks

- Shape: `size(x)`, `height(T)`, `width(T)`, `numel(x)`.
- Type: `class(x)`, `istable(x)`, `iscell(x)`, `isstring(x)`.
- Workspace: `whos`, function inputs, local variables, path conflicts.
- Numeric tolerance: `abs(actual - expected) < tol`.
- Table indexing: compare `T.Var`, `T(:, "Var")`, and `T{:, "Var"}`.
- Plot checks: axis labels, units, vector lengths, and missing values.

## Reflection Prompt

After the repair, ask:

```text
What evidence showed the bug, what MATLAB rule explained it, and how would you
recognize the same pattern next time?
```
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 322kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 322kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 322kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 197kUpdated Claude CodeCodexVerifiedInstall