Troubleshoots Outfitter Stack issues including Result handling, MCP problems, CLI output, exit codes, and logging. Use when debugging stack-specific issues, unexpected errors, wrong output modes, or when "debug Result", "MCP not working", "wrong exit code", or "logging issue" are mentioned.
View on GitHubplugins/outfitter-stack/skills/stack-debug/SKILL.md
February 1, 2026
Select agents to install to:
npx add-skill https://github.com/outfitter-dev/agents/blob/main/plugins/outfitter-stack/skills/stack-debug/SKILL.md -a claude-code --skill stack-debugInstallation paths:
.claude/skills/stack-debug/# Stack Debugging
Troubleshoot @outfitter/* package issues.
## Result Issues
### Always Getting Error
**Symptom:** Result is `err` when it should be `ok`.
**Check validation:**
```typescript
const inputResult = validateInput(rawInput);
if (inputResult.isErr()) {
console.log("Validation failed:", inputResult.error.details);
return inputResult;
}
```
**Check async:**
```typescript
// BAD: Missing await
const result = getUser(id); // Promise, not Result!
// GOOD
const result = await getUser(id);
```
### Type Narrowing Broken
**Symptom:** TypeScript doesn't know type after `isOk()`.
```typescript
// BAD: Reassigning breaks narrowing
let result = await getUser(id);
if (result.isOk()) {
result = await updateUser(result.value); // Breaks!
}
// GOOD: Separate variables
const getResult = await getUser(id);
if (getResult.isErr()) return getResult;
const updateResult = await updateUser(getResult.value);
```
### Error Type Lost
**Use `_tag` for narrowing:**
```typescript
if (result.isErr()) {
switch (result.error._tag) {
case "ValidationError":
console.log(result.error.details);
break;
case "NotFoundError":
console.log(result.error.resourceId);
break;
}
}
```
## MCP Issues
### Tool Not Appearing
1. Register before `start()`:
```typescript
server.registerTool(myTool);
server.start(); // After registration!
```
2. Check schema is valid Zod with `.describe()`:
```typescript
const schema = z.object({
query: z.string().describe("Required for AI"),
});
```
### Tool Invocation Failing
1. Verify handler is async:
```typescript
handler: async (input) => { // Not sync!
return Result.ok(data);
}
```
2. Return Result, not raw value:
```typescript
// BAD
return { data: "value" };
// GOOD
return Result.ok({ data: "value" });
```
## CLI Output Issues
### JSON Not Printing
1. Force mode:
```typescript
await output(data, { mode: "json" });
```
2. Check