chore: initialize repository with project docs and tooling
- Add persistent docs: PRD, functional design, architecture, repository structure, development guidelines, milestones - Add brainstorming notes (docs/ideas/) - Configure tooling: package.json, tsconfig, eslint, prettier, vitest - Add opencode configuration (commands, skills, agents) - Add .gitignore for node_modules, .env, data/, backups/, build outputs
This commit is contained in:
50
.opencode/skills/architecture-design/SKILL.md
Normal file
50
.opencode/skills/architecture-design/SKILL.md
Normal file
@ -0,0 +1,50 @@
|
||||
---
|
||||
name: architecture-design
|
||||
description: A detailed guide and template for creating architecture design documents. Use only when designing architecture.
|
||||
---
|
||||
|
||||
# Architecture Design Skill
|
||||
|
||||
This skill is a detailed guide for creating high-quality architecture design documents.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Before starting architecture design, check the following:
|
||||
|
||||
### Required Documents
|
||||
|
||||
1. `docs/product-requirements.md` (PRD)
|
||||
2. `docs/functional-design.md` (functional design document)
|
||||
|
||||
Architecture design defines the system structure and technology stack
|
||||
needed to technically realize the PRD's requirements and functional design.
|
||||
|
||||
## Priority of Existing Documents
|
||||
|
||||
**Important**: If an existing architecture design document is present at `docs/architecture.md`,
|
||||
follow this priority order:
|
||||
|
||||
1. **The existing architecture design document (`docs/architecture.md`)** - highest priority
|
||||
- It documents project-specific technology choices and design
|
||||
- It takes precedence over this skill's guide
|
||||
|
||||
2. **This skill's guide** - reference material
|
||||
- General-purpose templates and examples
|
||||
- Use when there is no existing design document, or as a supplement
|
||||
|
||||
**When creating new**: Refer to this skill's template and guide
|
||||
**When updating**: Update while preserving the structure and content of the existing design document
|
||||
|
||||
## Output Destination
|
||||
|
||||
Save the architecture design document you create to:
|
||||
|
||||
```
|
||||
docs/architecture.md
|
||||
```
|
||||
|
||||
## Referencing the Template
|
||||
|
||||
When creating an architecture design document, use the template while referring to the following guide:
|
||||
- Guide: ./guide.md
|
||||
- Template: ./template.md
|
||||
186
.opencode/skills/architecture-design/guide.md
Normal file
186
.opencode/skills/architecture-design/guide.md
Normal file
@ -0,0 +1,186 @@
|
||||
# Architecture Design Guide
|
||||
|
||||
## Basic Principles
|
||||
|
||||
### 1. State the Rationale for Technology Choices
|
||||
|
||||
**Bad example**:
|
||||
```
|
||||
- Node.js
|
||||
- TypeScript
|
||||
```
|
||||
|
||||
**Good example**:
|
||||
```
|
||||
- Node.js v24.11.0 (LTS)
|
||||
- Long-term support guaranteed until April 2026, ensuring stable operation in production
|
||||
- Excellent at asynchronous I/O, delivering high performance as an API server
|
||||
- Rich npm ecosystem makes the required libraries easy to obtain
|
||||
|
||||
- TypeScript 5.x
|
||||
- Static typing catches bugs at compile time, improving maintainability
|
||||
- Powerful IDE autocompletion boosts development efficiency
|
||||
- Shared type definitions in team development ensure code readability and quality
|
||||
|
||||
- npm 11.x
|
||||
- Bundled with Node.js v24.11.0, so no separate installation is required
|
||||
- Supports monorepo configurations via the workspaces feature
|
||||
- Enables strict dependency management through package-lock.json
|
||||
```
|
||||
|
||||
### 2. The Principle of Layer Separation
|
||||
|
||||
Clarify the responsibilities of each layer and keep dependencies unidirectional:
|
||||
|
||||
```
|
||||
UI → Service → Data (OK)
|
||||
UI ← Service (NG)
|
||||
UI → Data (NG)
|
||||
```
|
||||
|
||||
### 3. Measurable Requirements
|
||||
|
||||
Describe all performance requirements in a measurable form.
|
||||
|
||||
## Designing a Layered Architecture
|
||||
|
||||
### Responsibilities of Each Layer
|
||||
|
||||
**UI layer**:
|
||||
```typescript
|
||||
// Responsibility: Accepting and validating user input
|
||||
class CLI {
|
||||
// OK: Call the service layer
|
||||
async addTask(title: string) {
|
||||
const task = await this.taskService.create({ title });
|
||||
console.log(`Created: ${task.id}`);
|
||||
}
|
||||
|
||||
// NG: Call the data layer directly
|
||||
async addTask(title: string) {
|
||||
const task = await this.repository.save({ title }); // ❌
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Service layer**:
|
||||
```typescript
|
||||
// Responsibility: Implementing business logic
|
||||
class TaskService {
|
||||
// Business logic: Automatic priority estimation
|
||||
async create(data: CreateTaskData): Promise<Task> {
|
||||
const task = {
|
||||
...data,
|
||||
estimatedPriority: this.estimatePriority(data),
|
||||
};
|
||||
return this.repository.save(task);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Data layer**:
|
||||
```typescript
|
||||
// Responsibility: Data persistence
|
||||
class TaskRepository {
|
||||
async save(task: Task): Promise<void> {
|
||||
await this.storage.write(task);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Setting Performance Requirements
|
||||
|
||||
### Concrete Numeric Targets
|
||||
|
||||
```
|
||||
Command execution time: within 100ms (on an average PC environment)
|
||||
└─ Measurement method: measure from CLI startup to result display with console.time
|
||||
└─ Measurement environment: CPU equivalent to Core i5, 8GB RAM, SSD
|
||||
|
||||
Task list display: within 1 second for up to 1000 items
|
||||
└─ Measurement method: measure with 1000 dummy data items
|
||||
└─ Acceptable range: 100ms for 100 items, 1 second for 1000 items, 10 seconds for 10000 items
|
||||
```
|
||||
|
||||
## Security Design
|
||||
|
||||
### The Three Principles of Data Protection
|
||||
|
||||
1. **Principle of least privilege**
|
||||
```bash
|
||||
# File permissions
|
||||
chmod 600 ~/.devtask/tasks.json # Read/write for owner only
|
||||
```
|
||||
|
||||
2. **Input validation**
|
||||
```typescript
|
||||
function validateTitle(title: string): void {
|
||||
if (!title || title.length === 0) {
|
||||
throw new ValidationError('Title is required');
|
||||
}
|
||||
if (title.length > 200) {
|
||||
throw new ValidationError('Title must be 200 characters or fewer');
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
3. **Managing sensitive information**
|
||||
```bash
|
||||
# Manage via environment variables
|
||||
export DEVTASK_API_KEY="xxxxx" # Do not hardcode in the code
|
||||
```
|
||||
|
||||
## Scalability Design
|
||||
|
||||
### Handling Data Growth
|
||||
|
||||
**Expected data volume**: [e.g., 10,000 tasks]
|
||||
|
||||
**Countermeasures**:
|
||||
- Data pagination
|
||||
- Archiving old data
|
||||
- Index optimization
|
||||
|
||||
```typescript
|
||||
// Example archive feature: move old tasks to a separate file
|
||||
class ArchiveService {
|
||||
async archiveCompletedTasks(olderThan: Date): Promise<void> {
|
||||
const oldTasks = await this.repository.findCompleted(olderThan);
|
||||
await this.archiveStorage.save(oldTasks);
|
||||
await this.repository.deleteMany(oldTasks.map(t => t.id));
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Dependency Management
|
||||
|
||||
### Version Management Policy
|
||||
|
||||
```json
|
||||
{
|
||||
"dependencies": {
|
||||
"commander": "^11.0.0", // Minor version upgrades are automatic
|
||||
"chalk": "5.3.0" // Pin when there is a risk of breaking changes
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "~5.3.0", // Patch versions only are automatic
|
||||
"eslint": "^9.0.0"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Policy**:
|
||||
- Pin stable versions (allow up to minor versions with ^)
|
||||
- Pin completely when there is a risk of breaking changes
|
||||
- For devDependencies, automate patch versions only (~)
|
||||
|
||||
## Checklist
|
||||
|
||||
- [ ] Every technology choice has a stated rationale
|
||||
- [ ] The layered architecture is clearly defined
|
||||
- [ ] Performance requirements are measurable
|
||||
- [ ] Security considerations are documented
|
||||
- [ ] Scalability is taken into account
|
||||
- [ ] A backup strategy is defined
|
||||
- [ ] The dependency management policy is clear
|
||||
- [ ] A test strategy is defined
|
||||
153
.opencode/skills/architecture-design/template.md
Normal file
153
.opencode/skills/architecture-design/template.md
Normal file
@ -0,0 +1,153 @@
|
||||
# Architecture Design Document
|
||||
|
||||
## Technology Stack
|
||||
|
||||
### Languages and Runtimes
|
||||
|
||||
| Technology | Version |
|
||||
|------|-----------|
|
||||
| Node.js | v24.11.0 |
|
||||
| TypeScript | 5.x |
|
||||
| npm | 11.x |
|
||||
|
||||
### Frameworks and Libraries
|
||||
|
||||
| Technology | Version | Purpose | Rationale |
|
||||
|------|-----------|------|----------|
|
||||
| [name] | [version] | [purpose] | [rationale] |
|
||||
| [name] | [version] | [purpose] | [rationale] |
|
||||
|
||||
### Development Tools
|
||||
|
||||
| Technology | Version | Purpose | Rationale |
|
||||
|------|-----------|------|----------|
|
||||
| [name] | [version] | [purpose] | [rationale] |
|
||||
| [name] | [version] | [purpose] | [rationale] |
|
||||
|
||||
## Architecture Pattern
|
||||
|
||||
### Layered Architecture
|
||||
|
||||
```
|
||||
┌─────────────────────────┐
|
||||
│ UI layer │ ← Accepts and displays user input
|
||||
├─────────────────────────┤
|
||||
│ Service layer │ ← Business logic
|
||||
├─────────────────────────┤
|
||||
│ Data layer │ ← Data persistence
|
||||
└─────────────────────────┘
|
||||
```
|
||||
|
||||
#### UI Layer
|
||||
- **Responsibility**: Accepting user input, validation, displaying results
|
||||
- **Permitted operations**: Calling the service layer
|
||||
- **Prohibited operations**: Direct access to the data layer
|
||||
|
||||
#### Service Layer
|
||||
- **Responsibility**: Implementing business logic, data transformation
|
||||
- **Permitted operations**: Calling the data layer
|
||||
- **Prohibited operations**: Depending on the UI layer
|
||||
|
||||
#### Data Layer
|
||||
- **Responsibility**: Data persistence and retrieval
|
||||
- **Permitted operations**: Access to the file system and databases
|
||||
- **Prohibited operations**: Implementing business logic
|
||||
|
||||
## Data Persistence Strategy
|
||||
|
||||
### Storage Method
|
||||
|
||||
| Data type | Storage | Format | Rationale |
|
||||
|-----------|----------|-------------|------|
|
||||
| [data 1] | [method] | [format] | [rationale] |
|
||||
| [data 2] | [method] | [format] | [rationale] |
|
||||
|
||||
### Backup Strategy
|
||||
|
||||
- **Frequency**: [e.g., every hour]
|
||||
- **Destination**: [e.g., `.backup/` directory]
|
||||
- **Generation management**: [e.g., retain the latest 5 generations]
|
||||
- **Restoration method**: [procedure]
|
||||
|
||||
## Performance Requirements
|
||||
|
||||
### Response Time
|
||||
|
||||
| Operation | Target time | Measurement environment |
|
||||
|------|---------|---------|
|
||||
| [operation 1] | [time] | [environment] |
|
||||
| [operation 2] | [time] | [environment] |
|
||||
|
||||
### Resource Usage
|
||||
|
||||
| Resource | Limit | Rationale |
|
||||
|---------|------|------|
|
||||
| Memory | [MB] | [rationale] |
|
||||
| CPU | [%] | [rationale] |
|
||||
| Disk | [MB] | [rationale] |
|
||||
|
||||
## Security Architecture
|
||||
|
||||
### Data Protection
|
||||
|
||||
- **Encryption**: [target data and method]
|
||||
- **Access control**: [file permissions, etc.]
|
||||
- **Sensitive information management**: [environment variables, config files, etc.]
|
||||
|
||||
### Input Validation
|
||||
|
||||
- **Validation**: [validation items]
|
||||
- **Sanitization**: [target and method]
|
||||
- **Error handling**: [secure error display]
|
||||
|
||||
## Scalability Design
|
||||
|
||||
### Handling Data Growth
|
||||
|
||||
- **Expected data volume**: [e.g., 10,000 tasks]
|
||||
- **Performance degradation countermeasures**: [method]
|
||||
- **Archive strategy**: [handling of old data]
|
||||
|
||||
### Extensibility
|
||||
|
||||
- **Plugin system**: [presence/absence and design]
|
||||
- **Configuration customization**: [scope of what is possible]
|
||||
- **API extensibility**: [methods for future extension]
|
||||
|
||||
## Test Strategy
|
||||
|
||||
### Unit Tests
|
||||
- **Framework**: [framework name]
|
||||
- **Target**: [description of test target]
|
||||
- **Coverage target**: [%]
|
||||
|
||||
### Integration Tests
|
||||
- **Method**: [test method]
|
||||
- **Target**: [description of test target]
|
||||
|
||||
### E2E Tests
|
||||
- **Tool**: [tool name]
|
||||
- **Scenarios**: [test scenarios]
|
||||
|
||||
## Technical Constraints
|
||||
|
||||
### Environment Requirements
|
||||
- **OS**: [supported OS]
|
||||
- **Minimum memory**: [MB]
|
||||
- **Required disk space**: [MB]
|
||||
- **Required external dependencies**: [list]
|
||||
|
||||
### Performance Constraints
|
||||
- [constraint 1]
|
||||
- [constraint 2]
|
||||
|
||||
### Security Constraints
|
||||
- [constraint 1]
|
||||
- [constraint 2]
|
||||
|
||||
## Dependency Management
|
||||
|
||||
| Library | Purpose | Version management policy |
|
||||
|-----------|------|-------------------|
|
||||
| [name] | [purpose] | [pinned/range] |
|
||||
| [name] | [purpose] | [pinned/range] |
|
||||
Reference in New Issue
Block a user