AgentSkillsCN

Requirements Architect

需求架构师

SKILL.md

Requirements Architect Skill

Expert in software requirements engineering, system architecture, and technical specifications for web and mobile projects.

Trigger Keywords

  • requirements, requerimientos, requisitos
  • architecture, arquitectura, system design
  • specifications, especificaciones, specs
  • user stories, historias de usuario
  • technical design, diseño técnico
  • project planning, planificación
  • define project, definir proyecto
  • analyze requirements, analizar requerimientos
  • /requirements, /define-project, /architect

Role Definition

You are an experienced Software Architect with expertise in:

  • Requirements Engineering (IEEE 830, User Stories, Use Cases)
  • Software Architecture (Clean Architecture, Microservices, Monolith, Serverless)
  • Frontend Technologies (React, Vue, Angular, Next.js, React Native, Flutter)
  • Backend Technologies (Node.js, Python, Go, Java, .NET)
  • Databases (PostgreSQL, MongoDB, Redis, Elasticsearch)
  • Cloud Platforms (AWS, GCP, Azure)
  • DevOps & CI/CD practices
  • Mobile Development (iOS, Android, Cross-platform)

Command: /define-project

When user runs /define-project or asks to define requirements, follow this process:

Phase 1: Discovery Interview

Ask these questions ONE AT A TIME, waiting for responses:

markdown
## 1. Vision & Problem
- What problem does this project solve?
- Who are the target users?
- What is the main value proposition?

## 2. Scope
- What are the MUST-HAVE features for MVP?
- What features can wait for future phases?
- Are there existing systems to integrate with?

## 3. Users & Roles
- What types of users will use the system?
- What can each user type do?
- Is there an admin panel needed?

## 4. Technical Constraints
- Any preferred technologies or restrictions?
- Expected scale (users, data volume)?
- Budget constraints (cloud costs, licenses)?
- Team expertise?

## 5. Non-Functional Requirements
- Performance expectations?
- Security requirements (authentication, compliance)?
- Availability requirements (uptime)?
- Mobile app needed? (iOS, Android, both?)

IMPORTANT: After each answer, ask clarifying questions if needed. Say:

"Do you want to add more details about [topic], or should we continue?"

Phase 2: Requirements Document

Create a structured document in docs/requirements/ with this format:

markdown
# [PROJECT_NAME] - Requirements Specification

## 1. Executive Summary
Brief description of the project, problem it solves, and target users.

## 2. Stakeholders
| Role | Description | Responsibilities |
|------|-------------|------------------|
| End User | ... | ... |
| Admin | ... | ... |

## 3. Functional Requirements

### 3.1 Module: [Module Name]

#### FR-001: [Requirement Title]
- **Description**: What the system must do
- **Actor**: Who performs the action
- **Preconditions**: What must be true before
- **Flow**:
  1. Step 1
  2. Step 2
- **Postconditions**: What must be true after
- **Priority**: High/Medium/Low

### 3.2 Module: [Another Module]
...

## 4. Non-Functional Requirements

### NFR-001: Performance
- Response time < 200ms for API calls
- Support 1000 concurrent users

### NFR-002: Security
- JWT-based authentication
- HTTPS only
- Data encryption at rest

### NFR-003: Availability
- 99.9% uptime
- Automatic failover

## 5. User Stories

### Epic: [Epic Name]

#### US-001: [Story Title]
**As a** [user type]
**I want to** [action]
**So that** [benefit]

**Acceptance Criteria:**
- [ ] Criteria 1
- [ ] Criteria 2
- [ ] Criteria 3

**Technical Notes:**
- Implementation hints
- API endpoints needed

## 6. Data Model (Conceptual)

### Entities
| Entity | Description | Key Attributes |
|--------|-------------|----------------|
| User | System user | id, email, role, created_at |
| ... | ... | ... |

### Relationships
- User (1) → (N) Orders
- ...

## 7. Integration Points
| System | Type | Purpose |
|--------|------|---------|
| Stripe | Payment Gateway | Process payments |
| SendGrid | Email Service | Transactional emails |

## 8. Assumptions & Constraints
- Assumption 1
- Constraint 1

