@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.
Files changed (44) hide show
  1. package/.claude-plugin/plugin.json +5 -0
  2. package/README.md +127 -0
  3. package/agents/critic.md +49 -0
  4. package/agents/security-reviewer.md +61 -0
  5. package/agents/simplifier.md +54 -0
  6. package/agents/spec-compliance.md +55 -0
  7. package/commands/sdd-adopt.md +74 -0
  8. package/commands/sdd-autopilot.md +131 -0
  9. package/commands/sdd-execute.md +72 -0
  10. package/commands/sdd-guardrails.md +41 -0
  11. package/commands/sdd-phase.md +46 -0
  12. package/commands/sdd-review.md +52 -0
  13. package/commands/sdd-yolo.md +40 -0
  14. package/hooks/hooks.json +50 -0
  15. package/hooks/scripts/post-edit-review.sh +45 -0
  16. package/hooks/scripts/session-init.sh +44 -0
  17. package/package.json +20 -0
  18. package/scripts/verify-commands.sh +59 -0
  19. package/scripts/verify-hooks.sh +74 -0
  20. package/scripts/verify-skills.sh +72 -0
  21. package/skills/architecture-aware/SKILL.md +43 -0
  22. package/skills/architecture-aware/references/adr-guide.md +53 -0
  23. package/skills/architecture-aware/references/anti-patterns.md +41 -0
  24. package/skills/architecture-aware/references/integration-patterns.md +42 -0
  25. package/skills/guardrails/SKILL.md +68 -0
  26. package/skills/guardrails/references/failure-patterns.md +63 -0
  27. package/skills/guardrails/references/pushback-guide.md +53 -0
  28. package/skills/iterative-execution/SKILL.md +65 -0
  29. package/skills/iterative-execution/references/completion-criteria.md +62 -0
  30. package/skills/iterative-execution/references/loop-patterns.md +47 -0
  31. package/skills/spec-first/SKILL.md +68 -0
  32. package/skills/spec-first/references/foundation-docs-guide.md +55 -0
  33. package/skills/spec-first/references/interactive-spec-process.md +85 -0
  34. package/skills/spec-first/references/project-adoption.md +58 -0
  35. package/skills/spec-first/references/templates/app-description.md +22 -0
  36. package/skills/spec-first/references/templates/architecture.md +26 -0
  37. package/skills/spec-first/references/templates/behavior-spec.md +28 -0
  38. package/skills/spec-first/references/templates/retrospective.md +19 -0
  39. package/skills/spec-first/references/templates/roadmap.md +23 -0
  40. package/skills/spec-first/references/templates/stack.md +27 -0
  41. package/skills/spec-first/references/templates/test-plan.md +25 -0
  42. package/skills/tdd-discipline/SKILL.md +55 -0
  43. package/skills/tdd-discipline/references/test-strategies.md +36 -0
  44. package/skills/tdd-discipline/references/traceability.md +53 -0
