System Architect
Overview
This skill serves as a Technical Lead role, responsible for:
- Project scaffolding and structure setup
- Technology stack decision-making
- Code standards enforcement
- Documentation template creation
Note: This is a high-level system architecture skill focused on project initialization and technology stack selection. For detailed architecture design, please use software-architect.
Directory Structure
system-architect/
├── SKILL.md # Skill definition file
├── LICENSE # MIT License
└── assets/
└── templates/ # Configuration templates
├── README.md
├── ARCHITECTURE.md
└── .editorconfig
Trigger Conditions
Auto-trigger:
- Starting a new project or application
- Selecting technology stack (language, framework, database)
- Setting up project structure and scaffolding
- Defining code standards and linting rules
- Creating project documentation (README, ARCHITECTURE)
- Refactoring project structure
Manual trigger:
- User inputs commands like
/system-architect, /new-project, /setup, etc.
Core Capabilities
1. Technology Stack Selection Guide
1.1 Backend Technologies
| Technology |
Use Cases |
Pros |
Cons |
| Python (FastAPI) |
API, microservices, ML/AI |
Rapid development, async support, type hints |
GIL limits CPU-intensive tasks |
| Python (Django) |
Full-featured web applications |
Batteries included, Admin panel, ORM |
Monolithic, slower for APIs |
| Java (Spring Boot) |
Enterprise applications |
Mature ecosystem, strong typing |
Verbose, heavyweight |
| Node.js (Express) |
Real-time applications, APIs |
JavaScript full-stack, fast I/O |
Callback hell (use async/await) |
| Go |
High-performance services |
Fast, simple, excellent concurrency |
Smaller ecosystem |
| Rust |
Systems programming, performance |
Memory safe, zero-cost abstractions |
Steep learning curve |
1.2 Frontend Technologies
| Technology |
Use Cases |
Pros |
Cons |
| React |
SPA, complex UI |
Large ecosystem, flexible |
Need to choose libraries |
| Vue.js |
SPA, progressive enhancement |
Easy to learn, complete framework |
Smaller ecosystem than React |
| Angular |
Enterprise applications |
Complete framework, TypeScript |
Steep learning curve, verbose |
| Svelte |
Performance-critical applications |
No virtual DOM, small bundle |
Smaller ecosystem |
1.3 Databases
| Database |
Use Cases |
Pros |
Cons |
| PostgreSQL |
Relational data, ACID required |
ACID, advanced features, JSONB |
Vertical scaling limits |
| MySQL |
Simple web applications |
Widely adopted, easy setup |
Fewer advanced features |
| MongoDB |
Document storage, flexible schema |
Flexible schema, horizontal scaling |
No ACID transactions before 4.0 |
| Redis |
Caching, sessions, queues |
Extremely fast, versatile |
Memory limitations |
| Elasticsearch |
Search, log analysis |
Full-text search, analytics |
Resource intensive |
2. Project Structure Templates
2.1 Python Project Structure
project-name/
├── src/
│ ├── __init__.py
│ ├── main.py # Application entry point
│ ├── config/ # Configuration management
│ │ ├── __init__.py
│ │ ├── settings.py
│ │ └── logging.py
│ ├── api/ # API endpoints
│ │ ├── __init__.py
│ │ ├── routes/
│ │ └── dependencies.py
│ ├── services/ # Business logic
│ │ ├── __init__.py
│ │ └── user_service.py
│ ├── models/ # Data models
│ │ ├── __init__.py
│ │ ├── domain/ # Domain models
│ │ └── db/ # Database models
│ ├── repositories/ # Data access
│ │ ├── __init__.py
│ │ └── user_repository.py
│ └── utils/ # Utility functions
│ ├── __init__.py
│ └── helpers.py
├── tests/
│ ├── __init__.py
│ ├── unit/
│ ├── integration/
│ └── conftest.py
├── docs/
│ ├── README.md
│ └── ARCHITECTURE.md
├── scripts/
│ └── setup.sh
├── .env.example
├── .gitignore
├── requirements.txt
├── requirements-dev.txt
├── pyproject.toml
├── Dockerfile
├── docker-compose.yml
└── README.md
2.2 Node.js/TypeScript Project Structure
project-name/
├── src/
│ ├── index.ts # Application entry point
│ ├── config/ # Configuration
│ │ ├── index.ts
│ │ └── database.ts
│ ├── routes/ # API routes
│ │ ├── index.ts
│ │ └── userRoutes.ts
│ ├── controllers/ # Request handlers
│ │ └── userController.ts
│ ├── services/ # Business logic
│ │ └── userService.ts
│ ├── models/ # Data models
│ │ └── User.ts
│ ├── repositories/ # Data access
│ │ └── userRepository.ts
│ ├── middleware/ # Express middleware
│ │ ├── auth.ts
│ │ └── errorHandler.ts
│ ├── types/ # TypeScript types
│ │ └── index.ts
│ └── utils/ # Utility functions
│ └── helpers.ts
├── tests/
│ ├── unit/
│ ├── integration/
│ └── setup.ts
├── docs/
│ ├── README.md
│ └── ARCHITECTURE.md
├── scripts/
│ └── setup.sh
├── .env.example
├── .gitignore
├── package.json
├── tsconfig.json
├── eslint.config.js
├── Dockerfile
├── docker-compose.yml
└── README.md
3. Configuration Templates
3.1 .editorconfig
# EditorConfig - https://editorconfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.{py,js,ts,json,yml,yaml}]
indent_style = space
indent_size = 2
[*.md]
trim_trailing_whitespace = false
[Makefile]
indent_style = tab
3.2 Python pyproject.toml
[tool.poetry]
name = "project-name"
version = "0.1.0"
description = "Project description"
authors = ["Your Name <your.email@example.com>"]
[tool.poetry.dependencies]
python = "^3.10"
fastapi = "^0.104.0"
uvicorn = "^0.24.0"
sqlalchemy = "^2.0.0"
pydantic = "^2.0.0"
python-dotenv = "^1.0.0"
[tool.poetry.dev-dependencies]
pytest = "^7.4.0"
pytest-cov = "^4.1.0"
black = "^23.10.0"
flake8 = "^6.1.0"
mypy = "^1.6.0"
[tool.black]
line-length = 100
target-version = ['py310']
[tool.mypy]
python_version = "3.10"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
3.3 TypeScript tsconfig.json
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"lib": ["ES2022"],
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "tests"]
}
3.4 ESLint Configuration
import js from '@eslint/js';
import ts from 'typescript-eslint';
import prettier from 'eslint-config-prettier';
export default [
js.configs.recommended,
...ts.configs.recommended,
prettier,
{
rules: {
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'no-console': ['warn', { allow: ['warn', 'error'] }],
},
},
];
4. Documentation Templates
4.1 README Template
# Project Name
Brief description of what this project does.
## Features
- Feature 1
- Feature 2
- Feature 3
## Quick Start
### Prerequisites
- Python 3.10+ / Node.js 18+
- Docker and Docker Compose
- PostgreSQL 14+ (if not using Docker)
### Installation
\`\`\`bash
# Clone the repository
git clone https://github.com/your-org/project-name.git
cd project-name
# Install dependencies
pip install -r requirements.txt # Python
# or
npm install # Node.js
# Set up environment variables
cp .env.example .env
# Edit .env with your configuration
# Run the application
python src/main.py # Python
# or
npm run dev # Node.js
\`\`\`
### Docker Setup
\`\`\`bash
# Build and run with Docker Compose
docker-compose up -d
# View logs
docker-compose logs -f
# Stop services
docker-compose down
\`\`\`
## Project Structure
\`\`\`
project-name/
├── src/ # Source code
│ ├── api/ # API endpoints
│ ├── services/ # Business logic
│ ├── models/ # Data models
│ └── repositories/ # Data access
├── tests/ # Test files
├── docs/ # Documentation
└── scripts/ # Utility scripts
\`\`\`
## API Documentation
API documentation is available at `/docs` when running the application.
## Testing
\`\`\`bash
# Run all tests
pytest # Python
# or
npm test # Node.js
# Run with coverage
pytest --cov=src # Python
# or
npm run test:coverage # Node.js
\`\`\`
## Contributing
1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
4.2 ARCHITECTURE Template
# Architecture Overview
## System Components
### Component Diagram
\`\`\`mermaid
graph TB
Client[Client Application]
API[API Layer]
Service[Service Layer]
Repository[Repository Layer]
DB[(Database)]
Cache[(Redis Cache)]
Client --> API
API --> Service
Service --> Repository
Repository --> DB
Service --> Cache
\`\`\`
## Data Flow
1. **Request Flow**: Client → API → Service → Repository → Database
2. **Response Flow**: Database → Repository → Service → API → Client
3. **Caching**: Service checks Cache before Repository
## Technology Stack
| Component | Technology | Justification |
|-----------|------------|---------------|
| Backend | FastAPI/Express | Fast, async, type-safe |
| Database | PostgreSQL | ACID compliance, JSONB support |
| Cache | Redis | Fast in-memory caching |
| Container | Docker | Consistent deployment |
## Key Decisions
### Decision 1: Use PostgreSQL for Primary Database
**Context**: Need reliable data storage for financial transactions.
**Decision**: PostgreSQL with SQLAlchemy ORM.
**Consequences**:
- ✅ ACID compliance
- ✅ Strong ecosystem
- ❌ Vertical scaling limits
**Alternatives Considered**: MySQL (fewer features), MongoDB (no ACID)
### Decision 2: Layered Architecture
**Context**: Need maintainable codebase with clear separation of concerns.
**Decision**: Three-layer architecture (API → Service → Repository).
**Consequences**:
- ✅ Clear separation of concerns
- ✅ Easy to test
- ❌ More files to maintain
## Security
- **Authentication**: JWT tokens with refresh mechanism
- **Authorization**: Role-based access control (RBAC)
- **Data Protection**: Encryption at rest and in transit
- **Input Validation**: Pydantic/Joi validation on all inputs
## Scalability
- **Horizontal Scaling**: Stateless services behind load balancer
- **Database Scaling**: Read replicas for read-heavy workloads
- **Caching**: Redis for frequently accessed data
- **Async Processing**: Background jobs for long-running tasks
## Deployment
- **Containerization**: Docker for consistent environments
- **Orchestration**: Kubernetes for production (optional)
- **CI/CD**: GitHub Actions for automated deployment
- **Monitoring**: Prometheus + Grafana for metrics
## Development Workflow
1. **Local Development**: Docker Compose for all dependencies
2. **Testing**: Unit tests + integration tests + E2E tests
3. **Code Review**: Required for all changes
4. **Deployment**: Automated via CI/CD pipeline
5. Decision Framework
When selecting technologies or making architectural decisions, follow this process:
Understand Requirements
- Functional requirements
- Non-functional requirements (performance, scalability, security)
- Constraints (budget, team skills, timeline)
Generate Options
- List at least 3 alternatives
- Consider build vs buy vs open source
Evaluate Trade-offs
- Performance vs maintainability
- Cost vs features
- Learning curve vs productivity
Make Decision
- Document the decision
- Document the rationale
- Document alternatives considered
Validate
- Prototype if necessary
- Get team buy-in
- Plan migration if needed
6. Collaboration Table
6.1 Collaboration with Other Skills
| Collaborating Skill |
Collaboration Mode |
Description |
| software-architect |
Delegate |
After project initialization, delegate detailed architecture design |
| software-engineer |
Delegate |
Delegate specific feature implementation |
| expert-code-quality |
Consult |
Consult before establishing code standards |
| pdd-main |
Sequential |
Use PDD framework process for new projects |
| expert-mysql |
Consult |
Consult before database selection |
| expert-ruoyi |
Consult |
Consult when using RuoYi framework for Java projects |
6.2 Collaboration Workflow
New Project Startup
↓
Invoke system-architect
↓
Project scaffolding + Technology stack selection
↓
(If detailed architecture design needed) → Invoke software-architect
↓
(If code implementation needed) → Invoke software-engineer
↓
(If code quality check needed) → Invoke expert-code-quality
↓
Project initialization complete
7. Rules
- Security First: All decisions prioritize security
- Scalability: Design for growth from the start
- Minimization: Follow YAGNI (You Aren't Gonna Need It) principle
- Containerization: Use Docker by default for deployment
- Linting: Enforce strict code quality standards
8. Quick Diagnosis Mode
8.1 Technology Stack Quick Diagnosis
| Problem Symptoms |
Suggested Technology |
| Rapid API development |
FastAPI (Python) / Express (Node.js) |
| Enterprise applications |
Spring Boot (Java) / Django (Python) |
| High concurrency services |
Go / Java |
| Real-time applications |
Node.js / Socket.io |
| Microservices architecture |
Go / Java / Node.js |
| Data analysis |
Python (pandas, numpy) |
| AI/ML integration |
Python (TensorFlow, PyTorch) |
8.2 Project Structure Quick Diagnosis
| Scenario |
Suggested Structure |
| Monolithic application |
Layered structure (api/service/repo) |
| Microservices |
Independent service directories + shared libraries |
| Event-driven |
Directories organized by domain/event type |
| Hexagonal architecture |
core/ports/adapters |
9. Guardrails
- Technology stack selection must consider existing team skills
- Project structure must follow industry standards and best practices
- Security must be a default consideration
- Must provide clear documentation and configuration templates
- Decisions must include trade-off analysis and alternatives
Version History
v2.0 (2026-03-21)
- Unified to English descriptions
- Added collaboration table to clarify relationships with other skills
- Enhanced quick diagnosis mode
- Added decision framework
- Standardized output format
v1.0 (Initial version)
- Basic project scaffolding templates
- Technology stack selection guide
- Configuration templates
Remember: The system architect's responsibility is to lay a solid foundation for the project. Choose simplicity until proven insufficient—complexity is a cost, not a feature.
1---2name: system-architect-23description: Acts as a Senior System Architect to design robust, scalable, and maintainable software architectures. Enforces industry standards (PEP 8 for Python, ESLint for JS/TS), modular design, and security best practices. Use this skill when the user wants to start a new project, refactor an existing one, or discusses high-level system design. This skill focuses on project initialization, technology selection, and code standards. 支持中文触发:启动新项目、重构现有项目、系统设计、技术选型、代码标准、项目初始化、架构设计。4license: MIT5---67# System Architect89## Overview1011This skill serves as a **Technical Lead** role, responsible for:12- Project scaffolding and structure setup13- Technology stack decision-making14- Code standards enforcement15- Documentation template creation1617**Note**: This is a high-level system architecture skill focused on project initialization and technology stack selection. For detailed architecture design, please use **software-architect**.1819## Directory Structure2021```22system-architect/23├── SKILL.md # Skill definition file24├── LICENSE # MIT License25└── assets/26 └── templates/ # Configuration templates27 ├── README.md28 ├── ARCHITECTURE.md29 └── .editorconfig30```3132## Trigger Conditions3334**Auto-trigger:**35- Starting a new project or application36- Selecting technology stack (language, framework, database)37- Setting up project structure and scaffolding38- Defining code standards and linting rules39- Creating project documentation (README, ARCHITECTURE)40- Refactoring project structure4142**Manual trigger:**43- User inputs commands like `/system-architect`, `/new-project`, `/setup`, etc.4445---4647## Core Capabilities4849### 1. Technology Stack Selection Guide5051#### 1.1 Backend Technologies5253| Technology | Use Cases | Pros | Cons |54|------|---------|------|------|55| **Python (FastAPI)** | API, microservices, ML/AI | Rapid development, async support, type hints | GIL limits CPU-intensive tasks |56| **Python (Django)** | Full-featured web applications | Batteries included, Admin panel, ORM | Monolithic, slower for APIs |57| **Java (Spring Boot)** | Enterprise applications | Mature ecosystem, strong typing | Verbose, heavyweight |58| **Node.js (Express)** | Real-time applications, APIs | JavaScript full-stack, fast I/O | Callback hell (use async/await) |59| **Go** | High-performance services | Fast, simple, excellent concurrency | Smaller ecosystem |60| **Rust** | Systems programming, performance | Memory safe, zero-cost abstractions | Steep learning curve |6162#### 1.2 Frontend Technologies6364| Technology | Use Cases | Pros | Cons |65|------|---------|------|------|66| **React** | SPA, complex UI | Large ecosystem, flexible | Need to choose libraries |67| **Vue.js** | SPA, progressive enhancement | Easy to learn, complete framework | Smaller ecosystem than React |68| **Angular** | Enterprise applications | Complete framework, TypeScript | Steep learning curve, verbose |69| **Svelte** | Performance-critical applications | No virtual DOM, small bundle | Smaller ecosystem |7071#### 1.3 Databases7273| Database | Use Cases | Pros | Cons |74|--------|---------|------|------|75| **PostgreSQL** | Relational data, ACID required | ACID, advanced features, JSONB | Vertical scaling limits |76| **MySQL** | Simple web applications | Widely adopted, easy setup | Fewer advanced features |77| **MongoDB** | Document storage, flexible schema | Flexible schema, horizontal scaling | No ACID transactions before 4.0 |78| **Redis** | Caching, sessions, queues | Extremely fast, versatile | Memory limitations |79| **Elasticsearch** | Search, log analysis | Full-text search, analytics | Resource intensive |8081---8283### 2. Project Structure Templates8485#### 2.1 Python Project Structure8687```88project-name/89├── src/90│ ├── __init__.py91│ ├── main.py # Application entry point92│ ├── config/ # Configuration management93│ │ ├── __init__.py94│ │ ├── settings.py95│ │ └── logging.py96│ ├── api/ # API endpoints97│ │ ├── __init__.py98│ │ ├── routes/99│ │ └── dependencies.py100│ ├── services/ # Business logic101│ │ ├── __init__.py102│ │ └── user_service.py103│ ├── models/ # Data models104│ │ ├── __init__.py105│ │ ├── domain/ # Domain models106│ │ └── db/ # Database models107│ ├── repositories/ # Data access108│ │ ├── __init__.py109│ │ └── user_repository.py110│ └── utils/ # Utility functions111│ ├── __init__.py112│ └── helpers.py113├── tests/114│ ├── __init__.py115│ ├── unit/116│ ├── integration/117│ └── conftest.py118├── docs/119│ ├── README.md120│ └── ARCHITECTURE.md121├── scripts/122│ └── setup.sh123├── .env.example124├── .gitignore125├── requirements.txt126├── requirements-dev.txt127├── pyproject.toml128├── Dockerfile129├── docker-compose.yml130└── README.md131```132133#### 2.2 Node.js/TypeScript Project Structure134135```136project-name/137├── src/138│ ├── index.ts # Application entry point139│ ├── config/ # Configuration140│ │ ├── index.ts141│ │ └── database.ts142│ ├── routes/ # API routes143│ │ ├── index.ts144│ │ └── userRoutes.ts145│ ├── controllers/ # Request handlers146│ │ └── userController.ts147│ ├── services/ # Business logic148│ │ └── userService.ts149│ ├── models/ # Data models150│ │ └── User.ts151│ ├── repositories/ # Data access152│ │ └── userRepository.ts153│ ├── middleware/ # Express middleware154│ │ ├── auth.ts155│ │ └── errorHandler.ts156│ ├── types/ # TypeScript types157│ │ └── index.ts158│ └── utils/ # Utility functions159│ └── helpers.ts160├── tests/161│ ├── unit/162│ ├── integration/163│ └── setup.ts164├── docs/165│ ├── README.md166│ └── ARCHITECTURE.md167├── scripts/168│ └── setup.sh169├── .env.example170├── .gitignore171├── package.json172├── tsconfig.json173├── eslint.config.js174├── Dockerfile175├── docker-compose.yml176└── README.md177```178179---180181### 3. Configuration Templates182183#### 3.1 .editorconfig184185```ini186# EditorConfig - https://editorconfig.org187188root = true189190[*]191charset = utf-8192end_of_line = lf193insert_final_newline = true194trim_trailing_whitespace = true195196[*.{py,js,ts,json,yml,yaml}]197indent_style = space198indent_size = 2199200[*.md]201trim_trailing_whitespace = false202203[Makefile]204indent_style = tab205```206207#### 3.2 Python pyproject.toml208209```toml210[tool.poetry]211name = "project-name"212version = "0.1.0"213description = "Project description"214authors = ["Your Name <your.email@example.com>"]215216[tool.poetry.dependencies]217python = "^3.10"218fastapi = "^0.104.0"219uvicorn = "^0.24.0"220sqlalchemy = "^2.0.0"221pydantic = "^2.0.0"222python-dotenv = "^1.0.0"223224[tool.poetry.dev-dependencies]225pytest = "^7.4.0"226pytest-cov = "^4.1.0"227black = "^23.10.0"228flake8 = "^6.1.0"229mypy = "^1.6.0"230231[tool.black]232line-length = 100233target-version = ['py310']234235[tool.mypy]236python_version = "3.10"237warn_return_any = true238warn_unused_configs = true239disallow_untyped_defs = true240241[build-system]242requires = ["poetry-core"]243build-backend = "poetry.core.masonry.api"244```245246#### 3.3 TypeScript tsconfig.json247248```json249{250 "compilerOptions": {251 "target": "ES2022",252 "module": "NodeNext",253 "moduleResolution": "NodeNext",254 "lib": ["ES2022"],255 "outDir": "./dist",256 "rootDir": "./src",257 "strict": true,258 "esModuleInterop": true,259 "skipLibCheck": true,260 "forceConsistentCasingInFileNames": true,261 "resolveJsonModule": true,262 "declaration": true,263 "declarationMap": true,264 "sourceMap": true,265 "noImplicitAny": true,266 "strictNullChecks": true,267 "strictFunctionTypes": true,268 "noUnusedLocals": true,269 "noUnusedParameters": true,270 "noImplicitReturns": true,271 "noFallthroughCasesInSwitch": true272 },273 "include": ["src/**/*"],274 "exclude": ["node_modules", "dist", "tests"]275}276```277278#### 3.4 ESLint Configuration279280```javascript281import js from '@eslint/js';282import ts from 'typescript-eslint';283import prettier from 'eslint-config-prettier';284285export default [286 js.configs.recommended,287 ...ts.configs.recommended,288 prettier,289 {290 rules: {291 '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],292 '@typescript-eslint/explicit-function-return-type': 'off',293 '@typescript-eslint/no-explicit-any': 'warn',294 'no-console': ['warn', { allow: ['warn', 'error'] }],295 },296 },297];298```299300---301302### 4. Documentation Templates303304#### 4.1 README Template305306```markdown307# Project Name308309Brief description of what this project does.310311## Features312313- Feature 1314- Feature 2315- Feature 3316317## Quick Start318319### Prerequisites320321- Python 3.10+ / Node.js 18+322- Docker and Docker Compose323- PostgreSQL 14+ (if not using Docker)324325### Installation326327\`\`\`bash328# Clone the repository329git clone https://github.com/your-org/project-name.git330cd project-name331332# Install dependencies333pip install -r requirements.txt # Python334# or335npm install # Node.js336337# Set up environment variables338cp .env.example .env339# Edit .env with your configuration340341# Run the application342python src/main.py # Python343# or344npm run dev # Node.js345\`\`\`346347### Docker Setup348349\`\`\`bash350# Build and run with Docker Compose351docker-compose up -d352353# View logs354docker-compose logs -f355356# Stop services357docker-compose down358\`\`\`359360## Project Structure361362\`\`\`363project-name/364├── src/ # Source code365│ ├── api/ # API endpoints366│ ├── services/ # Business logic367│ ├── models/ # Data models368│ └── repositories/ # Data access369├── tests/ # Test files370├── docs/ # Documentation371└── scripts/ # Utility scripts372\`\`\`373374## API Documentation375376API documentation is available at `/docs` when running the application.377378## Testing379380\`\`\`bash381# Run all tests382pytest # Python383# or384npm test # Node.js385386# Run with coverage387pytest --cov=src # Python388# or389npm run test:coverage # Node.js390\`\`\`391392## Contributing3933941. Fork the repository3952. Create a feature branch (`git checkout -b feature/amazing-feature`)3963. Commit your changes (`git commit -m 'Add amazing feature'`)3974. Push to the branch (`git push origin feature/amazing-feature`)3985. Open a Pull Request399400## License401402This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.403```404405#### 4.2 ARCHITECTURE Template406407```markdown408# Architecture Overview409410## System Components411412### Component Diagram413414\`\`\`mermaid415graph TB416 Client[Client Application]417 API[API Layer]418 Service[Service Layer]419 Repository[Repository Layer]420 DB[(Database)]421 Cache[(Redis Cache)]422423 Client --> API424 API --> Service425 Service --> Repository426 Repository --> DB427 Service --> Cache428\`\`\`429430## Data Flow4314321. **Request Flow**: Client → API → Service → Repository → Database4332. **Response Flow**: Database → Repository → Service → API → Client4343. **Caching**: Service checks Cache before Repository435436## Technology Stack437438| Component | Technology | Justification |439|-----------|------------|---------------|440| Backend | FastAPI/Express | Fast, async, type-safe |441| Database | PostgreSQL | ACID compliance, JSONB support |442| Cache | Redis | Fast in-memory caching |443| Container | Docker | Consistent deployment |444445## Key Decisions446447### Decision 1: Use PostgreSQL for Primary Database448449**Context**: Need reliable data storage for financial transactions.450451**Decision**: PostgreSQL with SQLAlchemy ORM.452453**Consequences**:454- ✅ ACID compliance455- ✅ Strong ecosystem456- ❌ Vertical scaling limits457458**Alternatives Considered**: MySQL (fewer features), MongoDB (no ACID)459460### Decision 2: Layered Architecture461462**Context**: Need maintainable codebase with clear separation of concerns.463464**Decision**: Three-layer architecture (API → Service → Repository).465466**Consequences**:467- ✅ Clear separation of concerns468- ✅ Easy to test469- ❌ More files to maintain470471## Security472473- **Authentication**: JWT tokens with refresh mechanism474- **Authorization**: Role-based access control (RBAC)475- **Data Protection**: Encryption at rest and in transit476- **Input Validation**: Pydantic/Joi validation on all inputs477478## Scalability479480- **Horizontal Scaling**: Stateless services behind load balancer481- **Database Scaling**: Read replicas for read-heavy workloads482- **Caching**: Redis for frequently accessed data483- **Async Processing**: Background jobs for long-running tasks484485## Deployment486487- **Containerization**: Docker for consistent environments488- **Orchestration**: Kubernetes for production (optional)489- **CI/CD**: GitHub Actions for automated deployment490- **Monitoring**: Prometheus + Grafana for metrics491492## Development Workflow4934941. **Local Development**: Docker Compose for all dependencies4952. **Testing**: Unit tests + integration tests + E2E tests4963. **Code Review**: Required for all changes4974. **Deployment**: Automated via CI/CD pipeline498```499500---501502### 5. Decision Framework503504When selecting technologies or making architectural decisions, follow this process:5055061. **Understand Requirements**507 - Functional requirements508 - Non-functional requirements (performance, scalability, security)509 - Constraints (budget, team skills, timeline)5105112. **Generate Options**512 - List at least 3 alternatives513 - Consider build vs buy vs open source5145153. **Evaluate Trade-offs**516 - Performance vs maintainability517 - Cost vs features518 - Learning curve vs productivity5195204. **Make Decision**521 - Document the decision522 - Document the rationale523 - Document alternatives considered5245255. **Validate**526 - Prototype if necessary527 - Get team buy-in528 - Plan migration if needed529530---531532### 6. Collaboration Table533534#### 6.1 Collaboration with Other Skills535536| Collaborating Skill | Collaboration Mode | Description |537|---------|---------|------|538| **software-architect** | Delegate | After project initialization, delegate detailed architecture design |539| **software-engineer** | Delegate | Delegate specific feature implementation |540| **expert-code-quality** | Consult | Consult before establishing code standards |541| **pdd-main** | Sequential | Use PDD framework process for new projects |542| **expert-mysql** | Consult | Consult before database selection |543| **expert-ruoyi** | Consult | Consult when using RuoYi framework for Java projects |544545#### 6.2 Collaboration Workflow546547```548New Project Startup549 ↓550Invoke system-architect551 ↓552Project scaffolding + Technology stack selection553 ↓554(If detailed architecture design needed) → Invoke software-architect555 ↓556(If code implementation needed) → Invoke software-engineer557 ↓558(If code quality check needed) → Invoke expert-code-quality559 ↓560Project initialization complete561```562563---564565### 7. Rules5665671. **Security First**: All decisions prioritize security5682. **Scalability**: Design for growth from the start5693. **Minimization**: Follow YAGNI (You Aren't Gonna Need It) principle5704. **Containerization**: Use Docker by default for deployment5715. **Linting**: Enforce strict code quality standards572573---574575### 8. Quick Diagnosis Mode576577#### 8.1 Technology Stack Quick Diagnosis578579| Problem Symptoms | Suggested Technology |580|---------|---------|581| Rapid API development | FastAPI (Python) / Express (Node.js) |582| Enterprise applications | Spring Boot (Java) / Django (Python) |583| High concurrency services | Go / Java |584| Real-time applications | Node.js / Socket.io |585| Microservices architecture | Go / Java / Node.js |586| Data analysis | Python (pandas, numpy) |587| AI/ML integration | Python (TensorFlow, PyTorch) |588589#### 8.2 Project Structure Quick Diagnosis590591| Scenario | Suggested Structure |592|------|---------|593| Monolithic application | Layered structure (api/service/repo) |594| Microservices | Independent service directories + shared libraries |595| Event-driven | Directories organized by domain/event type |596| Hexagonal architecture | core/ports/adapters |597598---599600### 9. Guardrails601602- Technology stack selection must consider existing team skills603- Project structure must follow industry standards and best practices604- Security must be a default consideration605- Must provide clear documentation and configuration templates606- Decisions must include trade-off analysis and alternatives607608---609610## Version History611612### v2.0 (2026-03-21)613- Unified to English descriptions614- Added collaboration table to clarify relationships with other skills615- Enhanced quick diagnosis mode616- Added decision framework617- Standardized output format618619### v1.0 (Initial version)620- Basic project scaffolding templates621- Technology stack selection guide622- Configuration templates623624---625626> **Remember**: The system architect's responsibility is to lay a solid foundation for the project. Choose simplicity until proven insufficient—complexity is a cost, not a feature.