sdd-mcp-server 3.0.2 → 3.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/README.md +117 -98
- package/agents/architect.md +107 -0
- package/agents/implementer.md +154 -0
- package/agents/planner.md +97 -0
- package/agents/reviewer.md +252 -0
- package/agents/security-auditor.md +127 -0
- package/agents/tdd-guide.md +241 -0
- package/contexts/dev.md +58 -0
- package/contexts/planning.md +79 -0
- package/contexts/research.md +93 -0
- package/contexts/review.md +73 -0
- package/contexts/security-audit.md +92 -0
- package/dist/cli/migrate-steering.d.ts +24 -0
- package/dist/cli/migrate-steering.js +308 -0
- package/dist/cli/migrate-steering.js.map +1 -0
- package/dist/cli/sdd-mcp-cli.js +9 -0
- package/dist/cli/sdd-mcp-cli.js.map +1 -1
- package/hooks/post-tool-use/log-tool-execution.md +51 -0
- package/hooks/post-tool-use/update-spec-status.md +50 -0
- package/hooks/pre-tool-use/check-test-coverage.md +51 -0
- package/hooks/pre-tool-use/validate-sdd-workflow.md +55 -0
- package/hooks/session-end/remind-uncommitted-changes.md +58 -0
- package/hooks/session-end/save-session-summary.md +72 -0
- package/hooks/session-start/load-project-context.md +62 -0
- package/package.json +5 -1
- package/rules/coding-style.md +97 -0
- package/rules/error-handling.md +134 -0
- package/rules/git-workflow.md +92 -0
- package/rules/sdd-workflow.md +116 -0
- package/rules/security.md +89 -0
- package/rules/testing.md +85 -0
- package/sdd-entry.js +1 -1
- package/skills/sdd-commit/SKILL.md +0 -14
- package/steering/product.md +29 -0
- package/steering/structure.md +60 -0
- package/steering/tech.md +52 -0
- package/steering/AGENTS.md +0 -281
- package/steering/commit.md +0 -59
- package/steering/linus-review.md +0 -153
- package/steering/owasp-top10-check.md +0 -49
- package/steering/principles.md +0 -639
- package/steering/tdd-guideline.md +0 -324
package/dist/cli/sdd-mcp-cli.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { main as installSkillsMain, mainInstall as installMain } from './install-skills.js';
|
|
12
12
|
import { main as migrateKiroMain } from './migrate-kiro.js';
|
|
13
|
+
import { main as migrateSteeringMain } from './migrate-steering.js';
|
|
13
14
|
const HELP = `
|
|
14
15
|
SDD MCP CLI
|
|
15
16
|
|
|
@@ -19,6 +20,7 @@ Commands:
|
|
|
19
20
|
install Install SDD skills AND steering documents (recommended)
|
|
20
21
|
install-skills Install SDD skills only (legacy)
|
|
21
22
|
migrate-kiro Migrate .kiro directory to .spec (v2.1.0+)
|
|
23
|
+
migrate-steering Migrate steering docs to consolidated components (v3.1.0+)
|
|
22
24
|
|
|
23
25
|
Options:
|
|
24
26
|
--help, -h Show this help message
|
|
@@ -32,6 +34,8 @@ Examples:
|
|
|
32
34
|
npx sdd-mcp-server install-skills --list # List available skills
|
|
33
35
|
npx sdd-mcp-server migrate-kiro # Migrate .kiro to .spec
|
|
34
36
|
npx sdd-mcp-server migrate-kiro --dry-run # Preview migration
|
|
37
|
+
npx sdd-mcp-server migrate-steering # Migrate static steering docs
|
|
38
|
+
npx sdd-mcp-server migrate-steering --dry-run # Preview steering migration
|
|
35
39
|
|
|
36
40
|
Running without a command starts the MCP server (for IDE integrations).
|
|
37
41
|
`;
|
|
@@ -58,6 +62,11 @@ async function main() {
|
|
|
58
62
|
process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
|
|
59
63
|
await migrateKiroMain();
|
|
60
64
|
break;
|
|
65
|
+
case 'migrate-steering':
|
|
66
|
+
// Remove the command from args and pass the rest to migrate-steering
|
|
67
|
+
process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
|
|
68
|
+
await migrateSteeringMain();
|
|
69
|
+
break;
|
|
61
70
|
default:
|
|
62
71
|
console.error(`Unknown command: ${command}`);
|
|
63
72
|
console.log(HELP);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdd-mcp-cli.js","sourceRoot":"","sources":["../../src/cli/sdd-mcp-cli.ts"],"names":[],"mappings":";AAEA;;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+
event: post-tool-use
|
|
5
|
+
priority: 50
|
|
6
|
+
enabled: false
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Log Tool Execution Hook
|
|
10
|
+
|
|
11
|
+
This hook logs all tool executions to a local log file for debugging and auditing.
|
|
12
|
+
|
|
13
|
+
## Purpose
|
|
14
|
+
|
|
15
|
+
- **Debugging** - Trace issues by reviewing tool invocation history
|
|
16
|
+
- **Auditing** - Track what actions were taken during a session
|
|
17
|
+
- **Learning** - Analyze patterns in tool usage over time
|
|
18
|
+
|
|
19
|
+
## Log Format
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
[2024-01-15T10:30:00.000Z] TOOL_EXEC
|
|
23
|
+
tool: sdd-requirements
|
|
24
|
+
feature: user-authentication
|
|
25
|
+
duration: 1250ms
|
|
26
|
+
status: success
|
|
27
|
+
output_files:
|
|
28
|
+
- .spec/specs/user-authentication/requirements.md
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Log Location
|
|
32
|
+
|
|
33
|
+
Logs are written to:
|
|
34
|
+
- Default: `.sdd/logs/tool-execution.log`
|
|
35
|
+
- Configurable via `SDD_LOG_PATH` environment variable
|
|
36
|
+
|
|
37
|
+
## Configuration
|
|
38
|
+
|
|
39
|
+
```yaml
|
|
40
|
+
# In .sdd/config.yaml
|
|
41
|
+
hooks:
|
|
42
|
+
log-tool-execution:
|
|
43
|
+
enabled: true
|
|
44
|
+
log_level: info # debug, info, warn, error
|
|
45
|
+
max_log_size: 10MB
|
|
46
|
+
retain_days: 30
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Note
|
|
50
|
+
|
|
51
|
+
This hook is disabled by default to avoid unnecessary disk I/O during normal development. Enable it when debugging or for compliance requirements.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: update-spec-status
|
|
3
|
+
description: Automatically updates spec.json status after SDD tool completion
|
|
4
|
+
event: post-tool-use
|
|
5
|
+
priority: 100
|
|
6
|
+
enabled: true
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Update Spec Status Hook
|
|
10
|
+
|
|
11
|
+
This hook automatically updates the spec.json file after SDD workflow tools complete successfully.
|
|
12
|
+
|
|
13
|
+
## Trigger Conditions
|
|
14
|
+
|
|
15
|
+
Triggered after these tools complete successfully:
|
|
16
|
+
- `sdd-init` - Sets status to "initialized"
|
|
17
|
+
- `sdd-requirements` - Sets requirements phase to "generated"
|
|
18
|
+
- `sdd-approve requirements` - Sets requirements phase to "approved"
|
|
19
|
+
- `sdd-design` - Sets design phase to "generated"
|
|
20
|
+
- `sdd-approve design` - Sets design phase to "approved"
|
|
21
|
+
- `sdd-tasks` - Sets tasks phase to "generated"
|
|
22
|
+
- `sdd-approve tasks` - Sets tasks phase to "approved"
|
|
23
|
+
- `sdd-implement` - Updates task completion status
|
|
24
|
+
|
|
25
|
+
## Status Updates
|
|
26
|
+
|
|
27
|
+
```json
|
|
28
|
+
{
|
|
29
|
+
"workflow_status": {
|
|
30
|
+
"current_phase": "design",
|
|
31
|
+
"phases": {
|
|
32
|
+
"requirements": {
|
|
33
|
+
"status": "approved",
|
|
34
|
+
"completed_at": "2024-01-15T10:30:00Z"
|
|
35
|
+
},
|
|
36
|
+
"design": {
|
|
37
|
+
"status": "in_progress",
|
|
38
|
+
"started_at": "2024-01-15T11:00:00Z"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Benefits
|
|
46
|
+
|
|
47
|
+
1. **Audit Trail** - Track when each phase was completed
|
|
48
|
+
2. **Workflow Validation** - Enable pre-tool-use hooks to validate phase order
|
|
49
|
+
3. **Progress Visibility** - Show current workflow status in sdd-status
|
|
50
|
+
4. **Automation** - Enable CI/CD integration based on spec status
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: check-test-coverage
|
|
3
|
+
description: Reminds developers to write tests first when implementing features
|
|
4
|
+
event: pre-tool-use
|
|
5
|
+
priority: 90
|
|
6
|
+
enabled: true
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Check Test Coverage Hook
|
|
10
|
+
|
|
11
|
+
This hook promotes TDD by reminding developers to write tests before implementation.
|
|
12
|
+
|
|
13
|
+
## Trigger Conditions
|
|
14
|
+
|
|
15
|
+
Triggered before code modification tools:
|
|
16
|
+
- File writes to `src/**/*.ts` (excluding test files)
|
|
17
|
+
- Code generation requests
|
|
18
|
+
- Implementation-related tool calls
|
|
19
|
+
|
|
20
|
+
## Validation Logic
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
IF modifying source file (not test file) THEN
|
|
24
|
+
CHECK if corresponding test file exists
|
|
25
|
+
IF no test file THEN
|
|
26
|
+
WARN about TDD best practice
|
|
27
|
+
SUGGEST creating test file first
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Example Prompt
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
🧪 TDD Reminder
|
|
34
|
+
|
|
35
|
+
You're about to modify 'src/services/UserService.ts' but no
|
|
36
|
+
corresponding test file was found.
|
|
37
|
+
|
|
38
|
+
Consider creating 'src/__tests__/services/UserService.test.ts'
|
|
39
|
+
first and writing failing tests for the expected behavior.
|
|
40
|
+
|
|
41
|
+
TDD Flow:
|
|
42
|
+
1. Write failing test (Red)
|
|
43
|
+
2. Implement code to pass test (Green)
|
|
44
|
+
3. Refactor for quality (Refactor)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Configuration
|
|
48
|
+
|
|
49
|
+
This hook can be configured via environment variables:
|
|
50
|
+
- `SDD_TDD_STRICT=true` - Block modifications without tests
|
|
51
|
+
- `SDD_TDD_REMINDER=true` - Show reminder but allow proceeding (default)
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: validate-sdd-workflow
|
|
3
|
+
description: Validates that SDD workflow phases are followed in correct order
|
|
4
|
+
event: pre-tool-use
|
|
5
|
+
priority: 100
|
|
6
|
+
enabled: true
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Validate SDD Workflow Hook
|
|
10
|
+
|
|
11
|
+
This hook validates that the SDD workflow phases are being followed correctly before tool invocation.
|
|
12
|
+
|
|
13
|
+
## Trigger Conditions
|
|
14
|
+
|
|
15
|
+
Triggered before these tools are invoked:
|
|
16
|
+
- `sdd-design` (requires `sdd-requirements` to be completed first)
|
|
17
|
+
- `sdd-tasks` (requires `sdd-design` to be completed first)
|
|
18
|
+
- `sdd-implement` (requires `sdd-tasks` to be completed first)
|
|
19
|
+
|
|
20
|
+
## Validation Logic
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
IF tool == 'sdd-design' THEN
|
|
24
|
+
CHECK that requirements.md exists and is approved
|
|
25
|
+
CHECK that spec.json shows requirements phase completed
|
|
26
|
+
|
|
27
|
+
IF tool == 'sdd-tasks' THEN
|
|
28
|
+
CHECK that design.md exists and is approved
|
|
29
|
+
CHECK that spec.json shows design phase completed
|
|
30
|
+
|
|
31
|
+
IF tool == 'sdd-implement' THEN
|
|
32
|
+
CHECK that tasks.md exists
|
|
33
|
+
CHECK that spec.json shows tasks phase completed
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## On Validation Failure
|
|
37
|
+
|
|
38
|
+
If validation fails:
|
|
39
|
+
1. Display warning message explaining which phase is missing
|
|
40
|
+
2. Suggest running the correct phase first
|
|
41
|
+
3. Allow override with explicit `--skip-validation` flag
|
|
42
|
+
|
|
43
|
+
## Example Warning
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
⚠️ SDD Workflow Violation
|
|
47
|
+
|
|
48
|
+
You're attempting to run 'sdd-design' but the requirements phase
|
|
49
|
+
has not been completed yet.
|
|
50
|
+
|
|
51
|
+
Please run 'sdd-requirements' first to generate the requirements
|
|
52
|
+
document, then have it reviewed and approved before proceeding.
|
|
53
|
+
|
|
54
|
+
To skip this check: sdd-design --skip-validation
|
|
55
|
+
```
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: remind-uncommitted-changes
|
|
3
|
+
description: Reminds developer of uncommitted changes before ending session
|
|
4
|
+
event: session-end
|
|
5
|
+
priority: 90
|
|
6
|
+
enabled: true
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Remind Uncommitted Changes Hook
|
|
10
|
+
|
|
11
|
+
This hook checks for uncommitted changes and reminds the developer before the session ends.
|
|
12
|
+
|
|
13
|
+
## Actions
|
|
14
|
+
|
|
15
|
+
1. **Check Git Status**
|
|
16
|
+
- Detect uncommitted changes
|
|
17
|
+
- Identify untracked files
|
|
18
|
+
- Check for stashed changes
|
|
19
|
+
|
|
20
|
+
2. **Display Warning**
|
|
21
|
+
```
|
|
22
|
+
⚠️ Uncommitted Changes Detected
|
|
23
|
+
|
|
24
|
+
You have changes that haven't been committed:
|
|
25
|
+
|
|
26
|
+
Modified:
|
|
27
|
+
• src/hooks/HookLoader.ts
|
|
28
|
+
• src/__tests__/hooks/HookLoader.test.ts
|
|
29
|
+
|
|
30
|
+
Untracked:
|
|
31
|
+
• hooks/pre-tool-use/validate-sdd-workflow.md
|
|
32
|
+
|
|
33
|
+
Consider committing your changes before ending the session.
|
|
34
|
+
Run: /sdd-commit to create a commit with proper message
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
3. **Suggest Actions**
|
|
38
|
+
- Offer to run commit command
|
|
39
|
+
- Show diff summary
|
|
40
|
+
- Remind about push to remote
|
|
41
|
+
|
|
42
|
+
## Configuration
|
|
43
|
+
|
|
44
|
+
```yaml
|
|
45
|
+
# In .sdd/config.yaml
|
|
46
|
+
hooks:
|
|
47
|
+
remind-uncommitted-changes:
|
|
48
|
+
enabled: true
|
|
49
|
+
include_untracked: true
|
|
50
|
+
warn_large_diff: true
|
|
51
|
+
large_diff_threshold: 500 # lines
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Benefits
|
|
55
|
+
|
|
56
|
+
- **Prevent Lost Work** - Don't lose changes between sessions
|
|
57
|
+
- **Clean State** - End sessions with clean working directory
|
|
58
|
+
- **Team Sync** - Remind to push for team visibility
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: save-session-summary
|
|
3
|
+
description: Saves a summary of the session for continuity between sessions
|
|
4
|
+
event: session-end
|
|
5
|
+
priority: 100
|
|
6
|
+
enabled: true
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Save Session Summary Hook
|
|
10
|
+
|
|
11
|
+
This hook saves a summary of the session when it ends, enabling seamless continuity in future sessions.
|
|
12
|
+
|
|
13
|
+
## What Gets Saved
|
|
14
|
+
|
|
15
|
+
1. **Workflow Progress**
|
|
16
|
+
- Features worked on during session
|
|
17
|
+
- Phases completed
|
|
18
|
+
- Tasks implemented
|
|
19
|
+
|
|
20
|
+
2. **Decisions Made**
|
|
21
|
+
- Architecture decisions
|
|
22
|
+
- Implementation choices
|
|
23
|
+
- Trade-offs considered
|
|
24
|
+
|
|
25
|
+
3. **Context to Preserve**
|
|
26
|
+
- Current working state
|
|
27
|
+
- Pending items
|
|
28
|
+
- Blockers or questions
|
|
29
|
+
|
|
30
|
+
## Summary Location
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
.spec/sessions/
|
|
34
|
+
└── 2024-01-15T10-30-00Z.md
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Summary Format
|
|
38
|
+
|
|
39
|
+
```markdown
|
|
40
|
+
# Session Summary - 2024-01-15
|
|
41
|
+
|
|
42
|
+
## Duration
|
|
43
|
+
Started: 10:30 AM | Ended: 2:45 PM (4h 15m)
|
|
44
|
+
|
|
45
|
+
## Features Worked On
|
|
46
|
+
|
|
47
|
+
### plugin-architecture-v3
|
|
48
|
+
- Completed: requirements phase approved
|
|
49
|
+
- In Progress: design phase
|
|
50
|
+
- Next: Complete component diagram
|
|
51
|
+
|
|
52
|
+
### user-authentication
|
|
53
|
+
- Implemented: Tasks 1.1, 1.2, 1.3
|
|
54
|
+
- Tests: 12 new tests, all passing
|
|
55
|
+
- Blockers: Need OAuth provider decision
|
|
56
|
+
|
|
57
|
+
## Key Decisions
|
|
58
|
+
1. Using BaseManager pattern for all component managers
|
|
59
|
+
2. Hooks organized by event type in nested directories
|
|
60
|
+
3. YAML frontmatter for all component metadata
|
|
61
|
+
|
|
62
|
+
## Continuation Notes
|
|
63
|
+
- Resume design.md at "Data Flow" section
|
|
64
|
+
- Review OAuth options before next session
|
|
65
|
+
- Run integration tests after completing design
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Benefits
|
|
69
|
+
|
|
70
|
+
- **Seamless Continuity** - Start next session with full context
|
|
71
|
+
- **Knowledge Preservation** - Decisions and context don't get lost
|
|
72
|
+
- **Progress Tracking** - Clear record of work accomplished
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: load-project-context
|
|
3
|
+
description: Loads project context and steering documents at session start
|
|
4
|
+
event: session-start
|
|
5
|
+
priority: 100
|
|
6
|
+
enabled: true
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Load Project Context Hook
|
|
10
|
+
|
|
11
|
+
This hook loads project-specific context and steering documents when a new session starts.
|
|
12
|
+
|
|
13
|
+
## Actions
|
|
14
|
+
|
|
15
|
+
1. **Detect Project Type**
|
|
16
|
+
- Check for `.spec/steering/` directory
|
|
17
|
+
- Identify project technology stack
|
|
18
|
+
- Load appropriate steering documents
|
|
19
|
+
|
|
20
|
+
2. **Load Steering Documents**
|
|
21
|
+
```
|
|
22
|
+
.spec/steering/
|
|
23
|
+
├── PROJECT.md # Project overview and conventions
|
|
24
|
+
├── AGENTS.md # Agent configuration
|
|
25
|
+
├── ARCHITECTURE.md # System architecture
|
|
26
|
+
└── custom/ # Project-specific guides
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
3. **Restore Workflow State**
|
|
30
|
+
- Read `.spec/specs/*/spec.json` for active features
|
|
31
|
+
- Identify current phase for each feature
|
|
32
|
+
- Surface any incomplete workflows
|
|
33
|
+
|
|
34
|
+
4. **Set Session Context**
|
|
35
|
+
- Configure AI persona based on active agent
|
|
36
|
+
- Apply relevant rules
|
|
37
|
+
- Activate appropriate context mode
|
|
38
|
+
|
|
39
|
+
## Session Initialization Message
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
📋 Project Context Loaded
|
|
43
|
+
|
|
44
|
+
Project: sdd-mcp
|
|
45
|
+
Type: Node.js/TypeScript
|
|
46
|
+
Active Features:
|
|
47
|
+
• plugin-architecture-v3 (design phase)
|
|
48
|
+
• user-authentication (implementation phase)
|
|
49
|
+
|
|
50
|
+
Steering Documents:
|
|
51
|
+
✓ PROJECT.md loaded
|
|
52
|
+
✓ AGENTS.md loaded
|
|
53
|
+
✓ 3 custom guides loaded
|
|
54
|
+
|
|
55
|
+
Ready to continue. Run /sdd-status for full workflow state.
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Benefits
|
|
59
|
+
|
|
60
|
+
- **Consistent Context** - Every session starts with full project understanding
|
|
61
|
+
- **Workflow Continuity** - Pick up where you left off
|
|
62
|
+
- **Best Practices** - Steering documents are always active
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sdd-mcp-server",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "MCP server for spec-driven development workflows across AI-agent CLIs and IDEs",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
"dist/**/*",
|
|
13
13
|
"skills/**/*",
|
|
14
14
|
"steering/**/*",
|
|
15
|
+
"rules/**/*",
|
|
16
|
+
"contexts/**/*",
|
|
17
|
+
"agents/**/*",
|
|
18
|
+
"hooks/**/*",
|
|
15
19
|
"sdd-entry.js",
|
|
16
20
|
"mcp-server.js",
|
|
17
21
|
"atomicWrite.js",
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: coding-style
|
|
3
|
+
description: Enforce consistent TypeScript/JavaScript coding conventions and design principles
|
|
4
|
+
priority: 100
|
|
5
|
+
alwaysActive: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Coding Style Rules
|
|
9
|
+
|
|
10
|
+
## TypeScript/JavaScript Guidelines
|
|
11
|
+
|
|
12
|
+
### Type Safety
|
|
13
|
+
- Use explicit types for function parameters and return values
|
|
14
|
+
- Avoid `any` type - use `unknown` or proper generics instead
|
|
15
|
+
- Enable strict mode in TypeScript configuration
|
|
16
|
+
|
|
17
|
+
### Naming Conventions
|
|
18
|
+
- **Classes**: PascalCase (e.g., `UserService`)
|
|
19
|
+
- **Functions/Methods**: camelCase (e.g., `getUserById`)
|
|
20
|
+
- **Constants**: UPPER_SNAKE_CASE (e.g., `MAX_RETRIES`)
|
|
21
|
+
- **Files**: kebab-case (e.g., `user-service.ts`)
|
|
22
|
+
|
|
23
|
+
### Functions
|
|
24
|
+
- Keep functions small and focused (single responsibility)
|
|
25
|
+
- Limit function parameters to 3-4; use options object for more
|
|
26
|
+
- Use early returns to reduce nesting
|
|
27
|
+
|
|
28
|
+
### Code Organization
|
|
29
|
+
- One class per file (with rare exceptions)
|
|
30
|
+
- Keep files under 300 lines when possible
|
|
31
|
+
- Write self-documenting code - minimize inline comments
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
# Core Design Principles
|
|
36
|
+
|
|
37
|
+
**Golden Rule**: Always ask "Does this code follow SOLID, DRY, KISS, YAGNI?" before committing.
|
|
38
|
+
|
|
39
|
+
## SOLID Principles
|
|
40
|
+
|
|
41
|
+
### S - Single Responsibility Principle (SRP)
|
|
42
|
+
A class/module should have one, and only one, reason to change.
|
|
43
|
+
|
|
44
|
+
### O - Open/Closed Principle (OCP)
|
|
45
|
+
Open for extension, closed for modification. Use interfaces/abstractions.
|
|
46
|
+
|
|
47
|
+
### L - Liskov Substitution Principle (LSP)
|
|
48
|
+
Derived classes must be substitutable for their base classes.
|
|
49
|
+
|
|
50
|
+
### I - Interface Segregation Principle (ISP)
|
|
51
|
+
No client should depend on methods it doesn't use. Keep interfaces small.
|
|
52
|
+
|
|
53
|
+
### D - Dependency Inversion Principle (DIP)
|
|
54
|
+
Depend on abstractions, not concrete implementations. Use dependency injection.
|
|
55
|
+
|
|
56
|
+
## DRY (Don't Repeat Yourself)
|
|
57
|
+
Every piece of knowledge should have a single, authoritative representation.
|
|
58
|
+
|
|
59
|
+
## KISS (Keep It Simple)
|
|
60
|
+
Simplicity should be a key goal. Avoid unnecessary complexity.
|
|
61
|
+
|
|
62
|
+
## YAGNI (You Aren't Gonna Need It)
|
|
63
|
+
Don't implement functionality until it's actually needed.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Code Review Checklist
|
|
68
|
+
|
|
69
|
+
### SOLID
|
|
70
|
+
- [ ] Does each class/module have a single responsibility?
|
|
71
|
+
- [ ] Can I extend functionality without modifying existing code?
|
|
72
|
+
- [ ] Are interfaces small and focused?
|
|
73
|
+
- [ ] Do dependencies point toward abstractions?
|
|
74
|
+
|
|
75
|
+
### DRY
|
|
76
|
+
- [ ] Is there any duplicated logic that should be extracted?
|
|
77
|
+
- [ ] Are magic numbers/strings extracted to constants?
|
|
78
|
+
|
|
79
|
+
### KISS
|
|
80
|
+
- [ ] Is the solution as simple as possible?
|
|
81
|
+
- [ ] Are variable/function names clear without comments?
|
|
82
|
+
|
|
83
|
+
### YAGNI
|
|
84
|
+
- [ ] Is every feature actually needed now?
|
|
85
|
+
- [ ] Are there "future-proofing" additions that can be removed?
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Common Anti-Patterns to Avoid
|
|
90
|
+
|
|
91
|
+
| Anti-Pattern | Violates | Fix |
|
|
92
|
+
|--------------|----------|-----|
|
|
93
|
+
| God Object/Class | SRP | Split into focused classes |
|
|
94
|
+
| Copy-Paste Programming | DRY | Extract common logic |
|
|
95
|
+
| Premature Optimization | KISS, YAGNI | Optimize when needed |
|
|
96
|
+
| Long Parameter List | KISS | Use parameter objects |
|
|
97
|
+
| Magic Numbers | DRY | Extract to named constants |
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: error-handling
|
|
3
|
+
description: Error handling patterns and best practices
|
|
4
|
+
priority: 90
|
|
5
|
+
alwaysActive: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Error Handling Rules
|
|
9
|
+
|
|
10
|
+
## Error Types
|
|
11
|
+
|
|
12
|
+
### Custom Error Classes
|
|
13
|
+
Define domain-specific errors for better handling:
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
class ValidationError extends Error {
|
|
17
|
+
constructor(message: string, public field?: string) {
|
|
18
|
+
super(message);
|
|
19
|
+
this.name = 'ValidationError';
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
class NotFoundError extends Error {
|
|
24
|
+
constructor(resource: string, id: string) {
|
|
25
|
+
super(`${resource} with id "${id}" not found`);
|
|
26
|
+
this.name = 'NotFoundError';
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
class AuthorizationError extends Error {
|
|
31
|
+
constructor(action: string) {
|
|
32
|
+
super(`Not authorized to ${action}`);
|
|
33
|
+
this.name = 'AuthorizationError';
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Error Handling Patterns
|
|
39
|
+
|
|
40
|
+
### Try-Catch Best Practices
|
|
41
|
+
```typescript
|
|
42
|
+
// Good: Specific error handling
|
|
43
|
+
try {
|
|
44
|
+
await saveUser(user);
|
|
45
|
+
} catch (error) {
|
|
46
|
+
if (error instanceof ValidationError) {
|
|
47
|
+
return { status: 400, message: error.message };
|
|
48
|
+
}
|
|
49
|
+
if (error instanceof DuplicateError) {
|
|
50
|
+
return { status: 409, message: 'User already exists' };
|
|
51
|
+
}
|
|
52
|
+
// Re-throw unexpected errors
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Bad: Swallowing all errors
|
|
57
|
+
try {
|
|
58
|
+
await saveUser(user);
|
|
59
|
+
} catch (error) {
|
|
60
|
+
console.log('Something went wrong');
|
|
61
|
+
// Error lost, no recovery, no logging
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Async Error Handling
|
|
66
|
+
```typescript
|
|
67
|
+
// Always use try-catch with async/await
|
|
68
|
+
async function fetchData(): Promise<Data> {
|
|
69
|
+
try {
|
|
70
|
+
const response = await fetch(url);
|
|
71
|
+
if (!response.ok) {
|
|
72
|
+
throw new HttpError(response.status, response.statusText);
|
|
73
|
+
}
|
|
74
|
+
return await response.json();
|
|
75
|
+
} catch (error) {
|
|
76
|
+
logger.error('Failed to fetch data', { error, url });
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Error Propagation
|
|
83
|
+
- Let errors bubble up to appropriate handlers
|
|
84
|
+
- Add context when re-throwing
|
|
85
|
+
- Don't catch errors you can't handle
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
// Good: Add context when re-throwing
|
|
89
|
+
async function processOrder(orderId: string): Promise<void> {
|
|
90
|
+
try {
|
|
91
|
+
await validateOrder(orderId);
|
|
92
|
+
await chargePayment(orderId);
|
|
93
|
+
await fulfillOrder(orderId);
|
|
94
|
+
} catch (error) {
|
|
95
|
+
throw new OrderProcessingError(
|
|
96
|
+
`Failed to process order ${orderId}`,
|
|
97
|
+
{ cause: error }
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Logging Errors
|
|
104
|
+
|
|
105
|
+
### What to Log
|
|
106
|
+
- Error message and stack trace
|
|
107
|
+
- Request/operation context
|
|
108
|
+
- User identifier (not PII)
|
|
109
|
+
- Timestamp
|
|
110
|
+
|
|
111
|
+
### What NOT to Log
|
|
112
|
+
- Passwords or tokens
|
|
113
|
+
- Personal identifiable information (PII)
|
|
114
|
+
- Full credit card numbers
|
|
115
|
+
- Internal implementation details in production
|
|
116
|
+
|
|
117
|
+
### Log Levels
|
|
118
|
+
- **ERROR**: Unexpected failures requiring attention
|
|
119
|
+
- **WARN**: Handled issues that may indicate problems
|
|
120
|
+
- **INFO**: Normal operations, significant events
|
|
121
|
+
- **DEBUG**: Detailed information for troubleshooting
|
|
122
|
+
|
|
123
|
+
## User-Facing Errors
|
|
124
|
+
|
|
125
|
+
### Never Expose
|
|
126
|
+
- Stack traces
|
|
127
|
+
- Database errors
|
|
128
|
+
- Internal paths
|
|
129
|
+
- Implementation details
|
|
130
|
+
|
|
131
|
+
### Always Provide
|
|
132
|
+
- Clear, actionable message
|
|
133
|
+
- Error code for support reference
|
|
134
|
+
- Next steps when possible
|