@daniel-da-silva-alves/sddk 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/README.md +21 -4
- package/bin/cli.js +4 -4
- package/package.json +7 -2
- package/sddk/plugin.json +1 -1
- package/sddk/skills/code-review/SKILL.md +142 -141
- package/sddk/skills/code-review/references/anti-ai-design-patterns.md +90 -90
- package/sddk/skills/code-review/references/refactoring-severity-guide.md +60 -60
- package/sddk/skills/code-review/references/security-checklist.md +59 -59
- package/sddk/skills/fullstack-development/SKILL.md +79 -78
- package/sddk/skills/fullstack-development/references/clean-code-rules.md +65 -65
- package/sddk/skills/fullstack-development/references/self-review-checklist.md +42 -42
- package/sddk/skills/implementation-planning/SKILL.md +65 -64
- package/sddk/skills/implementation-planning/references/manual-tests-template.md +53 -53
- package/sddk/skills/implementation-planning/references/microtask-template.md +47 -47
- package/sddk/skills/software-requirements-specification/SKILL.md +46 -45
- package/sddk/skills/software-requirements-specification/references/checklist-template.md +48 -48
- package/sddk/skills/software-requirements-specification/references/ieee-830-template.md +94 -94
- package/sddk/skills/software-requirements-specification/references/socratic-interview-guide.md +65 -65
- package/sddk/skills/system-design-document/SKILL.md +108 -107
- package/sddk/skills/system-design-document/references/architecture-patterns.md +59 -59
- package/sddk/skills/system-design-document/references/documentation-sources-guide.md +69 -69
- package/sddk/skills/system-design-document/references/sdd-template.md +117 -117
- package/sddk/skills/system-design-document/references/standards-api-template.md +47 -47
- package/sddk/skills/system-design-document/references/standards-architecture-template.md +42 -42
- package/sddk/skills/system-design-document/references/standards-coding-template.md +64 -64
- package/sddk/skills/system-design-document/references/standards-design-system-template.md +81 -81
- package/sddk/skills/system-design-document/references/standards-naming-template.md +59 -59
- package/sddk/skills/system-design-document/references/standards-onboarding-guide.md +80 -80
- package/sddk/skills/system-design-document/references/tech-stack-analysis.md +37 -37
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
# Template:
|
|
1
|
+
# Template: Project API Conventions
|
|
2
2
|
|
|
3
|
-
Use
|
|
3
|
+
Use this template to generate `.specs/standards/api-conventions.md`. Fill in with the onboarding interview answers. If the project has no API, create with "N/A — project without API".
|
|
4
4
|
|
|
5
5
|
```markdown
|
|
6
|
-
#
|
|
6
|
+
# API Conventions
|
|
7
7
|
|
|
8
|
-
**
|
|
9
|
-
|
|
8
|
+
**Project**: {project name}
|
|
9
|
+
**Last updated**: {date}
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
-
## 1.
|
|
13
|
+
## 1. API Pattern
|
|
14
14
|
|
|
15
|
-
**
|
|
16
|
-
**
|
|
17
|
-
**Base URL**: {
|
|
15
|
+
**Type**: {REST | GraphQL | tRPC | gRPC}
|
|
16
|
+
**Versioning**: {e.g.: URL path /api/v1/, header, none}
|
|
17
|
+
**Base URL**: {e.g.: /api/v1}
|
|
18
18
|
|
|
19
19
|
---
|
|
20
20
|
|
|
21
|
-
## 2.
|
|
21
|
+
## 2. Response Format
|
|
22
22
|
|
|
23
|
-
### Response
|
|
23
|
+
### Success Response
|
|
24
24
|
```json
|
|
25
25
|
{
|
|
26
26
|
"data": { ... },
|
|
@@ -32,12 +32,12 @@ Use este template para gerar `.specs/standards/api-conventions.md`. Preencha com
|
|
|
32
32
|
}
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
### Response
|
|
35
|
+
### Error Response
|
|
36
36
|
```json
|
|
37
37
|
{
|
|
38
38
|
"error": {
|
|
39
39
|
"code": "{ERROR_CODE}",
|
|
40
|
-
"message": "{
|
|
40
|
+
"message": "{human-readable message}",
|
|
41
41
|
"details": [ ... ]
|
|
42
42
|
}
|
|
43
43
|
}
|
|
@@ -45,44 +45,44 @@ Use este template para gerar `.specs/standards/api-conventions.md`. Preencha com
|
|
|
45
45
|
|
|
46
46
|
### HTTP Status Codes
|
|
47
47
|
|
|
48
|
-
| Status |
|
|
48
|
+
| Status | When to use |
|
|
49
49
|
|:---|:---|
|
|
50
|
-
| 200 |
|
|
51
|
-
| 201 |
|
|
52
|
-
| 204 |
|
|
53
|
-
| 400 |
|
|
54
|
-
| 401 |
|
|
55
|
-
| 403 |
|
|
56
|
-
| 404 |
|
|
57
|
-
| 409 |
|
|
58
|
-
| 422 |
|
|
59
|
-
| 429 | Rate limit
|
|
60
|
-
| 500 |
|
|
50
|
+
| 200 | Success (GET, PUT, PATCH) |
|
|
51
|
+
| 201 | Resource created (POST) |
|
|
52
|
+
| 204 | Success with no body (DELETE) |
|
|
53
|
+
| 400 | Validation / invalid input |
|
|
54
|
+
| 401 | Not authenticated |
|
|
55
|
+
| 403 | Not authorized (no permission) |
|
|
56
|
+
| 404 | Resource not found |
|
|
57
|
+
| 409 | Conflict (e.g.: email already exists) |
|
|
58
|
+
| 422 | Unprocessable entity |
|
|
59
|
+
| 429 | Rate limit exceeded |
|
|
60
|
+
| 500 | Internal server error |
|
|
61
61
|
|
|
62
62
|
---
|
|
63
63
|
|
|
64
|
-
## 3. Naming
|
|
64
|
+
## 3. Endpoint Naming
|
|
65
65
|
|
|
66
|
-
|
|
|
66
|
+
| Rule | Correct example | Wrong example |
|
|
67
67
|
|:---|:---|:---|
|
|
68
|
-
|
|
|
69
|
-
|
|
|
70
|
-
| Kebab-case
|
|
71
|
-
|
|
|
68
|
+
| Plural nouns | `/api/v1/users` | `/api/v1/user` |
|
|
69
|
+
| No verbs in URL | `GET /users` | `GET /getUsers` |
|
|
70
|
+
| Kebab-case for multi-word | `/order-items` | `/orderItems` |
|
|
71
|
+
| Nested resources | `/users/:id/orders` | `/getUserOrders` |
|
|
72
72
|
|
|
73
73
|
---
|
|
74
74
|
|
|
75
|
-
## 4.
|
|
75
|
+
## 4. Pagination
|
|
76
76
|
|
|
77
|
-
**
|
|
77
|
+
**Type**: {cursor | offset | keyset}
|
|
78
78
|
|
|
79
|
-
###
|
|
80
|
-
{
|
|
79
|
+
### Request Format
|
|
80
|
+
{e.g. for offset:}
|
|
81
81
|
```
|
|
82
82
|
GET /api/v1/users?page=2&per_page=20
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
###
|
|
85
|
+
### Response Format (meta)
|
|
86
86
|
```json
|
|
87
87
|
{
|
|
88
88
|
"meta": {
|
|
@@ -96,33 +96,33 @@ GET /api/v1/users?page=2&per_page=20
|
|
|
96
96
|
|
|
97
97
|
---
|
|
98
98
|
|
|
99
|
-
## 5.
|
|
99
|
+
## 5. Filters and Sorting
|
|
100
100
|
|
|
101
|
-
###
|
|
101
|
+
### Filters
|
|
102
102
|
```
|
|
103
103
|
GET /api/v1/users?status=active&role=admin
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
-
###
|
|
106
|
+
### Sorting
|
|
107
107
|
```
|
|
108
108
|
GET /api/v1/users?sort=created_at&order=desc
|
|
109
109
|
```
|
|
110
110
|
|
|
111
111
|
---
|
|
112
112
|
|
|
113
|
-
## 6.
|
|
113
|
+
## 6. Authentication
|
|
114
114
|
|
|
115
|
-
**
|
|
115
|
+
**Method**: {e.g.: Bearer Token (JWT) via Authorization header}
|
|
116
116
|
**Header**: `Authorization: Bearer {token}`
|
|
117
|
-
**Refresh**: {
|
|
117
|
+
**Refresh**: {e.g.: via POST /api/v1/auth/refresh with refresh token in httpOnly cookie}
|
|
118
118
|
|
|
119
119
|
---
|
|
120
120
|
|
|
121
|
-
## 7.
|
|
121
|
+
## 7. Validation
|
|
122
122
|
|
|
123
|
-
|
|
|
123
|
+
| Rule | Description |
|
|
124
124
|
|:---|:---|
|
|
125
|
-
|
|
|
126
|
-
|
|
|
127
|
-
|
|
|
125
|
+
| Backend validation | ALL input is validated on the server, regardless of frontend |
|
|
126
|
+
| Error messages | Return field + specific message |
|
|
127
|
+
| Validation error format | `{"error": {"code": "VALIDATION_ERROR", "details": [{"field": "email", "message": "Invalid email"}]}}` |
|
|
128
128
|
```
|
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
# Template:
|
|
1
|
+
# Template: Project Architectural Standards
|
|
2
2
|
|
|
3
|
-
Use
|
|
3
|
+
Use this template to generate `.specs/standards/architecture.md`. Fill in with the onboarding interview answers.
|
|
4
4
|
|
|
5
5
|
```markdown
|
|
6
|
-
#
|
|
6
|
+
# Project Architectural Standards
|
|
7
7
|
|
|
8
|
-
**
|
|
9
|
-
|
|
8
|
+
**Project**: {project name}
|
|
9
|
+
**Last updated**: {date}
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
-
## 1.
|
|
13
|
+
## 1. Base Architectural Pattern
|
|
14
14
|
|
|
15
|
-
**
|
|
16
|
-
**
|
|
15
|
+
**Pattern**: {e.g.: Domain-Driven Design (DDD)}
|
|
16
|
+
**Justification**: {why this pattern}
|
|
17
17
|
|
|
18
|
-
###
|
|
18
|
+
### Layers and Responsibilities
|
|
19
19
|
|
|
20
|
-
|
|
|
20
|
+
| Layer | Responsibility | Can import from | CANNOT import from |
|
|
21
21
|
|:---|:---|:---|:---|
|
|
22
|
-
| {
|
|
23
|
-
| {
|
|
24
|
-
| {
|
|
25
|
-
| {
|
|
22
|
+
| {e.g.: Domain} | {e.g.: Entities, Value Objects, business rules} | {none} | {Application, Infrastructure, Presentation} |
|
|
23
|
+
| {e.g.: Application} | {e.g.: Use Cases, DTOs, Ports} | {Domain} | {Infrastructure, Presentation} |
|
|
24
|
+
| {e.g.: Infrastructure} | {e.g.: Repositories, API clients, DB} | {Domain, Application} | {Presentation} |
|
|
25
|
+
| {e.g.: Presentation} | {e.g.: Controllers, Views, Components} | {Application} | {Domain, Infrastructure} |
|
|
26
26
|
|
|
27
|
-
###
|
|
27
|
+
### Default Directory Structure
|
|
28
28
|
|
|
29
29
|
```
|
|
30
30
|
src/
|
|
31
|
-
├── {
|
|
32
|
-
├── {
|
|
33
|
-
├── {
|
|
34
|
-
└── {
|
|
31
|
+
├── {layer1}/
|
|
32
|
+
├── {layer2}/
|
|
33
|
+
├── {layer3}/
|
|
34
|
+
└── {layer4}/
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
---
|
|
38
38
|
|
|
39
|
-
## 2.
|
|
39
|
+
## 2. Advanced Patterns
|
|
40
40
|
|
|
41
|
-
### {
|
|
42
|
-
- **
|
|
43
|
-
- **
|
|
44
|
-
- **
|
|
41
|
+
### {e.g.: Event Sourcing}
|
|
42
|
+
- **Used in**: {modules/contexts where it applies}
|
|
43
|
+
- **NOT used in**: {modules where it does NOT apply}
|
|
44
|
+
- **Implementation**: {technical details}
|
|
45
45
|
|
|
46
|
-
### {
|
|
47
|
-
- **
|
|
48
|
-
- **
|
|
46
|
+
### {e.g.: BFF (Backend for Frontend)}
|
|
47
|
+
- **Scope**: {does each frontend have its own BFF? or a single BFF?}
|
|
48
|
+
- **Rule**: {does BFF contain business logic? Or only orchestrates?}
|
|
49
49
|
|
|
50
|
-
### {
|
|
51
|
-
- **
|
|
52
|
-
- **Command**: {
|
|
53
|
-
- **Query**: {
|
|
50
|
+
### {e.g.: CQRS (Command Query Responsibility Segregation)}
|
|
51
|
+
- **Used in**: {where it applies}
|
|
52
|
+
- **Command**: {what commands look like}
|
|
53
|
+
- **Query**: {what queries look like}
|
|
54
54
|
|
|
55
55
|
---
|
|
56
56
|
|
|
57
|
-
## 3.
|
|
57
|
+
## 3. Dependency Rules
|
|
58
58
|
|
|
59
59
|
> [!IMPORTANT]
|
|
60
|
-
>
|
|
60
|
+
> These rules must NEVER be violated. Violations are classified as 🔴 Critical in Code Review.
|
|
61
61
|
|
|
62
|
-
1. {
|
|
63
|
-
2. {
|
|
64
|
-
3. {
|
|
65
|
-
4. {
|
|
62
|
+
1. {e.g.: Domain NEVER imports from Infrastructure}
|
|
63
|
+
2. {e.g.: Use Cases orchestrate, NEVER contain pure domain logic}
|
|
64
|
+
3. {e.g.: Each Aggregate has its own Repository}
|
|
65
|
+
4. {e.g.: Repositories return Domain Entities, not DTOs}
|
|
66
66
|
|
|
67
67
|
---
|
|
68
68
|
|
|
69
|
-
## 4.
|
|
69
|
+
## 4. Design Principles
|
|
70
70
|
|
|
71
|
-
|
|
|
71
|
+
| Principle | How we apply it |
|
|
72
72
|
|:---|:---|
|
|
73
|
-
| {
|
|
74
|
-
| {
|
|
75
|
-
| {
|
|
73
|
+
| {e.g.: SSOT} | {e.g.: State lives in the database. Cache is derived, never the primary source} |
|
|
74
|
+
| {e.g.: Separation of Concerns} | {e.g.: Each module has a single responsibility} |
|
|
75
|
+
| {e.g.: Fail Fast} | {e.g.: Validate inputs at the system boundary} |
|
|
76
76
|
```
|
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
# Template:
|
|
1
|
+
# Template: Coding Best Practices and Standards
|
|
2
2
|
|
|
3
|
-
Use
|
|
3
|
+
Use this template to generate `.specs/standards/coding-standards.md`. Fill in with the onboarding interview answers.
|
|
4
4
|
|
|
5
5
|
```markdown
|
|
6
|
-
#
|
|
6
|
+
# Coding Best Practices and Standards
|
|
7
7
|
|
|
8
|
-
**
|
|
9
|
-
|
|
8
|
+
**Project**: {project name}
|
|
9
|
+
**Last updated**: {date}
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
-
## 1.
|
|
13
|
+
## 1. Adopted Principles
|
|
14
14
|
|
|
15
|
-
|
|
|
15
|
+
| Principle | What it means IN THIS project | Example |
|
|
16
16
|
|:---|:---|:---|
|
|
17
|
-
| **SSOT** (Single Source of Truth) | {
|
|
18
|
-
| **DRY** (Don't Repeat Yourself) | {
|
|
19
|
-
| **KISS** (Keep It Simple) | {
|
|
20
|
-
| **YAGNI** (You Aren't Gonna Need It) | {
|
|
21
|
-
| **SOLID** | {
|
|
17
|
+
| **SSOT** (Single Source of Truth) | {e.g.: State lives in the database. Cache is derived.} | {e.g.: Don't maintain counters in 2 tables} |
|
|
18
|
+
| **DRY** (Don't Repeat Yourself) | {e.g.: Extract when repeating ≥ 2 times} | {e.g.: Centralized apiClient, not repeated fetch} |
|
|
19
|
+
| **KISS** (Keep It Simple) | {e.g.: Prefer simple solution over elegant} | {e.g.: Use map/filter instead of complex reduce} |
|
|
20
|
+
| **YAGNI** (You Aren't Gonna Need It) | {e.g.: Don't implement features "just in case"} | {e.g.: Don't create generic abstraction for 1 use} |
|
|
21
|
+
| **SOLID** | {which SOLID principles the project explicitly follows} | — |
|
|
22
22
|
|
|
23
23
|
---
|
|
24
24
|
|
|
25
|
-
## 2.
|
|
25
|
+
## 2. Abstraction Rules
|
|
26
26
|
|
|
27
|
-
###
|
|
28
|
-
- {
|
|
29
|
-
- {
|
|
30
|
-
- {
|
|
27
|
+
### When to Extract a Function
|
|
28
|
+
- {e.g.: When the block is used ≥ 2 times}
|
|
29
|
+
- {e.g.: When the block has more than 10 lines and can have a descriptive name}
|
|
30
|
+
- {e.g.: When the block does something semantically independent}
|
|
31
31
|
|
|
32
|
-
###
|
|
33
|
-
- {
|
|
34
|
-
- {
|
|
35
|
-
- {
|
|
32
|
+
### When to Create a Component
|
|
33
|
+
- {e.g.: When the UI is reused in ≥ 2 places}
|
|
34
|
+
- {e.g.: When the component has more than ~100 lines}
|
|
35
|
+
- {e.g.: When it has its own state or logic}
|
|
36
36
|
|
|
37
|
-
###
|
|
38
|
-
- {
|
|
39
|
-
- {
|
|
37
|
+
### When to Create a Hook (React)
|
|
38
|
+
- {e.g.: When stateful logic is used in ≥ 2 components}
|
|
39
|
+
- {e.g.: When the component becomes cleaner by separating the logic}
|
|
40
40
|
|
|
41
|
-
###
|
|
42
|
-
- {
|
|
43
|
-
- {
|
|
41
|
+
### When to Create a Service
|
|
42
|
+
- {e.g.: When business logic doesn't belong to the component/controller}
|
|
43
|
+
- {e.g.: When the same operation is used across multiple endpoints/pages}
|
|
44
44
|
|
|
45
45
|
---
|
|
46
46
|
|
|
47
|
-
## 3.
|
|
47
|
+
## 3. Error Handling
|
|
48
48
|
|
|
49
|
-
###
|
|
49
|
+
### Strategy by Layer
|
|
50
50
|
|
|
51
|
-
|
|
|
51
|
+
| Layer | Strategy |
|
|
52
52
|
|:---|:---|
|
|
53
|
-
| **Domain** | {
|
|
54
|
-
| **Application/Service** | {
|
|
55
|
-
| **API/Controller** | {
|
|
56
|
-
| **Frontend** | {
|
|
53
|
+
| **Domain** | {e.g.: Throw custom exceptions (DomainError, ValidationError)} |
|
|
54
|
+
| **Application/Service** | {e.g.: Catch domain errors, translate to error DTOs} |
|
|
55
|
+
| **API/Controller** | {e.g.: Global error handler, map exceptions to HTTP status} |
|
|
56
|
+
| **Frontend** | {e.g.: Error Boundary for crashes, toast for action errors} |
|
|
57
57
|
|
|
58
|
-
### Custom Exceptions (
|
|
58
|
+
### Custom Exceptions (if applicable)
|
|
59
59
|
```typescript
|
|
60
|
-
//
|
|
60
|
+
// Project error hierarchy
|
|
61
61
|
class AppError extends Error { code: string; statusCode: number; }
|
|
62
62
|
class ValidationError extends AppError { fields: FieldError[]; }
|
|
63
63
|
class NotFoundError extends AppError { }
|
|
@@ -65,50 +65,50 @@ class UnauthorizedError extends AppError { }
|
|
|
65
65
|
class ConflictError extends AppError { }
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
###
|
|
69
|
-
- {
|
|
70
|
-
- {
|
|
71
|
-
- {
|
|
68
|
+
### Error Messages
|
|
69
|
+
- {e.g.: User-facing messages, never stack traces}
|
|
70
|
+
- {e.g.: Full error logging on the server, clean message on the client}
|
|
71
|
+
- {e.g.: Standardized error codes (ERROR_CODE) for the frontend to map}
|
|
72
72
|
|
|
73
73
|
---
|
|
74
74
|
|
|
75
75
|
## 4. Logging
|
|
76
76
|
|
|
77
|
-
###
|
|
78
|
-
- **
|
|
79
|
-
- **
|
|
80
|
-
- **
|
|
77
|
+
### Strategy
|
|
78
|
+
- **Format**: {e.g.: Structured logging (JSON)}
|
|
79
|
+
- **Levels**: {e.g.: error, warn, info, debug}
|
|
80
|
+
- **Tool**: {e.g.: pino, winston, structured console}
|
|
81
81
|
|
|
82
|
-
###
|
|
82
|
+
### What to Log
|
|
83
83
|
|
|
84
|
-
|
|
|
84
|
+
| Level | When to use | Example |
|
|
85
85
|
|:---|:---|:---|
|
|
86
|
-
| `error` |
|
|
87
|
-
| `warn` |
|
|
88
|
-
| `info` |
|
|
89
|
-
| `debug` |
|
|
86
|
+
| `error` | Failures that prevent the operation | DB connection error, unhandled exception |
|
|
87
|
+
| `warn` | Abnormal but recoverable situations | Rate limit approaching, fallback activated |
|
|
88
|
+
| `info` | Important business events | User created, payment processed |
|
|
89
|
+
| `debug` | Details for debugging | SQL query executed, received payload |
|
|
90
90
|
|
|
91
|
-
###
|
|
92
|
-
-
|
|
93
|
-
-
|
|
94
|
-
-
|
|
91
|
+
### What to NEVER Log
|
|
92
|
+
- Passwords, tokens, API keys
|
|
93
|
+
- Sensitive personal data (SSN, credit card)
|
|
94
|
+
- Full request payloads in production
|
|
95
95
|
|
|
96
96
|
---
|
|
97
97
|
|
|
98
|
-
## 5.
|
|
98
|
+
## 5. Testing (if applicable)
|
|
99
99
|
|
|
100
|
-
###
|
|
101
|
-
- **
|
|
102
|
-
- **
|
|
103
|
-
- **
|
|
100
|
+
### Strategy
|
|
101
|
+
- **Primary type**: {e.g.: Manual tests via manual-tests.md}
|
|
102
|
+
- **Minimum coverage**: {e.g.: N/A — focus on manual tests}
|
|
103
|
+
- **When to automate**: {e.g.: Critical domain logic (calculations, validations)}
|
|
104
104
|
|
|
105
105
|
---
|
|
106
106
|
|
|
107
107
|
## 6. Performance
|
|
108
108
|
|
|
109
|
-
###
|
|
110
|
-
- {
|
|
111
|
-
- {
|
|
112
|
-
- {
|
|
113
|
-
- {
|
|
109
|
+
### General Rules
|
|
110
|
+
- {e.g.: Listing queries MUST have pagination (maximum 100 per page)}
|
|
111
|
+
- {e.g.: N+1 queries are prohibited — use eager loading / join}
|
|
112
|
+
- {e.g.: Images must be optimized (WebP, lazy loading)}
|
|
113
|
+
- {e.g.: Bundle splitting for frontend routes}
|
|
114
114
|
```
|