tasks-spec-update
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSpecification Update Workflow
规格说明更新工作流
When to Use This Skill
何时使用该技能
- Syncing specs with implementation
- Branch comparison analysis
- Post-implementation documentation update
- Feature spec verification
- 同步规格说明与实现内容
- 分支对比分析
- 实现完成后的文档更新
- 功能规格验证
Pre-Flight Checklist
前期检查清单
- Identify specification files to update
- Determine implementation changes
- Compare current state vs documented state
- Plan update strategy
- 确定需要更新的规格说明文件
- 明确实现中的变更内容
- 对比当前状态与文档记录的状态
- 规划更新策略
Phase 1: Change Discovery
第一阶段:变更发现
Git-Based Discovery
基于Git的发现方式
bash
undefinedbash
undefinedCompare branches
Compare branches
git diff main..feature-branch --name-only
git diff main..feature-branch --name-only
Get detailed diff
Get detailed diff
git diff main..feature-branch
git diff main..feature-branch
List commits with messages
List commits with messages
git log main..feature-branch --oneline
git log main..feature-branch --oneline
Find files changed since date
Find files changed since date
git log --since="2024-01-01" --name-only --oneline
undefinedgit log --since="2024-01-01" --name-only --oneline
undefinedPattern-Based Discovery
基于模式的发现方式
bash
undefinedbash
undefinedFind all spec files
Find all spec files
find . -name ".spec.md" -o -name "-specification.md"
find . -name ".spec.md" -o -name "-specification.md"
Find implementation files
Find implementation files
grep -r "class.Command" --include=".cs" -l
grep -r "class.Command" --include=".cs" -l
Cross-reference
Cross-reference
grep -r "SaveEmployee" --include=".md" # In specs
grep -r "SaveEmployee" --include=".cs" # In code
undefinedgrep -r "SaveEmployee" --include=".md" # In specs
grep -r "SaveEmployee" --include=".cs" # In code
undefinedPhase 2: Gap Analysis
第二阶段:差异分析
Create Analysis Document
创建分析文档
markdown
undefinedmarkdown
undefinedSpecification Gap Analysis
Specification Gap Analysis
Date: [Date]
Date: [Date]
Feature: [Feature Name]
Feature: [Feature Name]
Implementation Status
Implementation Status
| Component | Specified | Implemented | Gap |
|---|---|---|---|
| Entity: Employee | ✅ | ✅ | None |
| Command: SaveEmployee | ✅ | ✅ | Missing validation doc |
| Query: GetEmployeeList | ✅ | ✅ | Filters not documented |
| Event: OnEmployeeCreated | ❌ | ✅ | Not in spec |
| Component | Specified | Implemented | Gap |
|---|---|---|---|
| Entity: Employee | ✅ | ✅ | None |
| Command: SaveEmployee | ✅ | ✅ | Missing validation doc |
| Query: GetEmployeeList | ✅ | ✅ | Filters not documented |
| Event: OnEmployeeCreated | ❌ | ✅ | Not in spec |
New Implementations (Not in Spec)
New Implementations (Not in Spec)
- - Added in PR #123
BulkUpdateEmployeeCommand - - Added for reporting
EmployeeExportQuery
- - Added in PR #123
BulkUpdateEmployeeCommand - - Added for reporting
EmployeeExportQuery
Spec Items Not Implemented
Spec Items Not Implemented
- - Deferred to Phase 2
EmployeeArchiveCommand - - Pending requirements
EmployeeAuditTrail
- - Deferred to Phase 2
EmployeeArchiveCommand - - Pending requirements
EmployeeAuditTrail
Documentation Updates Needed
Documentation Updates Needed
- Add BulkUpdateEmployeeCommand to spec
- Document new query filters
- Add event handler documentation
undefined- Add BulkUpdateEmployeeCommand to spec
- Document new query filters
- Add event handler documentation
undefinedPhase 3: Specification Update
第三阶段:规格说明更新
Update Checklist
更新检查清单
markdown
undefinedmarkdown
undefinedSpecification Updates
Specification Updates
Entities
Entities
- Update property list
- Document new computed properties
- Add validation rules
- Update relationships
- Update property list
- Document new computed properties
- Add validation rules
- Update relationships
Commands
Commands
- Add new commands
- Update validation rules
- Document side effects
- Add error codes
- Add new commands
- Update validation rules
- Document side effects
- Add error codes
Queries
Queries
- Document new filters
- Update response schema
- Add pagination details
- Document new filters
- Update response schema
- Add pagination details
Events
Events
- Document entity events
- List event handlers
- Describe cross-service effects
- Document entity events
- List event handlers
- Describe cross-service effects
API Endpoints
API Endpoints
- Add new endpoints
- Update request/response
- Document auth requirements
undefined- Add new endpoints
- Update request/response
- Document auth requirements
undefinedPattern 1: Entity Specification Update
模式1:实体规格说明更新
markdown
undefinedmarkdown
undefinedEmployee Entity Specification
Employee Entity Specification
Properties
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| Id | string | Yes | Unique identifier (ULID) |
| FullName | string | Yes | Employee full name (max 200) |
| string | Yes | Email address (unique per company) | |
| Status | EmployeeStatus | Yes | Current employment status |
| PhoneNumber | string | No | Contact phone (NEW in v2.1) |
| Property | Type | Required | Description |
|---|---|---|---|
| Id | string | Yes | Unique identifier (ULID) |
| FullName | string | Yes | Employee full name (max 200) |
| string | Yes | Email address (unique per company) | |
| Status | EmployeeStatus | Yes | Current employment status |
| PhoneNumber | string | No | Contact phone (NEW in v2.1) |
Computed Properties
Computed Properties
| Property | Calculation |
|---|---|
| IsActive | Status == Active && !IsDeleted |
| DisplayName | |
| Property | Calculation |
|---|---|
| IsActive | Status == Active && !IsDeleted |
| DisplayName | |
Validation Rules
Validation Rules
- FullName: Required, max 200 characters
- Email: Required, valid email format, unique within company
- PhoneNumber: Optional, valid phone format (NEW in v2.1)
- FullName: Required, max 200 characters
- Email: Required, valid email format, unique within company
- PhoneNumber: Optional, valid phone format (NEW in v2.1)
Static Expressions
Static Expressions
| Expression | Purpose |
|---|---|
| UniqueExpr(companyId, userId) | Find unique employee |
| ActiveInCompanyExpr(companyId) | Filter active employees |
| SearchExpr(term) | Full-text search |
undefined| Expression | Purpose |
|---|---|
| UniqueExpr(companyId, userId) | Find unique employee |
| ActiveInCompanyExpr(companyId) | Filter active employees |
| SearchExpr(term) | Full-text search |
undefinedPattern 2: Command Specification Update
模式2:命令规格说明更新
markdown
undefinedmarkdown
undefinedSaveEmployeeCommand Specification
SaveEmployeeCommand Specification
Overview
Overview
Creates or updates an employee record.
Creates or updates an employee record.
Request
Request
json
{
"id": "string | null",
"fullName": "string",
"email": "string",
"status": "Active | Inactive | Terminated",
"phoneNumber": "string | null"
}json
{
"id": "string | null",
"fullName": "string",
"email": "string",
"status": "Active | Inactive | Terminated",
"phoneNumber": "string | null"
}Validation
Validation
| Field | Rule | Error Code |
|---|---|---|
| fullName | Required | EMPLOYEE_NAME_REQUIRED |
| fullName | Max 200 chars | EMPLOYEE_NAME_TOO_LONG |
| Required | EMPLOYEE_EMAIL_REQUIRED | |
| Valid format | EMPLOYEE_EMAIL_INVALID | |
| Unique in company | EMPLOYEE_EMAIL_EXISTS |
| Field | Rule | Error Code |
|---|---|---|
| fullName | Required | EMPLOYEE_NAME_REQUIRED |
| fullName | Max 200 chars | EMPLOYEE_NAME_TOO_LONG |
| Required | EMPLOYEE_EMAIL_REQUIRED | |
| Valid format | EMPLOYEE_EMAIL_INVALID | |
| Unique in company | EMPLOYEE_EMAIL_EXISTS |
Response
Response
json
{
"employee": {
"id": "string",
"fullName": "string",
"email": "string",
"status": "string"
}
}json
{
"employee": {
"id": "string",
"fullName": "string",
"email": "string",
"status": "string"
}
}Side Effects
Side Effects
- Entity Event: raised
PlatformCqrsEntityEvent<Employee> - Cross-Service Sync: Employee synced to other services
- Notification: Welcome email sent (create only)
- Entity Event: raised
PlatformCqrsEntityEvent<Employee> - Cross-Service Sync: Employee synced to other services
- Notification: Welcome email sent (create only)
Error Codes
Error Codes
| Code | HTTP | Description |
|---|---|---|
| EMPLOYEE_NOT_FOUND | 404 | Employee ID not found |
| EMPLOYEE_EMAIL_EXISTS | 400 | Email already in use |
| EMPLOYEE_VALIDATION_FAILED | 400 | Validation error |
undefined| Code | HTTP | Description |
|---|---|---|
| EMPLOYEE_NOT_FOUND | 404 | Employee ID not found |
| EMPLOYEE_EMAIL_EXISTS | 400 | Email already in use |
| EMPLOYEE_VALIDATION_FAILED | 400 | Validation error |
undefinedPattern 3: API Endpoint Specification
模式3:API端点规格说明更新
markdown
undefinedmarkdown
undefinedEmployee API Endpoints
Employee API Endpoints
Base URL
Base URL
/api/Employee/api/EmployeeEndpoints
Endpoints
GET /api/Employee
GET /api/Employee
List employees with filtering and pagination.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| searchText | string | Full-text search |
| statuses | array | Filter by status |
| skipCount | int | Pagination offset |
| maxResultCount | int | Page size (max 100) |
Response
json
{
"items": [...],
"totalCount": 100
}List employees with filtering and pagination.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| searchText | string | Full-text search |
| statuses | array | Filter by status |
| skipCount | int | Pagination offset |
| maxResultCount | int | Page size (max 100) |
Response
json
{
"items": [...],
"totalCount": 100
}POST /api/Employee
POST /api/Employee
Create or update employee.
Request Body
See SaveEmployeeCommand specification.
Create or update employee.
Request Body
See SaveEmployeeCommand specification.
DELETE /api/Employee/{id}
DELETE /api/Employee/{id}
Soft delete an employee.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
| id | string | Employee ID |
Response: 204 No Content
Soft delete an employee.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
| id | string | Employee ID |
Response: 204 No Content
Authentication
Authentication
All endpoints require authentication.
Use header.
Authorization: Bearer {token}All endpoints require authentication.
Use header.
Authorization: Bearer {token}Authorization
Authorization
| Endpoint | Required Role |
|---|---|
| GET | Employee, Manager, Admin |
| POST | Manager, Admin |
| DELETE | Admin |
undefined| Endpoint | Required Role |
|---|---|
| GET | Employee, Manager, Admin |
| POST | Manager, Admin |
| DELETE | Admin |
undefinedPhase 4: Verification
第四阶段:验证
Cross-Reference Check
交叉引用检查
bash
undefinedbash
undefinedVerify all commands are documented
Verify all commands are documented
for cmd in $(grep -r "class.Command" --include=".cs" -l); do
name=$(grep -o "class [A-Za-z]Command" "$cmd" | head -1)
if ! grep -q "$name" docs/specifications/.md; then
echo "Missing in spec: $name"
fi
done
undefinedfor cmd in $(grep -r "class.Command" --include=".cs" -l); do
name=$(grep -o "class [A-Za-z]Command" "$cmd" | head -1)
if ! grep -q "$name" docs/specifications/.md; then
echo "Missing in spec: $name"
fi
done
undefinedValidation Report
验证报告
markdown
undefinedmarkdown
undefinedSpecification Verification Report
Specification Verification Report
Date: [Date]
Date: [Date]
Verified By: AI
Verified By: AI
Summary
Summary
- Total Specs: 15
- Up to Date: 12
- Needs Update: 3
- Missing: 0
- Total Specs: 15
- Up to Date: 12
- Needs Update: 3
- Missing: 0
Issues Found
Issues Found
Outdated Specifications
Outdated Specifications
-
Employee.spec.md
- Missing: PhoneNumber property
- Missing: BulkUpdate command
-
API-Reference.md
- Missing: /export endpoint
- Outdated: Error codes
-
Employee.spec.md
- Missing: PhoneNumber property
- Missing: BulkUpdate command
-
API-Reference.md
- Missing: /export endpoint
- Outdated: Error codes
Recommendations
Recommendations
- Update Employee.spec.md with new properties
- Add BulkUpdateEmployeeCommand specification
- Regenerate API reference from OpenAPI
undefined- Update Employee.spec.md with new properties
- Add BulkUpdateEmployeeCommand specification
- Regenerate API reference from OpenAPI
undefinedVerification Checklist
验证检查清单
- All implementation changes identified
- Gap analysis completed
- Specifications updated
- Cross-references verified
- Version numbers updated
- Change log updated
- 已识别所有实现变更
- 已完成差异分析
- 已更新规格说明
- 已验证交叉引用
- 已更新版本号
- 已更新变更日志