sdd-mcp-server 2.1.0 → 2.2.1
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 +53 -38
- package/atomicWrite.js +86 -0
- package/dist/adapters/cli/SDDToolAdapter.js +12 -2
- package/dist/adapters/cli/SDDToolAdapter.js.map +1 -1
- package/dist/cli/install-skills.d.ts +38 -2
- package/dist/cli/install-skills.js +226 -10
- package/dist/cli/install-skills.js.map +1 -1
- package/dist/cli/migrate-kiro.js +4 -4
- package/dist/cli/sdd-mcp-cli.d.ts +2 -1
- package/dist/cli/sdd-mcp-cli.js +21 -11
- package/dist/cli/sdd-mcp-cli.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/utils/atomicWrite.d.ts +55 -0
- package/dist/utils/atomicWrite.js +84 -0
- package/dist/utils/atomicWrite.js.map +1 -0
- package/mcp-server.js +5 -4
- package/package.json +5 -3
- package/sdd-entry.js +31 -0
- package/skills/sdd-commit/SKILL.md +14 -0
- package/skills/sdd-design/SKILL.md +15 -0
- package/skills/sdd-implement/SKILL.md +15 -0
- package/skills/sdd-requirements/SKILL.md +9 -2
- package/skills/sdd-tasks/SKILL.md +14 -0
- package/steering/AGENTS.md +281 -0
- package/steering/commit.md +59 -0
- package/steering/linus-review.md +153 -0
- package/steering/owasp-top10-check.md +49 -0
- package/steering/principles.md +639 -0
- package/steering/tdd-guideline.md +324 -0
- package/dist/utils/sddPaths.d.ts +0 -69
- package/dist/utils/sddPaths.js +0 -138
- package/dist/utils/sddPaths.js.map +0 -1
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Atomic file write utility
|
|
3
|
+
* 原子性檔案寫入工具
|
|
4
|
+
*
|
|
5
|
+
* Prevents file corruption when write operations are interrupted (crash, kill signal).
|
|
6
|
+
* Uses the temp-file + rename pattern which is atomic on POSIX systems.
|
|
7
|
+
* 防止寫入操作被中斷時(crash、kill signal)造成檔案損壞。
|
|
8
|
+
* 使用 temp-file + rename 模式,在 POSIX 系統上是原子操作。
|
|
9
|
+
*
|
|
10
|
+
* @note Windows Limitation / Windows 限制:
|
|
11
|
+
* On Windows, fs.rename() may fail with EEXIST if target exists.
|
|
12
|
+
* For Windows production use, consider using 'write-file-atomic' package.
|
|
13
|
+
* 在 Windows 上,若目標檔案存在,fs.rename() 可能會失敗。
|
|
14
|
+
* 若需在 Windows 生產環境使用,建議改用 'write-file-atomic' 套件。
|
|
15
|
+
*
|
|
16
|
+
* @module utils/atomicWrite
|
|
17
|
+
*/
|
|
18
|
+
import * as fs from "fs/promises";
|
|
19
|
+
import * as path from "path";
|
|
20
|
+
/**
|
|
21
|
+
* Write content to a file atomically.
|
|
22
|
+
*
|
|
23
|
+
* This function writes to a temporary file first, then renames it to the target path.
|
|
24
|
+
* The rename operation is atomic on POSIX systems, ensuring the file is never left
|
|
25
|
+
* in a corrupted state.
|
|
26
|
+
*
|
|
27
|
+
* @param filePath - The target file path
|
|
28
|
+
* @param content - The content to write
|
|
29
|
+
* @param options - Optional write options
|
|
30
|
+
* @returns Promise that resolves when write is complete
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* await atomicWriteFile('/path/to/spec.json', JSON.stringify(data, null, 2));
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export async function atomicWriteFile(filePath, content, options) {
|
|
38
|
+
const encoding = options?.encoding ?? "utf8";
|
|
39
|
+
const dir = path.dirname(filePath);
|
|
40
|
+
const filename = path.basename(filePath);
|
|
41
|
+
// Create temp file path with process ID, timestamp, and random suffix for uniqueness
|
|
42
|
+
// Random suffix prevents collisions when multiple writes occur within the same millisecond
|
|
43
|
+
const uniqueSuffix = `${Date.now()}.${Math.random().toString(36).slice(2, 10)}`;
|
|
44
|
+
const tempPath = path.join(dir, `.${filename}.${process.pid}.${uniqueSuffix}.tmp`);
|
|
45
|
+
try {
|
|
46
|
+
// Ensure directory exists
|
|
47
|
+
await fs.mkdir(dir, { recursive: true });
|
|
48
|
+
// Write to temp file
|
|
49
|
+
await fs.writeFile(tempPath, content, encoding);
|
|
50
|
+
// Atomic rename (on POSIX systems)
|
|
51
|
+
await fs.rename(tempPath, filePath);
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
// Clean up temp file if it exists
|
|
55
|
+
try {
|
|
56
|
+
await fs.unlink(tempPath);
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
// Ignore cleanup errors
|
|
60
|
+
}
|
|
61
|
+
throw error;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Write JSON content to a file atomically.
|
|
66
|
+
*
|
|
67
|
+
* Convenience wrapper that handles JSON serialization with pretty printing.
|
|
68
|
+
*
|
|
69
|
+
* @param filePath - The target file path
|
|
70
|
+
* @param data - The data to serialize and write
|
|
71
|
+
* @param options - Optional options (indent spaces, default 2)
|
|
72
|
+
* @returns Promise that resolves when write is complete
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```typescript
|
|
76
|
+
* await atomicWriteJSON('/path/to/spec.json', specData);
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
export async function atomicWriteJSON(filePath, data, options) {
|
|
80
|
+
const indent = options?.indent ?? 2;
|
|
81
|
+
const content = JSON.stringify(data, null, indent);
|
|
82
|
+
await atomicWriteFile(filePath, content);
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=atomicWrite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atomicWrite.js","sourceRoot":"","sources":["../../src/utils/atomicWrite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,QAAgB,EAChB,OAAe,EACf,OAAuC;IAEvC,MAAM,QAAQ,GAAG,OAAO,EAAE,QAAQ,IAAI,MAAM,CAAC;IAC7C,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAEzC,qFAAqF;IACrF,2FAA2F;IAC3F,MAAM,YAAY,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;IAChF,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,QAAQ,IAAI,OAAO,CAAC,GAAG,IAAI,YAAY,MAAM,CAAC,CAAC;IAEnF,IAAI,CAAC;QACH,0BAA0B;QAC1B,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAEzC,qBAAqB;QACrB,MAAM,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QAEhD,mCAAmC;QACnC,MAAM,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACtC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,kCAAkC;QAClC,IAAI,CAAC;YACH,MAAM,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC5B,CAAC;QAAC,MAAM,CAAC;YACP,wBAAwB;QAC1B,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,QAAgB,EAChB,IAAa,EACb,OAA6B;IAE7B,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,IAAI,CAAC,CAAC;IACpC,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IACnD,MAAM,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC"}
|
package/mcp-server.js
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
generateTechDocument,
|
|
11
11
|
generateStructureDocument,
|
|
12
12
|
} from "./documentGenerator.js";
|
|
13
|
+
import { atomicWriteJSON } from "./atomicWrite.js";
|
|
13
14
|
|
|
14
15
|
// Best-effort dynamic loader for spec generators (requirements/design/tasks)
|
|
15
16
|
async function loadSpecGenerator() {
|
|
@@ -551,7 +552,7 @@ server.registerTool(
|
|
|
551
552
|
spec.approvals.requirements.generated = true;
|
|
552
553
|
spec.updated_at = await getCurrentTimestamp();
|
|
553
554
|
|
|
554
|
-
await
|
|
555
|
+
await atomicWriteJSON(specPath, spec);
|
|
555
556
|
|
|
556
557
|
return {
|
|
557
558
|
content: [
|
|
@@ -633,7 +634,7 @@ server.registerTool(
|
|
|
633
634
|
spec.approvals.design.generated = true;
|
|
634
635
|
spec.updated_at = await getCurrentTimestamp();
|
|
635
636
|
|
|
636
|
-
await
|
|
637
|
+
await atomicWriteJSON(specPath, spec);
|
|
637
638
|
|
|
638
639
|
return {
|
|
639
640
|
content: [
|
|
@@ -771,7 +772,7 @@ ${designContext.substring(0, 1000)}${designContext.length > 1000 ? "...\n[Design
|
|
|
771
772
|
spec.ready_for_implementation = true;
|
|
772
773
|
spec.updated_at = await getCurrentTimestamp();
|
|
773
774
|
|
|
774
|
-
await
|
|
775
|
+
await atomicWriteJSON(specPath, spec);
|
|
775
776
|
|
|
776
777
|
return {
|
|
777
778
|
content: [
|
|
@@ -1034,7 +1035,7 @@ server.registerTool(
|
|
|
1034
1035
|
spec.approvals[phase].approved = true;
|
|
1035
1036
|
spec.updated_at = await getCurrentTimestamp();
|
|
1036
1037
|
|
|
1037
|
-
await
|
|
1038
|
+
await atomicWriteJSON(specPath, spec);
|
|
1038
1039
|
|
|
1039
1040
|
return {
|
|
1040
1041
|
content: [
|
package/package.json
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sdd-mcp-server",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.1",
|
|
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": {
|
|
7
|
-
"sdd-mcp-server": "
|
|
8
|
-
"sdd-mcp": "dist/cli/sdd-mcp-cli.js",
|
|
7
|
+
"sdd-mcp-server": "sdd-entry.js",
|
|
9
8
|
"sdd-install-skills": "dist/cli/install-skills.js"
|
|
10
9
|
},
|
|
11
10
|
"type": "module",
|
|
12
11
|
"files": [
|
|
13
12
|
"dist/**/*",
|
|
14
13
|
"skills/**/*",
|
|
14
|
+
"steering/**/*",
|
|
15
|
+
"sdd-entry.js",
|
|
15
16
|
"mcp-server.js",
|
|
17
|
+
"atomicWrite.js",
|
|
16
18
|
"documentGenerator.js",
|
|
17
19
|
"specGenerator.js",
|
|
18
20
|
"README.md",
|
package/sdd-entry.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Unified entry point for sdd-mcp-server
|
|
4
|
+
*
|
|
5
|
+
* Handles both:
|
|
6
|
+
* - CLI commands (install, install-skills, migrate-kiro)
|
|
7
|
+
* - MCP server mode (default)
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* npx sdd-mcp-server install --list # CLI: List available skills
|
|
11
|
+
* npx sdd-mcp-server install # CLI: Install skills and steering
|
|
12
|
+
* npx sdd-mcp-server # MCP: Start MCP server
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const CLI_COMMANDS = ['install', 'install-skills', 'migrate-kiro'];
|
|
16
|
+
const args = process.argv.slice(2);
|
|
17
|
+
const command = args[0];
|
|
18
|
+
|
|
19
|
+
if (command && (CLI_COMMANDS.includes(command) || command === '--help' || command === '-h')) {
|
|
20
|
+
// CLI mode - import and run CLI module
|
|
21
|
+
import('./dist/cli/sdd-mcp-cli.js').catch(err => {
|
|
22
|
+
console.error('Failed to load CLI:', err.message);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
});
|
|
25
|
+
} else {
|
|
26
|
+
// MCP server mode - import and run the MCP server
|
|
27
|
+
import('./mcp-server.js').catch(err => {
|
|
28
|
+
console.error('Failed to start MCP server:', err.message);
|
|
29
|
+
process.exit(1);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
@@ -271,6 +271,20 @@ git rebase origin/main
|
|
|
271
271
|
git push origin feature/AUTH-123-jwt-auth
|
|
272
272
|
```
|
|
273
273
|
|
|
274
|
+
## Steering Document References
|
|
275
|
+
|
|
276
|
+
Apply these steering documents for commits and PRs:
|
|
277
|
+
|
|
278
|
+
| Document | Purpose | Key Application |
|
|
279
|
+
|----------|---------|-----------------|
|
|
280
|
+
| `.spec/steering/commit.md` | Commit message conventions | Follow type prefixes, scope, and format guidelines |
|
|
281
|
+
|
|
282
|
+
**Key Commit Rules:**
|
|
283
|
+
1. Use type prefixes: `feat`, `fix`, `docs`, `refactor`, `test`, etc.
|
|
284
|
+
2. Keep subject line under 72 characters
|
|
285
|
+
3. Use imperative mood ("add" not "added")
|
|
286
|
+
4. Reference issues in footer
|
|
287
|
+
|
|
274
288
|
## Quality Checklist
|
|
275
289
|
|
|
276
290
|
- [ ] Commit message follows format
|
|
@@ -248,6 +248,21 @@ Before finalizing, validate against these principles:
|
|
|
248
248
|
| `sdd-validate-design` | Perform GO/NO-GO review |
|
|
249
249
|
| `sdd-approve` | Mark design phase as approved |
|
|
250
250
|
|
|
251
|
+
## Steering Document References
|
|
252
|
+
|
|
253
|
+
Apply these steering documents during design:
|
|
254
|
+
|
|
255
|
+
| Document | Purpose | Key Application |
|
|
256
|
+
|----------|---------|-----------------|
|
|
257
|
+
| `.spec/steering/principles.md` | SOLID, DRY, KISS, YAGNI | Apply SOLID principles to component design, ensure interfaces follow ISP and DIP |
|
|
258
|
+
| `.spec/steering/linus-review.md` | Code quality, data structures | Focus on data structures first, eliminate special cases, ensure backward compatibility |
|
|
259
|
+
|
|
260
|
+
**Key Linus Principles for Design:**
|
|
261
|
+
1. **Data Structures First**: "Bad programmers worry about the code. Good programmers worry about data structures."
|
|
262
|
+
2. **Eliminate Special Cases**: "Good code has no special cases"
|
|
263
|
+
3. **Simplicity**: "If implementation needs more than 3 levels of indentation, redesign it"
|
|
264
|
+
4. **Never Break Userspace**: Ensure backward compatibility
|
|
265
|
+
|
|
251
266
|
## Quality Checklist
|
|
252
267
|
|
|
253
268
|
- [ ] All FR-* requirements have corresponding components
|
|
@@ -269,6 +269,21 @@ After implementing each task:
|
|
|
269
269
|
- [ ] SOLID principles applied
|
|
270
270
|
- [ ] Code self-documenting or commented where needed
|
|
271
271
|
|
|
272
|
+
## Steering Document References
|
|
273
|
+
|
|
274
|
+
Apply these steering documents during implementation:
|
|
275
|
+
|
|
276
|
+
| Document | Purpose | Key Application |
|
|
277
|
+
|----------|---------|-----------------|
|
|
278
|
+
| `.spec/steering/tdd-guideline.md` | Test-Driven Development | Follow Red-Green-Refactor cycle for all code |
|
|
279
|
+
| `.spec/steering/principles.md` | SOLID, DRY, KISS, YAGNI | Apply SOLID principles, keep code simple and focused |
|
|
280
|
+
| `.spec/steering/owasp-top10-check.md` | Security checklist | Verify all OWASP Top 10 security requirements before completion |
|
|
281
|
+
|
|
282
|
+
**Critical Implementation Rules:**
|
|
283
|
+
1. **TDD First**: Never write production code without a failing test
|
|
284
|
+
2. **SOLID Always**: Apply all five principles (SRP, OCP, LSP, ISP, DIP)
|
|
285
|
+
3. **Security Required**: Complete OWASP checklist before marking done
|
|
286
|
+
|
|
272
287
|
## Common Anti-Patterns to Avoid
|
|
273
288
|
|
|
274
289
|
| Anti-Pattern | Problem | Solution |
|
|
@@ -133,8 +133,15 @@ Before completing requirements:
|
|
|
133
133
|
- [ ] No ambiguous terms (avoid "should", "may", "might")
|
|
134
134
|
- [ ] Each FR has clear acceptance criteria
|
|
135
135
|
|
|
136
|
-
##
|
|
136
|
+
## Steering Document References
|
|
137
137
|
|
|
138
|
-
|
|
138
|
+
Apply these steering documents during requirements generation:
|
|
139
|
+
|
|
140
|
+
| Document | Purpose | Key Application |
|
|
141
|
+
|----------|---------|-----------------|
|
|
142
|
+
| `.spec/steering/principles.md` | SOLID, DRY, KISS, YAGNI | Ensure requirements follow KISS (simple, unambiguous) and YAGNI (only what's needed now) |
|
|
143
|
+
|
|
144
|
+
**Key Principles for Requirements:**
|
|
139
145
|
- **KISS**: Keep requirements simple and unambiguous
|
|
140
146
|
- **YAGNI**: Only specify what's actually needed now
|
|
147
|
+
- **Single Responsibility**: Each requirement addresses one concern
|
|
@@ -222,6 +222,20 @@ describe('{Component}', () => {
|
|
|
222
222
|
- [ ] Implementation order respects dependencies
|
|
223
223
|
- [ ] Definition of Done is clear
|
|
224
224
|
|
|
225
|
+
## Steering Document References
|
|
226
|
+
|
|
227
|
+
Apply these steering documents during task breakdown:
|
|
228
|
+
|
|
229
|
+
| Document | Purpose | Key Application |
|
|
230
|
+
|----------|---------|-----------------|
|
|
231
|
+
| `.spec/steering/tdd-guideline.md` | Test-Driven Development | Structure all tasks using Red-Green-Refactor cycle, follow test pyramid (70/20/10) |
|
|
232
|
+
|
|
233
|
+
**Key TDD Principles for Tasks:**
|
|
234
|
+
1. **RED**: Every task starts with writing a failing test
|
|
235
|
+
2. **GREEN**: Implement minimal code to pass the test
|
|
236
|
+
3. **REFACTOR**: Clean up while keeping tests green
|
|
237
|
+
4. **Test Pyramid**: 70% unit, 20% integration, 10% E2E
|
|
238
|
+
|
|
225
239
|
## Common Anti-Patterns to Avoid
|
|
226
240
|
|
|
227
241
|
| Anti-Pattern | Problem | Solution |
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
# AI Agents Integration Guide
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
This document defines how AI agents should interact with the SDD workflow and provides guidelines for effective agent collaboration in spec-driven development.
|
|
5
|
+
|
|
6
|
+
## Agent Types and Roles
|
|
7
|
+
|
|
8
|
+
### Development Agents
|
|
9
|
+
AI agents that assist with code implementation, testing, and documentation.
|
|
10
|
+
|
|
11
|
+
**Primary Tools**: Claude Code, Cursor, GitHub Copilot, and similar AI development assistants.
|
|
12
|
+
|
|
13
|
+
**Responsibilities**:
|
|
14
|
+
- Follow SDD workflow phases strictly
|
|
15
|
+
- Generate code based on approved specifications
|
|
16
|
+
- Maintain consistency with project steering documents
|
|
17
|
+
- Ensure quality through automated testing
|
|
18
|
+
|
|
19
|
+
### Review Agents
|
|
20
|
+
AI agents specialized in code review, quality analysis, and security validation.
|
|
21
|
+
|
|
22
|
+
**Primary Focus**:
|
|
23
|
+
- Apply Linus-style code review principles
|
|
24
|
+
- Validate implementation against requirements
|
|
25
|
+
- Check for security vulnerabilities
|
|
26
|
+
- Ensure performance standards
|
|
27
|
+
|
|
28
|
+
### Planning Agents
|
|
29
|
+
AI agents that help with requirements gathering, design decisions, and task breakdown.
|
|
30
|
+
|
|
31
|
+
**Primary Activities**:
|
|
32
|
+
- Analyze project requirements using EARS format
|
|
33
|
+
- Generate technical design documents
|
|
34
|
+
- Create implementation task breakdowns
|
|
35
|
+
- Validate workflow phase transitions
|
|
36
|
+
|
|
37
|
+
## Agent Communication Protocol
|
|
38
|
+
|
|
39
|
+
### Context Sharing
|
|
40
|
+
All agents must:
|
|
41
|
+
1. Load project steering documents at interaction start:
|
|
42
|
+
- `product.md` - Product context and business objectives
|
|
43
|
+
- `tech.md` - Technology stack and architectural decisions
|
|
44
|
+
- `structure.md` - File organization and code patterns
|
|
45
|
+
- `linus-review.md` - Code quality review principles
|
|
46
|
+
- `commit.md` - Commit message standards
|
|
47
|
+
- **`owasp-top10-check.md` - OWASP Top 10 security checklist (REQUIRED for code generation and review)**
|
|
48
|
+
- **`tdd-guideline.md` - Test-Driven Development workflow (REQUIRED for all new features)**
|
|
49
|
+
- **`principles.md` - Core coding principles (SOLID, DRY, KISS, YAGNI, Separation of Concerns, Modularity)**
|
|
50
|
+
2. Check current workflow phase before proceeding
|
|
51
|
+
3. Validate approvals before phase transitions
|
|
52
|
+
4. Update spec.json with progress tracking
|
|
53
|
+
|
|
54
|
+
### Information Flow
|
|
55
|
+
```
|
|
56
|
+
User Request → Agent Analysis → SDD Tool Invocation → Result Validation → User Response
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### State Management
|
|
60
|
+
- Agents must maintain awareness of current project state
|
|
61
|
+
- Phase transitions require explicit approval tracking
|
|
62
|
+
- All changes must be logged in spec.json metadata
|
|
63
|
+
|
|
64
|
+
## Agent Tool Usage
|
|
65
|
+
|
|
66
|
+
### Required Tools for All Agents
|
|
67
|
+
- `sdd-status`: Check current workflow state
|
|
68
|
+
- `sdd-context-load`: Load project context
|
|
69
|
+
- `sdd-quality-check`: Validate code quality
|
|
70
|
+
|
|
71
|
+
### Phase-Specific Tools
|
|
72
|
+
|
|
73
|
+
**Initialization Phase**:
|
|
74
|
+
- `sdd-init`: Create new project structure
|
|
75
|
+
- `sdd-steering`: Generate steering documents
|
|
76
|
+
|
|
77
|
+
**Requirements Phase**:
|
|
78
|
+
- `sdd-requirements`: Generate requirements document
|
|
79
|
+
- `sdd-validate-gap`: Analyze implementation gaps
|
|
80
|
+
|
|
81
|
+
**Design Phase**:
|
|
82
|
+
- `sdd-design`: Create technical design
|
|
83
|
+
- `sdd-validate-design`: Review design quality
|
|
84
|
+
|
|
85
|
+
**Tasks Phase**:
|
|
86
|
+
- `sdd-tasks`: Generate task breakdown
|
|
87
|
+
- `sdd-spec-impl`: Execute tasks with TDD
|
|
88
|
+
|
|
89
|
+
**Implementation Phase**:
|
|
90
|
+
- `sdd-implement`: Get implementation guidelines
|
|
91
|
+
- `sdd-quality-check`: Continuous quality validation
|
|
92
|
+
|
|
93
|
+
## Agent Collaboration Patterns
|
|
94
|
+
|
|
95
|
+
### Sequential Collaboration
|
|
96
|
+
Agents work in sequence through workflow phases:
|
|
97
|
+
```
|
|
98
|
+
Planning Agent → Design Agent → Implementation Agent → Review Agent
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Parallel Collaboration
|
|
102
|
+
Multiple agents work on different aspects simultaneously:
|
|
103
|
+
- Frontend Agent handles UI tasks
|
|
104
|
+
- Backend Agent handles API tasks
|
|
105
|
+
- Test Agent creates test suites
|
|
106
|
+
- Documentation Agent updates docs
|
|
107
|
+
|
|
108
|
+
### Feedback Loops
|
|
109
|
+
Agents provide feedback to improve specifications:
|
|
110
|
+
- Implementation issues feed back to design
|
|
111
|
+
- Test failures inform requirement updates
|
|
112
|
+
- Performance problems trigger architecture reviews
|
|
113
|
+
|
|
114
|
+
## Quality Standards for Agents
|
|
115
|
+
|
|
116
|
+
### Code Generation Standards
|
|
117
|
+
- Follow project coding conventions from structure.md
|
|
118
|
+
- Implement comprehensive error handling
|
|
119
|
+
- Include appropriate logging and monitoring
|
|
120
|
+
- Write self-documenting code with clear naming
|
|
121
|
+
|
|
122
|
+
### Testing Requirements
|
|
123
|
+
- Generate unit tests for all new functions
|
|
124
|
+
- Create integration tests for workflows
|
|
125
|
+
- Implement performance benchmarks
|
|
126
|
+
- Ensure test coverage meets project standards
|
|
127
|
+
|
|
128
|
+
### Documentation Expectations
|
|
129
|
+
- Update relevant documentation with changes
|
|
130
|
+
- Maintain clear commit messages following commit.md
|
|
131
|
+
- Document design decisions and trade-offs
|
|
132
|
+
- Keep README and API docs current
|
|
133
|
+
|
|
134
|
+
## Agent Configuration
|
|
135
|
+
|
|
136
|
+
### Environment Setup
|
|
137
|
+
Agents should configure their environment with:
|
|
138
|
+
```bash
|
|
139
|
+
# Load SDD MCP server
|
|
140
|
+
npx sdd-mcp-server
|
|
141
|
+
|
|
142
|
+
# Initialize project context
|
|
143
|
+
sdd-context-load [feature-name]
|
|
144
|
+
|
|
145
|
+
# Check current status
|
|
146
|
+
sdd-status [feature-name]
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Steering Document Loading
|
|
150
|
+
Agents must respect steering document modes:
|
|
151
|
+
- **Always**: Load for every interaction
|
|
152
|
+
- **Conditional**: Load based on file patterns
|
|
153
|
+
- **Manual**: Load when explicitly requested
|
|
154
|
+
|
|
155
|
+
### Tool Invocation Patterns
|
|
156
|
+
```javascript
|
|
157
|
+
// Check phase before proceeding
|
|
158
|
+
const status = await sdd-status(featureName);
|
|
159
|
+
|
|
160
|
+
// Validate requirements exist
|
|
161
|
+
if (!status.requirements.generated) {
|
|
162
|
+
await sdd-requirements(featureName);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Proceed with implementation
|
|
166
|
+
await sdd-implement(featureName);
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Best Practices for AI Agents
|
|
170
|
+
|
|
171
|
+
### 1. Context Awareness
|
|
172
|
+
- Always load full project context before making changes
|
|
173
|
+
- Understand the current workflow phase and requirements
|
|
174
|
+
- Check for existing implementations before creating new ones
|
|
175
|
+
|
|
176
|
+
### 2. Incremental Progress
|
|
177
|
+
- Complete one task fully before moving to the next
|
|
178
|
+
- Update task checkboxes in tasks.md as work progresses
|
|
179
|
+
- Commit changes frequently with clear messages
|
|
180
|
+
|
|
181
|
+
### 3. Quality Focus
|
|
182
|
+
- Run quality checks after each significant change
|
|
183
|
+
- Address issues immediately rather than accumulating debt
|
|
184
|
+
- **Follow TDD principles strictly: Red → Green → Refactor**
|
|
185
|
+
- **RED**: Write failing tests BEFORE any implementation
|
|
186
|
+
- **GREEN**: Write minimal code to make tests pass
|
|
187
|
+
- **REFACTOR**: Improve code quality while keeping tests green
|
|
188
|
+
- Refer to `.spec/steering/tdd-guideline.md` for complete TDD workflow
|
|
189
|
+
|
|
190
|
+
### 4. Communication Clarity
|
|
191
|
+
- Provide clear explanations for design decisions
|
|
192
|
+
- Document assumptions and constraints
|
|
193
|
+
- Report blockers and issues promptly
|
|
194
|
+
|
|
195
|
+
### 5. Workflow Compliance
|
|
196
|
+
- Never skip workflow phases
|
|
197
|
+
- Ensure approvals are in place before proceeding
|
|
198
|
+
- Maintain traceability from requirements to implementation
|
|
199
|
+
|
|
200
|
+
## Error Handling for Agents
|
|
201
|
+
|
|
202
|
+
### Common Issues and Solutions
|
|
203
|
+
|
|
204
|
+
**Phase Violation**: Attempting to skip workflow phases
|
|
205
|
+
- Solution: Follow the prescribed phase sequence
|
|
206
|
+
- Use `sdd-status` to check current phase
|
|
207
|
+
|
|
208
|
+
**Missing Context**: Operating without project understanding
|
|
209
|
+
- Solution: Load context with `sdd-context-load`
|
|
210
|
+
- Review steering documents before proceeding
|
|
211
|
+
|
|
212
|
+
**Quality Failures**: Code doesn't meet standards
|
|
213
|
+
- Solution: Run `sdd-quality-check` regularly
|
|
214
|
+
- Apply Linus-style review principles
|
|
215
|
+
|
|
216
|
+
**Integration Conflicts**: Changes break existing functionality
|
|
217
|
+
- Solution: Run comprehensive tests before committing
|
|
218
|
+
- Ensure backward compatibility
|
|
219
|
+
|
|
220
|
+
## Performance Guidelines
|
|
221
|
+
|
|
222
|
+
### Efficiency Standards
|
|
223
|
+
- Minimize redundant tool invocations
|
|
224
|
+
- Cache project context when possible
|
|
225
|
+
- Batch related operations together
|
|
226
|
+
|
|
227
|
+
### Resource Management
|
|
228
|
+
- Clean up temporary files after operations
|
|
229
|
+
- Limit concurrent file operations
|
|
230
|
+
- Optimize for large codebases
|
|
231
|
+
|
|
232
|
+
## Security Considerations
|
|
233
|
+
|
|
234
|
+
### Code Review Security
|
|
235
|
+
- Check for credential exposure
|
|
236
|
+
- Validate input sanitization
|
|
237
|
+
- Review authentication/authorization logic
|
|
238
|
+
- Identify potential injection vulnerabilities
|
|
239
|
+
|
|
240
|
+
### Data Handling
|
|
241
|
+
- Never commit sensitive data
|
|
242
|
+
- Use environment variables for configuration
|
|
243
|
+
- Implement proper encryption for sensitive operations
|
|
244
|
+
- Follow least privilege principles
|
|
245
|
+
|
|
246
|
+
## Integration with CI/CD
|
|
247
|
+
|
|
248
|
+
### Automated Workflows
|
|
249
|
+
Agents should support CI/CD integration:
|
|
250
|
+
- Trigger quality checks on commits
|
|
251
|
+
- Validate phase requirements in pipelines
|
|
252
|
+
- Generate reports for review processes
|
|
253
|
+
- Update documentation automatically
|
|
254
|
+
|
|
255
|
+
### Deployment Readiness
|
|
256
|
+
Before deployment, agents must ensure:
|
|
257
|
+
- All tests pass successfully
|
|
258
|
+
- Documentation is complete and current
|
|
259
|
+
- Quality standards are met
|
|
260
|
+
- Security scans show no critical issues
|
|
261
|
+
|
|
262
|
+
## Continuous Improvement
|
|
263
|
+
|
|
264
|
+
### Learning from Feedback
|
|
265
|
+
- Analyze failed implementations
|
|
266
|
+
- Update patterns based on successes
|
|
267
|
+
- Refine task estimation accuracy
|
|
268
|
+
- Improve requirement interpretation
|
|
269
|
+
|
|
270
|
+
### Metrics and Monitoring
|
|
271
|
+
Track agent performance metrics:
|
|
272
|
+
- Task completion accuracy
|
|
273
|
+
- Code quality scores
|
|
274
|
+
- Time to implementation
|
|
275
|
+
- Defect rates post-deployment
|
|
276
|
+
|
|
277
|
+
## Conclusion
|
|
278
|
+
|
|
279
|
+
AI agents are integral to the SDD workflow, providing automation and intelligence throughout the development lifecycle. By following these guidelines, agents can effectively collaborate to deliver high-quality, specification-compliant software while maintaining the rigor and discipline of spec-driven development.
|
|
280
|
+
|
|
281
|
+
Remember: Agents augment human decision-making but don't replace it. Critical decisions, approvals, and architectural choices should always involve human oversight.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Commit Message Guidelines
|
|
2
|
+
|
|
3
|
+
Commit messages should follow a consistent format to improve readability and provide clear context about changes. Each commit message should start with a type prefix that indicates the nature of the change.
|
|
4
|
+
|
|
5
|
+
## Format
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
<type>(<scope>): <subject>
|
|
9
|
+
|
|
10
|
+
<body>
|
|
11
|
+
|
|
12
|
+
<footer>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Type Prefixes
|
|
16
|
+
|
|
17
|
+
All commit messages must begin with one of these type prefixes:
|
|
18
|
+
|
|
19
|
+
- **docs**: Documentation changes (README, comments, etc.)
|
|
20
|
+
- **chore**: Maintenance tasks, dependency updates, etc.
|
|
21
|
+
- **feat**: New features or enhancements
|
|
22
|
+
- **fix**: Bug fixes
|
|
23
|
+
- **refactor**: Code changes that neither fix bugs nor add features
|
|
24
|
+
- **test**: Adding or modifying tests
|
|
25
|
+
- **style**: Changes that don't affect code functionality (formatting, whitespace)
|
|
26
|
+
- **perf**: Performance improvements
|
|
27
|
+
- **ci**: Changes to CI/CD configuration files and scripts
|
|
28
|
+
|
|
29
|
+
## Scope (Optional)
|
|
30
|
+
|
|
31
|
+
The scope provides additional context about which part of the codebase is affected:
|
|
32
|
+
|
|
33
|
+
- **cluster**: Changes to EKS cluster configuration
|
|
34
|
+
- **db**: Database-related changes
|
|
35
|
+
- **iam**: Identity and access management changes
|
|
36
|
+
- **net**: Networking changes (VPC, security groups, etc.)
|
|
37
|
+
- **k8s**: Kubernetes resource changes
|
|
38
|
+
- **module**: Changes to reusable Terraform modules
|
|
39
|
+
|
|
40
|
+
## Examples
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
feat(cluster): add node autoscaling for billing namespace
|
|
44
|
+
fix(db): correct MySQL parameter group settings
|
|
45
|
+
docs(k8s): update network policy documentation
|
|
46
|
+
chore: update terraform provider versions
|
|
47
|
+
refactor(module): simplify EKS node group module
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Best Practices
|
|
51
|
+
|
|
52
|
+
1. Keep the subject line under 72 characters
|
|
53
|
+
2. Use imperative mood in the subject line ("add" not "added")
|
|
54
|
+
3. Don't end the subject line with a period
|
|
55
|
+
4. Separate subject from body with a blank line
|
|
56
|
+
5. Use the body to explain what and why, not how
|
|
57
|
+
6. Reference issues and pull requests in the footer
|
|
58
|
+
|
|
59
|
+
These guidelines help maintain a clean and useful git history that makes it easier to track changes and understand the project's evolution.
|