This skill audits Outfitter Stack compliance in TypeScript code, enforcing Result patterns, error handling, and safe logging for robust pre-commit reviews.
npx playbooks add skill outfitter-dev/agents --skill stack-review
Audit code for @outfitter/* pattern compliance.
Run searches to identify issues:
# Thrown exceptions (Critical)
rg "throw new" --type ts
# try/catch control flow (Critical)
rg "try \{" --type ts
# Console usage (High)
rg "console\.(log|error|warn)" --type ts
# Hardcoded paths (High)
rg "(homedir|~\/\.)" --type ts
# Custom error classes (Medium)
rg "class \w+Error extends Error" --type ts
Check each handler for:
Result<T, E> not Promise<T>Handler<TInput, TOutput, TError> type# Find handlers
rg "Handler<" --type ts -A 2
# Find missing context
rg "Handler<.*> = async \(input\)" --type ts
Verify errors:
@outfitter/contracts classesResult.err(), not thrownCheck logging:
ctx.logger, not consoleVerify paths:
securePath()getConfigDir, etc.)Check context:
createContext() at entry pointsrequestId used for tracing# Critical issues (count)
rg "throw new|catch \(" --type ts -c
# Console usage (count)
rg "console\.(log|error|warn)" --type ts -c
# Handler patterns
rg "Handler<" --type ts -A 2
Result<T, E>, not thrown exceptionsValidationError, NotFoundError, etc.)isOk() / isErr(), not try/catchcombine2, combine3, etc.Anti-patterns:
// BAD: Throwing
if (!user) throw new Error("Not found");
// GOOD: Result.err
if (!user) return Result.err(new NotFoundError("user", id));
// BAD: try/catch for control flow
try { await handler(input, ctx); } catch (e) { ... }
// GOOD: Result checking
const result = await handler(input, ctx);
if (result.isErr()) { ... }
@outfitter/contractscategory matches use case_tag used for pattern matching| Category | Use For |
|----------|---------|
| validation | Invalid input, schema failures |
| not_found | Resource doesn't exist |
| conflict | Already exists, version mismatch |
| permission | Forbidden action |
| internal | Unexpected errors, bugs |
ctx.logger, not console.logAnti-patterns:
// BAD
console.log("User " + user.name);
logger.info("Config: " + JSON.stringify(config));
// GOOD
ctx.logger.info("Processing", { userId: user.id });
ctx.logger.debug("Config loaded", { config }); // redaction enabled
securePath()~/. paths@outfitter/configAnti-patterns:
// BAD
const configPath = path.join(os.homedir(), ".myapp", "config.json");
const userFile = path.join(baseDir, userInput); // traversal risk!
// GOOD
const configDir = getConfigDir("myapp");
const result = securePath(userInput, workspaceRoot);
await atomicWriteJson(configPath, data);
createContext() at entry pointsrequestId used for tracingcreateValidator() with Zodawait output() with mode detectionexitWithError() for error exits# Find thrown exceptions
rg "throw new" --type ts
# Find console usage
rg "console\.(log|error|warn)" --type ts
# Find hardcoded paths
rg "(homedir|~\/\.)" --type ts
# Find custom errors
rg "class \w+Error extends Error" --type ts
# Find handlers without context
rg "Handler<.*> = async \(input\)" --type ts
| Level | Examples |
|-------|----------|
| Critical | Thrown exceptions, unvalidated paths, missing error handling |
| High | Console logging, hardcoded paths, missing context |
| Medium | Missing type annotations, non-atomic writes |
| Low | Style issues, missing documentation |
## Stack Compliance: [file/module]
**Status**: PASS | WARNINGS | FAIL
**Issues**: X critical, Y high, Z medium
### Critical
1. [file:line] Issue description
### High
1. [file:line] Issue description
### Recommendations
- Recommendation with fix
outfitter-stack:stack-patterns — Correct patterns referenceoutfitter-stack:stack-audit — Scan codebase for adoption scopeoutfitter-stack:stack-debug — Troubleshooting issuesWeekly roundup of top Claude Code skills, MCP servers, and AI coding tips.