Design stack-based systems using @outfitter/* packages. Use when planning new projects, choosing packages, designing handler architecture, or when "architecture", "design", "structure", "plan handlers", or "error taxonomy" are mentioned.
Design transport-agnostic handler systems with proper Result types and error taxonomy.
Gather information about:
For each domain operation:
Handler<Input, Output, Error1 | Error2>Example:
// Input schema
const CreateUserInputSchema = z.object({
email: z.string().email(),
name: z.string().min(1),
});
// Output type
interface User {
id: string;
email: string;
name: string;
}
// Handler signature
const createUser: Handler<unknown, User, ValidationError | ConflictError>;
Map domain errors to the 10 categories:
| Domain Error | Stack Category | Error Class |
|--------------|----------------|-------------|
| Not found | not_found | NotFoundError |
| Invalid input | validation | ValidationError |
| Already exists | conflict | ConflictError |
| No permission | permission | PermissionError |
| Auth required | auth | AuthError |
| Timed out | timeout | TimeoutError |
| Connection failed | network | NetworkError |
| Limit exceeded | rate_limit | RateLimitError |
| Bug/unexpected | internal | InternalError |
| User cancelled | cancelled | CancelledError |
Packages are organized into three tiers:
┌─────────────────────────────────────────────────────────────────┐
│ TOOLING TIER │
│ Build-time, dev-time, test-time packages │
│ @outfitter/testing │
└─────────────────────────────────────────────────────────────────┘
▲
│ depends on
┌─────────────────────────────────────────────────────────────────┐
│ RUNTIME TIER │
│ Application-specific packages for different deployment targets │
│ @outfitter/cli @outfitter/mcp @outfitter/daemon │
│ @outfitter/config @outfitter/logging @outfitter/file-ops │
│ @outfitter/state │
└─────────────────────────────────────────────────────────────────┘
▲
│ depends on
┌─────────────────────────────────────────────────────────────────┐
│ FOUNDATION TIER │
│ Zero-runtime-dependency core packages │
│ @outfitter/contracts @outfitter/types │
└─────────────────────────────────────────────────────────────────┘
| Tier | Packages | Dependency Rule |
|------|----------|-----------------|
| Foundation | contracts, types | No @outfitter/* deps |
| Runtime | cli, mcp, daemon, config, logging, file-ops, state | May depend on Foundation |
| Tooling | testing | May depend on Foundation + Runtime |
| Package | Purpose | When to Use |
|---------|---------|-------------|
| @outfitter/contracts | Result types, errors, Handler contract | Always (foundation) |
| @outfitter/types | Type utilities, collection helpers | Type manipulation |
| @outfitter/cli | CLI commands, output modes, formatting | CLI applications |
| @outfitter/mcp | MCP server, tool registration | AI agent tools |
| @outfitter/config | XDG paths, config loading | Configuration needed |
| @outfitter/logging | Structured logging, redaction | Logging needed |
| @outfitter/daemon | Background services, IPC | Long-running services |
| @outfitter/file-ops | Secure paths, atomic writes, locking | File operations |
| @outfitter/state | Pagination, cursor state | Paginated data |
| @outfitter/testing | Test harnesses, fixtures | Testing |
Selection criteria:
@outfitter/contracts (foundation)@outfitter/cli (includes UI components)@outfitter/mcp@outfitter/config (paths) and @outfitter/file-ops (safety)Determine:
Project: {PROJECT_NAME}
Transport Surfaces: {CLI | MCP | HTTP | ...}
Directory Structure:
├── src/
│ ├── handlers/ # Transport-agnostic business logic
│ │ ├── {handler-1}.ts
│ │ └── {handler-2}.ts
│ ├── commands/ # CLI adapter (if CLI)
│ ├── tools/ # MCP adapter (if MCP)
│ └── index.ts # Entry point
└── tests/
└── handlers/ # Handler tests
Dependencies:
├── @outfitter/contracts # Foundation (always)
├── @outfitter/{package-2} # {reason}
└── @outfitter/{package-3} # {reason}
| Handler | Input | Output | Errors | Description |
|---------|-------|--------|--------|-------------|
| getUser | GetUserInput | User | NotFoundError | Fetch user by ID |
| createUser | CreateUserInput | User | ValidationError, ConflictError | Create new user |
| deleteUser | DeleteUserInput | void | NotFoundError, PermissionError | Remove user |
Domain Errors → Stack Taxonomy:
{domain-error-1} → {stack-category} ({ErrorClass})
- When: {condition}
- Exit code: {code}
{domain-error-2} → {stack-category} ({ErrorClass})
- When: {condition}
- Exit code: {code}
Always:
Never:
outfitter-stack:stack-patterns — Reference for all patternsoutfitter:tdd — TDD implementation methodologyoutfitter-stack:stack-templates — Templates for componentsSearch for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer