---
name: design
description: System architecture, API, and component design with comprehensive specifications
---

# /design - System and Component Design

Design system architecture, APIs, and component interfaces with comprehensive specifications.

## When to Use

- Architecture planning and system design
- API specification and interface design
- Component design and technical specifications
- Database schema and data model design

## Usage

```
/skill design [target] [--type architecture|api|component|database] [--format diagram|spec|code]
```

## Workflow

### 1. Analyze
- Examine target requirements
- Review existing system context
- Identify constraints and dependencies

### 2. Plan
- Define design approach
- Select appropriate patterns
- Consider scalability needs

### 3. Design
- Create comprehensive specifications
- Apply industry best practices
- Document design decisions

### 4. Validate
- Ensure requirements are met
- Verify maintainability
- Check consistency with existing system

### 5. Document
- Generate clear documentation
- Include diagrams where helpful
- Provide implementation guidance

## Design Types

### Architecture
- System structure and components
- Communication patterns
- Deployment considerations
- Scalability planning

### API
- Endpoint specifications
- Request/response schemas
- Authentication/authorization
- Error handling patterns

### Component
- Interface definitions
- Dependencies and contracts
- State management
- Event handling

### Database
- Entity relationships
- Schema definitions
- Indexing strategy
- Migration planning

## Output Formats

### Diagram (Mermaid)
```mermaid
graph TD
    A[Client] --> B[API Gateway]
    B --> C[Service A]
    B --> D[Service B]
```

### Specification
```yaml
openapi: 3.0.0
paths:
  /users:
    get:
      summary: List users
      responses:
        200:
          description: Success
```

### Code (Interfaces/Types)
```typescript
interface UserService {
  getUser(id: string): Promise<User>;
  createUser(data: CreateUserDTO): Promise<User>;
}
```

## Design Principles

- **SOLID**: Single responsibility, Open-closed, etc.
- **KISS**: Keep it simple, avoid over-engineering
- **DRY**: Avoid duplication in design
- **Separation of Concerns**: Clear boundaries

## Examples

```
/skill design user-management-system --type architecture --format diagram
# Creates system architecture diagram with component relationships

/skill design payment-api --type api --format spec
# Generates OpenAPI specification for payment endpoints

/skill design notification-service --type component --format code
# Creates TypeScript interfaces for notification service

/skill design e-commerce-db --type database --format diagram
# Creates ER diagram with entity relationships
```

## Boundaries

**Will:**
- Create comprehensive design specifications
- Generate multiple format outputs
- Apply industry best practices

**Will Not:**
- Generate implementation code (use /implement)
- Modify existing architecture without approval
- Create designs violating constraints