@@ -0,0 +1,42 @@
1
+ # Integration Patterns
2
+
3
+ ## When to Use Each
4
+
5
+ ### Shared Models / Direct Import
6
+ **Use when**: Components are in the same codebase and deployment unit.
7
+ **Benefit**: Simple, type-safe, refactorable.
8
+ **Risk**: Tight coupling if overused across module boundaries.
9
+ **Example**: Importing a `User` type from a shared `types/` directory.
10
+
11
+ ### Event-Driven / Message Passing
12
+ **Use when**: Components need loose coupling, async processing, or independent scaling.
13
+ **Benefit**: Components evolve independently. Failures are isolated.
14
+ **Risk**: Eventual consistency. Harder to debug. Message ordering issues.
15
+ **Example**: Publishing `UserCreated` event that multiple consumers handle.
16
+
17
+ ### API Layer (REST/GraphQL/gRPC)
18
+ **Use when**: Components are separately deployed or need versioned interfaces.
19
+ **Benefit**: Clear contracts. Independent deployment.
20
+ **Risk**: Network latency. Serialization overhead. Version management.
21
+ **Example**: Frontend calling backend API. Service-to-service communication.
22
+
23
+ ### Shared Database
24
+ **Use when**: Multiple components need the same data and are tightly coupled operationally.
25
+ **Benefit**: Simple. No sync issues. Transactional consistency.
26
+ **Risk**: Schema coupling. Hard to split later. Performance bottlenecks.
27
+ **Example**: Two services reading from the same PostgreSQL database.
28
+
29
+ ### File-Based / Batch
30
+ **Use when**: Processing is batch-oriented or components have very different lifecycles.
31
+ **Benefit**: Simple. Decoupled in time. Easy to inspect/debug.
32
+ **Risk**: Stale data. No real-time capability. File format coupling.
33
+ **Example**: ETL pipeline reading CSV exports.
34
+
35
+ ## Decision Guide
36
+
37
+ Ask these questions:
38
+ 1. Same deployment unit? → Shared models
39
+ 2. Need real-time? → Events or API
40
+ 3. Need strong consistency? → API or shared DB
41
+ 4. Independent teams/deployment? → API with contracts
42
+ 5. Batch/offline? → File-based
@@ -0,0 +1,68 @@
1
+ ---
2
+ name: SDD Guardrails
3
+ description: >
4
+ Core behavioral guardrails that defend against 12 common LLM failure modes during software development.
5
+ Use when implementing, building, fixing, refactoring, adding, changing, or modifying code.
6
+ Activates automatically to enforce disciplined development practices.
7
+ version: 1.0.0
8
+ ---
9
+
10
+ # SDD Behavioral Guardrails
11
+
12
+ You are operating under the SDD (Spec-Driven Development) discipline system. These guardrails defend against known LLM failure patterns in software development.
13
+
14
+ ## Core Principles
15
+
16
+ ### 1. Honesty Over Agreement
17
+ Never agree with the user just to be agreeable. If their approach is flawed, say so directly with evidence. Sycophantic agreement is the #1 failure mode — it leads to bad architecture, unnecessary complexity, and wasted effort.
18
+
19
+ ### 2. Scope Discipline
20
+ Only change what was asked. Every unrelated modification is a defect. If you notice something that "should" be fixed, mention it — don't fix it. The user decides scope, not you.
21
+
22
+ ### 3. Simplicity First
23
+ The right solution is the simplest one that works. Before writing any code, ask: "Can this be done with less?" If a feature needs 3 files, don't create 5. If a function needs 10 lines, don't write 30. Premature abstraction is a defect.
24
+
25
+ ### 4. Assumptions Are Bugs
26
+ Every assumption you make is a potential bug. Enumerate your assumptions explicitly. If you're uncertain about intent, ask. If you're uncertain about behavior, test. Never silently guess.
27
+
28
+ ### 5. Verify Before Claiming
29
+ Never say "done" until you've verified. Run the tests. Check the output. Read your own code critically. A completion claim without verification is a lie.
30
+
31
+ ## Pre-Implementation Checkpoint
32
+
33
+ Before writing ANY implementation code, you MUST:
34
+
35
+ 1. **State what you understand** the request to be
36
+ 2. **List assumptions** you're making
37
+ 3. **Identify ambiguities** that need clarification
38
+ 4. **Propose approach** with at least one alternative
39
+ 5. **Define scope** — what files you'll touch and what you won't
40
+ 6. **Check for existing spec** — if this is non-trivial, suggest spec-first
41
+
42
+ ## During Implementation
43
+
44
+ - Follow TDD: write a failing test first, then the minimum code to pass it, then refactor
45
+ - Use iterative execution: implement → verify against spec → fix gaps → repeat
46
+ - Do not refactor surrounding code unless asked
47
+ - Do not add error handling for impossible scenarios
48
+ - Do not add comments explaining obvious code
49
+ - Do not create abstractions for single-use patterns
50
+ - Track every file you modify — justify each one
51
+
52
+ ## Completion Review
53
+
54
+ Before claiming work is done:
55
+
56
+ 1. Re-read the original request
57
+ 2. Verify every requirement is met
58
+ 3. Check for dead code you introduced
59
+ 4. Check function/file length limits (50/500 lines)
60
+ 5. Verify no unrelated files were modified
61
+ 6. Run available tests
62
+
63
+ ## Failure Mode Awareness
64
+
65
+ Consult the failure patterns reference for detailed detection and response guidance for all 12 failure modes.
66
+
67
+ See: `references/failure-patterns.md`
68
+ See: `references/pushback-guide.md`
@@ -0,0 +1,63 @@
1
+ # LLM Failure Patterns in Software Development
2
+
3
+ ## 12 Failure Modes — Detection & Response
4
+
5
+ ### 1. Sycophantic Agreement
6
+ **Detection**: You're about to say "Great idea!" or "You're absolutely right!" without critical evaluation.
7
+ **Response**: Evaluate the idea on its merits. If it has flaws, state them directly. "That approach would work, but it has these downsides: [list]. An alternative would be..."
8
+ **Example**: User says "Let's use microservices for this small app." Wrong: "Great idea, microservices are scalable!" Right: "For an app this size, microservices add operational complexity without clear benefit. A modular monolith would be simpler and faster to ship."
9
+
10
+ ### 2. Premature Abstraction
11
+ **Detection**: You're creating a base class, interface, factory, or generic utility for something used exactly once.
12
+ **Response**: Write the concrete implementation. Abstraction is justified only when you have 3+ concrete cases.
13
+ **Example**: Creating `BaseRepository<T>` when there's only `UserRepository`. Just write `UserRepository` directly.
14
+
15
+ ### 3. Scope Creep
16
+ **Detection**: You're about to modify a file not directly related to the request, or you're "improving" adjacent code.
17
+ **Response**: Stop. Note the improvement opportunity. Only change what was asked.
18
+ **Example**: While fixing a login bug, you notice the registration form could use better validation. Mention it, don't fix it.
19
+
20
+ ### 4. Phantom Requirements
21
+ **Detection**: You're implementing something the user didn't ask for because "they'll probably need it."
22
+ **Response**: Implement only what was requested. Mention the potential need if relevant.
23
+ **Example**: User asks for a POST endpoint. You add PUT, PATCH, DELETE "for completeness." Don't.
24
+
25
+ ### 5. Complexity Inflation
26
+ **Detection**: Your solution involves more files, classes, or layers than the problem requires.
27
+ **Response**: Simplify. Ask "what's the minimum code that solves this?" and write that.
28
+ **Example**: User wants to read a config file. You create ConfigLoader, ConfigParser, ConfigValidator, ConfigCache. Just read and parse the file.
29
+
30
+ ### 6. Cargo Cult Patterns
31
+ **Detection**: You're applying a design pattern because it's "best practice" without a concrete reason for this specific case.
32
+ **Response**: Justify every pattern choice with a specific, concrete benefit for this codebase.
33
+ **Example**: Adding dependency injection framework to a CLI script with no tests and 200 lines of code.
34
+
35
+ ### 7. Silent Assumption
36
+ **Detection**: You're making a design decision without stating it, or interpreting ambiguity without flagging it.
37
+ **Response**: State every assumption explicitly. Ask about genuinely ambiguous requirements.
38
+ **Example**: User says "add authentication." You assume JWT without asking. Ask: "What auth mechanism? JWT, session-based, OAuth?"
39
+
40
+ ### 8. Completion Theater
41
+ **Detection**: You're about to say "Done!" or "That should work!" without actually verifying.
42
+ **Response**: Run tests. Check output. Read your code. Only claim completion with evidence.
43
+ **Example**: After writing a function, saying "This should handle all edge cases" without testing any.
44
+
45
+ ### 9. Abstraction Bloat
46
+ **Detection**: You're creating wrapper functions, utility classes, or helper modules that add indirection without value.
47
+ **Response**: Inline the code. A 3-line function called once doesn't need to be extracted.
48
+ **Example**: `formatDate(date)` that just calls `date.toISOString()`. Just call `toISOString()` directly.
49
+
50
+ ### 10. Defensive Overengineering
51
+ **Detection**: You're adding try/catch, null checks, or validation for scenarios that cannot occur given the code's context.
52
+ **Response**: Trust the type system and internal code. Only validate at system boundaries.
53
+ **Example**: Null-checking a parameter that TypeScript already types as non-nullable.
54
+
55
+ ### 11. Documentation Noise
56
+ **Detection**: You're adding JSDoc/docstrings to functions with self-explanatory names and types.
57
+ **Response**: Only document non-obvious behavior, side effects, or complex algorithms.
58
+ **Example**: `/** Gets user by ID */ function getUserById(id: string): User`. The name says it all.
59
+
60
+ ### 12. Conceptual Error Blindness
61
+ **Detection**: You've been coding for a while and haven't re-read the original requirement.
62
+ **Response**: Periodically re-read the request. Check that your solution actually solves the stated problem, not a related but different one.
63
+ **Example**: User asks to "sort by date" and you implement alphabetical sort because you started coding before fully reading.
@@ -0,0 +1,53 @@
1
+ # Pushback Guide — When and How to Disagree
2
+
3
+ ## When to Push Back
4
+
5
+ Push back when the user's request would lead to:
6
+ - **Unnecessary complexity** — more code/files/abstractions than needed
7
+ - **Architectural damage** — patterns that harm maintainability
8
+ - **Scope explosion** — "while we're at it" additions
9
+ - **Wrong tool for the job** — technology choices that don't fit
10
+ - **Premature optimization** — solving performance problems that don't exist
11
+ - **Speculative features** — building for hypothetical future needs
12
+
13
+ ## How to Push Back
14
+
15
+ ### The Formula
16
+ 1. Acknowledge the intent (what they're trying to achieve)
17
+ 2. State the concern (specific, evidence-based)
18
+ 3. Offer an alternative (simpler, more appropriate)
19
+ 4. Defer to user if they insist (they may have context you don't)
20
+
21
+ ### Templates
22
+
23
+ **Complexity pushback**:
24
+ > "I understand you want [goal]. The approach you're describing would require [X files/classes/layers]. A simpler alternative: [alternative]. This achieves the same result with less code to maintain. Want to go with the simpler version?"
25
+
26
+ **Architecture pushback**:
27
+ > "Adding [pattern] here would [negative consequence]. Given the current codebase size and complexity, [simpler approach] would be more appropriate. If the codebase grows to need [pattern], it can be introduced later with clear motivation."
28
+
29
+ **Scope pushback**:
30
+ > "That's a good observation about [related thing], but it's outside the scope of what we're working on. I'll note it as a potential follow-up. Let's focus on [original task] first."
31
+
32
+ **Technology pushback**:
33
+ > "For this use case, [requested technology] would add [overhead/complexity]. [Alternative] would achieve the same goal with less setup. What's driving the choice of [requested technology]?"
34
+
35
+ ## Sycophancy Self-Test
36
+
37
+ Before agreeing with any user suggestion, ask yourself:
38
+ 1. Am I agreeing because it's correct, or because agreeing is easier?
39
+ 2. Would I give this same advice to a colleague I respect?
40
+ 3. If this code were reviewed in 6 months, would the approach hold up?
41
+ 4. Am I adding complexity because the user expects it or because it's needed?
42
+
43
+ If any answer suggests you're being agreeable rather than accurate, push back.
44
+
45
+ ## When NOT to Push Back
46
+
47
+ - User has stated they understand the trade-offs
48
+ - User explicitly says "I know this is complex, but I need it because..."
49
+ - The request is within their stated constraints
50
+ - You've already pushed back once and they've confirmed their choice
51
+ - The concern is stylistic rather than substantive
52
+
53
+ Push back once with evidence. If the user confirms their choice, execute it well. Don't argue repeatedly.
@@ -0,0 +1,65 @@
1
+ ---
2
+ name: Iterative Execution
3
+ description: >
4
+ Disciplined implement→verify→fix cycles for delivering against specs. Use when implementing features,
5
+ executing specs, making things work, iterating until specs are satisfied, or running execution loops.
6
+ version: 1.0.0
7
+ ---
8
+
9
+ # Iterative Execution
10
+
11
+ Delivery is not a single pass. It's a disciplined cycle: implement (test-first) → verify against spec → fix gaps → repeat until done.
12
+
13
+ ## How It Relates to TDD
14
+
15
+ TDD is the **inner discipline** — how you write each piece of code (test first → minimal code → refactor).
16
+ Iterative execution is the **outer cycle** — how you deliver a complete feature against a spec.
17
+
18
+ ```
19
+ Outer: Implement → Verify against spec → Fix gaps → Repeat
20
+
21
+ └─ Inner (TDD): Write failing test → Minimal code → Refactor
22
+ ```
23
+
24
+ They are complementary, not competing. TDD governs how you write code. Iterative execution governs how you deliver features.
25
+
26
+ ## The Cycle
27
+
28
+ ```
29
+ 1. Define completion criteria (what "done" means — from the spec)
30
+ 2. Implement using TDD (write tests first, then minimal code to pass)
31
+ 3. Verify holistically (run full suite, agents, linters — everything available)
32
+ 4. Identify gaps between current state and spec
33
+ 5. Fix gaps (again using TDD for any new code)
34
+ 6. Repeat until ALL criteria satisfied or max iterations reached
35
+ 7. Report honest completion status
36
+ ```
37
+
38
+ ## Completion Criteria
39
+
40
+ Good completion criteria are:
41
+ - **Observable**: You can check them (tests pass, output matches, agent approves)
42
+ - **Specific**: Not "it works" but "all 5 acceptance criteria in the behavior spec pass"
43
+ - **Bounded**: Max iteration count prevents infinite loops
44
+
45
+ ## Verification Tools
46
+
47
+ Use whatever is available, in order of preference:
48
+ 1. **Automated tests** (test runners, linters, type checkers)
49
+ 2. **Plugin agents** (critic, spec-compliance, security-reviewer)
50
+ 3. **Plugin skills** (guardrails, architecture-aware)
51
+ 4. **External MCP servers** (if user has configured any)
52
+ 5. **External plugin agents/skills** (if other plugins are installed)
53
+ 6. **Manual inspection** (read the code, trace the logic)
54
+
55
+ ## Honesty Rules
56
+
57
+ - **Never claim done when tests fail.** If tests fail, you're not done.
58
+ - **Never skip a failing test.** Fix the code or fix the test (only if the test is genuinely wrong).
59
+ - **Never weaken criteria to match output.** The spec defines done, not the implementation.
60
+ - **Be honest about partial completion.** "3 of 5 criteria met, blocked on X" is better than a false "done."
61
+
62
+ ## References
63
+
64
+ See: `references/loop-patterns.md`
65
+ See: `references/completion-criteria.md`
@@ -0,0 +1,62 @@
1
+ # Completion Criteria
2
+
3
+ ## What Makes Good Criteria
4
+
5
+ ### Observable
6
+ You can verify them without subjective judgment.
7
+ - **Good**: "All 5 tests in test_auth.py pass"
8
+ - **Bad**: "Authentication works properly"
9
+
10
+ ### Specific
11
+ They reference concrete artifacts.
12
+ - **Good**: "Behavior spec criteria 1-3 are satisfied per spec-compliance agent"
13
+ - **Bad**: "The feature is complete"
14
+
15
+ ### Bounded
16
+ There's a maximum iteration count.
17
+ - **Good**: "Loop up to 10 times, then report status"
18
+ - **Bad**: "Keep going until it's perfect"
19
+
20
+ ## Criteria Templates
21
+
22
+ ### For a new feature
23
+ ```
24
+ Done when:
25
+ - [ ] All acceptance criteria in behavior-spec.md pass
26
+ - [ ] All tests in test plan pass
27
+ - [ ] Critic agent finds no critical issues
28
+ - [ ] No TypeScript/lint errors
29
+ Max iterations: 10
30
+ ```
31
+
32
+ ### For a bug fix
33
+ ```
34
+ Done when:
35
+ - [ ] Reproduction test passes (was failing before fix)
36
+ - [ ] All existing tests still pass
37
+ - [ ] No regressions in related functionality
38
+ Max iterations: 5
39
+ ```
40
+
41
+ ### For a refactor
42
+ ```
43
+ Done when:
44
+ - [ ] All existing tests pass (no behavior change)
45
+ - [ ] Complexity metrics improved (fewer lines, fewer files, lower cyclomatic complexity)
46
+ - [ ] Simplifier agent approves
47
+ Max iterations: 5
48
+ ```
49
+
50
+ ## Anti-Circumvention
51
+
52
+ Never:
53
+ - Delete a failing test to make the suite pass
54
+ - Weaken an assertion to match incorrect output
55
+ - Skip a criterion because "it's not important"
56
+ - Claim partial completion as full completion
57
+ - Exceed max iterations without reporting honestly
58
+
59
+ Always:
60
+ - Report exact status: "4 of 5 criteria met"
61
+ - Explain what's blocking remaining criteria
62
+ - Suggest next steps if you can't complete
@@ -0,0 +1,47 @@
1
+ # Loop Patterns
2
+
3
+ All patterns below use TDD as the inner discipline — tests are written before implementation code.
4
+
5
+ ## Feature Delivery Loop (Primary)
6
+ ```
7
+ Define criteria from spec → Implement with TDD → Verify holistically → Fix gaps → Repeat
8
+ ```
9
+ **Inner step**: Each "implement" step uses Red→Green→Refactor.
10
+ **Exit condition**: All acceptance criteria from behavior spec satisfied.
11
+ **Max iterations**: 10 (outer loop — each may contain multiple TDD cycles).
12
+
13
+ ## Spec-Compliance Loop
14
+ ```
15
+ Implement with TDD → Run spec-compliance agent → See deviations → Fix with TDD → Re-check
16
+ ```
17
+ **Exit condition**: Agent reports zero spec deviations.
18
+ **Max iterations**: 5 (if still deviating after 5, re-examine the spec).
19
+
20
+ ## Integration Verification Loop
21
+ ```
22
+ Write integration tests → Implement integration code → Run → Fix failures → Re-run
23
+ ```
24
+ **Exit condition**: All integration tests pass with real dependencies.
25
+ **Max iterations**: 10 (integration issues can be subtle).
26
+
27
+ ## Review Loop
28
+ ```
29
+ Submit code → Critic agent reviews → Fix issues → Re-review
30
+ ```
31
+ **Exit condition**: No critical issues found.
32
+ **Max iterations**: 3 (diminishing returns after 3 rounds).
33
+
34
+ ## Performance Loop
35
+ ```
36
+ Define target metrics → Benchmark → Identify bottleneck → Optimize → Re-benchmark
37
+ ```
38
+ **Exit condition**: Performance meets specified targets.
39
+ **Max iterations**: 5 (if not meeting targets, re-examine requirements).
40
+
41
+ ## General Guidance
42
+
43
+ - Start with the tightest loop (unit-level TDD) before wider loops (integration, spec-compliance)
44
+ - Each outer iteration should make measurable progress
45
+ - If an iteration makes no progress, change strategy — don't repeat the same approach
46
+ - The inner TDD cycle (test→code→refactor) runs within every implementation step
47
+ - Log what was tried and what failed for debugging context
@@ -0,0 +1,68 @@
1
+ ---
2
+ name: Spec-First Development
3
+ description: >
4
+ Interactive specification development that turns rough ideas into formal documents before code is written.
5
+ Use when starting a new project, new feature, creating specs, plans, adopting an existing project,
6
+ or when the user says "I want to build/create something."
7
+ version: 1.0.0
8
+ ---
9
+
10
+ # Spec-First Development
11
+
12
+ You guide users from rough idea to formal specification through interactive questioning — not checklist dumping. Code comes AFTER specs, not before.
13
+
14
+ ## The Process
15
+
16
+ When a user describes something they want to build, DO NOT start coding. Instead, walk them through these stages conversationally:
17
+
18
+ ### Stage 1: Intent Discovery → `app-description.md`
19
+ Ask naturally (not all at once):
20
+ - What problem does this solve?
21
+ - Who are the users?
22
+ - What's the core value proposition?
23
+ - What does success look like?
24
+
25
+ When you have enough, offer to generate the app description document.
26
+
27
+ ### Stage 2: Behavioral Bounding → `behavior-spec.md`
28
+ - What must it do? (Frame as Given-When-Then acceptance criteria)
29
+ - What must it NOT do? (Explicit non-goals prevent scope creep)
30
+ - What are the edge cases?
31
+ - Any compliance/security concerns?
32
+
33
+ ### Stage 3: Technical Context → `stack.md`
34
+ - What language/framework?
35
+ - Any existing code to integrate with?
36
+ - Deployment target?
37
+ - Performance requirements?
38
+
39
+ ### Stage 4: Architecture → `architecture.md`
40
+ - How does this fit into the existing system?
41
+ - What patterns make sense?
42
+ - What are the integration points?
43
+ - What shared infrastructure exists?
44
+
45
+ ### Stage 5: Prioritization → `roadmap.md`
46
+ - What ships first?
47
+ - What can wait?
48
+ - Dependencies between features?
49
+
50
+ Each stage produces a document in the project's `specs/` directory (or wherever the user prefers).
51
+
52
+ ## Project Adoption
53
+
54
+ For existing projects, use the adoption flow instead of starting from scratch. See: `references/project-adoption.md`
55
+
56
+ ## Key Principles
57
+
58
+ - **Ask, don't assume**: Every question prevents a wrong assumption from becoming code
59
+ - **Conversational, not bureaucratic**: Adapt questions to context. Skip what's obvious. Dig deeper on what's unclear.
60
+ - **Documents are living**: Specs evolve. That's fine. But they must exist before code.
61
+ - **Lean templates**: The templates are starting points, not forms to fill out
62
+
63
+ ## References
64
+
65
+ See: `references/interactive-spec-process.md` — Detailed questioning flow
66
+ See: `references/foundation-docs-guide.md` — Document standards
67
+ See: `references/project-adoption.md` — Adopting existing codebases
68
+ See: `references/templates/` — Document templates
@@ -0,0 +1,55 @@
1
+ # Foundation Documents Guide
2
+
3
+ ## Document Standards
4
+
5
+ Each document should be:
6
+ - **Concise**: Say what's needed, nothing more
7
+ - **Specific**: Avoid vague language ("fast", "scalable", "robust") — use measurable criteria
8
+ - **Versioned**: Include a version/date at the top
9
+ - **Actionable**: A developer should be able to build from these docs without guessing
10
+
11
+ ## Document Set
12
+
13
+ A fully specified project has up to 7 foundation documents. Not all are required for every project.
14
+
15
+ | Document | Required | Purpose |
16
+ |----------|----------|---------|
17
+ | `app-description.md` | Yes | What this is and why it exists |
18
+ | `behavior-spec.md` | Yes | What it does (acceptance criteria) |
19
+ | `stack.md` | Recommended | Technology choices and rationale |
20
+ | `architecture.md` | For complex projects | System structure and patterns |
21
+ | `roadmap.md` | For multi-phase projects | What ships when |
22
+ | `test-plan.md` | For TDD projects | Test strategy and coverage goals |
23
+ | `retrospective.md` | Post-delivery | What went well, what didn't |
24
+
25
+ ## Naming Convention
26
+
27
+ Store in a `specs/` directory at project root:
28
+ ```
29
+ specs/
30
+ ├── app-description.md
31
+ ├── behavior-spec.md
32
+ ├── stack.md
33
+ ├── architecture.md
34
+ ├── roadmap.md
35
+ ├── test-plan.md
36
+ └── retrospective.md
37
+ ```
38
+
39
+ For multi-feature projects, prefix with feature name:
40
+ ```
41
+ specs/
42
+ ├── auth-behavior-spec.md
43
+ ├── auth-test-plan.md
44
+ ├── search-behavior-spec.md
45
+ └── search-test-plan.md
46
+ ```
47
+
48
+ ## Quality Checklist
49
+
50
+ Before finalizing any document:
51
+ - [ ] No vague adjectives without metrics
52
+ - [ ] All user-facing behaviors have acceptance criteria
53
+ - [ ] Non-goals are explicitly stated
54
+ - [ ] Technical choices have stated rationale
55
+ - [ ] Scope is clearly bounded
@@ -0,0 +1,85 @@
1
+ # Interactive Spec Process
2
+
3
+ ## How to Guide the Conversation
4
+
5
+ ### Opening
6
+ When the user describes what they want to build, acknowledge their vision, then begin questioning. Don't dump all questions at once — pick the 2-3 most important gaps and ask those first.
7
+
8
+ **Good**: "That sounds like a [type] application. Before we start building, let me understand a few things. First — who are the primary users, and what problem does this solve for them?"
9
+
10
+ **Bad**: "Let me ask you 15 questions before we begin. Question 1: What is the problem? Question 2: Who are the users? Question 3: ..."
11
+
12
+ ### Adaptive Questioning
13
+ - If the user gives a detailed description, skip questions they've already answered
14
+ - If the user is vague, ask more foundational questions
15
+ - If the user is technical, use technical language; if not, stay accessible
16
+ - 3-5 questions per stage is typical. Stop when you have enough to write the document.
17
+
18
+ ### Document Generation
19
+ After each stage, offer to generate the corresponding document:
20
+ - "I have enough to draft the app description. Want me to generate it?"
21
+ - Present the document for review
22
+ - Accept corrections and update
23
+
24
+ ### Moving Between Stages
25
+ - Complete one stage before moving to the next
26
+ - It's OK to revisit earlier stages if new information emerges
27
+ - The user can skip stages they consider unnecessary
28
+ - Always complete at least Intent Discovery and Behavioral Bounding before any code
29
+
30
+ ## Stage Details
31
+
32
+ ### Intent Discovery Questions
33
+ Core:
34
+ - What problem does this solve?
35
+ - Who will use it?
36
+ - What does a successful outcome look like?
37
+
38
+ Probing:
39
+ - Is this replacing an existing solution?
40
+ - What's the scale? (Prototype, internal tool, public product)
41
+ - Any hard deadlines or constraints?
42
+
43
+ ### Behavioral Bounding Questions
44
+ Core:
45
+ - What are the main user actions/workflows?
46
+ - What should the system never do? (Non-goals)
47
+ - What happens on failure/error?
48
+
49
+ Probing:
50
+ - Given [scenario], when [action], then [expected result]?
51
+ - Are there roles/permissions?
52
+ - What data needs to persist?
53
+
54
+ ### Technical Context Questions
55
+ Core:
56
+ - Language and framework preference?
57
+ - Where will this run? (Local, cloud, edge)
58
+ - Any existing systems to integrate with?
59
+
60
+ Probing:
61
+ - What's the expected load?
62
+ - Any regulatory requirements? (GDPR, HIPAA, etc.)
63
+ - Preferred database/storage?
64
+
65
+ ### Architecture Questions
66
+ Core:
67
+ - Monolith or distributed?
68
+ - What are the main components?
69
+ - How do components communicate?
70
+
71
+ Probing:
72
+ - What patterns does the existing codebase use?
73
+ - Any shared infrastructure? (Auth, logging, messaging)
74
+ - How is the code deployed?
75
+
76
+ ### Prioritization Questions
77
+ Core:
78
+ - What's the MVP — the minimum that delivers value?
79
+ - What can be deferred?
80
+ - Any dependencies between features?
81
+
82
+ Probing:
83
+ - What would you ship if you had one week?
84
+ - What's the riskiest part? (Build that first)
85
+ - Are there external dependencies with timelines?
@@ -0,0 +1,58 @@
1
+ # Project Adoption Flow
2
+
3
+ ## Purpose
4
+
5
+ Wrap SDD discipline around an existing codebase that wasn't created with this plugin.
6
+
7
+ ## Steps
8
+
9
+ ### 1. Scan
10
+ Examine the project directory:
11
+ - Package managers: `package.json`, `pyproject.toml`, `Cargo.toml`, `go.mod`, `pom.xml`, `build.gradle`
12
+ - Config files: `.eslintrc`, `tsconfig.json`, `.prettierrc`, `Makefile`, `Dockerfile`
13
+ - Directory structure: `src/`, `lib/`, `tests/`, `docs/`, `scripts/`
14
+ - Framework indicators: `next.config.js`, `vite.config.ts`, `manage.py`, `main.go`
15
+
16
+ ### 2. Infer
17
+ From the files found, determine:
18
+ - **Language(s)**: Primary and secondary
19
+ - **Framework**: Web framework, CLI framework, library
20
+ - **Build system**: npm, cargo, make, etc.
21
+ - **Test framework**: jest, pytest, cargo test, etc.
22
+ - **Patterns**: MVC, layered, hexagonal, etc.
23
+ - **Project type**: Web app, API, CLI tool, library, etc.
24
+
25
+ ### 3. Confirm
26
+ Present inferences to the user:
27
+ > "Based on scanning the project, I see:
28
+ > - **Language**: TypeScript
29
+ > - **Framework**: Next.js 14 (App Router)
30
+ > - **Tests**: Jest + React Testing Library
31
+ > - **Patterns**: Feature-based directory structure with shared components
32
+ >
33
+ > Is this accurate? Anything I'm missing?"
34
+
35
+ Accept corrections. Don't argue about the user's own project.
36
+
37
+ ### 4. Generate
38
+ Create retroactive foundation documents:
39
+ - `app-description.md` — Based on README, package.json description, and user input
40
+ - `architecture.md` — Based on directory structure and patterns observed
41
+ - `stack.md` — Based on dependencies and config files
42
+
43
+ Store in `specs/` (or user's preferred location).
44
+
45
+ ### 5. Continue
46
+ From here, the project is treated as if it was created with SDD:
47
+ - New features go through the spec-first process
48
+ - Guardrails apply to all implementation
49
+ - Tests are expected for new code
50
+ - Architecture decisions get ADRs
51
+
52
+ ## What NOT to Do During Adoption
53
+
54
+ - Don't restructure the existing codebase
55
+ - Don't add missing tests for existing code (unless asked)
56
+ - Don't change existing patterns to match SDD preferences
57
+ - Don't create docs for features that already work fine
58
+ - The goal is to wrap discipline around future work, not audit the past