speccrew 0.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/.speccrew/agents/speccrew-feature-designer.md +142 -0
- package/.speccrew/agents/speccrew-product-manager.md +61 -0
- package/.speccrew/agents/speccrew-system-designer.md +200 -0
- package/.speccrew/agents/speccrew-system-developer.md +238 -0
- package/.speccrew/agents/speccrew-task-worker.md +80 -0
- package/.speccrew/agents/speccrew-team-leader.md +92 -0
- package/.speccrew/agents/speccrew-test-manager.md +313 -0
- package/.speccrew/skills/speccrew-create-agents/SKILL.md +98 -0
- package/.speccrew/skills/speccrew-create-agents/templates/agents/designer-agent.md +54 -0
- package/.speccrew/skills/speccrew-create-agents/templates/agents/dev-agent.md +79 -0
- package/.speccrew/skills/speccrew-create-agents/templates/agents/test-agent.md +80 -0
- package/.speccrew/skills/speccrew-dev-backend/SKILL.md +205 -0
- package/.speccrew/skills/speccrew-dev-backend/templates/TASK-RECORD-TEMPLATE.md +118 -0
- package/.speccrew/skills/speccrew-dev-desktop/SKILL.md +258 -0
- package/.speccrew/skills/speccrew-dev-desktop/templates/TASK-RECORD-TEMPLATE.md +161 -0
- package/.speccrew/skills/speccrew-dev-frontend/SKILL.md +202 -0
- package/.speccrew/skills/speccrew-dev-frontend/templates/TASK-RECORD-TEMPLATE.md +115 -0
- package/.speccrew/skills/speccrew-dev-mobile/SKILL.md +200 -0
- package/.speccrew/skills/speccrew-dev-mobile/templates/TASK-RECORD-TEMPLATE.md +125 -0
- package/.speccrew/skills/speccrew-fd-api-contract/SKILL.md +73 -0
- package/.speccrew/skills/speccrew-fd-api-contract/templates/API-CONTRACT-TEMPLATE.md +96 -0
- package/.speccrew/skills/speccrew-fd-feature-design/SKILL.md +395 -0
- package/.speccrew/skills/speccrew-fd-feature-design/templates/FEATURE-SPEC-TEMPLATE.md +387 -0
- package/.speccrew/skills/speccrew-get-timestamp/SKILL.md +80 -0
- package/.speccrew/skills/speccrew-get-timestamp/scripts/get-timestamp.js +35 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-api-analyze/SKILL.md +1116 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-api-analyze/templates/FEATURE-DETAIL-TEMPLATE-FASTAPI.md +462 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-api-analyze/templates/FEATURE-DETAIL-TEMPLATE-JAVA.md +480 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-api-analyze/templates/FEATURE-DETAIL-TEMPLATE-NET.md +464 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-api-analyze/templates/FEATURE-DETAIL-TEMPLATE.md +480 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-api-analyze/templates/MODULE-OVERVIEW-TEMPLATE.md +367 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/SKILL.md +667 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/STATUS-FORMATS.md +74 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/batch-orchestrator.js +176 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/get-next-batch.js +150 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/get-pending-features.js +106 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/mark-stale.js +249 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/process-batch-results.js +848 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/update-feature-status.js +226 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-init-features/SKILL.md +264 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-init-features/examples/features.json +34 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-init-features/scripts/generate-inventory.js +867 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-init-features/scripts/test-inventory.js +26 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-module-classify/SKILL.md +165 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-module-classify/scripts/apply-module-mapping.js +208 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-module-classify/scripts/extract-module-summary.js +180 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-module-classify/scripts/reindex-modules.js +358 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-ui-analyze/SKILL.md +1055 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-ui-analyze/templates/FEATURE-DETAIL-TEMPLATE-UI-DESKTOP.md +303 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-ui-analyze/templates/FEATURE-DETAIL-TEMPLATE-UI-ELECTRON.md +327 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-ui-analyze/templates/FEATURE-DETAIL-TEMPLATE-UI-MINIAPP.md +292 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-ui-analyze/templates/FEATURE-DETAIL-TEMPLATE-UI-MOBILE.md +281 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-ui-analyze/templates/FEATURE-DETAIL-TEMPLATE-UI.md +324 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-ui-style-extract/SKILL.md +270 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-ui-style-extract/templates/COMPONENT-PATTERN-TEMPLATE.md +33 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-ui-style-extract/templates/LAYOUT-PATTERN-TEMPLATE.md +33 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-ui-style-extract/templates/PAGE-TYPE-TEMPLATE.md +33 -0
- package/.speccrew/skills/speccrew-knowledge-graph-query/SKILL.md +229 -0
- package/.speccrew/skills/speccrew-knowledge-graph-query/scripts/graph-query.js +549 -0
- package/.speccrew/skills/speccrew-knowledge-graph-write/SKILL.md +181 -0
- package/.speccrew/skills/speccrew-knowledge-graph-write/scripts/graph-write.js +651 -0
- package/.speccrew/skills/speccrew-knowledge-module-summarize/SKILL.md +305 -0
- package/.speccrew/skills/speccrew-knowledge-module-summarize/templates/MODULE-OVERVIEW-TEMPLATE.md +400 -0
- package/.speccrew/skills/speccrew-knowledge-system-summarize/SKILL.md +351 -0
- package/.speccrew/skills/speccrew-knowledge-system-summarize/templates/SYSTEM-OVERVIEW-TEMPLATE.md +294 -0
- package/.speccrew/skills/speccrew-knowledge-techs-dispatch/SKILL.md +683 -0
- package/.speccrew/skills/speccrew-knowledge-techs-dispatch/STATUS-FORMATS.md +550 -0
- package/.speccrew/skills/speccrew-knowledge-techs-dispatch/templates/techs-manifest-EXAMPLE.json +35 -0
- package/.speccrew/skills/speccrew-knowledge-techs-generate/SKILL.md +1087 -0
- package/.speccrew/skills/speccrew-knowledge-techs-generate/templates/ARCHITECTURE-TEMPLATE.md +240 -0
- package/.speccrew/skills/speccrew-knowledge-techs-generate/templates/COLOR-SYSTEM-TEMPLATE.md +68 -0
- package/.speccrew/skills/speccrew-knowledge-techs-generate/templates/COMPONENT-LIBRARY-TEMPLATE.md +86 -0
- package/.speccrew/skills/speccrew-knowledge-techs-generate/templates/CONVENTIONS-BUILD-TEMPLATE.md +466 -0
- package/.speccrew/skills/speccrew-knowledge-techs-generate/templates/CONVENTIONS-DATA-TEMPLATE.md +432 -0
- package/.speccrew/skills/speccrew-knowledge-techs-generate/templates/CONVENTIONS-DESIGN-TEMPLATE.md +1209 -0
- package/.speccrew/skills/speccrew-knowledge-techs-generate/templates/CONVENTIONS-DEV-TEMPLATE.md +1433 -0
- package/.speccrew/skills/speccrew-knowledge-techs-generate/templates/CONVENTIONS-SYSTEM-TEST-TEMPLATE.md +1052 -0
- package/.speccrew/skills/speccrew-knowledge-techs-generate/templates/CONVENTIONS-UNIT-TEST-TEMPLATE.md +946 -0
- package/.speccrew/skills/speccrew-knowledge-techs-generate/templates/INDEX-TEMPLATE.md +29 -0
- package/.speccrew/skills/speccrew-knowledge-techs-generate/templates/PAGE-LAYOUTS-TEMPLATE.md +69 -0
- package/.speccrew/skills/speccrew-knowledge-techs-generate/templates/PAGE-TYPE-SUMMARY-TEMPLATE.md +74 -0
- package/.speccrew/skills/speccrew-knowledge-techs-generate/templates/TECH-STACK-TEMPLATE.md +232 -0
- package/.speccrew/skills/speccrew-knowledge-techs-generate-conventions/SKILL.md +628 -0
- package/.speccrew/skills/speccrew-knowledge-techs-generate-ui-style/SKILL.md +392 -0
- package/.speccrew/skills/speccrew-knowledge-techs-index/SKILL.md +489 -0
- package/.speccrew/skills/speccrew-knowledge-techs-index/templates/INDEX-TEMPLATE.md +243 -0
- package/.speccrew/skills/speccrew-knowledge-techs-init/SKILL.md +269 -0
- package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/SKILL.md +562 -0
- package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/templates/BUSINESS-COMPONENTS-TEMPLATE.md +171 -0
- package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/templates/COMMON-COMPONENTS-TEMPLATE.md +177 -0
- package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/templates/COMPONENT-INDIVIDUAL-TEMPLATE.md +80 -0
- package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/templates/COMPONENT-LIBRARY-TEMPLATE.md +118 -0
- package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/templates/LAYOUT-INDIVIDUAL-TEMPLATE.md +97 -0
- package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/templates/LAYOUT-PATTERNS-TEMPLATE.md +208 -0
- package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/templates/NAVIGATION-PATTERNS-TEMPLATE.md +157 -0
- package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/templates/PAGE-TYPE-INDIVIDUAL-TEMPLATE.md +123 -0
- package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/templates/PAGE-TYPE-SUMMARY-TEMPLATE.md +58 -0
- package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/templates/SPACING-TEMPLATE.md +119 -0
- package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/templates/STYLE-SYSTEM-TEMPLATE.md +117 -0
- package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/templates/TYPOGRAPHY-TEMPLATE.md +107 -0
- package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/templates/UI-STYLE-GUIDE-TEMPLATE.md +171 -0
- package/.speccrew/skills/speccrew-pm-requirement-analysis/SKILL.md +434 -0
- package/.speccrew/skills/speccrew-pm-requirement-analysis/templates/BIZS-MODELING-TEMPLATE.md +332 -0
- package/.speccrew/skills/speccrew-pm-requirement-analysis/templates/PRD-TEMPLATE.md +200 -0
- package/.speccrew/skills/speccrew-pm-requirement-assess/SKILL.md +195 -0
- package/.speccrew/skills/speccrew-project-diagnosis/SKILL.md +208 -0
- package/.speccrew/skills/speccrew-project-diagnosis/templates/DIAGNOSIS-REPORT-TEMPLATE.md +202 -0
- package/.speccrew/skills/speccrew-sd-backend/SKILL.md +188 -0
- package/.speccrew/skills/speccrew-sd-backend/templates/INDEX-TEMPLATE.md +85 -0
- package/.speccrew/skills/speccrew-sd-backend/templates/SD-BACKEND-TEMPLATE.md +269 -0
- package/.speccrew/skills/speccrew-sd-desktop/SKILL.md +192 -0
- package/.speccrew/skills/speccrew-sd-desktop/templates/INDEX-TEMPLATE.md +271 -0
- package/.speccrew/skills/speccrew-sd-desktop/templates/SD-DESKTOP-TEMPLATE.md +673 -0
- package/.speccrew/skills/speccrew-sd-frontend/SKILL.md +176 -0
- package/.speccrew/skills/speccrew-sd-frontend/templates/INDEX-TEMPLATE.md +184 -0
- package/.speccrew/skills/speccrew-sd-frontend/templates/SD-FRONTEND-TEMPLATE.md +382 -0
- package/.speccrew/skills/speccrew-sd-mobile/SKILL.md +189 -0
- package/.speccrew/skills/speccrew-sd-mobile/templates/INDEX-TEMPLATE.md +219 -0
- package/.speccrew/skills/speccrew-sd-mobile/templates/SD-MOBILE-TEMPLATE.md +534 -0
- package/.speccrew/skills/speccrew-test-case-design/SKILL.md +284 -0
- package/.speccrew/skills/speccrew-test-case-design/templates/TEST-CASE-DESIGN-TEMPLATE.md +263 -0
- package/.speccrew/skills/speccrew-test-code-gen/SKILL.md +313 -0
- package/.speccrew/skills/speccrew-test-code-gen/templates/TEST-CODE-PLAN-TEMPLATE.md +180 -0
- package/.speccrew/skills/speccrew-test-execute/SKILL.md +283 -0
- package/.speccrew/skills/speccrew-test-execute/templates/BUG-REPORT-TEMPLATE.md +50 -0
- package/.speccrew/skills/speccrew-test-execute/templates/TEST-REPORT-TEMPLATE.md +57 -0
- package/.speccrew/skills/speccrew-workflow-diagnose/SKILL.md +155 -0
- package/LICENSE +21 -0
- package/README.ar.md +318 -0
- package/README.en.md +318 -0
- package/README.es.md +318 -0
- package/README.md +340 -0
- package/bin/cli.js +62 -0
- package/lib/commands/doctor.js +138 -0
- package/lib/commands/init.js +231 -0
- package/lib/commands/list.js +114 -0
- package/lib/commands/uninstall.js +117 -0
- package/lib/commands/update.js +351 -0
- package/lib/ide-adapters.js +73 -0
- package/lib/utils.js +104 -0
- package/package.json +28 -0
- package/workspace-template/docs/configs/document-templates.json +667 -0
- package/workspace-template/docs/configs/platform-mapping.json +194 -0
- package/workspace-template/docs/configs/tech-stack-mappings.json +313 -0
- package/workspace-template/docs/configs/validation-rules.json +87 -0
- package/workspace-template/docs/rules/mermaid-rule.md +114 -0
- package/workspace-template/docs/solutions/Agent/346/212/200/350/203/275/345/256/232/344/271/211+/351/234/200/346/261/202/346/226/207/346/241/243+UML/344/275/277/347/224/250/346/250/241/346/235/277/357/274/210ISA-95/345/205/255/346/256/265/345/274/217/350/236/215/345/220/210/347/211/210/357/274/211.md +586 -0
- package/workspace-template/docs/solutions/agent-knowledge-map.md +238 -0
- package/workspace-template/docs/solutions/bizs-knowledge-pipeline.md +678 -0
- package/workspace-template/docs/solutions/harness.md +410 -0
- package/workspace-template/docs/solutions/knowledge-incremental-sync-spec.md +943 -0
- package/workspace-template/docs/solutions/techs-knowledge-pipeline.md +803 -0
- package/workspace-template/docs/solutions/workspace-structure.md +318 -0
|
@@ -0,0 +1,464 @@
|
|
|
1
|
+
# API Feature Detail Template - [Feature Name]
|
|
2
|
+
|
|
3
|
+
> **Tech Stack**: ASP.NET Core + Entity Framework Core
|
|
4
|
+
> **Target Audience**: devcrew-product-manager, devcrew-solution-manager, devcrew-developer
|
|
5
|
+
> **Related Document**: [Module Overview Document](../{{module-name}}-overview.md)
|
|
6
|
+
>
|
|
7
|
+
> <!-- AI-TAG: FEATURE_DETAIL -->
|
|
8
|
+
> <!-- AI-CONTEXT: This document describes ASP.NET Core API endpoints, business logic flow, and data models. AI should fill all placeholders when generating. -->
|
|
9
|
+
|
|
10
|
+
<cite>
|
|
11
|
+
**Files Referenced in This Document**
|
|
12
|
+
- [{Controller}.cs](../../{controllerSourcePath})
|
|
13
|
+
- [{Service}.cs](../../{serviceSourcePath})
|
|
14
|
+
- [{Repository}.cs](../../{repositorySourcePath})
|
|
15
|
+
- [{Entity}.cs](../../{entitySourcePath})
|
|
16
|
+
</cite>
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 1. Content Overview
|
|
21
|
+
|
|
22
|
+
<!-- AI-TAG: OVERVIEW -->
|
|
23
|
+
|
|
24
|
+
### 1.1 Basic Information
|
|
25
|
+
|
|
26
|
+
| Item | Description |
|
|
27
|
+
|------|-------------|
|
|
28
|
+
| Controller Name | {Fill in controller name} |
|
|
29
|
+
| Module | {e.g., Order Management Module} |
|
|
30
|
+
| Core Function | {1-3 sentences describing core API functionality} |
|
|
31
|
+
| Base Path | {e.g., /api/v1/users} |
|
|
32
|
+
| Area | {e.g., Admin} |
|
|
33
|
+
|
|
34
|
+
### 1.2 API Scope
|
|
35
|
+
|
|
36
|
+
This controller includes the following API endpoints:
|
|
37
|
+
- [ ] {GET /api/v1/users} - {List users with pagination}
|
|
38
|
+
- [ ] {POST /api/v1/users} - {Create new user}
|
|
39
|
+
- [ ] {GET /api/v1/users/{id}} - {Get user by ID}
|
|
40
|
+
- [ ] {PUT /api/v1/users/{id}} - {Update user}
|
|
41
|
+
- [ ] {DELETE /api/v1/users/{id}} - {Delete user}
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 2. API Endpoint Definitions
|
|
46
|
+
|
|
47
|
+
<!-- AI-TAG: API_ENDPOINTS -->
|
|
48
|
+
<!-- AI-NOTE: Document all public API endpoints exposed by this controller -->
|
|
49
|
+
|
|
50
|
+
### 2.1 {Endpoint Name} - {HTTP Method} {API Path}
|
|
51
|
+
|
|
52
|
+
**Endpoint Information:**
|
|
53
|
+
|
|
54
|
+
| Item | Description |
|
|
55
|
+
|------|-------------|
|
|
56
|
+
| Method | {GET/POST/PUT/DELETE} |
|
|
57
|
+
| Path | {/api/v1/users} |
|
|
58
|
+
| Description | {Brief description of what this endpoint does} |
|
|
59
|
+
| Authorization | {e.g., [Authorize(Roles = "Admin")]} |
|
|
60
|
+
|
|
61
|
+
**Request Parameters:**
|
|
62
|
+
|
|
63
|
+
| Parameter | Type | Required | Description | Validation Rules |
|
|
64
|
+
|-----------|------|----------|-------------|------------------|
|
|
65
|
+
| {param1} | {string/int} | {Yes/No} | {Description} | {e.g., [Required], [MaxLength(50)]} |
|
|
66
|
+
| {param2} | {int} | {No} | {Description} | {e.g., [Range(1, 100)]} |
|
|
67
|
+
| {pageNumber} | {int} | {No} | {Page number} | {Default 1} |
|
|
68
|
+
| {pageSize} | {int} | {No} | {Page size} | {Default 10, Max 100} |
|
|
69
|
+
|
|
70
|
+
**Response Data:**
|
|
71
|
+
|
|
72
|
+
| Field | Type | Description | Nullable |
|
|
73
|
+
|-------|------|-------------|----------|
|
|
74
|
+
| {id} | {Guid/int} | {Record ID} | {No} |
|
|
75
|
+
| {field1} | {string} | {Description} | {Yes} |
|
|
76
|
+
| {field2} | {int} | {Description} | {No} |
|
|
77
|
+
| {createdAt} | {DateTime} | {Creation time} | {No} |
|
|
78
|
+
|
|
79
|
+
**Response Example:**
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"id": "550e8400-e29b-41d4-a716-446655440000",
|
|
84
|
+
"field1": "value1",
|
|
85
|
+
"field2": 100,
|
|
86
|
+
"createdAt": "2024-01-01T12:00:00Z"
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Error Codes:**
|
|
91
|
+
|
|
92
|
+
| Error Code | Description | Trigger Condition |
|
|
93
|
+
|------------|-------------|-------------------|
|
|
94
|
+
| {400} | {Bad Request} | {Model validation failed} |
|
|
95
|
+
| {401} | {Unauthorized} | {Missing or invalid JWT token} |
|
|
96
|
+
| {403} | {Forbidden} | {Insufficient permissions} |
|
|
97
|
+
| {404} | {Not Found} | {Resource not found} |
|
|
98
|
+
|
|
99
|
+
**Business Flow:**
|
|
100
|
+
|
|
101
|
+
```mermaid
|
|
102
|
+
graph TB
|
|
103
|
+
Start([Request Received]) --> Auth{Authorization Middleware}
|
|
104
|
+
|
|
105
|
+
Auth -->|Unauthorized| AuthError[Return 401 Unauthorized]
|
|
106
|
+
AuthError --> End1([End])
|
|
107
|
+
|
|
108
|
+
Auth -->|Authorized| Validate{Model Validation}
|
|
109
|
+
|
|
110
|
+
Validate -->|Invalid| ValError[Return 400 Bad Request]
|
|
111
|
+
ValError --> End1
|
|
112
|
+
|
|
113
|
+
Validate -->|Valid| Ctrl[Controller Action Method]
|
|
114
|
+
|
|
115
|
+
Ctrl -->|Call| Svc[Service Method]
|
|
116
|
+
|
|
117
|
+
Svc -->|Validate| BizRule{Business Rules}
|
|
118
|
+
BizRule -->|Violation| BizError[Return 400 Business Error]
|
|
119
|
+
BizError --> End1
|
|
120
|
+
|
|
121
|
+
BizRule -->|Pass| SvcLogic[Business Logic Processing]
|
|
122
|
+
SvcLogic -->|Transform Data| SvcData[Prepare Data]
|
|
123
|
+
|
|
124
|
+
SvcData -->|Call| Repo[Repository Method]
|
|
125
|
+
|
|
126
|
+
Repo -->|Execute via EF Core| DB[(SQL Server/PostgreSQL)]
|
|
127
|
+
DB -->|Return Result| Repo
|
|
128
|
+
|
|
129
|
+
Repo -->|Return| SvcResult[Service Process Result]
|
|
130
|
+
SvcResult -->|Return| CtrlResult[Controller Assemble Response]
|
|
131
|
+
|
|
132
|
+
CtrlResult --> Response[DTO Response]
|
|
133
|
+
Response --> Success[Return 200 Success]
|
|
134
|
+
Success --> End2([End])
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**Flow Step Description:**
|
|
138
|
+
|
|
139
|
+
| Step | Operation | Layer | Component | Input | Output | Exception Handling |
|
|
140
|
+
|------|-----------|-------|-----------|-------|--------|-------------------|
|
|
141
|
+
| 1 | Authorization | Middleware | {Auth Middleware} | Request + JWT Token | ClaimsPrincipal | Return 401 |
|
|
142
|
+
| 2 | Model Validation | Controller | {Data Annotations} | Request body | Validated DTO | Return 400 |
|
|
143
|
+
| 3 | Invoke Service | Controller | {Controller Action} | Validated DTO | Service result | - |
|
|
144
|
+
| 4 | Business Rule Check | Service | {Service} | Business data | Validation result | Return 400 |
|
|
145
|
+
| 5 | Data Processing | Service | {Service} | Raw data | Processed data | - |
|
|
146
|
+
| 6 | Invoke Repository | Service | {Repository} | Processed data | Entity result | - |
|
|
147
|
+
| 7 | SQL Execution | Repository | {EF Core DbContext} | LINQ/Query | DB result | Return 500 |
|
|
148
|
+
| 8 | Assemble Response | Controller | {Controller} | Service result | DTO response | Return 200 |
|
|
149
|
+
|
|
150
|
+
**Detailed Call Chain:**
|
|
151
|
+
|
|
152
|
+
| # | Layer | File | Method/Class | Responsibility | Source |
|
|
153
|
+
|---|-------|------|--------------|----------------|--------|
|
|
154
|
+
| 1 | Controller | {UsersController.cs} | {CreateUser} | Receive request, validate params, call service | [Source](../../{controllerSourcePath}) |
|
|
155
|
+
| 2 | Service | {UserService.cs} | {CreateUserAsync} | Business validation, data processing, call repository | [Source](../../{serviceSourcePath}) |
|
|
156
|
+
| 3 | Service | {UserService.cs} | {ValidateUserEmailAsync} | Check email uniqueness | [Source](../../{serviceSourcePath}) |
|
|
157
|
+
| 4 | Repository | {UserRepository.cs} | {AddAsync} | Execute Add via EF Core | [Source](../../{repositorySourcePath}) |
|
|
158
|
+
| 5 | Entity | {User.cs} | {User entity} | EF Core entity definition | [Source](../../{entitySourcePath}) |
|
|
159
|
+
|
|
160
|
+
**Database Operations:**
|
|
161
|
+
|
|
162
|
+
| Operation | Table | EF Core Method | Description |
|
|
163
|
+
|-----------|-------|----------------|-------------|
|
|
164
|
+
| {INSERT} | {Users} | {DbSet.AddAsync} | {Insert new user record} |
|
|
165
|
+
| {SELECT} | {Users} | {DbSet.FirstOrDefaultAsync} | {Check email exists} |
|
|
166
|
+
| {UPDATE} | {Users} | {DbSet.Update} | {Update user status} |
|
|
167
|
+
|
|
168
|
+
**Transaction Boundaries:**
|
|
169
|
+
|
|
170
|
+
| Method | Transaction Scope | Isolation Level | Notes |
|
|
171
|
+
|--------|-------------------|-----------------|-------|
|
|
172
|
+
| {UserService.CreateUserAsync} | {User + UserRoles} | {ReadCommitted} | {Using Unit of Work pattern} |
|
|
173
|
+
|
|
174
|
+
### 2.2 {Next Endpoint Name} - {HTTP Method} {API Path}
|
|
175
|
+
|
|
176
|
+
{Repeat the same structure for each API endpoint in the controller}
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## 3. Data Field Definition
|
|
181
|
+
|
|
182
|
+
<!-- AI-TAG: DATA_DEFINITION -->
|
|
183
|
+
<!-- AI-NOTE: Data definitions are important for Solution Agent to design APIs and databases -->
|
|
184
|
+
|
|
185
|
+
### 3.1 Database Table Structure
|
|
186
|
+
|
|
187
|
+
<!-- AI-NOTE: Analyze EF Core Entity to extract database table structure -->
|
|
188
|
+
|
|
189
|
+
**Table Name:** {table_name}
|
|
190
|
+
|
|
191
|
+
**Table Description:** {Description of what this table stores}
|
|
192
|
+
|
|
193
|
+
| Field Name | C# Type | DB Type | Length | Nullable | Default | Constraint | Index | Description |
|
|
194
|
+
|------------|---------|---------|--------|----------|---------|------------|-------|-------------|
|
|
195
|
+
| {Id} | {Guid/int} | {uniqueidentifier/INT} | - | {No} | {NEWID()/IDENTITY} | {PRIMARY KEY} | {PRIMARY} | {Primary key} |
|
|
196
|
+
| {Field1} | {string} | {nvarchar} | {255} | {No} | - | {UNIQUE} | {UNIQUE} | {Unique field} |
|
|
197
|
+
| {Field2} | {int} | {INT} | - | {Yes} | {0} | - | - | {Optional field} |
|
|
198
|
+
| {Field3} | {DateTime} | {datetime2} | - | {No} | {GETUTCDATE()} | - | - | {Creation time} |
|
|
199
|
+
| {Field4} | {bool/Enum} | {bit/TINYINT} | - | {No} | {1} | - | {INDEX} | {Status field} |
|
|
200
|
+
|
|
201
|
+
**Indexes:**
|
|
202
|
+
|
|
203
|
+
| Index Name | Index Type | Fields | Purpose |
|
|
204
|
+
|------------|------------|--------|---------|
|
|
205
|
+
| {IX_Name} | {Index} | {Field1} | {Query optimization} |
|
|
206
|
+
| {IX_Status_CreatedAt} | {Index} | {Field4, CreatedAt} | {Composite index for status query} |
|
|
207
|
+
|
|
208
|
+
**Relationships:**
|
|
209
|
+
|
|
210
|
+
| Related Table | Relationship | Foreign Key | Description |
|
|
211
|
+
|---------------|--------------|-------------|-------------|
|
|
212
|
+
| {RelatedTable} | {One-to-Many} | {RelatedId} | {Relationship description} |
|
|
213
|
+
| {AnotherTable} | {Many-to-One} | {AnotherId} | {Relationship description} |
|
|
214
|
+
|
|
215
|
+
**Source:** [Entity](../../{entitySourcePath}) | [DbContext](../../{dbContextSourcePath})
|
|
216
|
+
|
|
217
|
+
### 3.2 Entity-Database Mapping
|
|
218
|
+
|
|
219
|
+
| Entity Property | DB Column | Type Mapping | Notes |
|
|
220
|
+
|-----------------|-----------|--------------|-------|
|
|
221
|
+
| {entity.Field1} | {ColumnName} | {string → nvarchar(255)} | {Mapping notes} |
|
|
222
|
+
| {entity.Field2} | {ColumnName} | {int → INT} | {Mapping notes} |
|
|
223
|
+
| {entity.CreatedAt} | {CreatedAt} | {DateTime → datetime2} | {Value generated on add} |
|
|
224
|
+
|
|
225
|
+
### 3.3 DTO Definitions
|
|
226
|
+
|
|
227
|
+
**Request DTO:**
|
|
228
|
+
|
|
229
|
+
```csharp
|
|
230
|
+
public class {CreateUserRequest}
|
|
231
|
+
{
|
|
232
|
+
[Required]
|
|
233
|
+
[MaxLength(50)]
|
|
234
|
+
public string Field1 { get; set; }
|
|
235
|
+
|
|
236
|
+
[Range(1, int.MaxValue)]
|
|
237
|
+
public int Field2 { get; set; }
|
|
238
|
+
}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
**Response DTO:**
|
|
242
|
+
|
|
243
|
+
```csharp
|
|
244
|
+
public class {UserResponse}
|
|
245
|
+
{
|
|
246
|
+
public Guid Id { get; set; }
|
|
247
|
+
public string Field1 { get; set; }
|
|
248
|
+
public int Field2 { get; set; }
|
|
249
|
+
public DateTime CreatedAt { get; set; }
|
|
250
|
+
}
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## 4. References
|
|
256
|
+
|
|
257
|
+
<!-- AI-TAG: REFERENCES -->
|
|
258
|
+
<!-- AI-NOTE: List all dependencies and references for this controller -->
|
|
259
|
+
|
|
260
|
+
### 4.1 Internal Services
|
|
261
|
+
|
|
262
|
+
| Service Name | Purpose | Source Path |
|
|
263
|
+
|--------------|---------|-------------|
|
|
264
|
+
| {IUserService} | {e.g., User business logic interface} | [Source](../../{serviceInterfaceSourcePath}) |
|
|
265
|
+
| {UserService} | {e.g., User business logic implementation} | [Source](../../{serviceSourcePath}) |
|
|
266
|
+
|
|
267
|
+
### 4.2 Data Access Layer
|
|
268
|
+
|
|
269
|
+
| Repository | Entity | Purpose | Source Path |
|
|
270
|
+
|------------|--------|---------|-------------|
|
|
271
|
+
| {IUserRepository} | {User} | {e.g., User repository interface} | [Source](../../{repositoryInterfaceSourcePath}) |
|
|
272
|
+
| {UserRepository} | {User} | {e.g., User repository implementation} | [Source](../../{repositorySourcePath}) |
|
|
273
|
+
|
|
274
|
+
### 4.3 DTOs and Entities
|
|
275
|
+
|
|
276
|
+
| Class Name | Type | Purpose | Source Path |
|
|
277
|
+
|------------|------|---------|-------------|
|
|
278
|
+
| {CreateUserRequest} | Request DTO | {e.g., Create user request} | [Source](../../{dtoSourcePath}) |
|
|
279
|
+
| {UserResponse} | Response DTO | {e.g., User detail response} | [Source](../../{dtoSourcePath}) |
|
|
280
|
+
| {User} | EF Core Entity | {e.g., User database entity} | [Source](../../{entitySourcePath}) |
|
|
281
|
+
|
|
282
|
+
### 4.4 API Consumers
|
|
283
|
+
|
|
284
|
+
<!-- AI-NOTE: List frontend pages that call this controller's APIs -->
|
|
285
|
+
|
|
286
|
+
| Page Name | Function Description | Source Path | Document Path |
|
|
287
|
+
|-----------|---------------------|-------------|---------------|
|
|
288
|
+
| {PageName} | {e.g., User management list page} | [Source](../../{pageSourcePath}) | [Doc](../../{pageDocumentPath}) |
|
|
289
|
+
| {PageName} | {e.g., User form page} | [Source](../../{pageSourcePath}) | [Doc](../../{pageDocumentPath}) |
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
## 5. Business Rule Constraints
|
|
294
|
+
|
|
295
|
+
<!-- AI-TAG: BUSINESS_RULES -->
|
|
296
|
+
|
|
297
|
+
### 5.1 Permission Rules
|
|
298
|
+
|
|
299
|
+
| API Endpoint | Permission Requirement | No Permission Response |
|
|
300
|
+
|--------------|----------------------|----------------------|
|
|
301
|
+
| {GET /api/v1/users} | {Require authentication} | Return 401 Unauthorized |
|
|
302
|
+
| {POST /api/v1/users} | {Require Admin role} | Return 403 Forbidden |
|
|
303
|
+
| {DELETE /api/v1/users/{id}} | {Require Admin role} | Return 403 Forbidden |
|
|
304
|
+
|
|
305
|
+
### 5.2 Business Logic Rules
|
|
306
|
+
|
|
307
|
+
1. **{Rule 1}**: {e.g., User email must be unique across system}
|
|
308
|
+
2. **{Rule 2}**: {e.g., Cannot delete user with active orders}
|
|
309
|
+
3. **{Rule 3}**: {e.g., Password must be hashed before storage}
|
|
310
|
+
4. **{Rule 4}**: {e.g., Admin user cannot be deleted}
|
|
311
|
+
|
|
312
|
+
### 5.3 Validation Rules
|
|
313
|
+
|
|
314
|
+
| Validation Scenario | Validation Rule | Error Response | Error Code |
|
|
315
|
+
|--------------------|-----------------|----------------|------------|
|
|
316
|
+
| Data Annotations | {Field} validation attributes | Return 400 Bad Request | - |
|
|
317
|
+
| Business validation | {Business rule violation} | Return 400 Bad Request | - |
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
## 6. Dependency Analysis
|
|
322
|
+
|
|
323
|
+
<!-- AI-TAG: DEPENDENCIES -->
|
|
324
|
+
|
|
325
|
+
### 6.1 Module Dependencies
|
|
326
|
+
|
|
327
|
+
| Dependency Module | Dependency Type | Purpose | Impact Scope |
|
|
328
|
+
|-------------------|-----------------|---------|--------------|
|
|
329
|
+
| {Module A} | Strong | {Purpose description} | {Impact when unavailable} |
|
|
330
|
+
| {Module B} | Weak | {Purpose description} | {Degraded functionality} |
|
|
331
|
+
|
|
332
|
+
### 6.2 Service Dependencies
|
|
333
|
+
|
|
334
|
+
```mermaid
|
|
335
|
+
graph LR
|
|
336
|
+
A[This Controller] --> B[Dependency Service 1]
|
|
337
|
+
A --> C[Dependency Service 2]
|
|
338
|
+
B --> D[Database]
|
|
339
|
+
C --> D
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
**Diagram Source**
|
|
343
|
+
- [{Service}.cs](../../{serviceSourcePath})
|
|
344
|
+
|
|
345
|
+
### 6.3 External Dependencies
|
|
346
|
+
|
|
347
|
+
| External System | Interface Type | Call Scenario | Degradation Strategy |
|
|
348
|
+
|-----------------|----------------|---------------|---------------------|
|
|
349
|
+
| {Payment Gateway} | REST API | {Payment processing} | {Queue and retry} |
|
|
350
|
+
| {SMS Service} | REST API | {Verification code} | {Skip and log} |
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
## 7. Performance Considerations
|
|
355
|
+
|
|
356
|
+
<!-- AI-TAG: PERFORMANCE -->
|
|
357
|
+
|
|
358
|
+
### 7.1 Performance Bottlenecks
|
|
359
|
+
|
|
360
|
+
| Scenario | Bottleneck Description | Optimization Suggestion | Priority |
|
|
361
|
+
|----------|----------------------|------------------------|----------|
|
|
362
|
+
| {List query} | {Large data volume} | {Add index, use IQueryable} | High |
|
|
363
|
+
| {Batch operation} | {Database lock} | {Use async processing} | Medium |
|
|
364
|
+
|
|
365
|
+
### 7.2 Index Suggestions
|
|
366
|
+
|
|
367
|
+
| Table Name | Index Fields | Index Type | Scenario Description |
|
|
368
|
+
|------------|--------------|------------|---------------------|
|
|
369
|
+
| {table_name} | {field1, field2} | {COMPOSITE INDEX} | {Query optimization} |
|
|
370
|
+
| {table_name} | {field3} | {INDEX} | {Filter condition} |
|
|
371
|
+
|
|
372
|
+
### 7.3 Caching Strategy
|
|
373
|
+
|
|
374
|
+
| Cache Scenario | Cache Strategy | Expiration Time | Invalidation Strategy |
|
|
375
|
+
|----------------|----------------|-----------------|----------------------|
|
|
376
|
+
| {User info} | {Redis/IDistributedCache} | {30 minutes} | {Write-through} |
|
|
377
|
+
| {Configuration} | {IMemoryCache} | {5 minutes} | {TTL expiration} |
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
## 8. Troubleshooting Guide
|
|
382
|
+
|
|
383
|
+
<!-- AI-TAG: TROUBLESHOOTING -->
|
|
384
|
+
|
|
385
|
+
### 8.1 Common Issues
|
|
386
|
+
|
|
387
|
+
| Issue Symptom | Possible Cause | Troubleshooting Steps | Solution |
|
|
388
|
+
|---------------|----------------|----------------------|----------|
|
|
389
|
+
| {Query timeout} | {Missing index} | {Check SQL execution plan} | {Add index} |
|
|
390
|
+
| {Data inconsistency} | {Transaction failure} | {Check transaction logs} | {Manual correction} |
|
|
391
|
+
| {Permission denied} | {Role not assigned} | {Check JWT claims} | {Assign correct role} |
|
|
392
|
+
|
|
393
|
+
### 8.2 Error Code Reference
|
|
394
|
+
|
|
395
|
+
| Error Code | Error Description | Trigger Condition | Handling Suggestion |
|
|
396
|
+
|------------|-------------------|-------------------|---------------------|
|
|
397
|
+
| {400} | {Bad Request} | {Model validation failed} | {Check request body} |
|
|
398
|
+
| {401} | {Unauthorized} | {Invalid or expired JWT} | {Refresh token} |
|
|
399
|
+
| {500} | {Internal Server Error} | {Unhandled exception} | {Check server logs} |
|
|
400
|
+
|
|
401
|
+
---
|
|
402
|
+
|
|
403
|
+
## 9. Notes and Additional Information
|
|
404
|
+
|
|
405
|
+
<!-- AI-TAG: ADDITIONAL_NOTES -->
|
|
406
|
+
|
|
407
|
+
### 9.1 Compatibility Adaptation
|
|
408
|
+
|
|
409
|
+
- **.NET Version**: Compatible with .NET 6/7/8
|
|
410
|
+
- **EF Core Version**: Compatible with EF Core 6/7/8
|
|
411
|
+
- **Database**: SQL Server, PostgreSQL, MySQL supported
|
|
412
|
+
|
|
413
|
+
### 9.2 Pending Confirmations
|
|
414
|
+
|
|
415
|
+
- [ ] **{Pending 1}**: {e.g., Whether to implement API versioning}
|
|
416
|
+
- [ ] **{Pending 2}**: {e.g., Whether to add OData support}
|
|
417
|
+
|
|
418
|
+
---
|
|
419
|
+
|
|
420
|
+
## 10. Appendix
|
|
421
|
+
|
|
422
|
+
### 10.1 Best Practices
|
|
423
|
+
|
|
424
|
+
- {Best practice 1: e.g., Use async/await for all I/O operations}
|
|
425
|
+
- {Best practice 2: e.g., Implement repository pattern for testability}
|
|
426
|
+
- {Best practice 3: e.g., Use DTOs to decouple API from domain models}
|
|
427
|
+
|
|
428
|
+
### 10.2 Configuration Examples
|
|
429
|
+
|
|
430
|
+
```csharp
|
|
431
|
+
// Program.cs configuration
|
|
432
|
+
builder.Services.AddControllers();
|
|
433
|
+
builder.Services.AddDbContext<ApplicationDbContext>(options =>
|
|
434
|
+
options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")));
|
|
435
|
+
|
|
436
|
+
builder.Services.AddScoped<IUserService, UserService>();
|
|
437
|
+
builder.Services.AddScoped<IUserRepository, UserRepository>();
|
|
438
|
+
|
|
439
|
+
// JWT Authentication
|
|
440
|
+
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
|
|
441
|
+
.AddJwtBearer(options =>
|
|
442
|
+
{
|
|
443
|
+
options.Authority = builder.Configuration["Jwt:Authority"];
|
|
444
|
+
options.Audience = builder.Configuration["Jwt:Audience"];
|
|
445
|
+
});
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
### 10.3 Related Documents
|
|
449
|
+
|
|
450
|
+
- [API Documentation](link)
|
|
451
|
+
- [Database Design](link)
|
|
452
|
+
- [Module Overview](../{module-name}-overview.md)
|
|
453
|
+
|
|
454
|
+
---
|
|
455
|
+
|
|
456
|
+
**Document Status:** 📝 Draft / 👀 In Review / ✅ Published
|
|
457
|
+
**Last Updated:** {Date}
|
|
458
|
+
**Maintainer:** {Name}
|
|
459
|
+
**Related Module Document:** [Module Overview Document](../{{module-name}}-overview.md)
|
|
460
|
+
|
|
461
|
+
**Section Source**
|
|
462
|
+
- [{Controller}.cs](../../{controllerSourcePath})
|
|
463
|
+
- [{Service}.cs](../../{serviceSourcePath})
|
|
464
|
+
- [{Entity}.cs](../../{entitySourcePath})
|