specweave 0.1.0 → 0.1.2
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/README.md +18 -8
- package/SPECWEAVE.md +2 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +37 -53
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/utils/auto-install.d.ts +44 -0
- package/dist/utils/auto-install.d.ts.map +1 -0
- package/dist/utils/auto-install.js +277 -0
- package/dist/utils/auto-install.js.map +1 -0
- package/package.json +1 -1
- package/src/agents/diagrams-architect/AGENT.md +380 -0
- package/src/agents/diagrams-architect/templates/c4-component-template.mmd +45 -0
- package/src/agents/diagrams-architect/templates/c4-container-template.mmd +48 -0
- package/src/agents/diagrams-architect/templates/c4-context-template.mmd +29 -0
- package/src/agents/diagrams-architect/templates/deployment-template.mmd +77 -0
- package/src/agents/diagrams-architect/templates/er-diagram-template.mmd +64 -0
- package/src/agents/diagrams-architect/templates/sequence-template.mmd +55 -0
- package/src/agents/diagrams-architect/test-cases/test-1-c4-context.yaml +131 -0
- package/src/agents/diagrams-architect/test-cases/test-2-sequence.yaml +150 -0
- package/src/agents/diagrams-architect/test-cases/test-3-er-diagram.yaml +182 -0
- package/src/skills/diagrams-architect/test-cases/test-1-c4-context.yaml +13 -0
- package/src/skills/diagrams-architect/test-cases/test-2-sequence-diagram.yaml +13 -0
- package/src/skills/diagrams-architect/test-cases/test-3-er-diagram.yaml +13 -0
- package/src/skills/diagrams-generator/SKILL.md +213 -13
- package/src/skills/dotnet-backend/test-cases/test-1-rest-api.yaml +14 -0
- package/src/skills/dotnet-backend/test-cases/test-2-authentication.yaml +13 -0
- package/src/skills/dotnet-backend/test-cases/test-3-minimal-api.yaml +13 -0
- package/src/skills/figma-designer/test-cases/test-1-design-system.yaml +13 -0
- package/src/skills/figma-designer/test-cases/test-2-component-library.yaml +13 -0
- package/src/skills/figma-designer/test-cases/test-3-responsive-layout.yaml +13 -0
- package/src/skills/figma-implementer/test-cases/test-1-design-to-react.yaml +13 -0
- package/src/skills/figma-implementer/test-cases/test-2-storybook.yaml +13 -0
- package/src/skills/figma-implementer/test-cases/test-3-design-tokens.yaml +13 -0
- package/src/skills/frontend/test-cases/test-1-react-component.yaml +13 -0
- package/src/skills/frontend/test-cases/test-2-form-validation.yaml +13 -0
- package/src/skills/frontend/test-cases/test-3-state-management.yaml +13 -0
- package/src/skills/nextjs/test-cases/test-1-app-router.yaml +13 -0
- package/src/skills/nextjs/test-cases/test-2-server-actions.yaml +13 -0
- package/src/skills/nextjs/test-cases/test-3-api-routes.yaml +13 -0
- package/src/skills/nodejs-backend/test-cases/test-1-express-api.yaml +13 -0
- package/src/skills/nodejs-backend/test-cases/test-2-prisma-orm.yaml +13 -0
- package/src/skills/nodejs-backend/test-cases/test-3-authentication.yaml +13 -0
- package/src/skills/python-backend/test-cases/test-1-fastapi-crud.yaml +13 -0
- package/src/skills/python-backend/test-cases/test-2-sqlalchemy.yaml +13 -0
- package/src/skills/python-backend/test-cases/test-3-authentication.yaml +13 -0
- package/src/skills/specweave-ado-mapper/test-cases/test-1-export-to-ado.yaml +13 -0
- package/src/skills/specweave-ado-mapper/test-cases/test-2-import-from-ado.yaml +13 -0
- package/src/skills/specweave-ado-mapper/test-cases/test-3-bidirectional-sync.yaml +13 -0
- package/src/skills/specweave-detector/SKILL.md +146 -0
- package/src/skills/specweave-jira-mapper/test-cases/test-1-export-to-jira.yaml +13 -0
- package/src/skills/specweave-jira-mapper/test-cases/test-2-import-from-jira.yaml +13 -0
- package/src/skills/specweave-jira-mapper/test-cases/test-3-sync-status.yaml +13 -0
- package/src/templates/config.yaml +18 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
sequenceDiagram
|
|
2
|
+
participant {{ACTOR_1}} as {{ACTOR_1_NAME}}
|
|
3
|
+
participant {{ACTOR_2}} as {{ACTOR_2_NAME}}
|
|
4
|
+
participant {{ACTOR_3}} as {{ACTOR_3_NAME}}
|
|
5
|
+
participant {{ACTOR_4}} as {{ACTOR_4_NAME}}
|
|
6
|
+
|
|
7
|
+
{{ACTOR_1}}->>{{ACTOR_2}}: {{STEP_1_ACTION}}
|
|
8
|
+
activate {{ACTOR_2}}
|
|
9
|
+
|
|
10
|
+
{{ACTOR_2}}->>{{ACTOR_3}}: {{STEP_2_ACTION}}
|
|
11
|
+
activate {{ACTOR_3}}
|
|
12
|
+
|
|
13
|
+
{{ACTOR_3}}->>{{ACTOR_4}}: {{STEP_3_ACTION}}
|
|
14
|
+
{{ACTOR_4}}-->>{{ACTOR_3}}: {{STEP_3_RESPONSE}}
|
|
15
|
+
|
|
16
|
+
{{ACTOR_3}}-->>{{ACTOR_2}}: {{STEP_2_RESPONSE}}
|
|
17
|
+
deactivate {{ACTOR_3}}
|
|
18
|
+
|
|
19
|
+
alt {{SUCCESS_CONDITION}}
|
|
20
|
+
{{ACTOR_2}}-->>{{ACTOR_1}}: {{SUCCESS_RESPONSE}}
|
|
21
|
+
{{ACTOR_1}}->>{{ACTOR_1}}: {{SUCCESS_ACTION}}
|
|
22
|
+
else {{FAILURE_CONDITION}}
|
|
23
|
+
{{ACTOR_2}}-->>{{ACTOR_1}}: {{ERROR_RESPONSE}}
|
|
24
|
+
{{ACTOR_1}}->>{{ACTOR_1}}: {{ERROR_ACTION}}
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
deactivate {{ACTOR_2}}
|
|
28
|
+
|
|
29
|
+
%% Optional: Loop example
|
|
30
|
+
%% loop {{LOOP_CONDITION}}
|
|
31
|
+
%% {{ACTOR}}->>{{TARGET}}: {{LOOP_ACTION}}
|
|
32
|
+
%% end
|
|
33
|
+
|
|
34
|
+
%% Optional: Note example
|
|
35
|
+
%% Note over {{ACTOR_1}},{{ACTOR_2}}: {{NOTE_TEXT}}
|
|
36
|
+
|
|
37
|
+
%% Template Variables:
|
|
38
|
+
%% {{ACTOR_*}} - Short identifier for participant
|
|
39
|
+
%% {{ACTOR_*_NAME}} - Display name for participant
|
|
40
|
+
%% {{STEP_*_ACTION}} - Action/message description
|
|
41
|
+
%% {{STEP_*_RESPONSE}} - Response message
|
|
42
|
+
%% {{SUCCESS_CONDITION}} - Condition for success path
|
|
43
|
+
%% {{FAILURE_CONDITION}} - Condition for error path
|
|
44
|
+
%% {{SUCCESS_RESPONSE}} - Success message
|
|
45
|
+
%% {{SUCCESS_ACTION}} - Action on success
|
|
46
|
+
%% {{ERROR_RESPONSE}} - Error message
|
|
47
|
+
%% {{ERROR_ACTION}} - Action on error
|
|
48
|
+
|
|
49
|
+
%% Notes:
|
|
50
|
+
%% - Use activate/deactivate to show processing time
|
|
51
|
+
%% - Use alt/else for conditional flows
|
|
52
|
+
%% - Use loop for repeated actions
|
|
53
|
+
%% - Use Note over for explanations
|
|
54
|
+
%% - Solid arrow (->>) for requests
|
|
55
|
+
%% - Dashed arrow (-->>) for responses
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
---
|
|
2
|
+
test_id: diagrams-architect-001
|
|
3
|
+
test_name: C4 Context Diagram Generation
|
|
4
|
+
coverage:
|
|
5
|
+
- TC-B001 # User request detected
|
|
6
|
+
- TC-B004 # Correct Mermaid syntax
|
|
7
|
+
- TC-B005 # C4 Level 1 conventions
|
|
8
|
+
- TC-B006 # Saved to correct location
|
|
9
|
+
- TC-B007 # File named correctly
|
|
10
|
+
priority: P1
|
|
11
|
+
tags:
|
|
12
|
+
- c4-model
|
|
13
|
+
- context-diagram
|
|
14
|
+
- level-1
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Test Case: C4 Context Diagram Generation
|
|
18
|
+
|
|
19
|
+
## Scenario
|
|
20
|
+
|
|
21
|
+
User requests a C4 context diagram for an authentication system to understand system boundaries and external actors.
|
|
22
|
+
|
|
23
|
+
## Input
|
|
24
|
+
|
|
25
|
+
**User Request**: "Create C4 context diagram for authentication system"
|
|
26
|
+
|
|
27
|
+
**Context Provided** (optional):
|
|
28
|
+
- System handles user registration, login, password management
|
|
29
|
+
- Integrates with email service for verification
|
|
30
|
+
- Integrates with SMS gateway for 2FA
|
|
31
|
+
- Supports OAuth providers (Google, GitHub, Microsoft)
|
|
32
|
+
|
|
33
|
+
## Expected Agent Behavior
|
|
34
|
+
|
|
35
|
+
1. **Recognize diagram type**: C4 Context (Level 1)
|
|
36
|
+
2. **Choose appropriate template**: `c4-context-template.mmd`
|
|
37
|
+
3. **Generate diagram** with:
|
|
38
|
+
- Clear title: "Authentication System Context"
|
|
39
|
+
- Main system: Authentication System
|
|
40
|
+
- Users: User, Administrator
|
|
41
|
+
- External systems: Email Service, SMS Gateway, OAuth Providers
|
|
42
|
+
- Relationships showing data flow
|
|
43
|
+
4. **Validate syntax**:
|
|
44
|
+
- Starts with `C4Context` (NO `mermaid` keyword)
|
|
45
|
+
- All elements have descriptions in quotes
|
|
46
|
+
- All relationships labeled
|
|
47
|
+
- Proper indentation (2 spaces)
|
|
48
|
+
5. **Specify file path**: `.specweave/docs/internal/architecture/diagrams/auth-context.mmd`
|
|
49
|
+
6. **Provide validation instructions**: Tell user to verify rendering
|
|
50
|
+
|
|
51
|
+
## Expected Output
|
|
52
|
+
|
|
53
|
+
**Diagram Content** (approximate):
|
|
54
|
+
```
|
|
55
|
+
C4Context
|
|
56
|
+
title Authentication System Context
|
|
57
|
+
|
|
58
|
+
Person(user, "User", "A user who needs to authenticate")
|
|
59
|
+
Person(admin, "Administrator", "Manages user accounts")
|
|
60
|
+
|
|
61
|
+
System(auth, "Authentication System", "Handles user authentication, registration, password management")
|
|
62
|
+
|
|
63
|
+
System_Ext(email, "Email Service", "Sends verification and password reset emails")
|
|
64
|
+
System_Ext(sms, "SMS Gateway", "Sends 2FA codes via SMS")
|
|
65
|
+
System_Ext(oauth, "OAuth Providers", "Google, GitHub, Microsoft identity providers")
|
|
66
|
+
|
|
67
|
+
Rel(user, auth, "Authenticates, registers, resets password")
|
|
68
|
+
Rel(admin, auth, "Manages users, views audit logs")
|
|
69
|
+
Rel(auth, email, "Sends emails via")
|
|
70
|
+
Rel(auth, sms, "Sends SMS via")
|
|
71
|
+
Rel(auth, oauth, "Delegates authentication to")
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**File Path**: `.specweave/docs/internal/architecture/diagrams/auth-context.mmd`
|
|
75
|
+
|
|
76
|
+
**Validation Message**:
|
|
77
|
+
```
|
|
78
|
+
✅ Diagram created: .specweave/docs/internal/architecture/diagrams/auth-context.mmd
|
|
79
|
+
|
|
80
|
+
📋 VALIDATION REQUIRED:
|
|
81
|
+
1. Open the file in VS Code
|
|
82
|
+
2. Install Mermaid Preview extension if needed
|
|
83
|
+
3. Verify the diagram renders correctly
|
|
84
|
+
4. Confirm all systems and relationships are visible
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Success Criteria
|
|
88
|
+
|
|
89
|
+
- [ ] Diagram uses correct C4 Context syntax
|
|
90
|
+
- [ ] NO `mermaid` keyword present
|
|
91
|
+
- [ ] All elements (Person, System, System_Ext) have descriptions
|
|
92
|
+
- [ ] All relationships (Rel) have labels
|
|
93
|
+
- [ ] Indentation is correct (2 spaces per level)
|
|
94
|
+
- [ ] File path follows conventions
|
|
95
|
+
- [ ] Validation instructions provided
|
|
96
|
+
- [ ] Diagram would render correctly in Mermaid Preview
|
|
97
|
+
|
|
98
|
+
## Failure Scenarios
|
|
99
|
+
|
|
100
|
+
**Scenario 1: Uses `mermaid` keyword**
|
|
101
|
+
```
|
|
102
|
+
mermaid
|
|
103
|
+
C4Context
|
|
104
|
+
...
|
|
105
|
+
```
|
|
106
|
+
❌ FAIL: C4 diagrams must start directly with `C4Context`
|
|
107
|
+
|
|
108
|
+
**Scenario 2: Missing descriptions**
|
|
109
|
+
```
|
|
110
|
+
C4Context
|
|
111
|
+
Person(user, User)
|
|
112
|
+
```
|
|
113
|
+
❌ FAIL: All elements must have descriptions in quotes
|
|
114
|
+
|
|
115
|
+
**Scenario 3: Incorrect file location**
|
|
116
|
+
```
|
|
117
|
+
File: .specweave/docs/diagrams/context.mmd
|
|
118
|
+
```
|
|
119
|
+
❌ FAIL: Should be in `architecture/diagrams/` subdirectory
|
|
120
|
+
|
|
121
|
+
## Traceability
|
|
122
|
+
|
|
123
|
+
**Covers User Stories**:
|
|
124
|
+
- US-B001: Create C4 Context Diagram
|
|
125
|
+
|
|
126
|
+
**Covers Acceptance Criteria**:
|
|
127
|
+
- TC-B001: User request detected by diagrams-generator skill
|
|
128
|
+
- TC-B004: Agent creates diagram with correct Mermaid syntax
|
|
129
|
+
- TC-B005: Diagram follows C4 Level 1 conventions (system boundary, external actors)
|
|
130
|
+
- TC-B006: Diagram saved to correct location
|
|
131
|
+
- TC-B007: File named correctly (e.g., `auth-context.mmd`)
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
---
|
|
2
|
+
test_id: diagrams-architect-002
|
|
3
|
+
test_name: Sequence Diagram Generation
|
|
4
|
+
coverage:
|
|
5
|
+
- TC-B008 # Skill detects sequence diagram request
|
|
6
|
+
- TC-B009 # Agent generates sequenceDiagram syntax
|
|
7
|
+
- TC-B010 # Participants clearly labeled
|
|
8
|
+
- TC-B011 # Flow accurately represents process
|
|
9
|
+
- TC-B012 # Saved to correct location
|
|
10
|
+
- TC-B013 # File named correctly
|
|
11
|
+
priority: P1
|
|
12
|
+
tags:
|
|
13
|
+
- sequence-diagram
|
|
14
|
+
- interaction-flow
|
|
15
|
+
- authentication
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Test Case: Sequence Diagram Generation
|
|
19
|
+
|
|
20
|
+
## Scenario
|
|
21
|
+
|
|
22
|
+
User requests a sequence diagram to understand the login authentication flow, including success and failure paths.
|
|
23
|
+
|
|
24
|
+
## Input
|
|
25
|
+
|
|
26
|
+
**User Request**: "Create sequence diagram for login flow"
|
|
27
|
+
|
|
28
|
+
**Context Provided** (optional):
|
|
29
|
+
- User submits credentials via browser
|
|
30
|
+
- AuthService validates against database
|
|
31
|
+
- Session created on success
|
|
32
|
+
- Error message on failure
|
|
33
|
+
|
|
34
|
+
## Expected Agent Behavior
|
|
35
|
+
|
|
36
|
+
1. **Recognize diagram type**: Sequence diagram
|
|
37
|
+
2. **Choose appropriate template**: `sequence-template.mmd`
|
|
38
|
+
3. **Generate diagram** with:
|
|
39
|
+
- Participants: User, Browser, AuthService, Database, SessionStore
|
|
40
|
+
- Clear interaction sequence
|
|
41
|
+
- Success path (alt) and failure path (else)
|
|
42
|
+
- Activation boxes showing processing time
|
|
43
|
+
- Response arrows (dashed)
|
|
44
|
+
4. **Validate syntax**:
|
|
45
|
+
- Starts with `sequenceDiagram` (uses `mermaid` keyword for non-C4)
|
|
46
|
+
- All participants defined
|
|
47
|
+
- Message arrows correct (->>, -->>)
|
|
48
|
+
- Alt/else blocks properly structured
|
|
49
|
+
5. **Specify file path**: `.specweave/docs/internal/architecture/diagrams/auth/flows/login-flow.mmd`
|
|
50
|
+
6. **Provide validation instructions**
|
|
51
|
+
|
|
52
|
+
## Expected Output
|
|
53
|
+
|
|
54
|
+
**Diagram Content** (approximate):
|
|
55
|
+
```
|
|
56
|
+
sequenceDiagram
|
|
57
|
+
participant User
|
|
58
|
+
participant Browser
|
|
59
|
+
participant AuthService
|
|
60
|
+
participant Database
|
|
61
|
+
participant SessionStore
|
|
62
|
+
|
|
63
|
+
User->>Browser: Enter credentials
|
|
64
|
+
Browser->>AuthService: POST /api/auth/login
|
|
65
|
+
activate AuthService
|
|
66
|
+
|
|
67
|
+
AuthService->>Database: Query user by email
|
|
68
|
+
Database-->>AuthService: User record
|
|
69
|
+
|
|
70
|
+
AuthService->>AuthService: Verify password (bcrypt)
|
|
71
|
+
|
|
72
|
+
alt Password valid
|
|
73
|
+
AuthService->>SessionStore: Create session
|
|
74
|
+
SessionStore-->>AuthService: Session ID
|
|
75
|
+
AuthService-->>Browser: 200 OK + Session cookie
|
|
76
|
+
Browser-->>User: Redirect to dashboard
|
|
77
|
+
else Password invalid
|
|
78
|
+
AuthService-->>Browser: 401 Unauthorized
|
|
79
|
+
Browser-->>User: Show error message
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
deactivate AuthService
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**File Path**: `.specweave/docs/internal/architecture/diagrams/auth/flows/login-flow.mmd`
|
|
86
|
+
|
|
87
|
+
**Validation Message**:
|
|
88
|
+
```
|
|
89
|
+
✅ Diagram created: .specweave/docs/internal/architecture/diagrams/auth/flows/login-flow.mmd
|
|
90
|
+
|
|
91
|
+
📋 VALIDATION REQUIRED:
|
|
92
|
+
1. Open the file in VS Code
|
|
93
|
+
2. Verify the sequence diagram renders correctly
|
|
94
|
+
3. Confirm all participants and messages are clear
|
|
95
|
+
4. Verify success and failure paths are visible
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Success Criteria
|
|
99
|
+
|
|
100
|
+
- [ ] Diagram uses correct sequenceDiagram syntax
|
|
101
|
+
- [ ] Includes `mermaid` keyword (standard for non-C4 diagrams)
|
|
102
|
+
- [ ] All participants clearly defined
|
|
103
|
+
- [ ] Request arrows are solid (->>)
|
|
104
|
+
- [ ] Response arrows are dashed (-->>)
|
|
105
|
+
- [ ] Alt/else block shows conditional logic
|
|
106
|
+
- [ ] Activate/deactivate shows processing time
|
|
107
|
+
- [ ] File path follows conventions (module/flows/ subdirectory)
|
|
108
|
+
- [ ] Validation instructions provided
|
|
109
|
+
- [ ] Diagram would render correctly
|
|
110
|
+
|
|
111
|
+
## Failure Scenarios
|
|
112
|
+
|
|
113
|
+
**Scenario 1: Missing participant definition**
|
|
114
|
+
```
|
|
115
|
+
sequenceDiagram
|
|
116
|
+
User->>Browser: Enter credentials
|
|
117
|
+
```
|
|
118
|
+
❌ FAIL: Participants should be explicitly defined
|
|
119
|
+
|
|
120
|
+
**Scenario 2: Wrong arrow types**
|
|
121
|
+
```
|
|
122
|
+
Browser-->>AuthService: POST /api/auth/login
|
|
123
|
+
```
|
|
124
|
+
❌ FAIL: Requests should use solid arrows (->>) not dashed
|
|
125
|
+
|
|
126
|
+
**Scenario 3: Missing alt/else for conditional flow**
|
|
127
|
+
```
|
|
128
|
+
AuthService->>SessionStore: Create session
|
|
129
|
+
AuthService-->>Browser: 401 Unauthorized
|
|
130
|
+
```
|
|
131
|
+
❌ FAIL: Should use alt/else to show conditional paths
|
|
132
|
+
|
|
133
|
+
**Scenario 4: Incorrect file location**
|
|
134
|
+
```
|
|
135
|
+
File: .specweave/docs/internal/architecture/diagrams/login-flow.mmd
|
|
136
|
+
```
|
|
137
|
+
❌ FAIL: Should be in module-specific `flows/` subdirectory
|
|
138
|
+
|
|
139
|
+
## Traceability
|
|
140
|
+
|
|
141
|
+
**Covers User Stories**:
|
|
142
|
+
- US-B002: Create Sequence Diagram
|
|
143
|
+
|
|
144
|
+
**Covers Acceptance Criteria**:
|
|
145
|
+
- TC-B008: Skill detects sequence diagram request
|
|
146
|
+
- TC-B009: Agent generates sequenceDiagram syntax
|
|
147
|
+
- TC-B010: Participants clearly labeled
|
|
148
|
+
- TC-B011: Flow accurately represents login process
|
|
149
|
+
- TC-B012: Diagram saved to correct location
|
|
150
|
+
- TC-B013: File named `login-flow.sequence.mmd` or `login-flow.mmd`
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
---
|
|
2
|
+
test_id: diagrams-architect-003
|
|
3
|
+
test_name: ER Diagram Generation
|
|
4
|
+
coverage:
|
|
5
|
+
- TC-B014 # Skill detects ER diagram request
|
|
6
|
+
- TC-B015 # Agent generates erDiagram syntax
|
|
7
|
+
- TC-B016 # Entities, attributes, relationships correctly defined
|
|
8
|
+
- TC-B017 # Primary/foreign keys marked
|
|
9
|
+
- TC-B018 # Saved to correct location
|
|
10
|
+
- TC-B019 # File named correctly
|
|
11
|
+
priority: P1
|
|
12
|
+
tags:
|
|
13
|
+
- er-diagram
|
|
14
|
+
- data-model
|
|
15
|
+
- database-schema
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Test Case: ER Diagram Generation
|
|
19
|
+
|
|
20
|
+
## Scenario
|
|
21
|
+
|
|
22
|
+
User requests an entity-relationship diagram to understand the authentication data model, including user, session, and token entities.
|
|
23
|
+
|
|
24
|
+
## Input
|
|
25
|
+
|
|
26
|
+
**User Request**: "Create ER diagram for user and session entities"
|
|
27
|
+
|
|
28
|
+
**Context Provided** (optional):
|
|
29
|
+
- USER table: id, email, password_hash, created_at
|
|
30
|
+
- SESSION table: id, user_id, token, expires_at
|
|
31
|
+
- REFRESH_TOKEN table: id, user_id, token, expires_at
|
|
32
|
+
- PASSWORD_RESET table: id, user_id, token, expires_at
|
|
33
|
+
|
|
34
|
+
## Expected Agent Behavior
|
|
35
|
+
|
|
36
|
+
1. **Recognize diagram type**: ER diagram
|
|
37
|
+
2. **Choose appropriate template**: `er-diagram-template.mmd`
|
|
38
|
+
3. **Generate diagram** with:
|
|
39
|
+
- Entities: USER, SESSION, REFRESH_TOKEN, PASSWORD_RESET
|
|
40
|
+
- Relationships with cardinality (one-to-many, many-to-one)
|
|
41
|
+
- Primary keys (PK), foreign keys (FK), unique keys (UK)
|
|
42
|
+
- Field types and constraints
|
|
43
|
+
- Timestamps (created_at, updated_at)
|
|
44
|
+
4. **Validate syntax**:
|
|
45
|
+
- Starts with `erDiagram` (uses `mermaid` keyword)
|
|
46
|
+
- Relationship cardinality correct (||--o{, }o--||, etc.)
|
|
47
|
+
- Field definitions include type and constraints
|
|
48
|
+
- Proper formatting
|
|
49
|
+
5. **Specify file path**: `.specweave/docs/internal/architecture/diagrams/auth/data-model.mmd`
|
|
50
|
+
6. **Provide validation instructions**
|
|
51
|
+
|
|
52
|
+
## Expected Output
|
|
53
|
+
|
|
54
|
+
**Diagram Content** (approximate):
|
|
55
|
+
```
|
|
56
|
+
erDiagram
|
|
57
|
+
USER ||--o{ SESSION : has
|
|
58
|
+
USER ||--o{ REFRESH_TOKEN : has
|
|
59
|
+
USER ||--o{ PASSWORD_RESET : requests
|
|
60
|
+
|
|
61
|
+
USER {
|
|
62
|
+
uuid id PK
|
|
63
|
+
string email UK
|
|
64
|
+
string password_hash
|
|
65
|
+
string first_name
|
|
66
|
+
string last_name
|
|
67
|
+
boolean email_verified
|
|
68
|
+
timestamp created_at
|
|
69
|
+
timestamp updated_at
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
SESSION {
|
|
73
|
+
uuid id PK
|
|
74
|
+
uuid user_id FK
|
|
75
|
+
string token UK
|
|
76
|
+
timestamp expires_at
|
|
77
|
+
string ip_address
|
|
78
|
+
string user_agent
|
|
79
|
+
timestamp created_at
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
REFRESH_TOKEN {
|
|
83
|
+
uuid id PK
|
|
84
|
+
uuid user_id FK
|
|
85
|
+
string token UK
|
|
86
|
+
timestamp expires_at
|
|
87
|
+
boolean revoked
|
|
88
|
+
timestamp created_at
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
PASSWORD_RESET {
|
|
92
|
+
uuid id PK
|
|
93
|
+
uuid user_id FK
|
|
94
|
+
string token UK
|
|
95
|
+
timestamp expires_at
|
|
96
|
+
boolean used
|
|
97
|
+
timestamp created_at
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**File Path**: `.specweave/docs/internal/architecture/diagrams/auth/data-model.mmd`
|
|
102
|
+
|
|
103
|
+
**Validation Message**:
|
|
104
|
+
```
|
|
105
|
+
✅ Diagram created: .specweave/docs/internal/architecture/diagrams/auth/data-model.mmd
|
|
106
|
+
|
|
107
|
+
📋 VALIDATION REQUIRED:
|
|
108
|
+
1. Open the file in VS Code
|
|
109
|
+
2. Verify the ER diagram renders correctly
|
|
110
|
+
3. Confirm relationships and cardinality are accurate
|
|
111
|
+
4. Check that all fields and constraints are visible
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Success Criteria
|
|
115
|
+
|
|
116
|
+
- [ ] Diagram uses correct erDiagram syntax
|
|
117
|
+
- [ ] Includes `mermaid` keyword
|
|
118
|
+
- [ ] Entities named in UPPERCASE
|
|
119
|
+
- [ ] Relationship cardinality correct (||--o{, }o--||, }o--o{)
|
|
120
|
+
- [ ] All entities have id PK field
|
|
121
|
+
- [ ] Foreign keys marked with FK
|
|
122
|
+
- [ ] Unique constraints marked with UK
|
|
123
|
+
- [ ] Field types specified (uuid, string, boolean, timestamp, etc.)
|
|
124
|
+
- [ ] Timestamps (created_at, updated_at) included
|
|
125
|
+
- [ ] Relationships have descriptive labels (has, belongs to, requests)
|
|
126
|
+
- [ ] File path follows conventions (module subdirectory)
|
|
127
|
+
- [ ] Validation instructions provided
|
|
128
|
+
- [ ] Diagram would render correctly
|
|
129
|
+
|
|
130
|
+
## Failure Scenarios
|
|
131
|
+
|
|
132
|
+
**Scenario 1: Incorrect relationship cardinality**
|
|
133
|
+
```
|
|
134
|
+
USER ||--|| SESSION : has
|
|
135
|
+
```
|
|
136
|
+
❌ FAIL: User can have multiple sessions (should be one-to-many: ||--o{)
|
|
137
|
+
|
|
138
|
+
**Scenario 2: Missing field constraints**
|
|
139
|
+
```
|
|
140
|
+
USER {
|
|
141
|
+
uuid id
|
|
142
|
+
string email
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
❌ FAIL: Should mark id as PK, email as UK
|
|
146
|
+
|
|
147
|
+
**Scenario 3: Missing foreign key relationships**
|
|
148
|
+
```
|
|
149
|
+
SESSION {
|
|
150
|
+
uuid id PK
|
|
151
|
+
uuid user_id
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
❌ FAIL: user_id should be marked as FK
|
|
155
|
+
|
|
156
|
+
**Scenario 4: Lowercase entity names**
|
|
157
|
+
```
|
|
158
|
+
user ||--o{ session : has
|
|
159
|
+
```
|
|
160
|
+
❌ FAIL: Entity names should be UPPERCASE convention
|
|
161
|
+
|
|
162
|
+
**Scenario 5: Missing timestamps**
|
|
163
|
+
```
|
|
164
|
+
USER {
|
|
165
|
+
uuid id PK
|
|
166
|
+
string email UK
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
❌ FAIL: Should include created_at, updated_at
|
|
170
|
+
|
|
171
|
+
## Traceability
|
|
172
|
+
|
|
173
|
+
**Covers User Stories**:
|
|
174
|
+
- US-B003: Create ER Diagram
|
|
175
|
+
|
|
176
|
+
**Covers Acceptance Criteria**:
|
|
177
|
+
- TC-B014: Skill detects ER diagram request
|
|
178
|
+
- TC-B015: Agent generates erDiagram syntax
|
|
179
|
+
- TC-B016: Entities, attributes, relationships correctly defined
|
|
180
|
+
- TC-B017: Primary/foreign keys marked
|
|
181
|
+
- TC-B018: Diagram saved to correct location
|
|
182
|
+
- TC-B019: File named `data-model.mmd` or `{module}-data-model.mmd`
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
name: "Create C4 Context Diagram"
|
|
2
|
+
description: "Test creating a C4 Level 1 context diagram for a system"
|
|
3
|
+
user_input: "Create a C4 context diagram for an e-commerce platform"
|
|
4
|
+
expected_behavior:
|
|
5
|
+
- Generates valid Mermaid C4Context diagram
|
|
6
|
+
- Includes system boundary
|
|
7
|
+
- Shows external actors (users, external systems)
|
|
8
|
+
- Shows relationships and dependencies
|
|
9
|
+
validation:
|
|
10
|
+
- Diagram starts with C4Context keyword
|
|
11
|
+
- Contains Person/System elements
|
|
12
|
+
- Includes Boundary definition
|
|
13
|
+
- Has BiRel or Rel relationship arrows
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
name: "Create Sequence Diagram"
|
|
2
|
+
description: "Test creating a sequence diagram for API authentication flow"
|
|
3
|
+
user_input: "Create a sequence diagram for OAuth 2.0 authentication flow"
|
|
4
|
+
expected_behavior:
|
|
5
|
+
- Generates valid Mermaid sequence diagram
|
|
6
|
+
- Shows participants (client, auth server, resource server)
|
|
7
|
+
- Includes authentication steps in correct order
|
|
8
|
+
- Shows token exchange flow
|
|
9
|
+
validation:
|
|
10
|
+
- Diagram starts with sequenceDiagram keyword
|
|
11
|
+
- Contains participant declarations
|
|
12
|
+
- Has sequential messages (->>, -->)
|
|
13
|
+
- Includes notes for clarity
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
name: "Create Entity Relationship Diagram"
|
|
2
|
+
description: "Test creating an ER diagram for database schema"
|
|
3
|
+
user_input: "Create an ER diagram for a multi-tenant SaaS database"
|
|
4
|
+
expected_behavior:
|
|
5
|
+
- Generates valid Mermaid ER diagram
|
|
6
|
+
- Shows entities (tables)
|
|
7
|
+
- Shows relationships with cardinality
|
|
8
|
+
- Includes key attributes
|
|
9
|
+
validation:
|
|
10
|
+
- Diagram starts with erDiagram keyword
|
|
11
|
+
- Contains entity definitions
|
|
12
|
+
- Has relationships (||--o{, etc.)
|
|
13
|
+
- Shows primary/foreign key fields
|