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
package/.speccrew/skills/speccrew-knowledge-techs-generate/templates/CONVENTIONS-DEV-TEMPLATE.md
ADDED
|
@@ -0,0 +1,1433 @@
|
|
|
1
|
+
# {{platform_name}} Development Conventions
|
|
2
|
+
|
|
3
|
+
<cite>
|
|
4
|
+
**Files Referenced in This Document**
|
|
5
|
+
{{#each source_files}}
|
|
6
|
+
- [{{name}}]({{path}})
|
|
7
|
+
{{/each}}
|
|
8
|
+
</cite>
|
|
9
|
+
|
|
10
|
+
> **Target Audience**: devcrew-designer-{{platform_id}}, devcrew-dev-{{platform_id}}, devcrew-test-{{platform_id}}
|
|
11
|
+
|
|
12
|
+
## Table of Contents
|
|
13
|
+
|
|
14
|
+
1. [Convention Enforcement Levels](#1-convention-enforcement-levels)
|
|
15
|
+
2. [Project Structure & Directory Conventions (Platform-Specific)](#2-project-structure--directory-conventions-platform-specific)
|
|
16
|
+
3. [Naming Conventions](#3-naming-conventions)
|
|
17
|
+
4. [Code Comment Conventions](#4-code-comment-conventions)
|
|
18
|
+
5. [Code Style & Formatting](#5-code-style--formatting)
|
|
19
|
+
6. [Common Development Patterns](#6-common-development-patterns)
|
|
20
|
+
7. [API & Interface Conventions (Backend Only)](#7-api--interface-conventions-backend-only)
|
|
21
|
+
8. [Null & Empty Value Handling](#8-null--empty-value-handling)
|
|
22
|
+
9. [Transaction Conventions (Backend Only)](#9-transaction-conventions-backend-only)
|
|
23
|
+
10. [Exception Handling Conventions (Backend Only)](#10-exception-handling-conventions-backend-only)
|
|
24
|
+
11. [Sensitive Data Handling](#11-sensitive-data-handling)
|
|
25
|
+
12. [Internationalization (i18n)](#12-internationalization-i18n)
|
|
26
|
+
13. [Authorization & Permissions (Platform-Specific)](#13-authorization--permissions-platform-specific)
|
|
27
|
+
14. [Menu Registration & Routing (Frontend Only)](#14-menu-registration--routing-frontend-only)
|
|
28
|
+
15. [Data Dictionary Usage](#15-data-dictionary-usage)
|
|
29
|
+
16. [Logging Standards](#16-logging-standards)
|
|
30
|
+
17. [API Request Layer (Frontend Only)](#17-api-request-layer-frontend-only)
|
|
31
|
+
18. [Data Validation](#18-data-validation)
|
|
32
|
+
19. [Scheduled Jobs & Task Scheduling (Backend Only)](#19-scheduled-jobs--task-scheduling-backend-only)
|
|
33
|
+
20. [File Upload & Storage](#20-file-upload--storage)
|
|
34
|
+
21. [Performance Conventions](#21-performance-conventions)
|
|
35
|
+
22. [Security Conventions (Platform-Specific)](#22-security-conventions-platform-specific)
|
|
36
|
+
23. [Dependency Management](#23-dependency-management)
|
|
37
|
+
24. [Automated Enforcement](#24-automated-enforcement)
|
|
38
|
+
25. [Best Practices & Anti-Patterns](#25-best-practices--anti-patterns)
|
|
39
|
+
26. [Appendix](#appendix)
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 1. Convention Enforcement Levels
|
|
44
|
+
|
|
45
|
+
<!-- AI-TAG: ENFORCEMENT_LEVELS -->
|
|
46
|
+
<!-- Fill with actual enforcement levels used in the project. Define what is mandatory vs recommended vs reference. -->
|
|
47
|
+
|
|
48
|
+
All conventions in this document are classified into three enforcement levels:
|
|
49
|
+
|
|
50
|
+
| Level | Description | Enforcement | Examples |
|
|
51
|
+
|-------|-------------|-------------|----------|
|
|
52
|
+
| **Mandatory** | Must follow, CI blocks on violation | CI check + Code review gate | Naming conventions, parameter validation, exception handling |
|
|
53
|
+
| **Recommended** | Should follow, flagged in review | Code review reminder + best practice examples | Cache usage, batch operations, log levels |
|
|
54
|
+
| **Reference** | Optional, team agreement | Documentation reference | Branch naming details, comment style |
|
|
55
|
+
|
|
56
|
+
### Level Definitions for This Platform
|
|
57
|
+
|
|
58
|
+
{{#each enforcement_levels}}
|
|
59
|
+
#### {{level}}
|
|
60
|
+
|
|
61
|
+
{{description}}
|
|
62
|
+
|
|
63
|
+
**Enforcement:** {{enforcement}}
|
|
64
|
+
|
|
65
|
+
{{/each}}
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## 2. Project Structure & Directory Conventions (Platform-Specific)
|
|
70
|
+
|
|
71
|
+
<!-- AI-TAG: PROJECT_STRUCTURE -->
|
|
72
|
+
<!-- Backend platforms: describe controller/service/dal/convert layer structure. Frontend platforms: describe components/views/stores/composables structure. Mobile platforms: describe pages/components/store structure. -->
|
|
73
|
+
|
|
74
|
+
### Directory Structure
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
{{directory_structure}}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
```mermaid
|
|
81
|
+
graph TB
|
|
82
|
+
{{#each directory_components}}
|
|
83
|
+
{{id}}["{{name}}"]
|
|
84
|
+
{{/each}}
|
|
85
|
+
{{#each directory_relations}}
|
|
86
|
+
{{from}} --> {{to}}
|
|
87
|
+
{{/each}}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Package/Module Naming
|
|
91
|
+
|
|
92
|
+
| Layer | Naming Pattern | Example | Enforcement |
|
|
93
|
+
|-------|---------------|---------|-------------|
|
|
94
|
+
| Controller | `xxx.controller` | `user.controller` | Mandatory |
|
|
95
|
+
| Service | `xxx.service` | `user.service` | Mandatory |
|
|
96
|
+
| DAL/DAO | `xxx.dal` or `xxx.dao` | `user.dal` | Mandatory |
|
|
97
|
+
| Convert | `xxx.convert` | `user.convert` | Mandatory |
|
|
98
|
+
|
|
99
|
+
### Layered Directory Standards
|
|
100
|
+
|
|
101
|
+
{{#each layer_standards}}
|
|
102
|
+
#### {{layer}}
|
|
103
|
+
|
|
104
|
+
| Item | Convention | Example |
|
|
105
|
+
|------|-----------|---------|
|
|
106
|
+
| {{item}} | {{convention}} | {{example}} |
|
|
107
|
+
|
|
108
|
+
{{/each}}
|
|
109
|
+
|
|
110
|
+
**Section Source**
|
|
111
|
+
{{#each project_structure_sources}}
|
|
112
|
+
- [{{name}}]({{path}}#L{{start}}-L{{end}})
|
|
113
|
+
{{/each}}
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## 3. Naming Conventions
|
|
118
|
+
|
|
119
|
+
<!-- AI-TAG: NAMING_CONVENTIONS -->
|
|
120
|
+
<!-- Fill with actual naming conventions found in the project source code. -->
|
|
121
|
+
|
|
122
|
+
### File Naming
|
|
123
|
+
|
|
124
|
+
| Type | Pattern | Example | Enforcement |
|
|
125
|
+
|------|---------|---------|-------------|
|
|
126
|
+
{{#each file_naming}}
|
|
127
|
+
| {{type}} | {{pattern}} | {{example}} | {{enforcement}} |
|
|
128
|
+
{{/each}}
|
|
129
|
+
|
|
130
|
+
### Variables & Functions
|
|
131
|
+
|
|
132
|
+
| Type | Pattern | Example | Enforcement |
|
|
133
|
+
|------|---------|---------|-------------|
|
|
134
|
+
{{#each naming_conventions}}
|
|
135
|
+
| {{type}} | {{pattern}} | {{example}} | {{enforcement}} |
|
|
136
|
+
{{/each}}
|
|
137
|
+
|
|
138
|
+
### Classes & Types
|
|
139
|
+
|
|
140
|
+
| Type | Pattern | Example | Enforcement |
|
|
141
|
+
|------|---------|---------|-------------|
|
|
142
|
+
{{#each class_naming}}
|
|
143
|
+
| {{type}} | {{pattern}} | {{example}} | {{enforcement}} |
|
|
144
|
+
{{/each}}
|
|
145
|
+
|
|
146
|
+
### Constants
|
|
147
|
+
|
|
148
|
+
| Type | Pattern | Example | Enforcement |
|
|
149
|
+
|------|---------|---------|-------------|
|
|
150
|
+
{{#each constant_naming}}
|
|
151
|
+
| {{type}} | {{pattern}} | {{example}} | {{enforcement}} |
|
|
152
|
+
{{/each}}
|
|
153
|
+
|
|
154
|
+
### Database Naming (if backend platform)
|
|
155
|
+
|
|
156
|
+
| Object | Pattern | Example | Enforcement |
|
|
157
|
+
|--------|---------|---------|-------------|
|
|
158
|
+
{{#each database_naming}}
|
|
159
|
+
| {{object}} | {{pattern}} | {{example}} | {{enforcement}} |
|
|
160
|
+
{{/each}}
|
|
161
|
+
|
|
162
|
+
**Section Source**
|
|
163
|
+
{{#each naming_conventions_sources}}
|
|
164
|
+
- [{{name}}]({{path}}#L{{start}}-L{{end}})
|
|
165
|
+
{{/each}}
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## 4. Code Comment Conventions
|
|
170
|
+
|
|
171
|
+
<!-- AI-TAG: COMMENT_CONVENTIONS -->
|
|
172
|
+
<!-- Fill with actual comment conventions found in the project. Include Good/Bad examples. -->
|
|
173
|
+
|
|
174
|
+
### Class Comment Standards
|
|
175
|
+
|
|
176
|
+
| Element | Required | Format | Example |
|
|
177
|
+
|---------|----------|--------|---------|
|
|
178
|
+
| Class purpose | Yes | Description of functionality | `/** User service for managing user entities */` |
|
|
179
|
+
| Author | Optional | `@author name` | `@author John Doe` |
|
|
180
|
+
| Creation date | Optional | `@since YYYY-MM-DD` | `@since 2024-01-15` |
|
|
181
|
+
|
|
182
|
+
### Method Comment Standards
|
|
183
|
+
|
|
184
|
+
| Element | Required | Rule | Example |
|
|
185
|
+
|---------|----------|------|---------|
|
|
186
|
+
| Method purpose | Complex methods only | Brief description | `/** Query users by department */` |
|
|
187
|
+
| Parameters | Complex methods only | `@param name description` | `@param deptId department ID` |
|
|
188
|
+
| Return value | Complex methods only | `@return description` | `@return list of users` |
|
|
189
|
+
| Exceptions | If throws checked | `@throws ExceptionType reason` | `@throws NotFoundException if dept not exists` |
|
|
190
|
+
|
|
191
|
+
### Inline Comment Standards
|
|
192
|
+
|
|
193
|
+
| Scenario | Rule | Example |
|
|
194
|
+
|----------|------|---------|
|
|
195
|
+
| Complex logic | Explain "why", not "what" | `// Compensate for timezone offset` |
|
|
196
|
+
| Workarounds | Explain the issue and reference | `// FIXME: Remove after library upgrade (ISSUE-123)` |
|
|
197
|
+
| Algorithm steps | Numbered steps for clarity | `// Step 1: Validate input range` |
|
|
198
|
+
|
|
199
|
+
### Prohibited Practices
|
|
200
|
+
|
|
201
|
+
- ❌ Meaningless comments: `// Increment i by 1` for `i++`
|
|
202
|
+
- ❌ Outdated comments that don't match code
|
|
203
|
+
- ❌ Commented-out code blocks
|
|
204
|
+
- ❌ Redundant comments on obvious operations
|
|
205
|
+
|
|
206
|
+
### Good Example
|
|
207
|
+
|
|
208
|
+
```{{language}}
|
|
209
|
+
/**
|
|
210
|
+
* Calculates prorated refund amount based on usage period.
|
|
211
|
+
*
|
|
212
|
+
* @param subscription the subscription to refund
|
|
213
|
+
* @param cancelDate the cancellation effective date
|
|
214
|
+
* @return calculated refund amount, never null
|
|
215
|
+
* @throws IllegalArgumentException if subscription is expired
|
|
216
|
+
*/
|
|
217
|
+
public BigDecimal calculateRefund(Subscription subscription, LocalDate cancelDate) {
|
|
218
|
+
// Validate subscription is still active (not expired)
|
|
219
|
+
if (subscription.isExpired()) {
|
|
220
|
+
throw new IllegalArgumentException("Cannot refund expired subscription");
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// Calculate remaining days using 30-day month approximation
|
|
224
|
+
// per business requirement BR-2024-001
|
|
225
|
+
int remainingDays = calculateRemainingDays(subscription, cancelDate);
|
|
226
|
+
|
|
227
|
+
return subscription.getDailyRate().multiply(BigDecimal.valueOf(remainingDays));
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Bad Example
|
|
232
|
+
|
|
233
|
+
```{{language}}
|
|
234
|
+
// Calculate refund
|
|
235
|
+
public BigDecimal calc(Subscription s, LocalDate d) {
|
|
236
|
+
// Check if expired
|
|
237
|
+
if (s.isExpired()) {
|
|
238
|
+
throw new IllegalArgumentException("Expired");
|
|
239
|
+
}
|
|
240
|
+
int days = calcDays(s, d); // calculate days
|
|
241
|
+
return s.getRate().multiply(BigDecimal.valueOf(days)); // multiply
|
|
242
|
+
}
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
**Section Source**
|
|
246
|
+
{{#each comment_conventions_sources}}
|
|
247
|
+
- [{{name}}]({{path}}#L{{start}}-L{{end}})
|
|
248
|
+
{{/each}}
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## 5. Code Style & Formatting
|
|
253
|
+
|
|
254
|
+
<!-- AI-TAG: CODE_STYLE -->
|
|
255
|
+
<!-- List formatting and linting tools specific to this platform's language/runtime (e.g., Checkstyle for Java, ESLint for JavaScript/TypeScript, Flake8 for Python, SwiftLint for iOS). -->
|
|
256
|
+
|
|
257
|
+
### Formatting Rules
|
|
258
|
+
|
|
259
|
+
{{#each formatting_rules}}
|
|
260
|
+
- **{{name}}**: {{value}}
|
|
261
|
+
{{/each}}
|
|
262
|
+
|
|
263
|
+
### Lint Rules
|
|
264
|
+
|
|
265
|
+
{{#each linting_rules}}
|
|
266
|
+
#### {{tool}}
|
|
267
|
+
|
|
268
|
+
| Rule | Setting | Description | Enforcement |
|
|
269
|
+
|------|---------|-------------|-------------|
|
|
270
|
+
{{#each rules}}
|
|
271
|
+
| `{{rule}}` | {{setting}} | {{description}} | {{enforcement}} |
|
|
272
|
+
{{/each}}
|
|
273
|
+
|
|
274
|
+
{{/each}}
|
|
275
|
+
|
|
276
|
+
### Import/Export Patterns
|
|
277
|
+
|
|
278
|
+
{{import_export_patterns}}
|
|
279
|
+
|
|
280
|
+
### IDE Configuration
|
|
281
|
+
|
|
282
|
+
| IDE | Config File | Purpose |
|
|
283
|
+
|-----|-------------|---------|
|
|
284
|
+
{{#each ide_configs}}
|
|
285
|
+
| {{ide}} | [{{file}}]({{path}}) | {{purpose}} |
|
|
286
|
+
{{/each}}
|
|
287
|
+
|
|
288
|
+
**Section Source**
|
|
289
|
+
{{#each code_style_sources}}
|
|
290
|
+
- [{{name}}]({{path}}#L{{start}}-L{{end}})
|
|
291
|
+
{{/each}}
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## 6. Common Development Patterns
|
|
296
|
+
|
|
297
|
+
<!-- AI-TAG: DEV_PATTERNS -->
|
|
298
|
+
<!-- Fill with actual patterns and framework usage found in the project. -->
|
|
299
|
+
|
|
300
|
+
### Framework/Tool Usage Standards
|
|
301
|
+
|
|
302
|
+
{{#each framework_patterns}}
|
|
303
|
+
#### {{framework}}
|
|
304
|
+
|
|
305
|
+
| Aspect | Convention | Example |
|
|
306
|
+
|--------|-----------|---------|
|
|
307
|
+
| {{aspect}} | {{convention}} | {{example}} |
|
|
308
|
+
|
|
309
|
+
```{{language}}
|
|
310
|
+
{{code_example}}
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
{{/each}}
|
|
314
|
+
|
|
315
|
+
### DTO/VO/DO Conversion Standards
|
|
316
|
+
|
|
317
|
+
| Conversion | Pattern | Tool | Example |
|
|
318
|
+
|------------|---------|------|---------|
|
|
319
|
+
{{#each conversion_patterns}}
|
|
320
|
+
| {{conversion}} | {{pattern}} | {{tool}} | {{example}} |
|
|
321
|
+
{{/each}}
|
|
322
|
+
|
|
323
|
+
### Dependency Injection Patterns
|
|
324
|
+
|
|
325
|
+
| Scenario | Pattern | Example |
|
|
326
|
+
|----------|---------|---------|
|
|
327
|
+
{{#each di_patterns}}
|
|
328
|
+
| {{scenario}} | {{pattern}} | {{example}} |
|
|
329
|
+
{{/each}}
|
|
330
|
+
|
|
331
|
+
**Section Source**
|
|
332
|
+
{{#each dev_patterns_sources}}
|
|
333
|
+
- [{{name}}]({{path}}#L{{start}}-L{{end}})
|
|
334
|
+
{{/each}}
|
|
335
|
+
|
|
336
|
+
---
|
|
337
|
+
|
|
338
|
+
## 7. API & Interface Conventions (Backend Only)
|
|
339
|
+
|
|
340
|
+
<!-- AI-TAG: API_CONVENTIONS -->
|
|
341
|
+
<!-- If this platform is frontend or mobile, write 'Not applicable - API design is defined in the backend platform conventions.' -->
|
|
342
|
+
|
|
343
|
+
### RESTful Standards (if applicable)
|
|
344
|
+
|
|
345
|
+
| HTTP Method | URL Pattern | Purpose | Example |
|
|
346
|
+
|-------------|-------------|---------|---------|
|
|
347
|
+
| GET | `/resources` | List resources | `GET /users` |
|
|
348
|
+
| GET | `/resources/{id}` | Get single resource | `GET /users/123` |
|
|
349
|
+
| POST | `/resources` | Create resource | `POST /users` |
|
|
350
|
+
| PUT | `/resources/{id}` | Full update | `PUT /users/123` |
|
|
351
|
+
| PATCH | `/resources/{id}` | Partial update | `PATCH /users/123` |
|
|
352
|
+
| DELETE | `/resources/{id}` | Delete resource | `DELETE /users/123` |
|
|
353
|
+
|
|
354
|
+
### Unified Response Format
|
|
355
|
+
|
|
356
|
+
| Field | Type | Description | Required |
|
|
357
|
+
|-------|------|-------------|----------|
|
|
358
|
+
| `code` | Integer | Business status code | Yes |
|
|
359
|
+
| `message` | String | Human-readable message | Yes |
|
|
360
|
+
| `data` | T | Response payload | No |
|
|
361
|
+
| `timestamp` | Long | Response timestamp | Optional |
|
|
362
|
+
|
|
363
|
+
```{{language}}
|
|
364
|
+
{{response_format_example}}
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
### Pagination Standards
|
|
368
|
+
|
|
369
|
+
| Parameter | Type | Default | Description |
|
|
370
|
+
|-----------|------|---------|-------------|
|
|
371
|
+
{{#each pagination_params}}
|
|
372
|
+
| {{param}} | {{type}} | {{default}} | {{description}} |
|
|
373
|
+
{{/each}}
|
|
374
|
+
|
|
375
|
+
### API Version Management
|
|
376
|
+
|
|
377
|
+
| Strategy | Implementation | Example |
|
|
378
|
+
|----------|---------------|---------|
|
|
379
|
+
{{#each versioning_strategies}}
|
|
380
|
+
| {{strategy}} | {{implementation}} | {{example}} |
|
|
381
|
+
{{/each}}
|
|
382
|
+
|
|
383
|
+
### API Documentation Standards
|
|
384
|
+
|
|
385
|
+
| Tool | Configuration | Standards |
|
|
386
|
+
|------|--------------|-----------|
|
|
387
|
+
{{#each api_doc_tools}}
|
|
388
|
+
| {{tool}} | {{config}} | {{standards}} |
|
|
389
|
+
{{/each}}
|
|
390
|
+
|
|
391
|
+
**Section Source**
|
|
392
|
+
{{#each api_conventions_sources}}
|
|
393
|
+
- [{{name}}]({{path}}#L{{start}}-L{{end}})
|
|
394
|
+
{{/each}}
|
|
395
|
+
|
|
396
|
+
---
|
|
397
|
+
|
|
398
|
+
## 8. Null & Empty Value Handling
|
|
399
|
+
|
|
400
|
+
<!-- AI-TAG: NULL_HANDLING -->
|
|
401
|
+
<!-- Fill with actual null handling patterns found in the project. Include Good/Bad examples. -->
|
|
402
|
+
|
|
403
|
+
### Null Value Handling Rules
|
|
404
|
+
|
|
405
|
+
| Scenario | Rule | Enforcement |
|
|
406
|
+
|----------|------|-------------|
|
|
407
|
+
| Collection return | Never return null, use empty collection | Mandatory |
|
|
408
|
+
| Optional usage | Use Optional for nullable returns | Recommended |
|
|
409
|
+
| Parameter validation | Validate null at method entry | Mandatory |
|
|
410
|
+
| Null checks | Use Objects.requireNonNull or similar | Recommended |
|
|
411
|
+
|
|
412
|
+
### Empty Value Conventions
|
|
413
|
+
|
|
414
|
+
| Type | Empty Representation | Null Allowed? |
|
|
415
|
+
|------|---------------------|---------------|
|
|
416
|
+
| String | `""` (empty string) | No |
|
|
417
|
+
| List | `Collections.emptyList()` | No |
|
|
418
|
+
| Map | `Collections.emptyMap()` | No |
|
|
419
|
+
| Optional | `Optional.empty()` | N/A |
|
|
420
|
+
|
|
421
|
+
### DO/VO Field Null Semantics
|
|
422
|
+
|
|
423
|
+
| Field Type | Null Meaning | Empty Meaning |
|
|
424
|
+
|------------|--------------|---------------|
|
|
425
|
+
{{#each field_semantics}}
|
|
426
|
+
| {{field_type}} | {{null_meaning}} | {{empty_meaning}} |
|
|
427
|
+
{{/each}}
|
|
428
|
+
|
|
429
|
+
### Good Example
|
|
430
|
+
|
|
431
|
+
```{{language}}
|
|
432
|
+
// Return empty list instead of null
|
|
433
|
+
public List<User> findByDepartment(Long deptId) {
|
|
434
|
+
List<User> users = userMapper.selectByDeptId(deptId);
|
|
435
|
+
return users != null ? users : Collections.emptyList();
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
// Use Optional for potentially null values
|
|
439
|
+
public Optional<User> findById(Long id) {
|
|
440
|
+
return Optional.ofNullable(userMapper.selectById(id));
|
|
441
|
+
}
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
### Bad Example
|
|
445
|
+
|
|
446
|
+
```{{language}}
|
|
447
|
+
// Don't return null for collections
|
|
448
|
+
public List<User> findByDepartment(Long deptId) {
|
|
449
|
+
List<User> users = userMapper.selectByDeptId(deptId);
|
|
450
|
+
return users; // May return null - BAD
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
// Don't use null without checking
|
|
454
|
+
public void processUser(User user) {
|
|
455
|
+
String name = user.getName(); // NPE risk - BAD
|
|
456
|
+
System.out.println(name.toUpperCase());
|
|
457
|
+
}
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
**Section Source**
|
|
461
|
+
{{#each null_handling_sources}}
|
|
462
|
+
- [{{name}}]({{path}}#L{{start}}-L{{end}})
|
|
463
|
+
{{/each}}
|
|
464
|
+
|
|
465
|
+
---
|
|
466
|
+
|
|
467
|
+
## 9. Transaction Conventions (Backend Only)
|
|
468
|
+
|
|
469
|
+
<!-- AI-TAG: TRANSACTION_CONVENTIONS -->
|
|
470
|
+
<!-- If this platform is frontend or mobile, write 'Not applicable - transactions are managed at the backend layer.' -->
|
|
471
|
+
|
|
472
|
+
### transaction_annotation Usage Standards (if backend platform)
|
|
473
|
+
|
|
474
|
+
| Aspect | Rule | Enforcement |
|
|
475
|
+
|--------|------|-------------|
|
|
476
|
+
| Placement | On service methods, not DAO | Mandatory |
|
|
477
|
+
| Read-only | Add to query methods | Recommended |
|
|
478
|
+
| Public methods only | Transactional requires public | Mandatory |
|
|
479
|
+
|
|
480
|
+
### Prohibited Practices
|
|
481
|
+
|
|
482
|
+
- ❌ Adding `transaction_annotation` to simple query methods without read-only
|
|
483
|
+
- ❌ Large transactions spanning multiple business operations
|
|
484
|
+
- ❌ Calling transactional methods within same class (self-invocation)
|
|
485
|
+
- ❌ Catching exceptions without proper rollback handling
|
|
486
|
+
|
|
487
|
+
### Propagation Behavior Guidelines
|
|
488
|
+
|
|
489
|
+
| Scenario | Propagation | Reason |
|
|
490
|
+
|----------|-------------|--------|
|
|
491
|
+
| Default service method | REQUIRED | Join existing or create new |
|
|
492
|
+
| Independent operation | REQUIRES_NEW | Must commit regardless |
|
|
493
|
+
| Optional operation | SUPPORTS | Participate if exists |
|
|
494
|
+
| Nested operation | NESTED | Can rollback independently |
|
|
495
|
+
|
|
496
|
+
### Isolation Level Selection
|
|
497
|
+
|
|
498
|
+
| Scenario | Isolation | Reason |
|
|
499
|
+
|----------|-----------|--------|
|
|
500
|
+
| Default | READ_COMMITTED | Balance consistency/performance |
|
|
501
|
+
| Financial operations | SERIALIZABLE | Strict consistency required |
|
|
502
|
+
| Read-heavy reporting | READ_UNCOMMITTED | Performance over consistency |
|
|
503
|
+
|
|
504
|
+
### Transaction Splitting Best Practices
|
|
505
|
+
|
|
506
|
+
```{{language}}
|
|
507
|
+
// Good: Split large transaction into smaller units
|
|
508
|
+
@Service
|
|
509
|
+
public class OrderService {
|
|
510
|
+
|
|
511
|
+
@transaction_annotation
|
|
512
|
+
public void createOrder(OrderDTO dto) {
|
|
513
|
+
// Step 1: Validate and create order (in transaction)
|
|
514
|
+
Order order = createOrderEntity(dto);
|
|
515
|
+
|
|
516
|
+
// Step 2: Process payment (separate transaction)
|
|
517
|
+
paymentService.processPayment(order);
|
|
518
|
+
|
|
519
|
+
// Step 3: Send notification (outside transaction)
|
|
520
|
+
notificationService.sendOrderConfirmation(order);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
### Good Example
|
|
526
|
+
|
|
527
|
+
```{{language}}
|
|
528
|
+
@Service
|
|
529
|
+
public class UserService {
|
|
530
|
+
|
|
531
|
+
@transaction_annotation(readOnly = true)
|
|
532
|
+
public User getUserById(Long id) {
|
|
533
|
+
return userMapper.selectById(id);
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
@transaction_annotation(rollbackFor = Exception.class)
|
|
537
|
+
public void transfer(Long fromId, Long toId, BigDecimal amount) {
|
|
538
|
+
// Both operations in same transaction
|
|
539
|
+
debit(fromId, amount);
|
|
540
|
+
credit(toId, amount);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
### Bad Example
|
|
546
|
+
|
|
547
|
+
```{{language}}
|
|
548
|
+
@Service
|
|
549
|
+
public class UserService {
|
|
550
|
+
|
|
551
|
+
// BAD: Transactional on private method
|
|
552
|
+
@transaction_annotation
|
|
553
|
+
private void updateUser(User user) {
|
|
554
|
+
userMapper.update(user);
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
// BAD: No readOnly on query
|
|
558
|
+
@transaction_annotation
|
|
559
|
+
public User getUser(Long id) {
|
|
560
|
+
return userMapper.selectById(id);
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
// BAD: Self-invocation bypasses transaction
|
|
564
|
+
public void processOrder(Order order) {
|
|
565
|
+
saveOrder(order); // Transactional ignored!
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
@transaction_annotation
|
|
569
|
+
public void saveOrder(Order order) {
|
|
570
|
+
orderMapper.insert(order);
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
**Section Source**
|
|
576
|
+
{{#each transaction_sources}}
|
|
577
|
+
- [{{name}}]({{path}}#L{{start}}-L{{end}})
|
|
578
|
+
{{/each}}
|
|
579
|
+
|
|
580
|
+
---
|
|
581
|
+
|
|
582
|
+
## 10. Exception Handling Conventions (Backend Only)
|
|
583
|
+
|
|
584
|
+
<!-- AI-TAG: EXCEPTION_CONVENTIONS -->
|
|
585
|
+
<!-- If this platform is frontend, describe frontend error handling (try/catch, error boundaries, global error handlers) instead. If mobile, describe mobile error handling patterns. -->
|
|
586
|
+
|
|
587
|
+
### Exception Hierarchy (if backend platform)
|
|
588
|
+
|
|
589
|
+
```
|
|
590
|
+
BaseException
|
|
591
|
+
├── ServiceException (business logic errors)
|
|
592
|
+
├── BizException (domain-specific errors)
|
|
593
|
+
└── SystemException (infrastructure errors)
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
| Exception Type | Use Case | HTTP Status | Example |
|
|
597
|
+
|----------------|----------|-------------|---------|
|
|
598
|
+
| ServiceException | Business rule violation | 400/422 | Insufficient balance |
|
|
599
|
+
| BizException | Domain constraint violation | 409 | Duplicate email |
|
|
600
|
+
| SystemException | Infrastructure failure | 500 | Database timeout |
|
|
601
|
+
|
|
602
|
+
### Error Code Standards
|
|
603
|
+
|
|
604
|
+
| Code Range | Category | Example |
|
|
605
|
+
|------------|----------|---------|
|
|
606
|
+
{{#each error_code_ranges}}
|
|
607
|
+
| {{range}} | {{category}} | {{example}} |
|
|
608
|
+
{{/each}}
|
|
609
|
+
|
|
610
|
+
### Prohibited Practices
|
|
611
|
+
|
|
612
|
+
- ❌ Throwing raw `RuntimeException` or `Exception`
|
|
613
|
+
- ❌ Swallowing exceptions without logging
|
|
614
|
+
- ❌ Catching `Exception` or `Throwable` broadly without re-throwing
|
|
615
|
+
- ❌ Returning error codes instead of throwing exceptions
|
|
616
|
+
|
|
617
|
+
### Exception Handling Best Practices
|
|
618
|
+
|
|
619
|
+
```{{language}}
|
|
620
|
+
// Good: Specific exception with meaningful message
|
|
621
|
+
if (user == null) {
|
|
622
|
+
throw new ServiceException(ErrorCode.USER_NOT_FOUND, "User not found: " + userId);
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
// Good: Wrap and re-throw with context
|
|
626
|
+
try {
|
|
627
|
+
paymentGateway.charge(card, amount);
|
|
628
|
+
} catch (PaymentException e) {
|
|
629
|
+
log.error("Payment failed for order: {}", orderId, e);
|
|
630
|
+
throw new ServiceException(ErrorCode.PAYMENT_FAILED, "Payment processing failed", e);
|
|
631
|
+
}
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
**Section Source**
|
|
635
|
+
{{#each exception_sources}}
|
|
636
|
+
- [{{name}}]({{path}}#L{{start}}-L{{end}})
|
|
637
|
+
{{/each}}
|
|
638
|
+
|
|
639
|
+
---
|
|
640
|
+
|
|
641
|
+
## 11. Sensitive Data Handling
|
|
642
|
+
|
|
643
|
+
<!-- AI-TAG: SENSITIVE_DATA -->
|
|
644
|
+
<!-- Fill with actual sensitive data handling patterns found in the project. -->
|
|
645
|
+
|
|
646
|
+
### Data Masking Rules
|
|
647
|
+
|
|
648
|
+
| Data Type | Masking Rule | Example |
|
|
649
|
+
|-----------|--------------|---------|
|
|
650
|
+
| Mobile Phone | Show first 3 and last 4 digits | `138****8888` |
|
|
651
|
+
| ID Card | Show first 6 and last 4 digits | `110101********1234` |
|
|
652
|
+
| Email | Show first 2 and domain | `ab****@example.com` |
|
|
653
|
+
| Bank Card | Show last 4 digits only | `**** **** **** 1234` |
|
|
654
|
+
| Password | Never log or display | `[PROTECTED]` |
|
|
655
|
+
|
|
656
|
+
### Password Storage Standards
|
|
657
|
+
|
|
658
|
+
| Aspect | Requirement | Implementation |
|
|
659
|
+
|--------|-------------|----------------|
|
|
660
|
+
| Hashing Algorithm | Use BCrypt/Argon2 | `BCryptPasswordEncoder` |
|
|
661
|
+
| Salt | Auto-generated per password | Built into BCrypt |
|
|
662
|
+
| Plain Text | Strictly prohibited | N/A |
|
|
663
|
+
| MD5/SHA1 | Deprecated, do not use | N/A |
|
|
664
|
+
|
|
665
|
+
### Log Sensitive Field Masking
|
|
666
|
+
|
|
667
|
+
```{{language}}
|
|
668
|
+
// Good: Mask sensitive fields in logs
|
|
669
|
+
log.info("User registered: phone={}, email={}",
|
|
670
|
+
maskPhone(user.getPhone()),
|
|
671
|
+
maskEmail(user.getEmail()));
|
|
672
|
+
// Output: User registered: phone=138****8888, email=jo****@example.com
|
|
673
|
+
```
|
|
674
|
+
|
|
675
|
+
### API Response Desensitization
|
|
676
|
+
|
|
677
|
+
| Scenario | Approach | Example |
|
|
678
|
+
|----------|----------|---------|
|
|
679
|
+
| Internal APIs | Full data with authentication | Complete user object |
|
|
680
|
+
| External APIs | Masked sensitive fields | Masked phone/email |
|
|
681
|
+
| Public APIs | Minimal data exposure | User ID and name only |
|
|
682
|
+
|
|
683
|
+
**Section Source**
|
|
684
|
+
{{#each sensitive_data_sources}}
|
|
685
|
+
- [{{name}}]({{path}}#L{{start}}-L{{end}})
|
|
686
|
+
{{/each}}
|
|
687
|
+
|
|
688
|
+
---
|
|
689
|
+
|
|
690
|
+
## 12. Internationalization (i18n)
|
|
691
|
+
|
|
692
|
+
<!-- AI-TAG: I18N_SETUP -->
|
|
693
|
+
<!-- Fill this section with actual i18n setup found in the project. If the project does not use i18n, write "Not applicable - this platform does not implement i18n." -->
|
|
694
|
+
|
|
695
|
+
### i18n Framework & Configuration
|
|
696
|
+
|
|
697
|
+
| Item | Detail |
|
|
698
|
+
|------|--------|
|
|
699
|
+
| Framework | i18n_framework |
|
|
700
|
+
| Default Locale | default_locale |
|
|
701
|
+
| Supported Locales | supported_locales |
|
|
702
|
+
| Locale File Location | locale_dir |
|
|
703
|
+
|
|
704
|
+
### Language File Organization
|
|
705
|
+
|
|
706
|
+
| Strategy | Description | Example |
|
|
707
|
+
|----------|-------------|---------|
|
|
708
|
+
| strategy | description | example_path |
|
|
709
|
+
|
|
710
|
+
### Translation Key Conventions
|
|
711
|
+
|
|
712
|
+
| Convention | Rule | Example |
|
|
713
|
+
|-----------|------|---------|
|
|
714
|
+
| Key format | rule | example |
|
|
715
|
+
| Namespace | rule | example |
|
|
716
|
+
|
|
717
|
+
### Usage in Code
|
|
718
|
+
|
|
719
|
+
```lang
|
|
720
|
+
// Example of using i18n in this platform
|
|
721
|
+
code_example
|
|
722
|
+
```
|
|
723
|
+
|
|
724
|
+
### Backend Internationalization (if backend platform)
|
|
725
|
+
|
|
726
|
+
<!-- AI-TAG: BACKEND_I18N -->
|
|
727
|
+
<!-- Fill if the backend has message internationalization. If not applicable, write "Not applicable." -->
|
|
728
|
+
|
|
729
|
+
| Item | Detail |
|
|
730
|
+
|------|--------|
|
|
731
|
+
| Message Source | message_source (e.g., messages.properties, database) |
|
|
732
|
+
| Error Message i18n | error_i18n_approach |
|
|
733
|
+
| Validation Message i18n | validation_i18n_approach |
|
|
734
|
+
| Response Message i18n | response_i18n_approach |
|
|
735
|
+
|
|
736
|
+
```lang
|
|
737
|
+
// Example of internationalized error/validation message
|
|
738
|
+
backend_i18n_example
|
|
739
|
+
```
|
|
740
|
+
|
|
741
|
+
---
|
|
742
|
+
|
|
743
|
+
## 13. Authorization & Permissions (Platform-Specific)
|
|
744
|
+
|
|
745
|
+
<!-- AI-TAG: PERMISSION_SETUP -->
|
|
746
|
+
<!-- Fill with actual permission implementation found in source code -->
|
|
747
|
+
|
|
748
|
+
### Backend Authorization (if backend platform)
|
|
749
|
+
|
|
750
|
+
<!-- AI-TAG: BACKEND_PERMISSION -->
|
|
751
|
+
<!-- Fill with backend permission framework: annotations, interceptors, filters. If frontend platform, skip this subsection. -->
|
|
752
|
+
|
|
753
|
+
| Item | Detail |
|
|
754
|
+
|------|--------|
|
|
755
|
+
| Permission Framework | permission_framework (e.g., Spring Security, Shiro, Passport.js, Django permissions) |
|
|
756
|
+
| Permission Check Mechanism | check_mechanism (e.g., annotation, middleware, decorator) |
|
|
757
|
+
| Permission Annotation/Decorator | permission_annotation |
|
|
758
|
+
| Data Permission | data_permission_approach |
|
|
759
|
+
|
|
760
|
+
```lang
|
|
761
|
+
// Example of backend permission check
|
|
762
|
+
backend_permission_example
|
|
763
|
+
```
|
|
764
|
+
|
|
765
|
+
### Frontend Permission UI (if frontend platform)
|
|
766
|
+
|
|
767
|
+
<!-- AI-TAG: FRONTEND_PERMISSION -->
|
|
768
|
+
<!-- Fill with frontend permission implementation: route guards, directives, state management. If backend platform, skip this subsection. -->
|
|
769
|
+
|
|
770
|
+
| Item | Detail |
|
|
771
|
+
|------|--------|
|
|
772
|
+
| Permission Storage | permission_storage (e.g., Vuex/Pinia store, Redux, localStorage) |
|
|
773
|
+
| Permission Source API | permission_api |
|
|
774
|
+
| Route Guard | route_guard_impl |
|
|
775
|
+
| Permission Directive/HOC | permission_directive |
|
|
776
|
+
|
|
777
|
+
```lang
|
|
778
|
+
// Example of frontend permission check
|
|
779
|
+
frontend_permission_example
|
|
780
|
+
```
|
|
781
|
+
|
|
782
|
+
---
|
|
783
|
+
|
|
784
|
+
## 14. Menu Registration & Routing (Frontend Only)
|
|
785
|
+
|
|
786
|
+
<!-- AI-TAG: MENU_REGISTRATION -->
|
|
787
|
+
<!-- If this platform is backend, write 'Not applicable - menu registration is handled at the frontend platform. Backend exposes menu data via API.' -->
|
|
788
|
+
|
|
789
|
+
### Menu Data Source
|
|
790
|
+
|
|
791
|
+
| Item | Detail |
|
|
792
|
+
|------|--------|
|
|
793
|
+
| Source Type | menu_source_type (e.g., static config, dynamic API) |
|
|
794
|
+
| API Endpoint | menu_api |
|
|
795
|
+
| Local Config | menu_config_path |
|
|
796
|
+
|
|
797
|
+
### Menu-to-Route Mapping
|
|
798
|
+
|
|
799
|
+
| Menu Field | Route Property | Description |
|
|
800
|
+
|-----------|---------------|-------------|
|
|
801
|
+
| field | property | description |
|
|
802
|
+
|
|
803
|
+
### Adding a New Menu Item
|
|
804
|
+
|
|
805
|
+
```
|
|
806
|
+
Step 1: step1
|
|
807
|
+
Step 2: step2
|
|
808
|
+
Step 3: step3
|
|
809
|
+
```
|
|
810
|
+
|
|
811
|
+
---
|
|
812
|
+
|
|
813
|
+
## 15. Data Dictionary Usage
|
|
814
|
+
|
|
815
|
+
<!-- AI-TAG: DICTIONARY_USAGE -->
|
|
816
|
+
<!-- Fill with actual dictionary usage patterns found in source code -->
|
|
817
|
+
|
|
818
|
+
### Dictionary Infrastructure
|
|
819
|
+
|
|
820
|
+
| Item | Detail |
|
|
821
|
+
|------|--------|
|
|
822
|
+
| Dictionary Source | dict_source (e.g., API, local enum) |
|
|
823
|
+
| Cache Strategy | cache_strategy |
|
|
824
|
+
| Dictionary Component | dict_component (e.g., DictTag) |
|
|
825
|
+
|
|
826
|
+
### Using Dictionary in Templates
|
|
827
|
+
|
|
828
|
+
```lang
|
|
829
|
+
// Example of rendering dictionary values
|
|
830
|
+
dict_template_example
|
|
831
|
+
```
|
|
832
|
+
|
|
833
|
+
### Using Dictionary in Logic
|
|
834
|
+
|
|
835
|
+
```lang
|
|
836
|
+
// Example of dictionary lookup in code
|
|
837
|
+
dict_logic_example
|
|
838
|
+
```
|
|
839
|
+
|
|
840
|
+
### Dictionary Code Conventions
|
|
841
|
+
|
|
842
|
+
| Convention | Rule | Example |
|
|
843
|
+
|-----------|------|---------|
|
|
844
|
+
| Dict type naming | rule | example |
|
|
845
|
+
| Dict value type | rule | example |
|
|
846
|
+
|
|
847
|
+
---
|
|
848
|
+
|
|
849
|
+
## 16. Logging Standards
|
|
850
|
+
|
|
851
|
+
<!-- AI-TAG: LOGGING_STANDARDS -->
|
|
852
|
+
<!-- Fill with actual logging practices found in source code -->
|
|
853
|
+
|
|
854
|
+
### Logging Framework & Configuration
|
|
855
|
+
|
|
856
|
+
| Item | Detail |
|
|
857
|
+
|------|--------|
|
|
858
|
+
| Framework | logging_framework (e.g., SLF4J+Logback, Log4j2, console.log wrapper, winston) |
|
|
859
|
+
| Config File | config_file |
|
|
860
|
+
| Log Output | log_output (e.g., console, file, ELK) |
|
|
861
|
+
|
|
862
|
+
### Log Level Conventions
|
|
863
|
+
|
|
864
|
+
| Level | When to Use | Example |
|
|
865
|
+
|-------|------------|---------|
|
|
866
|
+
| ERROR | error_usage | error_example |
|
|
867
|
+
| WARN | warn_usage | warn_example |
|
|
868
|
+
| INFO | info_usage | info_example |
|
|
869
|
+
| DEBUG | debug_usage | debug_example |
|
|
870
|
+
|
|
871
|
+
### Operation/Audit Log
|
|
872
|
+
|
|
873
|
+
<!-- AI-TAG: AUDIT_LOG -->
|
|
874
|
+
<!-- Fill if the project has operation log or audit trail mechanism -->
|
|
875
|
+
|
|
876
|
+
| Item | Detail |
|
|
877
|
+
|------|--------|
|
|
878
|
+
| Mechanism | audit_mechanism (e.g., AOP annotation, interceptor, manual) |
|
|
879
|
+
| Annotation/Decorator | audit_annotation (e.g., @OperateLog) |
|
|
880
|
+
| Storage | audit_storage (e.g., database table, log file) |
|
|
881
|
+
|
|
882
|
+
```lang
|
|
883
|
+
// Example of operation log usage
|
|
884
|
+
audit_log_example
|
|
885
|
+
```
|
|
886
|
+
|
|
887
|
+
### Frontend Error Reporting (if frontend platform)
|
|
888
|
+
|
|
889
|
+
| Item | Detail |
|
|
890
|
+
|------|--------|
|
|
891
|
+
| Error Boundary | error_boundary |
|
|
892
|
+
| Error Reporting | error_reporting (e.g., Sentry, custom API) |
|
|
893
|
+
| Console Policy | console_policy (e.g., remove console.log in production) |
|
|
894
|
+
|
|
895
|
+
---
|
|
896
|
+
|
|
897
|
+
## 17. API Request Layer (Frontend Only)
|
|
898
|
+
|
|
899
|
+
<!-- AI-TAG: API_REQUEST_LAYER -->
|
|
900
|
+
<!-- If this platform is backend, write 'Not applicable - backend does not have a frontend request layer. See backend API conventions instead.' -->
|
|
901
|
+
|
|
902
|
+
### HTTP Client Setup
|
|
903
|
+
|
|
904
|
+
| Item | Detail |
|
|
905
|
+
|------|--------|
|
|
906
|
+
| Library | http_library (e.g., Axios, fetch, uni.request) |
|
|
907
|
+
| Base Config File | config_file |
|
|
908
|
+
| Base URL | base_url_config |
|
|
909
|
+
| Timeout | timeout |
|
|
910
|
+
|
|
911
|
+
### Request Interceptors
|
|
912
|
+
|
|
913
|
+
| Interceptor | Purpose | Implementation |
|
|
914
|
+
|------------|---------|---------------|
|
|
915
|
+
| Auth Token | auth_token_impl | code_location |
|
|
916
|
+
| Tenant Header | tenant_header_impl | code_location |
|
|
917
|
+
| custom_interceptor | purpose | code_location |
|
|
918
|
+
|
|
919
|
+
### Response Interceptors
|
|
920
|
+
|
|
921
|
+
| Interceptor | Purpose | Implementation |
|
|
922
|
+
|------------|---------|---------------|
|
|
923
|
+
| Error Handler | error_handler | code_location |
|
|
924
|
+
| Token Refresh | token_refresh | code_location |
|
|
925
|
+
| custom_interceptor | purpose | code_location |
|
|
926
|
+
|
|
927
|
+
### API Module Organization
|
|
928
|
+
|
|
929
|
+
| Convention | Rule | Example |
|
|
930
|
+
|-----------|------|---------|
|
|
931
|
+
| File naming | rule | example |
|
|
932
|
+
| Function naming | rule | example |
|
|
933
|
+
| Base path | rule | example |
|
|
934
|
+
|
|
935
|
+
```lang
|
|
936
|
+
// Example of a typical API module definition
|
|
937
|
+
api_module_example
|
|
938
|
+
```
|
|
939
|
+
|
|
940
|
+
---
|
|
941
|
+
|
|
942
|
+
## 18. Data Validation
|
|
943
|
+
|
|
944
|
+
<!-- AI-TAG: DATA_VALIDATION -->
|
|
945
|
+
<!-- Fill with actual validation patterns found in source code -->
|
|
946
|
+
|
|
947
|
+
### Backend Validation (if backend platform)
|
|
948
|
+
|
|
949
|
+
| Item | Detail |
|
|
950
|
+
|------|--------|
|
|
951
|
+
| Framework | validation_framework (e.g., JSR 380/Hibernate Validator, class-validator) |
|
|
952
|
+
| Validation Groups | validation_groups (e.g., Create.class, Update.class) |
|
|
953
|
+
|
|
954
|
+
| Annotation/Decorator | Purpose | Example |
|
|
955
|
+
|----------------------|---------|---------|
|
|
956
|
+
| annotation | purpose | example |
|
|
957
|
+
|
|
958
|
+
```lang
|
|
959
|
+
// Example of validation usage in DTO/Request
|
|
960
|
+
backend_validation_example
|
|
961
|
+
```
|
|
962
|
+
|
|
963
|
+
### Frontend Validation (if frontend platform)
|
|
964
|
+
|
|
965
|
+
| Item | Detail |
|
|
966
|
+
|------|--------|
|
|
967
|
+
| Framework | frontend_validation (e.g., Element Plus form rules, VeeValidate) |
|
|
968
|
+
| Validation Timing | validation_timing (e.g., on blur, on submit) |
|
|
969
|
+
|
|
970
|
+
```lang
|
|
971
|
+
// Example of form validation rules
|
|
972
|
+
frontend_validation_example
|
|
973
|
+
```
|
|
974
|
+
|
|
975
|
+
### Custom Validators
|
|
976
|
+
|
|
977
|
+
| Validator | Purpose | Usage |
|
|
978
|
+
|-----------|---------|-------|
|
|
979
|
+
| validator | purpose | usage |
|
|
980
|
+
|
|
981
|
+
---
|
|
982
|
+
|
|
983
|
+
## 19. Scheduled Jobs & Task Scheduling (Backend Only)
|
|
984
|
+
|
|
985
|
+
<!-- AI-TAG: SCHEDULED_JOBS -->
|
|
986
|
+
<!-- If this platform is frontend or mobile, write 'Not applicable - scheduled jobs run on the backend.' -->
|
|
987
|
+
|
|
988
|
+
### Job Framework
|
|
989
|
+
|
|
990
|
+
| Item | Detail |
|
|
991
|
+
|------|--------|
|
|
992
|
+
| Framework | job_framework (e.g., Spring @Scheduled, Quartz, XXL-Job, node-cron) |
|
|
993
|
+
| Config Location | job_config |
|
|
994
|
+
| Management UI | job_management_ui |
|
|
995
|
+
|
|
996
|
+
### Job Registration Pattern
|
|
997
|
+
|
|
998
|
+
```lang
|
|
999
|
+
// Example of registering a scheduled job
|
|
1000
|
+
job_registration_example
|
|
1001
|
+
```
|
|
1002
|
+
|
|
1003
|
+
### Existing Jobs Overview
|
|
1004
|
+
|
|
1005
|
+
| Job Name | Schedule | Purpose | Source |
|
|
1006
|
+
|----------|----------|---------|--------|
|
|
1007
|
+
| job_name | cron_expression | purpose | [Source]({{source_file}}) |
|
|
1008
|
+
|
|
1009
|
+
---
|
|
1010
|
+
|
|
1011
|
+
## 20. File Upload & Storage
|
|
1012
|
+
|
|
1013
|
+
<!-- AI-TAG: FILE_STORAGE -->
|
|
1014
|
+
<!-- Fill with actual file handling patterns found in source code. If not applicable, write "Not applicable." -->
|
|
1015
|
+
|
|
1016
|
+
### Storage Strategy
|
|
1017
|
+
|
|
1018
|
+
| Item | Detail |
|
|
1019
|
+
|------|--------|
|
|
1020
|
+
| Storage Backend | storage_backend (e.g., local disk, S3/OSS, MinIO, database) |
|
|
1021
|
+
| Upload API | upload_api |
|
|
1022
|
+
| Max File Size | max_size |
|
|
1023
|
+
| Allowed Types | allowed_types |
|
|
1024
|
+
|
|
1025
|
+
### File Path Convention
|
|
1026
|
+
|
|
1027
|
+
| Convention | Rule | Example |
|
|
1028
|
+
|-----------|------|---------|
|
|
1029
|
+
| Path format | rule | example |
|
|
1030
|
+
| Naming strategy | rule | example |
|
|
1031
|
+
|
|
1032
|
+
### Frontend Upload Component (if frontend platform)
|
|
1033
|
+
|
|
1034
|
+
| Item | Detail |
|
|
1035
|
+
|------|--------|
|
|
1036
|
+
| Component | upload_component |
|
|
1037
|
+
| Usage Pattern | usage_pattern |
|
|
1038
|
+
|
|
1039
|
+
```lang
|
|
1040
|
+
// Example of file upload usage
|
|
1041
|
+
upload_example
|
|
1042
|
+
```
|
|
1043
|
+
|
|
1044
|
+
---
|
|
1045
|
+
|
|
1046
|
+
## 21. Performance Conventions
|
|
1047
|
+
|
|
1048
|
+
<!-- AI-TAG: PERFORMANCE_CONVENTIONS -->
|
|
1049
|
+
<!-- Backend: focus on API latency, throughput, database query optimization. Frontend: focus on page load time, bundle size, render performance, memory usage. -->
|
|
1050
|
+
|
|
1051
|
+
### JVM Configuration (if backend platform)
|
|
1052
|
+
|
|
1053
|
+
| Parameter | Recommendation | Rationale |
|
|
1054
|
+
|-----------|----------------|-----------|
|
|
1055
|
+
{{#each jvm_configs}}
|
|
1056
|
+
| {{param}} | {{recommendation}} | {{rationale}} |
|
|
1057
|
+
{{/each}}
|
|
1058
|
+
|
|
1059
|
+
### API Performance Standards (Backend Only)
|
|
1060
|
+
|
|
1061
|
+
<!-- AI-TAG: API_PERFORMANCE -->
|
|
1062
|
+
<!-- If this platform is frontend, skip this subsection and fill the Page Performance Standards instead. -->
|
|
1063
|
+
|
|
1064
|
+
| Metric | Target | Maximum | Measurement |
|
|
1065
|
+
|--------|--------|---------|-------------|
|
|
1066
|
+
| P50 Response Time | {{p50_target}} | {{p50_max}} | APM/Metrics |
|
|
1067
|
+
| P95 Response Time | {{p95_target}} | {{p95_max}} | APM/Metrics |
|
|
1068
|
+
| P99 Response Time | {{p99_target}} | {{p99_max}} | APM/Metrics |
|
|
1069
|
+
| Error Rate | < {{error_target}}% | {{error_max}}% | Monitoring |
|
|
1070
|
+
|
|
1071
|
+
### Page Performance Standards (Frontend Only)
|
|
1072
|
+
|
|
1073
|
+
<!-- AI-TAG: PAGE_PERFORMANCE -->
|
|
1074
|
+
<!-- If this platform is backend, skip this subsection and fill the API Performance Standards instead. -->
|
|
1075
|
+
|
|
1076
|
+
| Metric | Target | Measurement |
|
|
1077
|
+
|--------|--------|-------------|
|
|
1078
|
+
| First Contentful Paint (FCP) | fcp_target | Lighthouse |
|
|
1079
|
+
| Largest Contentful Paint (LCP) | lcp_target | Lighthouse |
|
|
1080
|
+
| Time to Interactive (TTI) | tti_target | Lighthouse |
|
|
1081
|
+
| Cumulative Layout Shift (CLS) | cls_target | Lighthouse |
|
|
1082
|
+
| Bundle Size | bundle_size_target | Build analysis |
|
|
1083
|
+
|
|
1084
|
+
### Slow Query Governance
|
|
1085
|
+
|
|
1086
|
+
| Threshold | Action | Owner |
|
|
1087
|
+
|-----------|--------|-------|
|
|
1088
|
+
| > 1s | Log warning | DBA |
|
|
1089
|
+
| > 3s | Alert + Review | Dev Team |
|
|
1090
|
+
| > 10s | Block + Emergency fix | Dev + DBA |
|
|
1091
|
+
|
|
1092
|
+
### Batch Operation Standards
|
|
1093
|
+
|
|
1094
|
+
| Operation | Recommended Batch Size | Notes |
|
|
1095
|
+
|-----------|----------------------|-------|
|
|
1096
|
+
| Database insert | 500-1000 | Use batch insert |
|
|
1097
|
+
| Database update | 200-500 | Avoid large transactions |
|
|
1098
|
+
| API bulk operations | 100-200 | Consider timeout |
|
|
1099
|
+
|
|
1100
|
+
### Code Performance Guidelines
|
|
1101
|
+
|
|
1102
|
+
{{#each performance_guidelines}}
|
|
1103
|
+
#### {{category}}
|
|
1104
|
+
|
|
1105
|
+
{{description}}
|
|
1106
|
+
|
|
1107
|
+
**Guidelines:**
|
|
1108
|
+
{{#each items}}
|
|
1109
|
+
- {{this}}
|
|
1110
|
+
{{/each}}
|
|
1111
|
+
|
|
1112
|
+
{{/each}}
|
|
1113
|
+
|
|
1114
|
+
**Section Source**
|
|
1115
|
+
{{#each performance_sources}}
|
|
1116
|
+
- [{{name}}]({{path}}#L{{start}}-L{{end}})
|
|
1117
|
+
{{/each}}
|
|
1118
|
+
|
|
1119
|
+
---
|
|
1120
|
+
|
|
1121
|
+
## 22. Security Conventions (Platform-Specific)
|
|
1122
|
+
|
|
1123
|
+
<!-- AI-TAG: SECURITY_CONVENTIONS -->
|
|
1124
|
+
<!-- Fill with actual security patterns and requirements found in the project. -->
|
|
1125
|
+
|
|
1126
|
+
### Backend Security (if backend platform)
|
|
1127
|
+
|
|
1128
|
+
<!-- AI-TAG: BACKEND_SECURITY -->
|
|
1129
|
+
<!-- Fill with backend security measures. If frontend platform, skip this subsection. -->
|
|
1130
|
+
|
|
1131
|
+
| Category | Measure | Implementation | Example |
|
|
1132
|
+
|----------|---------|---------------|---------|
|
|
1133
|
+
| SQL Injection Prevention | sql_injection_prevention | implementation | example |
|
|
1134
|
+
| Authentication Enforcement | auth_enforcement | implementation | example |
|
|
1135
|
+
| Rate Limiting | rate_limiting | implementation | example |
|
|
1136
|
+
| Input Sanitization | input_sanitization | implementation | example |
|
|
1137
|
+
| Sensitive Data in Logs | log_sanitization | implementation | example |
|
|
1138
|
+
|
|
1139
|
+
### Frontend Security (if frontend platform)
|
|
1140
|
+
|
|
1141
|
+
<!-- AI-TAG: FRONTEND_SECURITY -->
|
|
1142
|
+
<!-- Fill with frontend security measures. If backend platform, skip this subsection. -->
|
|
1143
|
+
|
|
1144
|
+
| Category | Measure | Implementation | Example |
|
|
1145
|
+
|----------|---------|---------------|---------|
|
|
1146
|
+
| XSS Prevention | xss_prevention | implementation | example |
|
|
1147
|
+
| CSRF Protection | csrf_protection | implementation | example |
|
|
1148
|
+
| Sensitive Data Handling | sensitive_data_handling | implementation | example |
|
|
1149
|
+
| Content Security Policy | csp_policy | implementation | example |
|
|
1150
|
+
| Auth Token Storage | token_storage | implementation | example |
|
|
1151
|
+
|
|
1152
|
+
### API Rate Limiting
|
|
1153
|
+
|
|
1154
|
+
| Endpoint Type | Rate Limit | Implementation |
|
|
1155
|
+
|---------------|------------|----------------|
|
|
1156
|
+
{{#each rate_limits}}
|
|
1157
|
+
| {{type}} | {{limit}} | {{implementation}} |
|
|
1158
|
+
{{/each}}
|
|
1159
|
+
|
|
1160
|
+
### XSS & SQL Injection Prevention
|
|
1161
|
+
|
|
1162
|
+
| Threat | Prevention Method | Implementation |
|
|
1163
|
+
|--------|------------------|----------------|
|
|
1164
|
+
| XSS | Input sanitization + Output encoding | {{xss_impl}} |
|
|
1165
|
+
| SQL Injection | Parameterized queries only | {{sql_impl}} |
|
|
1166
|
+
|
|
1167
|
+
### Authorization Check Standards
|
|
1168
|
+
|
|
1169
|
+
| Requirement | Implementation | Enforcement |
|
|
1170
|
+
|-------------|----------------|-------------|
|
|
1171
|
+
| All endpoints protected | `@PreAuthorize` or equivalent | Mandatory |
|
|
1172
|
+
| Public endpoints explicitly marked | `@PermitAll` or whitelist | Mandatory |
|
|
1173
|
+
| Role checks consistent | Use constants, not hardcoded strings | Mandatory |
|
|
1174
|
+
|
|
1175
|
+
### MyBatis SQL Safety (if backend platform)
|
|
1176
|
+
|
|
1177
|
+
| Rule | Requirement | Example |
|
|
1178
|
+
|------|-------------|---------|
|
|
1179
|
+
| Parameter binding | Always use `#{}` | `WHERE id = #{id}` |
|
|
1180
|
+
| Dynamic SQL | Use `<bind>` for like | `<bind name="pattern" value="'%' + name + '%'"/>` |
|
|
1181
|
+
| Prohibited | Never use `${}` for user input | ❌ `WHERE id = ${id}` |
|
|
1182
|
+
|
|
1183
|
+
### Good Example
|
|
1184
|
+
|
|
1185
|
+
```{{language}}
|
|
1186
|
+
// Good: Parameterized query with #{
|
|
1187
|
+
@Select("SELECT * FROM users WHERE name = #{name} AND status = #{status}")
|
|
1188
|
+
List<User> findByNameAndStatus(@Param("name") String name, @Param("status") Integer status);
|
|
1189
|
+
```
|
|
1190
|
+
|
|
1191
|
+
### Bad Example
|
|
1192
|
+
|
|
1193
|
+
```{{language}}
|
|
1194
|
+
// BAD: String concatenation in SQL
|
|
1195
|
+
@Select("SELECT * FROM users WHERE name = '" + name + "'")
|
|
1196
|
+
List<User> findByName(String name);
|
|
1197
|
+
|
|
1198
|
+
// BAD: Using ${} for user input
|
|
1199
|
+
@Select("SELECT * FROM users WHERE name = '${name}'")
|
|
1200
|
+
List<User> findByName(@Param("name") String name);
|
|
1201
|
+
```
|
|
1202
|
+
|
|
1203
|
+
**Section Source**
|
|
1204
|
+
{{#each security_sources}}
|
|
1205
|
+
- [{{name}}]({{path}}#L{{start}}-L{{end}})
|
|
1206
|
+
{{/each}}
|
|
1207
|
+
|
|
1208
|
+
---
|
|
1209
|
+
|
|
1210
|
+
## 23. Dependency Management
|
|
1211
|
+
|
|
1212
|
+
<!-- AI-TAG: DEPENDENCY_MANAGEMENT -->
|
|
1213
|
+
<!-- Fill with actual dependency management practices found in the project. -->
|
|
1214
|
+
|
|
1215
|
+
### Dependency Version Selection
|
|
1216
|
+
|
|
1217
|
+
| Type | Strategy | Example |
|
|
1218
|
+
|------|----------|---------|
|
|
1219
|
+
| Framework | Use managed version from BOM | `spring-boot-dependencies` |
|
|
1220
|
+
| Libraries | Prefer stable versions over latest | `1.2.3` vs `1.3.0-beta` |
|
|
1221
|
+
| Security patches | Apply within 7 days of release | CVE fixes |
|
|
1222
|
+
|
|
1223
|
+
### Upgrade Strategy
|
|
1224
|
+
|
|
1225
|
+
| Scenario | Action | Timeline |
|
|
1226
|
+
|----------|--------|----------|
|
|
1227
|
+
| Security vulnerability | Emergency upgrade | Within 7 days |
|
|
1228
|
+
| Major version update | Planned migration | Per roadmap |
|
|
1229
|
+
| Minor version update | Regular maintenance | Quarterly |
|
|
1230
|
+
|
|
1231
|
+
### Dependency Scanning
|
|
1232
|
+
|
|
1233
|
+
| Tool | Integration | Threshold |
|
|
1234
|
+
|------|-------------|-----------|
|
|
1235
|
+
{{#each dependency_scanners}}
|
|
1236
|
+
| {{tool}} | {{integration}} | {{threshold}} |
|
|
1237
|
+
{{/each}}
|
|
1238
|
+
|
|
1239
|
+
### Dependency Whitelist/Blacklist
|
|
1240
|
+
|
|
1241
|
+
| Category | Policy | Examples |
|
|
1242
|
+
|----------|--------|----------|
|
|
1243
|
+
| Whitelist | Approved libraries | {{whitelist}} |
|
|
1244
|
+
| Blacklist | Prohibited libraries | {{blacklist}} |
|
|
1245
|
+
|
|
1246
|
+
**Section Source**
|
|
1247
|
+
{{#each dependency_sources}}
|
|
1248
|
+
- [{{name}}]({{path}}#L{{start}}-L{{end}})
|
|
1249
|
+
{{/each}}
|
|
1250
|
+
|
|
1251
|
+
---
|
|
1252
|
+
|
|
1253
|
+
## 24. Automated Enforcement
|
|
1254
|
+
|
|
1255
|
+
<!-- AI-TAG: AUTOMATED_ENFORCEMENT -->
|
|
1256
|
+
<!-- Fill with actual automation tools and configurations found in the project. -->
|
|
1257
|
+
|
|
1258
|
+
### Git Hooks
|
|
1259
|
+
|
|
1260
|
+
| Hook | Purpose | Implementation |
|
|
1261
|
+
|------|---------|----------------|
|
|
1262
|
+
| pre-commit | Code format check | {{pre_commit_impl}} |
|
|
1263
|
+
| commit-msg | Commit message validation | {{commit_msg_impl}} |
|
|
1264
|
+
| pre-push | Test execution | {{pre_push_impl}} |
|
|
1265
|
+
|
|
1266
|
+
### CI/CD Gate Rules
|
|
1267
|
+
|
|
1268
|
+
| Stage | Check | Failure Action |
|
|
1269
|
+
|-------|-------|----------------|
|
|
1270
|
+
{{#each ci_checks}}
|
|
1271
|
+
| {{stage}} | {{check}} | {{action}} |
|
|
1272
|
+
{{/each}}
|
|
1273
|
+
|
|
1274
|
+
### Static Analysis Integration
|
|
1275
|
+
|
|
1276
|
+
| Tool | Purpose | Configuration | Threshold |
|
|
1277
|
+
|------|---------|---------------|-----------|
|
|
1278
|
+
{{#each static_analysis_tools}}
|
|
1279
|
+
| {{tool}} | {{purpose}} | {{config}} | {{threshold}} |
|
|
1280
|
+
{{/each}}
|
|
1281
|
+
|
|
1282
|
+
### IDE Configuration Standardization
|
|
1283
|
+
|
|
1284
|
+
| IDE | Config File | Distribution |
|
|
1285
|
+
|-----|-------------|--------------|
|
|
1286
|
+
{{#each ide_standardization}}
|
|
1287
|
+
| {{ide}} | [{{file}}]({{path}}) | {{distribution}} |
|
|
1288
|
+
{{/each}}
|
|
1289
|
+
|
|
1290
|
+
**Section Source**
|
|
1291
|
+
{{#each automated_enforcement_sources}}
|
|
1292
|
+
- [{{name}}]({{path}}#L{{start}}-L{{end}})
|
|
1293
|
+
{{/each}}
|
|
1294
|
+
|
|
1295
|
+
---
|
|
1296
|
+
|
|
1297
|
+
## 25. Best Practices & Anti-Patterns
|
|
1298
|
+
|
|
1299
|
+
<!-- AI-TAG: BEST_PRACTICES -->
|
|
1300
|
+
<!-- Provide examples relevant to THIS platform's tech stack. Backend: focus on database, concurrency, caching patterns. Frontend: focus on rendering, state management, component patterns. Use the actual language and frameworks of this platform. -->
|
|
1301
|
+
|
|
1302
|
+
### Pagination Optimization
|
|
1303
|
+
|
|
1304
|
+
**Good Example:**
|
|
1305
|
+
```{{language}}
|
|
1306
|
+
{{pagination_good_example}}
|
|
1307
|
+
```
|
|
1308
|
+
|
|
1309
|
+
**Bad Example:**
|
|
1310
|
+
```{{language}}
|
|
1311
|
+
{{pagination_bad_example}}
|
|
1312
|
+
```
|
|
1313
|
+
|
|
1314
|
+
### Batch Operations
|
|
1315
|
+
|
|
1316
|
+
**Good Example:**
|
|
1317
|
+
```{{language}}
|
|
1318
|
+
{{batch_good_example}}
|
|
1319
|
+
```
|
|
1320
|
+
|
|
1321
|
+
**Bad Example:**
|
|
1322
|
+
```{{language}}
|
|
1323
|
+
{{batch_bad_example}}
|
|
1324
|
+
```
|
|
1325
|
+
|
|
1326
|
+
### Cache Consistency
|
|
1327
|
+
|
|
1328
|
+
**Good Example:**
|
|
1329
|
+
```{{language}}
|
|
1330
|
+
{{cache_good_example}}
|
|
1331
|
+
```
|
|
1332
|
+
|
|
1333
|
+
**Bad Example:**
|
|
1334
|
+
```{{language}}
|
|
1335
|
+
{{cache_bad_example}}
|
|
1336
|
+
```
|
|
1337
|
+
|
|
1338
|
+
### Concurrency Handling
|
|
1339
|
+
|
|
1340
|
+
**Good Example:**
|
|
1341
|
+
```{{language}}
|
|
1342
|
+
{{concurrency_good_example}}
|
|
1343
|
+
```
|
|
1344
|
+
|
|
1345
|
+
**Bad Example:**
|
|
1346
|
+
```{{language}}
|
|
1347
|
+
{{concurrency_bad_example}}
|
|
1348
|
+
```
|
|
1349
|
+
|
|
1350
|
+
### Anti-Patterns to Avoid
|
|
1351
|
+
|
|
1352
|
+
| Anti-Pattern | Problem | Solution |
|
|
1353
|
+
|--------------|---------|----------|
|
|
1354
|
+
{{#each anti_patterns}}
|
|
1355
|
+
| {{name}} | {{problem}} | {{solution}} |
|
|
1356
|
+
{{/each}}
|
|
1357
|
+
|
|
1358
|
+
**Section Source**
|
|
1359
|
+
{{#each best_practices_sources}}
|
|
1360
|
+
- [{{name}}]({{path}}#L{{start}}-L{{end}})
|
|
1361
|
+
{{/each}}
|
|
1362
|
+
|
|
1363
|
+
---
|
|
1364
|
+
|
|
1365
|
+
## Appendix
|
|
1366
|
+
|
|
1367
|
+
### Git Conventions
|
|
1368
|
+
|
|
1369
|
+
#### Commit Message Format
|
|
1370
|
+
|
|
1371
|
+
```
|
|
1372
|
+
<type>(<scope>): <subject>
|
|
1373
|
+
|
|
1374
|
+
<body>
|
|
1375
|
+
|
|
1376
|
+
<footer>
|
|
1377
|
+
```
|
|
1378
|
+
|
|
1379
|
+
**Types:**
|
|
1380
|
+
{{#each commit_types}}
|
|
1381
|
+
- `{{type}}`: {{description}}
|
|
1382
|
+
{{/each}}
|
|
1383
|
+
|
|
1384
|
+
#### Branch Naming
|
|
1385
|
+
|
|
1386
|
+
{{branch_naming}}
|
|
1387
|
+
|
|
1388
|
+
### Code Review Checklist
|
|
1389
|
+
|
|
1390
|
+
#### Mandatory Checks
|
|
1391
|
+
- [ ] Code follows naming conventions
|
|
1392
|
+
- [ ] Code follows style guidelines
|
|
1393
|
+
- [ ] No console.log or debug code left in production
|
|
1394
|
+
- [ ] Error handling is comprehensive
|
|
1395
|
+
- [ ] Tests are included
|
|
1396
|
+
- [ ] Documentation is updated
|
|
1397
|
+
|
|
1398
|
+
#### Security Checks
|
|
1399
|
+
- [ ] No hardcoded credentials or secrets
|
|
1400
|
+
- [ ] SQL injection prevention verified
|
|
1401
|
+
- [ ] XSS prevention verified
|
|
1402
|
+
- [ ] Input validation implemented
|
|
1403
|
+
|
|
1404
|
+
#### Performance Checks
|
|
1405
|
+
- [ ] No N+1 query problems
|
|
1406
|
+
- [ ] Proper use of caching
|
|
1407
|
+
- [ ] Batch operations used where appropriate
|
|
1408
|
+
- [ ] Transaction boundaries are correct
|
|
1409
|
+
|
|
1410
|
+
### Newcomer Quick Reference
|
|
1411
|
+
|
|
1412
|
+
<!-- AI-TAG: NEWCOMER_GUIDE -->
|
|
1413
|
+
<!-- Fill with quick start information for new team members -->
|
|
1414
|
+
|
|
1415
|
+
| Topic | Resource | Description |
|
|
1416
|
+
|-------|----------|-------------|
|
|
1417
|
+
| Project setup | {{setup_guide}} | Environment setup steps |
|
|
1418
|
+
| First contribution | {{first_pr_guide}} | How to submit first PR |
|
|
1419
|
+
| Common commands | {{commands_ref}} | Frequently used commands |
|
|
1420
|
+
| Key contacts | {{contacts}} | Who to ask for help |
|
|
1421
|
+
|
|
1422
|
+
### Version History
|
|
1423
|
+
|
|
1424
|
+
| Version | Date | Author | Changes |
|
|
1425
|
+
|---------|------|--------|---------|
|
|
1426
|
+
{{#each version_history}}
|
|
1427
|
+
| {{version}} | {{date}} | {{author}} | {{changes}} |
|
|
1428
|
+
{{/each}}
|
|
1429
|
+
|
|
1430
|
+
**Section Source**
|
|
1431
|
+
{{#each appendix_sources}}
|
|
1432
|
+
- [{{name}}]({{path}}#L{{start}}-L{{end}})
|
|
1433
|
+
{{/each}}
|