@abdullah-alnahas/claude-sdd 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +5 -0
- package/README.md +127 -0
- package/agents/critic.md +49 -0
- package/agents/security-reviewer.md +61 -0
- package/agents/simplifier.md +54 -0
- package/agents/spec-compliance.md +55 -0
- package/commands/sdd-adopt.md +74 -0
- package/commands/sdd-autopilot.md +131 -0
- package/commands/sdd-execute.md +72 -0
- package/commands/sdd-guardrails.md +41 -0
- package/commands/sdd-phase.md +46 -0
- package/commands/sdd-review.md +52 -0
- package/commands/sdd-yolo.md +40 -0
- package/hooks/hooks.json +50 -0
- package/hooks/scripts/post-edit-review.sh +45 -0
- package/hooks/scripts/session-init.sh +44 -0
- package/package.json +20 -0
- package/scripts/verify-commands.sh +59 -0
- package/scripts/verify-hooks.sh +74 -0
- package/scripts/verify-skills.sh +72 -0
- package/skills/architecture-aware/SKILL.md +43 -0
- package/skills/architecture-aware/references/adr-guide.md +53 -0
- package/skills/architecture-aware/references/anti-patterns.md +41 -0
- package/skills/architecture-aware/references/integration-patterns.md +42 -0
- package/skills/guardrails/SKILL.md +68 -0
- package/skills/guardrails/references/failure-patterns.md +63 -0
- package/skills/guardrails/references/pushback-guide.md +53 -0
- package/skills/iterative-execution/SKILL.md +65 -0
- package/skills/iterative-execution/references/completion-criteria.md +62 -0
- package/skills/iterative-execution/references/loop-patterns.md +47 -0
- package/skills/spec-first/SKILL.md +68 -0
- package/skills/spec-first/references/foundation-docs-guide.md +55 -0
- package/skills/spec-first/references/interactive-spec-process.md +85 -0
- package/skills/spec-first/references/project-adoption.md +58 -0
- package/skills/spec-first/references/templates/app-description.md +22 -0
- package/skills/spec-first/references/templates/architecture.md +26 -0
- package/skills/spec-first/references/templates/behavior-spec.md +28 -0
- package/skills/spec-first/references/templates/retrospective.md +19 -0
- package/skills/spec-first/references/templates/roadmap.md +23 -0
- package/skills/spec-first/references/templates/stack.md +27 -0
- package/skills/spec-first/references/templates/test-plan.md +25 -0
- package/skills/tdd-discipline/SKILL.md +55 -0
- package/skills/tdd-discipline/references/test-strategies.md +36 -0
- package/skills/tdd-discipline/references/traceability.md +53 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sdd-phase
|
|
3
|
+
description: Show or set the current development phase
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /sdd-phase
|
|
7
|
+
|
|
8
|
+
Display or change the current SDD development phase. Phases provide context that shapes how guardrails and skills behave.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
- `/sdd-phase` — Show current phase
|
|
13
|
+
- `/sdd-phase <phase-name>` — Set phase
|
|
14
|
+
|
|
15
|
+
## Phases
|
|
16
|
+
|
|
17
|
+
| Phase | Name | Focus |
|
|
18
|
+
|-------|------|-------|
|
|
19
|
+
| **specify** | Specification | Defining what to build (app-description, behavior-spec, stack, architecture, roadmap) |
|
|
20
|
+
| **design** | Design | Architecture decisions, integration patterns, ADRs |
|
|
21
|
+
| **implement** | Implementation | TDD cycles within iterative execution loops — test first, then minimal code |
|
|
22
|
+
| **verify** | Verification | Running full verification suite, spec-compliance checks, security review |
|
|
23
|
+
| **review** | Review | Critic + simplifier agents, retrospective |
|
|
24
|
+
|
|
25
|
+
## Behavior
|
|
26
|
+
|
|
27
|
+
1. Display the current phase (or "none" if not set)
|
|
28
|
+
2. If a phase name is provided, set it
|
|
29
|
+
3. Phase context is available to subsequent prompts and skills
|
|
30
|
+
4. Phase affects which skills are most relevant:
|
|
31
|
+
- `specify` → spec-first skill
|
|
32
|
+
- `design` → architecture-aware skill
|
|
33
|
+
- `implement` → TDD discipline + iterative execution skills
|
|
34
|
+
- `verify` → iterative execution (verification step)
|
|
35
|
+
- `review` → all agents (critic, simplifier, spec-compliance, security-reviewer)
|
|
36
|
+
|
|
37
|
+
## Output Format
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
SDD Phase: implement
|
|
41
|
+
─────────────────────
|
|
42
|
+
Focus: TDD cycles within iterative execution — write tests first, then minimal code to pass
|
|
43
|
+
|
|
44
|
+
Available skills: tdd-discipline, iterative-execution, guardrails
|
|
45
|
+
Available agents: critic, simplifier, spec-compliance, security-reviewer
|
|
46
|
+
```
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sdd-review
|
|
3
|
+
description: On-demand self-review using critic and simplifier agents with iterative fix cycles
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /sdd-review
|
|
7
|
+
|
|
8
|
+
Trigger an on-demand review of recent work using the critic and simplifier agents. Runs iteratively — reviews, fixes, re-reviews until no critical issues remain.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
- `/sdd-review` — Review recent changes
|
|
13
|
+
- `/sdd-review --max-iterations <n>` — Set max review-fix cycles (default: 3)
|
|
14
|
+
|
|
15
|
+
## Behavior
|
|
16
|
+
|
|
17
|
+
1. Identify what was recently changed (git diff or session context)
|
|
18
|
+
2. Run the **critic agent** — find logical errors, spec drift, assumption issues
|
|
19
|
+
3. Run the **simplifier agent** — find unnecessary complexity
|
|
20
|
+
4. If spec documents exist, run the **spec-compliance agent**
|
|
21
|
+
5. Present findings with severity levels
|
|
22
|
+
6. Offer to auto-fix issues found
|
|
23
|
+
7. If fixes are made (using TDD — write test for the fix first if applicable), re-review
|
|
24
|
+
8. Repeat until no critical issues remain or max iterations reached
|
|
25
|
+
|
|
26
|
+
## Output Format
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
SDD Review — Iteration 1/3
|
|
30
|
+
──────────────────────────
|
|
31
|
+
|
|
32
|
+
Critic Findings:
|
|
33
|
+
[Critical] ...
|
|
34
|
+
[Warning] ...
|
|
35
|
+
|
|
36
|
+
Simplifier Findings:
|
|
37
|
+
[Simplification] ...
|
|
38
|
+
|
|
39
|
+
Spec Compliance:
|
|
40
|
+
[X of Y criteria satisfied]
|
|
41
|
+
|
|
42
|
+
Actions:
|
|
43
|
+
- Fix critical issues? (y/n)
|
|
44
|
+
- Apply simplifications? (y/n)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Principles
|
|
48
|
+
|
|
49
|
+
- Reviews are honest — findings are reported as-is, not softened
|
|
50
|
+
- Fixes follow TDD: if the fix changes behavior, write a test first
|
|
51
|
+
- Max iterations prevent infinite loops
|
|
52
|
+
- The review itself is part of the iterative execution cycle
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sdd-yolo
|
|
3
|
+
description: Temporarily disable all SDD guardrails for this session
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /sdd-yolo
|
|
7
|
+
|
|
8
|
+
Disables all guardrails for the current session. Use when you need to move fast without discipline checks.
|
|
9
|
+
|
|
10
|
+
## Behavior
|
|
11
|
+
|
|
12
|
+
1. Create `.sdd-yolo` flag file in the project root
|
|
13
|
+
2. Set `GUARDRAILS_DISABLED=true` for the current session context
|
|
14
|
+
3. All hooks check this flag and skip their checks when set
|
|
15
|
+
4. The flag auto-clears on next session start (session-init.sh removes it)
|
|
16
|
+
5. Can also be cleared manually with `/sdd-guardrails enable`
|
|
17
|
+
|
|
18
|
+
## Output
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
⚠ YOLO MODE ACTIVATED
|
|
22
|
+
|
|
23
|
+
All SDD guardrails are disabled for this session:
|
|
24
|
+
- Pre-implementation checkpoint: SKIPPED
|
|
25
|
+
- Scope guard: SKIPPED
|
|
26
|
+
- Completion review: SKIPPED
|
|
27
|
+
|
|
28
|
+
Guardrails will re-enable automatically on next session start.
|
|
29
|
+
To re-enable now: /sdd-guardrails enable
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Warning
|
|
33
|
+
|
|
34
|
+
YOLO mode disables ALL behavioral guardrails. This means:
|
|
35
|
+
- No assumption checking before implementation
|
|
36
|
+
- No scope creep detection
|
|
37
|
+
- No completion review
|
|
38
|
+
- No TDD enforcement reminders
|
|
39
|
+
|
|
40
|
+
Use sparingly. The guardrails exist because LLMs (including this one) make predictable mistakes without them.
|
package/hooks/hooks.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"hooks": {
|
|
3
|
+
"SessionStart": [
|
|
4
|
+
{
|
|
5
|
+
"matcher": "",
|
|
6
|
+
"hooks": [
|
|
7
|
+
{
|
|
8
|
+
"type": "command",
|
|
9
|
+
"command": "bash $CLAUDE_PLUGIN_ROOT/hooks/scripts/session-init.sh",
|
|
10
|
+
"timeout": 10
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"UserPromptSubmit": [
|
|
16
|
+
{
|
|
17
|
+
"matcher": "",
|
|
18
|
+
"hooks": [
|
|
19
|
+
{
|
|
20
|
+
"type": "prompt",
|
|
21
|
+
"prompt": "BEFORE responding to this request, apply the SDD pre-implementation checkpoint:\n\n1. **Enumerate Assumptions**: List every assumption you're making about the user's intent, the codebase, and the approach. Flag any that are uncertain.\n\n2. **Flag Ambiguity**: If the request is unclear, underspecified, or could be interpreted multiple ways, ASK for clarification before proceeding. Do not guess.\n\n3. **Surface Alternatives**: Identify at least 2 alternative approaches. Briefly note trade-offs. If the user's suggested approach has significant downsides, say so.\n\n4. **Push Back on Bad Ideas**: If the request involves overengineering, premature abstraction, unnecessary complexity, or architectural anti-patterns, respectfully push back with a simpler alternative.\n\n5. **Define Scope**: State explicitly what you WILL and WILL NOT change. Any file not directly related to the request is out of scope.\n\n6. **Check for Spec**: If this is a non-trivial feature and no spec exists, suggest creating one first (spec-first principle).\n\n7. **Plan TDD Approach**: Identify what tests should be written first. Implementation follows tests, not the reverse.\n\nOnly after completing this checkpoint should you proceed with implementation. If GUARDRAILS_DISABLED=true is set, skip this checkpoint."
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"PostToolUse": [
|
|
27
|
+
{
|
|
28
|
+
"matcher": "Write|Edit",
|
|
29
|
+
"hooks": [
|
|
30
|
+
{
|
|
31
|
+
"type": "command",
|
|
32
|
+
"command": "bash $CLAUDE_PLUGIN_ROOT/hooks/scripts/post-edit-review.sh",
|
|
33
|
+
"timeout": 15
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"Stop": [
|
|
39
|
+
{
|
|
40
|
+
"matcher": "",
|
|
41
|
+
"hooks": [
|
|
42
|
+
{
|
|
43
|
+
"type": "prompt",
|
|
44
|
+
"prompt": "Before finalizing, perform the SDD completion review:\n\n1. **Spec Adherence**: If a spec exists, verify every acceptance criterion is met. List any gaps.\n\n2. **Test Coverage**: Were tests written before implementation (TDD)? Do they trace back to spec criteria? Any untested acceptance criteria?\n\n3. **Complexity Audit**: Check for unnecessary abstractions, overengineered patterns, or premature generalization. Every function should be under 50 lines. Every file should be under 500 lines.\n\n4. **Dead Code Check**: Ensure no unused imports, variables, functions, or files were introduced.\n\n5. **Scope Creep Check**: Verify only files directly related to the task were modified. Flag any unrelated changes.\n\n6. **Conceptual Error Scan**: Re-read the core logic. Does it actually solve the problem correctly? Are there off-by-one errors, race conditions, or logical gaps?\n\nReport findings concisely. If GUARDRAILS_DISABLED=true is set, skip this review."
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# SDD Post-Edit Review Hook
|
|
3
|
+
# Detects scope creep by checking if edited files are related to the current task
|
|
4
|
+
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
# Skip if guardrails disabled
|
|
8
|
+
if [ "${GUARDRAILS_DISABLED:-false}" = "true" ]; then
|
|
9
|
+
exit 0
|
|
10
|
+
fi
|
|
11
|
+
|
|
12
|
+
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-.}"
|
|
13
|
+
|
|
14
|
+
# Read tool input from stdin (JSON with file_path)
|
|
15
|
+
INPUT=$(cat)
|
|
16
|
+
FILE_PATH=$(echo "$INPUT" | grep -oP '"file_path"\s*:\s*"([^"]*)"' | head -1 | sed 's/.*"\([^"]*\)"/\1/' 2>/dev/null || echo "")
|
|
17
|
+
|
|
18
|
+
if [ -z "$FILE_PATH" ]; then
|
|
19
|
+
# Try alternate JSON key names
|
|
20
|
+
FILE_PATH=$(echo "$INPUT" | grep -oP '"filePath"\s*:\s*"([^"]*)"' | head -1 | sed 's/.*"\([^"]*\)"/\1/' 2>/dev/null || echo "")
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
if [ -z "$FILE_PATH" ]; then
|
|
24
|
+
exit 0
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
# Check if inside project directory
|
|
28
|
+
case "$FILE_PATH" in
|
|
29
|
+
"$PROJECT_DIR"*) ;; # Inside project, OK
|
|
30
|
+
/*)
|
|
31
|
+
echo "SDD SCOPE WARNING: Edit to file outside project directory: $FILE_PATH" >&2
|
|
32
|
+
exit 2
|
|
33
|
+
;;
|
|
34
|
+
esac
|
|
35
|
+
|
|
36
|
+
# Check git status for unrelated modifications
|
|
37
|
+
if command -v git &>/dev/null && [ -d "$PROJECT_DIR/.git" ]; then
|
|
38
|
+
MODIFIED_COUNT=$(cd "$PROJECT_DIR" && git diff --name-only 2>/dev/null | wc -l)
|
|
39
|
+
if [ "$MODIFIED_COUNT" -gt 10 ]; then
|
|
40
|
+
echo "SDD SCOPE WARNING: $MODIFIED_COUNT files modified — possible scope creep. Review changes with 'git diff --stat'" >&2
|
|
41
|
+
exit 2
|
|
42
|
+
fi
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
exit 0
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# SDD Session Initialization Hook
|
|
3
|
+
# Loads .sdd.yaml config, sets environment variables, checks yolo flag
|
|
4
|
+
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-.}"
|
|
8
|
+
ENV_FILE="${CLAUDE_ENV_FILE:-}"
|
|
9
|
+
CONFIG_FILE="$PROJECT_DIR/.sdd.yaml"
|
|
10
|
+
YOLO_FLAG="$PROJECT_DIR/.sdd-yolo"
|
|
11
|
+
|
|
12
|
+
# Check for yolo mode
|
|
13
|
+
if [ -f "$YOLO_FLAG" ]; then
|
|
14
|
+
echo "SDD: YOLO mode active — all guardrails disabled" >&2
|
|
15
|
+
# Remove yolo flag (auto-clears on session start)
|
|
16
|
+
rm -f "$YOLO_FLAG"
|
|
17
|
+
if [ -n "$ENV_FILE" ]; then
|
|
18
|
+
echo "GUARDRAILS_DISABLED=true" >> "$ENV_FILE"
|
|
19
|
+
echo "SDD_YOLO_CLEARED=true" >> "$ENV_FILE"
|
|
20
|
+
fi
|
|
21
|
+
exit 0
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
# Set defaults
|
|
25
|
+
if [ -n "$ENV_FILE" ]; then
|
|
26
|
+
echo "GUARDRAILS_DISABLED=false" >> "$ENV_FILE"
|
|
27
|
+
echo "SDD_ACTIVE=true" >> "$ENV_FILE"
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
# Check for config file
|
|
31
|
+
if [ -f "$CONFIG_FILE" ]; then
|
|
32
|
+
echo "SDD: Config loaded from $CONFIG_FILE" >&2
|
|
33
|
+
if [ -n "$ENV_FILE" ]; then
|
|
34
|
+
echo "SDD_CONFIG_FOUND=true" >> "$ENV_FILE"
|
|
35
|
+
fi
|
|
36
|
+
else
|
|
37
|
+
echo "SDD: No .sdd.yaml found — using defaults" >&2
|
|
38
|
+
if [ -n "$ENV_FILE" ]; then
|
|
39
|
+
echo "SDD_CONFIG_FOUND=false" >> "$ENV_FILE"
|
|
40
|
+
fi
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
echo "SDD: Session initialized — guardrails active" >&2
|
|
44
|
+
exit 0
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@abdullah-alnahas/claude-sdd",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Spec-Driven Development discipline system for Claude Code — behavioral guardrails, spec-first development, architecture awareness, TDD enforcement, iterative execution loops",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"claude-code-plugin",
|
|
7
|
+
"sdd",
|
|
8
|
+
"spec-driven-development",
|
|
9
|
+
"tdd",
|
|
10
|
+
"guardrails",
|
|
11
|
+
"architecture",
|
|
12
|
+
"iterative-execution"
|
|
13
|
+
],
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/abdullah-alnahas/claude-sdd.git"
|
|
18
|
+
},
|
|
19
|
+
"author": "abdullah-alnahas"
|
|
20
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# SDD Self-Test: Verify commands structure
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
|
|
5
|
+
PLUGIN_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
|
6
|
+
PASS=0
|
|
7
|
+
FAIL=0
|
|
8
|
+
|
|
9
|
+
check() {
|
|
10
|
+
local desc="$1"
|
|
11
|
+
shift
|
|
12
|
+
if "$@" >/dev/null 2>&1; then
|
|
13
|
+
echo " ✓ $desc"
|
|
14
|
+
PASS=$((PASS + 1))
|
|
15
|
+
else
|
|
16
|
+
echo " ✗ $desc"
|
|
17
|
+
FAIL=$((FAIL + 1))
|
|
18
|
+
fi
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
echo "SDD Command Verification"
|
|
22
|
+
echo "────────────────────────"
|
|
23
|
+
|
|
24
|
+
COMMANDS=("sdd-guardrails" "sdd-yolo" "sdd-phase" "sdd-review" "sdd-adopt" "sdd-execute" "sdd-autopilot")
|
|
25
|
+
|
|
26
|
+
for cmd in "${COMMANDS[@]}"; do
|
|
27
|
+
echo ""
|
|
28
|
+
echo "Command: /$cmd"
|
|
29
|
+
CMD_FILE="$PLUGIN_DIR/commands/$cmd.md"
|
|
30
|
+
|
|
31
|
+
check "File exists" test -f "$CMD_FILE"
|
|
32
|
+
check "Has frontmatter" grep -q "^---" "$CMD_FILE"
|
|
33
|
+
check "Has name field" grep -q "^name:" "$CMD_FILE"
|
|
34
|
+
check "Has description field" grep -q "^description:" "$CMD_FILE"
|
|
35
|
+
check "Is non-empty (>100 chars)" test "$(wc -c < "$CMD_FILE")" -gt 100
|
|
36
|
+
done
|
|
37
|
+
|
|
38
|
+
# Check for duplicate command names
|
|
39
|
+
echo ""
|
|
40
|
+
echo "Uniqueness:"
|
|
41
|
+
NAMES=$(grep -h "^name:" "$PLUGIN_DIR/commands/"*.md | sort)
|
|
42
|
+
UNIQUE_NAMES=$(echo "$NAMES" | sort -u)
|
|
43
|
+
check "All command names are unique" test "$(echo "$NAMES" | wc -l)" -eq "$(echo "$UNIQUE_NAMES" | wc -l)"
|
|
44
|
+
|
|
45
|
+
# Check agents referenced by commands exist
|
|
46
|
+
echo ""
|
|
47
|
+
echo "Agent references:"
|
|
48
|
+
AGENTS=("critic" "simplifier" "spec-compliance" "security-reviewer")
|
|
49
|
+
for agent in "${AGENTS[@]}"; do
|
|
50
|
+
check "Agent: $agent.md exists" test -f "$PLUGIN_DIR/agents/$agent.md"
|
|
51
|
+
done
|
|
52
|
+
|
|
53
|
+
echo ""
|
|
54
|
+
echo "────────────────────────"
|
|
55
|
+
echo "Results: $PASS passed, $FAIL failed"
|
|
56
|
+
|
|
57
|
+
if [ "$FAIL" -gt 0 ]; then
|
|
58
|
+
exit 1
|
|
59
|
+
fi
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# SDD Self-Test: Verify hooks configuration and scripts
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
|
|
5
|
+
PLUGIN_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
|
6
|
+
PASS=0
|
|
7
|
+
FAIL=0
|
|
8
|
+
|
|
9
|
+
check() {
|
|
10
|
+
local desc="$1"
|
|
11
|
+
shift
|
|
12
|
+
if "$@" >/dev/null 2>&1; then
|
|
13
|
+
echo " ✓ $desc"
|
|
14
|
+
PASS=$((PASS + 1))
|
|
15
|
+
else
|
|
16
|
+
echo " ✗ $desc"
|
|
17
|
+
FAIL=$((FAIL + 1))
|
|
18
|
+
fi
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
echo "SDD Hook Verification"
|
|
22
|
+
echo "─────────────────────"
|
|
23
|
+
|
|
24
|
+
# Check hooks.json exists and is valid JSON
|
|
25
|
+
echo ""
|
|
26
|
+
echo "hooks.json:"
|
|
27
|
+
check "File exists" test -f "$PLUGIN_DIR/hooks/hooks.json"
|
|
28
|
+
check "Valid JSON" python3 -c "import json; json.load(open('$PLUGIN_DIR/hooks/hooks.json'))"
|
|
29
|
+
check "Has hooks wrapper" python3 -c "
|
|
30
|
+
import json
|
|
31
|
+
d = json.load(open('$PLUGIN_DIR/hooks/hooks.json'))
|
|
32
|
+
assert 'hooks' in d, 'Missing hooks key'
|
|
33
|
+
"
|
|
34
|
+
check "Has SessionStart hook" python3 -c "
|
|
35
|
+
import json
|
|
36
|
+
d = json.load(open('$PLUGIN_DIR/hooks/hooks.json'))
|
|
37
|
+
assert 'SessionStart' in d['hooks']
|
|
38
|
+
"
|
|
39
|
+
check "Has UserPromptSubmit hook" python3 -c "
|
|
40
|
+
import json
|
|
41
|
+
d = json.load(open('$PLUGIN_DIR/hooks/hooks.json'))
|
|
42
|
+
assert 'UserPromptSubmit' in d['hooks']
|
|
43
|
+
"
|
|
44
|
+
check "Has PostToolUse hook" python3 -c "
|
|
45
|
+
import json
|
|
46
|
+
d = json.load(open('$PLUGIN_DIR/hooks/hooks.json'))
|
|
47
|
+
assert 'PostToolUse' in d['hooks']
|
|
48
|
+
"
|
|
49
|
+
check "Has Stop hook" python3 -c "
|
|
50
|
+
import json
|
|
51
|
+
d = json.load(open('$PLUGIN_DIR/hooks/hooks.json'))
|
|
52
|
+
assert 'Stop' in d['hooks']
|
|
53
|
+
"
|
|
54
|
+
|
|
55
|
+
# Check scripts exist and are executable
|
|
56
|
+
echo ""
|
|
57
|
+
echo "Hook scripts:"
|
|
58
|
+
check "session-init.sh exists" test -f "$PLUGIN_DIR/hooks/scripts/session-init.sh"
|
|
59
|
+
check "post-edit-review.sh exists" test -f "$PLUGIN_DIR/hooks/scripts/post-edit-review.sh"
|
|
60
|
+
check "session-init.sh is executable or bash-runnable" bash -n "$PLUGIN_DIR/hooks/scripts/session-init.sh"
|
|
61
|
+
check "post-edit-review.sh is executable or bash-runnable" bash -n "$PLUGIN_DIR/hooks/scripts/post-edit-review.sh"
|
|
62
|
+
|
|
63
|
+
# Test session-init.sh runs without error
|
|
64
|
+
echo ""
|
|
65
|
+
echo "Script execution:"
|
|
66
|
+
check "session-init.sh runs without error" bash "$PLUGIN_DIR/hooks/scripts/session-init.sh"
|
|
67
|
+
|
|
68
|
+
echo ""
|
|
69
|
+
echo "─────────────────────"
|
|
70
|
+
echo "Results: $PASS passed, $FAIL failed"
|
|
71
|
+
|
|
72
|
+
if [ "$FAIL" -gt 0 ]; then
|
|
73
|
+
exit 1
|
|
74
|
+
fi
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# SDD Self-Test: Verify skills structure and content
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
|
|
5
|
+
PLUGIN_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
|
6
|
+
PASS=0
|
|
7
|
+
FAIL=0
|
|
8
|
+
|
|
9
|
+
check() {
|
|
10
|
+
local desc="$1"
|
|
11
|
+
shift
|
|
12
|
+
if "$@" >/dev/null 2>&1; then
|
|
13
|
+
echo " ✓ $desc"
|
|
14
|
+
PASS=$((PASS + 1))
|
|
15
|
+
else
|
|
16
|
+
echo " ✗ $desc"
|
|
17
|
+
FAIL=$((FAIL + 1))
|
|
18
|
+
fi
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
echo "SDD Skill Verification"
|
|
22
|
+
echo "──────────────────────"
|
|
23
|
+
|
|
24
|
+
SKILLS=("guardrails" "spec-first" "architecture-aware" "tdd-discipline" "iterative-execution")
|
|
25
|
+
|
|
26
|
+
for skill in "${SKILLS[@]}"; do
|
|
27
|
+
echo ""
|
|
28
|
+
echo "Skill: $skill"
|
|
29
|
+
SKILL_DIR="$PLUGIN_DIR/skills/$skill"
|
|
30
|
+
|
|
31
|
+
check "Directory exists" test -d "$SKILL_DIR"
|
|
32
|
+
check "SKILL.md exists" test -f "$SKILL_DIR/SKILL.md"
|
|
33
|
+
check "SKILL.md has frontmatter" grep -q "^---" "$SKILL_DIR/SKILL.md"
|
|
34
|
+
check "SKILL.md has name field" grep -q "^name:" "$SKILL_DIR/SKILL.md"
|
|
35
|
+
check "SKILL.md has description field" grep -q "^description:" "$SKILL_DIR/SKILL.md"
|
|
36
|
+
|
|
37
|
+
# Check SKILL.md body is under 3000 words
|
|
38
|
+
if [ -f "$SKILL_DIR/SKILL.md" ]; then
|
|
39
|
+
WORD_COUNT=$(wc -w < "$SKILL_DIR/SKILL.md")
|
|
40
|
+
check "SKILL.md under 3000 words ($WORD_COUNT)" test "$WORD_COUNT" -lt 3000
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
# Check references exist
|
|
44
|
+
if [ -d "$SKILL_DIR/references" ]; then
|
|
45
|
+
REF_COUNT=$(find "$SKILL_DIR/references" -name "*.md" -type f | wc -l)
|
|
46
|
+
check "Has reference files ($REF_COUNT found)" test "$REF_COUNT" -gt 0
|
|
47
|
+
|
|
48
|
+
# Check no empty reference files
|
|
49
|
+
while IFS= read -r ref; do
|
|
50
|
+
SIZE=$(wc -c < "$ref")
|
|
51
|
+
check "$(basename "$ref") is non-empty" test "$SIZE" -gt 10
|
|
52
|
+
done < <(find "$SKILL_DIR/references" -name "*.md" -type f)
|
|
53
|
+
fi
|
|
54
|
+
done
|
|
55
|
+
|
|
56
|
+
# Check templates
|
|
57
|
+
echo ""
|
|
58
|
+
echo "Templates:"
|
|
59
|
+
TEMPLATE_DIR="$PLUGIN_DIR/skills/spec-first/references/templates"
|
|
60
|
+
check "Templates directory exists" test -d "$TEMPLATE_DIR"
|
|
61
|
+
TEMPLATES=("app-description.md" "architecture.md" "stack.md" "roadmap.md" "behavior-spec.md" "test-plan.md" "retrospective.md")
|
|
62
|
+
for tmpl in "${TEMPLATES[@]}"; do
|
|
63
|
+
check "Template: $tmpl exists" test -f "$TEMPLATE_DIR/$tmpl"
|
|
64
|
+
done
|
|
65
|
+
|
|
66
|
+
echo ""
|
|
67
|
+
echo "──────────────────────"
|
|
68
|
+
echo "Results: $PASS passed, $FAIL failed"
|
|
69
|
+
|
|
70
|
+
if [ "$FAIL" -gt 0 ]; then
|
|
71
|
+
exit 1
|
|
72
|
+
fi
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Architecture Awareness
|
|
3
|
+
description: >
|
|
4
|
+
Provides architecture consciousness during development — integration patterns, anti-patterns, and ADR guidance.
|
|
5
|
+
Use when designing systems, discussing architecture, integration, patterns, structure, or organization.
|
|
6
|
+
version: 1.0.0
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Architecture Awareness
|
|
10
|
+
|
|
11
|
+
You maintain architectural consciousness throughout development. Every code change exists within an architectural context — respect it.
|
|
12
|
+
|
|
13
|
+
## Core Principles
|
|
14
|
+
|
|
15
|
+
### Fit the Existing Architecture
|
|
16
|
+
Before proposing any pattern, understand what's already there. Don't introduce a new pattern when the codebase already has an established one that works.
|
|
17
|
+
|
|
18
|
+
### Justify Pattern Choices
|
|
19
|
+
Every pattern has trade-offs. State the specific benefit for THIS codebase, not abstract "best practice" arguments.
|
|
20
|
+
|
|
21
|
+
### Record Significant Decisions
|
|
22
|
+
If a decision is hard to reverse or affects multiple components, it deserves an ADR (Architecture Decision Record).
|
|
23
|
+
|
|
24
|
+
## When to Engage
|
|
25
|
+
|
|
26
|
+
- User asks "how should I structure this?"
|
|
27
|
+
- Adding a new component to an existing system
|
|
28
|
+
- Introducing a new technology or pattern
|
|
29
|
+
- Changing how components communicate
|
|
30
|
+
- Anything that touches 3+ modules/services
|
|
31
|
+
|
|
32
|
+
## What to Check
|
|
33
|
+
|
|
34
|
+
1. **Existing patterns**: What patterns does the codebase already use?
|
|
35
|
+
2. **Integration points**: How will new code connect to existing code?
|
|
36
|
+
3. **Coupling**: Are we creating tight coupling between components?
|
|
37
|
+
4. **Consistency**: Does this follow or violate established conventions?
|
|
38
|
+
|
|
39
|
+
## References
|
|
40
|
+
|
|
41
|
+
See: `references/integration-patterns.md`
|
|
42
|
+
See: `references/anti-patterns.md`
|
|
43
|
+
See: `references/adr-guide.md`
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Architecture Decision Records (ADRs)
|
|
2
|
+
|
|
3
|
+
## When to Write an ADR
|
|
4
|
+
|
|
5
|
+
Write an ADR when:
|
|
6
|
+
- The decision is hard to reverse
|
|
7
|
+
- Multiple valid alternatives exist
|
|
8
|
+
- The decision affects multiple components
|
|
9
|
+
- Future developers will wonder "why did they do it this way?"
|
|
10
|
+
|
|
11
|
+
Don't write an ADR for:
|
|
12
|
+
- Obvious choices (using the project's existing language)
|
|
13
|
+
- Easily reversible decisions
|
|
14
|
+
- Style preferences
|
|
15
|
+
|
|
16
|
+
## Format
|
|
17
|
+
|
|
18
|
+
```markdown
|
|
19
|
+
# ADR-[NUMBER]: [Title]
|
|
20
|
+
|
|
21
|
+
**Date**: [Date]
|
|
22
|
+
**Status**: [Proposed | Accepted | Deprecated | Superseded by ADR-X]
|
|
23
|
+
|
|
24
|
+
## Context
|
|
25
|
+
[What situation or problem prompted this decision?]
|
|
26
|
+
|
|
27
|
+
## Decision
|
|
28
|
+
[What did we decide to do?]
|
|
29
|
+
|
|
30
|
+
## Alternatives Considered
|
|
31
|
+
[What other options were evaluated? Why were they rejected?]
|
|
32
|
+
|
|
33
|
+
## Consequences
|
|
34
|
+
[What are the positive and negative results of this decision?]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Storage
|
|
38
|
+
|
|
39
|
+
Store ADRs in `docs/adr/` or `specs/adr/`:
|
|
40
|
+
```
|
|
41
|
+
docs/adr/
|
|
42
|
+
├── 0001-use-postgresql.md
|
|
43
|
+
├── 0002-event-driven-notifications.md
|
|
44
|
+
└── 0003-monorepo-structure.md
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Tips
|
|
48
|
+
|
|
49
|
+
- Keep ADRs short (1 page max)
|
|
50
|
+
- Focus on the WHY, not the HOW
|
|
51
|
+
- Include rejected alternatives — they're as valuable as the choice
|
|
52
|
+
- Link to relevant specs or behavior documents
|
|
53
|
+
- ADRs are immutable — supersede, don't edit
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Architectural Anti-Patterns
|
|
2
|
+
|
|
3
|
+
## 1. Direct DB Coupling Across Boundaries
|
|
4
|
+
**Problem**: Service A queries Service B's database directly.
|
|
5
|
+
**Why it's bad**: Changes to B's schema break A. No encapsulation.
|
|
6
|
+
**Fix**: B exposes an API. A calls the API.
|
|
7
|
+
|
|
8
|
+
## 2. Mega Object / Mega Module
|
|
9
|
+
**Problem**: One module/class does everything.
|
|
10
|
+
**Why it's bad**: Impossible to understand, test, or modify safely.
|
|
11
|
+
**Fix**: Extract cohesive responsibilities into focused modules.
|
|
12
|
+
|
|
13
|
+
## 3. Distributed Monolith
|
|
14
|
+
**Problem**: Microservices that must be deployed together and share everything.
|
|
15
|
+
**Why it's bad**: All the complexity of distributed systems with none of the benefits.
|
|
16
|
+
**Fix**: Either make them truly independent or merge them back into a monolith.
|
|
17
|
+
|
|
18
|
+
## 4. Synchronous Chains
|
|
19
|
+
**Problem**: A calls B calls C calls D synchronously. Any failure breaks the chain.
|
|
20
|
+
**Why it's bad**: Latency multiplies. Availability decreases multiplicatively.
|
|
21
|
+
**Fix**: Use async processing. Break the chain with events or queues.
|
|
22
|
+
|
|
23
|
+
## 5. Missing Correlation IDs
|
|
24
|
+
**Problem**: Requests flow through multiple services with no way to trace them.
|
|
25
|
+
**Why it's bad**: Debugging production issues becomes nearly impossible.
|
|
26
|
+
**Fix**: Generate a correlation ID at the entry point, pass it through all calls.
|
|
27
|
+
|
|
28
|
+
## 6. Premature Microservices
|
|
29
|
+
**Problem**: Splitting into services before understanding domain boundaries.
|
|
30
|
+
**Why it's bad**: Wrong boundaries are expensive to fix. Data consistency becomes hard.
|
|
31
|
+
**Fix**: Start monolithic. Split when you have clear, proven boundaries.
|
|
32
|
+
|
|
33
|
+
## 7. Shared Mutable State
|
|
34
|
+
**Problem**: Multiple components read/write the same data without coordination.
|
|
35
|
+
**Why it's bad**: Race conditions. Inconsistent state. Hard to reproduce bugs.
|
|
36
|
+
**Fix**: Single owner per piece of state. Others request changes through the owner.
|
|
37
|
+
|
|
38
|
+
## 8. Copy-Paste Integration
|
|
39
|
+
**Problem**: Duplicating code across services instead of sharing or abstracting.
|
|
40
|
+
**Why it's bad**: Bug fixes need to be applied N times. Drift is inevitable.
|
|
41
|
+
**Fix**: Shared library for truly shared logic. Accept some duplication for loose coupling.
|