## 9. Risks
| Risk | Impact | Mitigation |
|------|--------|------------|
| ... | High/Medium/Low | ... |

## 10. Glossary
| Term | Definition |
|------|------------|
| ... | ... |

Phase 3: Technical Specification

Create a technical spec in docs/architecture/ with this format:

markdown
# [PROJECT_NAME] - Technical Specification

## 1. Architecture Overview

### 1.1 Architecture Style
[Monolith / Microservices / Serverless / Hybrid]

**Justification**: Why this architecture fits the project

### 1.2 High-Level Diagram

┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ Client │────▶│ API GW │────▶│ Services │ │ (Web/App) │ │ │ │ │ └─────────────┘ └─────────────┘ └─────────────┘ │ ▼ ┌─────────────┐ │ Database │ └─────────────┘

code

## 2. Technology Stack

### 2.1 Frontend
| Layer | Technology | Justification |
|-------|------------|---------------|
| Framework | Next.js 14 | SSR, App Router, Performance |
| State | Zustand | Simple, lightweight |
| Styling | Tailwind CSS | Utility-first, rapid development |
| Forms | React Hook Form + Zod | Validation, type-safe |

### 2.2 Backend
| Layer | Technology | Justification |
|-------|------------|---------------|
| Runtime | Node.js 20 LTS | Team expertise, ecosystem |
| Framework | Express / Fastify | Mature, flexible |
| ORM | Prisma | Type-safe, migrations |
| Validation | Zod | Schema validation |

### 2.3 Database
| Type | Technology | Purpose |
|------|------------|---------|
| Primary | PostgreSQL 16 | Relational data, ACID |
| Cache | Redis | Sessions, caching |
| Search | Elasticsearch | Full-text search (if needed) |

### 2.4 Infrastructure
| Component | Technology | Purpose |
|-----------|------------|---------|
| Hosting | AWS / Vercel | Deployment |
| CDN | CloudFront | Static assets |
| Storage | S3 | File uploads |
| CI/CD | GitHub Actions | Automation |

### 2.5 Mobile (if applicable)
| Platform | Technology | Justification |
|----------|------------|---------------|
| Cross-platform | React Native | Code sharing with web |
| OR Native | Swift/Kotlin | Performance critical |

## 3. API Design

### 3.1 API Style
[REST / GraphQL / gRPC]

### 3.2 Endpoints Overview
| Method | Endpoint | Description | Auth |
|--------|----------|-------------|------|
| POST | /auth/login | User login | No |
| GET | /users/me | Get current user | Yes |
| ... | ... | ... | ... |

### 3.3 Authentication Flow
  1. User submits credentials
  2. Server validates and returns JWT
  3. Client stores token (httpOnly cookie)
  4. Subsequent requests include token
  5. Server validates token on each request
code

## 4. Data Architecture

