| name | debug-outfitter |
| version | 0.2.1 |
| description | Systematic debugging process for @outfitter/* package issues. Use when debugging Result handling, MCP problems, CLI output, exit codes, logging, or unexpected behavior. Produces structured investigation reports with root cause analysis. |
| allowed-tools | Read, Grep, Glob, Bash(bun *), Bash(rg *) |
Debug Outfitter
Systematic debugging process for @outfitter/* package issues.
Goal
Investigate issues methodically and produce a structured report documenting:
- What was observed (symptoms)
- What was investigated (evidence)
- What was found (root cause)
- What to do about it (fix or escalation)
Constraints
DO:
- Gather evidence before forming hypotheses
- Use the diagnostic patterns in this skill
- Reference
outfitter-atlas for correct patterns
- Assign a confidence level to your diagnosis
- Produce a Debug Report at the end
DON'T:
- Apply random fixes hoping something works
- Skip the evidence collection phase
- Leave issues undiagnosed
- Forget to document findings
Steps
- Load the
outfitter-atlas skill to gain expertise in the Outfitter packages.
- Collect evidence — gather symptoms before hypothesizing
- Categorize the issue — identify which area is affected
- Investigate — use category-specific diagnostics
- Produce a Debug Report using TEMPLATE.md
- If the issue is in Outfitter's packages themselves, escalate via
outfitter-issue
Stage 1: Evidence Collection
Gather symptoms before forming hypotheses.
What to Collect
- Error messages and stack traces
- Unexpected output vs expected output
- Exit codes (actual vs expected)
- Relevant code snippets
- Environment details (Bun version, package versions)
Quick Diagnostic Commands
bun pm ls | grep @outfitter
rg "Result\.(ok|err)" --type ts -A 2
rg "isErr\(\)|isOk\(\)" --type ts -A 3
rg "throw new" --type ts
Stage 2: Categorize the Issue
Based on symptoms, identify the issue category:
| Category | Symptoms | Common Causes |
|---|
| Result Handling | Wrong value, type errors | Missing await, reassignment breaking narrowing |
| MCP Issues | Tool not appearing, invocation failing | Registration order, missing schema descriptions |
| CLI Output | Wrong format, missing data | Mode detection, await on output |
| Exit Codes | Wrong exit code | Not using exitWithError, manual process.exit |
| Logging | Missing logs, sensitive data exposed | Wrong level, redaction disabled |
| Validation | Unexpected validation errors | Schema mismatch, missing .describe() |
Stage 3: Targeted Investigation
Result Handling Issues
Always getting error:
const result = getUser(id);
const result = await getUser(id);
const validated = validate(input);
if (validated.isErr()) {
console.log("Validation failed:", validated.error.context);
}
Type narrowing broken:
let result = await getUser(id);
if (result.isOk()) {
result = await updateUser(result.value);
}
const getResult = await getUser(id);
if (getResult.isErr()) return getResult;
const updateResult = await updateUser(getResult.value);
Error type lost:
if (result.isErr()) {
switch (result.error._tag) {
case "ValidationError":
console.log(result.error.context);
break;
case "NotFoundError":
console.log(result.error.resourceId);
break;
}
}
MCP Issues
Tool not appearing:
-
Verify registration happens before start():
server.registerTool(myTool);
server.start();
-
Check schema has .describe() on all fields:
const schema = z.object({
query: z.string().describe("Required for AI"),
});
Tool invocation failing:
-
Handler must be async:
handler: async (input) => {
return Result.ok(data);
};
-
Must return Result:
CLI Output Issues
JSON not printing:
await output(data, { mode: "json" });
await output(data);
Wrong exit code:
Exit code reference:
| Category | Exit |
|---|
| validation | 1 |
| not_found | 2 |
| conflict | 3 |
| permission | 4 |
| timeout | 5 |
| rate_limit | 6 |
| network | 7 |
| internal | 8 |
| auth | 9 |
| cancelled | 130 |
Logging Issues
Redaction not working:
const logger = createLogger({
redaction: { enabled: true },
redaction: {
enabled: true,
patterns: ["password", "apiKey", "myCustomSecret"],
},
});
Missing context:
const requestLogger = createChildLogger(ctx.logger, {
requestId: ctx.requestId,
handler: "myHandler",
});
requestLogger.info("Processing", { data });
Wrong level:
const logger = createLogger({
level: process.env.LOG_LEVEL || "info",
});
Stage 4: Document Findings
Assess confidence in your diagnosis:
| Confidence | Meaning |
|---|
| High | Clear pattern violation or bug found with evidence |
| Medium | Likely cause identified, may need verification |
| Low | Multiple possibilities remain, needs more investigation |
Based on diagnosis, recommend:
- Code fix — Provide specific fix with before/after
- Pattern guidance — Reference correct pattern from fieldguide
- Escalation — If issue is in Outfitter itself, use
outfitter-issue
Produce a Debug Report using TEMPLATE.md.
When to Escalate
If investigation reveals an issue in @outfitter/* packages themselves (not user code):
- Document the issue clearly in the Debug Report
- Recommend using
outfitter-issue skill to file an issue
- Include reproduction steps and expected vs actual behavior
Related Skills
outfitter-atlas — Correct patterns reference
outfitter-check — Compliance verification
outfitter-issue — Report issues to Outfitter team