# Rapid Mode - Ship Fast

**Context**: 1-2 developers, 3-6 months lifespan, 0-100 users, $0-5K MRR

When this skill is activated, you operate in **RAPID mode** - optimized for speed and market validation.

## Architecture Rules

### Structure: Flat (Plate)
- Logic directly in tRPC routers
- No layer separation required
- Working code > Perfect code

### Code Quality Rules

| Aspect | Rule |
|--------|------|
| Max lines/function | 100 lines |
| Parameters | Flexible (no limit) |
| Duplication | OK if < 3 times (⚠️ Warning at 3+) |
| Cyclomatic complexity | No limit |
| SOLID | S + I basic only |
| Comments | WHY only if needed |

### Testing Strategy

**Coverage**: NO minimum required

**What to test**:
- ✅ Auth flows (login, register, logout)
- ✅ Payment flows (checkout, webhooks)
- ❌ Business logic (skip)
- ❌ UI components (skip)
- ❌ E2E (skip)

**Test approach**: Test-After Generation (TAG)
1. Generate code + tests in parallel
2. Run tests automatically
3. Fix if fails
4. Ship when passes

### Typical Structure

```
packages/
├── api/
│   └── routers/
│       └── product.ts        # All logic here (100 lines OK)
├── database/
│   └── client.ts             # Prisma simple
└── ui/
    └── components/           # shadcn/ui
```

## MCP Tools to Use

### Context
```typescript
mcp__crafted-context__get_context_summary() // Understand project
mcp__crafted-context__get_architecture_info() // Confirm level = rapid
```

### Validation (Relaxed)
```typescript
mcp__rules-validator__validate_code({
  code: "...",
  level: "rapid" // Will allow 100 lines/function
})
```

### Development
```typescript
mcp__filesystem__write_file() // Create files
mcp__vitest__run_tests() // Run auth/payment tests only
```

## Philosophy

> "Ship, learn, iterate. Perfect is the enemy of done."

## Active Craft Principles (6/16)

- ✅ Type Safety (TypeScript strict + Zod)
- ✅ Linting (ESLint basic)
- ✅ Git Hooks (pre-commit minimal)
- ✅ Error Handling (basic try-catch)
- ✅ Security (input validation + auth)
- ✅ Self-Documenting Code (NO inline comments)

## When to Use This Skill

Invoke this skill when:
- Starting a new project for market validation
- Building an MVP
- Time to market is critical
- User wants to ship fast

## Example Code Style

```typescript
// ✅ GOOD - Rapid style
export const productRouter = createTRPCRouter({
  create: protectedProcedure
    .input(z.object({
      name: z.string(),
      price: z.number(),
      description: z.string().optional(),
    }))
    .mutation(async ({ ctx, input }) => {
      // Stripe requires amount in cents
      const priceInCents = input.price * 100;

      const product = await ctx.db.product.create({
        data: {
          ...input,
          userId: ctx.session.user.id,
          priceInCents,
        },
      });

      await ctx.stripe.products.create({
        id: product.id,
        name: product.name,
        default_price_data: {
          unit_amount: priceInCents,
          currency: 'usd',
        },
      });

      return product;
    }),
});
```

## Commands You Can Run

```bash
# Generate code with Rapid rules
/feature "Add user authentication"

# Validate code (relaxed rules)
/validate rapid

# Run critical tests only
pnpm test -- auth payment
```

## Transitioning to Balanced

When you reach:
- 100+ users
- $5K+ MRR
- 3+ developers
- 6+ months lifespan

Consider switching to `/balanced` skill for better maintainability.