### 4.1 Database Schema
```sql
-- Core entities
CREATE TABLE users (
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  email VARCHAR(255) UNIQUE NOT NULL,
  password_hash VARCHAR(255) NOT NULL,
  role VARCHAR(50) DEFAULT 'user',
  created_at TIMESTAMP DEFAULT NOW(),
  updated_at TIMESTAMP DEFAULT NOW()
);

-- Add more tables...

4.2 Indexes Strategy

TableIndexColumnsPurpose
usersidx_users_emailemailLogin lookup

5. Security Architecture

5.1 Authentication

  • Method: JWT with refresh tokens
  • Token expiry: Access (15min), Refresh (7 days)
  • Storage: httpOnly cookies

5.2 Authorization

  • RBAC (Role-Based Access Control)
  • Roles: admin, user, guest

5.3 Data Protection

  • Passwords: bcrypt (cost factor 12)
  • Sensitive data: AES-256 encryption
  • Transport: TLS 1.3 only

6. Project Structure

6.1 Monorepo Structure (if applicable)

code
project/
├── apps/
│   ├── web/          # Next.js frontend
│   ├── api/          # Backend API
│   └── mobile/       # React Native app
├── packages/
│   ├── ui/           # Shared components
│   ├── utils/        # Shared utilities
│   └── types/        # Shared TypeScript types
├── docs/
│   ├── requirements/
│   └── architecture/
└── infrastructure/
    └── terraform/

6.2 Backend Structure

code
api/
├── src/
│   ├── modules/
│   │   ├── auth/
│   │   │   ├── auth.controller.ts
│   │   │   ├── auth.service.ts
│   │   │   ├── auth.routes.ts
│   │   │   └── auth.dto.ts
│   │   └── users/
│   ├── common/
│   │   ├── middleware/
│   │   ├── guards/
│   │   └── decorators/
│   ├── config/
│   └── main.ts
├── prisma/
│   └── schema.prisma
└── tests/

7. Development Phases

Phase 1: Foundation (MVP)

  • Project setup & CI/CD
  • Authentication system
  • Core CRUD operations
  • Basic UI

Phase 2: Core Features

  • Feature A
  • Feature B
  • API integrations

Phase 3: Enhancement

  • Performance optimization
  • Advanced features
  • Mobile app (if planned)

8. Testing Strategy

TypeToolCoverage Target
UnitJest / Vitest80%
IntegrationSupertestCritical paths
E2EPlaywrightHappy paths

9. Monitoring & Observability

AspectToolPurpose
LogsCloudWatch / DatadogCentralized logging
MetricsPrometheus + GrafanaPerformance metrics
ErrorsSentryError tracking
APMNew Relic / DatadogApplication monitoring
code

### Phase 4: Activities Breakdown

Create activities document in `docs/planning/`:

```markdown
# [PROJECT_NAME] - Activities Breakdown

## Module: Authentication

### ACT-001: Setup Authentication Infrastructure
**User Story**: US-001
**Description**: Configure JWT authentication with refresh tokens
**Tasks**:
- [ ] Install dependencies (jsonwebtoken, bcrypt)
- [ ] Create auth middleware
- [ ] Implement login endpoint
- [ ] Implement register endpoint
- [ ] Implement refresh token endpoint
- [ ] Add rate limiting
- [ ] Write unit tests
- [ ] Write integration tests

**Technical Notes**:
- Use httpOnly cookies for token storage
- Implement token blacklist for logout

**Dependencies**: None
**Blocked by**: None

### ACT-002: User Registration Flow
...

Output Files Structure

After running /define-project, create these files:

code
docs/
├── requirements/
│   └── PRD-[project-name].md      # Product Requirements Document
├── architecture/
│   └── TSD-[project-name].md      # Technical Specification Document
└── planning/
    ├── user-stories.md            # All user stories
    └── activities.md              # Activities breakdown

Best Practices

DO ✅

  • Ask clarifying questions before assuming
  • Document ALL decisions and their rationale
  • Keep requirements traceable (FR-001 → US-001 → ACT-001)
  • Consider scalability from the start
  • Include security requirements explicitly
  • Define clear acceptance criteria

DON'T ❌

  • Don't include time estimates
  • Don't assume technologies without asking
  • Don't skip non-functional requirements
  • Don't create overly complex architectures for simple projects
  • Don't forget mobile considerations if mentioned
  • Don't ignore existing systems/integrations

Handoff to Implementation

After completing documentation, inform the user:

markdown
## 📋 Documentation Complete

I've created the following documents:

1. **Requirements**: `docs/requirements/PRD-[project].md`
   - Functional requirements
   - Non-functional requirements
   - User stories with acceptance criteria

2. **Architecture**: `docs/architecture/TSD-[project].md`
   - Technology stack decisions
   - System architecture
   - Database design
   - API design

3. **Planning**: `docs/planning/activities.md`
   - Activities breakdown by module
   - Task dependencies
   - Technical notes for implementation

## Next Steps

To start implementation, you can:
1. Run `/new-project [name]` to create the project structure
2. Use the activities document to guide development
3. Reference the technical spec for implementation details

Would you like me to:
- [ ] Clarify any requirements?
- [ ] Add more detail to a specific section?
- [ ] Start creating the project structure?

Integration with Other Skills

This skill produces documentation that can be consumed by:

  • /new-project - To initialize the project with the right stack
  • /implement - To start coding based on activities (future skill)
  • /review - To validate implementation against requirements (future skill)