prd-writer-mcp 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.
@@ -0,0 +1,41 @@
1
+ <section id="1" title="Overview">
2
+ <subsection id="1.1" title="Purpose">
3
+ <description>Briefly describe the overall purpose and overview of the document.</description>
4
+ </subsection>
5
+ <subsection id="1.2" title="Document Name">
6
+ <description>Provide the official name of the document.</description>
7
+ </subsection>
8
+ <subsection id="1.3" title="Target Users">
9
+ <description>Define the primary target users or personas for this product.</description>
10
+ <example>
11
+ - Small business owners who need to manage inventory
12
+ - Marketing teams in mid-sized companies
13
+ </example>
14
+ </subsection>
15
+ <subsection id="1.4" title="Core Problem">
16
+ <description>Describe the core problem that this product aims to solve.</description>
17
+ <example>
18
+ - Users spend too much time manually tracking inventory across multiple spreadsheets.
19
+ </example>
20
+ </subsection>
21
+ <subsection id="1.5" title="Solution Strategy">
22
+ <description>Explain the high-level approach to solving the core problem.</description>
23
+ <example>
24
+ - Provide a centralized dashboard that automatically syncs inventory data from multiple sources.
25
+ </example>
26
+ </subsection>
27
+ <subsection id="1.6" title="Success Criteria">
28
+ <description>Define the criteria that will determine whether the product is successful.</description>
29
+ <example>
30
+ - 80% of users can complete inventory updates in under 5 minutes.
31
+ - User satisfaction score of 4.0 or higher.
32
+ </example>
33
+ </subsection>
34
+ <subsection id="1.7" title="Key Differentiators">
35
+ <description>List the unique features or advantages that set this product apart from competitors.</description>
36
+ <example>
37
+ - AI-powered demand forecasting
38
+ - One-click integration with major e-commerce platforms
39
+ </example>
40
+ </subsection>
41
+ </section>
@@ -0,0 +1,14 @@
1
+ <section id="2" title="MVP Goals and Key Metrics">
2
+ <subsection id="2.1" title="Purpose">
3
+ <description>Briefly describe the hypothesis or goals to be validated through the MVP.</description>
4
+ <example>
5
+ If we provide a 30% discount coupon upon sign-up, the revisit rate within 14 days will increase.
6
+ </example>
7
+ </subsection>
8
+ <subsection id="2.2" title="Key Performance Indicators (KPIs)">
9
+ <description>Define the quantitative metrics to evaluate the purpose (hypothesis) stated above.</description>
10
+ <example>
11
+ Revisit rate within 14 days after sign-up: 30% or higher
12
+ </example>
13
+ </subsection>
14
+ </section>
@@ -0,0 +1,12 @@
1
+ <section id="3" title="Demo Scenario">
2
+ <description>
3
+ - Briefly describe the demo scenario that shows how key hypotheses can be validated.
4
+ - Ensure the scenario aligns with Section 2.
5
+ </description>
6
+ <example>
7
+ 1. Amanda visited the shoes category page on our shopping website a week ago.
8
+ 2. Amanda received a 30% discount coupon via email.
9
+ 3. Amanda clicks the link in the email, which redirects her to the shoes category page.
10
+ 4. Amanda buys a pair of shoes using the discount coupon, which is automatically applied to the order.
11
+ </example>
12
+ </section>
@@ -0,0 +1,33 @@
1
+ <section id="4" title="High-Level Architecture">
2
+ <subsection id="4.1" title="System Diagram">
3
+ <description>
4
+ - Provide Context and Container diagrams (C4 model) illustrating the overall system architecture of the project.
5
+ - The Context diagram is essential; the Container diagram is optional.
6
+ - Component and Code diagrams are excluded.
7
+ </description>
8
+ <example>
9
+ ```mermaid
10
+ C4Context
11
+
12
+ title System Context Diagram for {Project Name}
13
+
14
+ Person(user, "User", "User")
15
+
16
+ System_Ext(system_ext, "System Ext", "External System")
17
+ System(system, "System", "Target System")
18
+
19
+ Rel(user, system_ext, "Uses", "HTTPS")
20
+ Rel(user, system, "Uses", "HTTPS")
21
+ ```
22
+ </example>
23
+ </subsection>
24
+ <subsection id="4.2" title="Technology Stack">
25
+ <description>List the key technologies and frameworks to be used in the MVP.</description>
26
+ <example>
27
+ - Frontend: React (Tailwind CSS)
28
+ - Backend: Node.js (Express)
29
+ - Database: MongoDB
30
+ - Infrastructure: AWS (EC2), GitHub Actions (CI/CD)
31
+ </example>
32
+ </subsection>
33
+ </section>
@@ -0,0 +1,22 @@
1
+ <section id="5" title="Design Specification">
2
+ <description>Define the UX guidelines and page flow that will be directly reflected in MVP development.</description>
3
+ <subsection id="5.1" title="User Flow and Page Structure">
4
+ <subsection id="5.1.1" title="Key Pages (Features)">
5
+ <description>List the key pages that must be implemented in the MVP. (Use the same feature IDs as Section 6.1 where applicable.)</description>
6
+ <example>
7
+ - F3: Main Screen
8
+ - F4: Post Creation Screen
9
+ - F5: Post List/Detail Screen
10
+ </example>
11
+ </subsection>
12
+ <subsection id="5.1.2" title="Page Navigation">
13
+ <description>Summarize how users navigate between pages and key scenarios.</description>
14
+ <example>
15
+ 1. The user accesses the main screen.
16
+ 2. Sign-up/Login → Redirects to the main screen upon successful login.
17
+ 3. View post list → Enter the post details screen → Create a post (Login required).
18
+ (Optional) This flow can be visualized using a Mermaid Sequence Diagram.
19
+ </example>
20
+ </subsection>
21
+ </subsection>
22
+ </section>
@@ -0,0 +1,60 @@
1
+ <section id="6" title="Requirements Summary">
2
+ <description>
3
+ - List all core features (functional requirements) and non-functional requirements for the MVP.
4
+ - Each core feature is assigned a unique ID (F1, F2, …), and will be mapped to Section 7.
5
+ - Prioritize each requirement using: Must-Have, Should-Have, or Nice-to-Have.
6
+ - Only features defined in this section are included in the MVP scope; additional features must be listed in Section 9.
7
+ - Up to 3 non-functional requirements are allowed.
8
+ </description>
9
+ <subsection id="6.1" title="Core Features (Functional Requirements)">
10
+ <example>
11
+ | ID | Feature | Priority |
12
+ |----|---------|----------|
13
+ | F1 | Email Sign-up | Must-Have |
14
+ | F2 | Email Login | Must-Have |
15
+ | F3 | Main Screen | Must-Have |
16
+ | F4 | Post Creation | Should-Have |
17
+ | F5 | Post List/Detail | Nice-to-Have |
18
+ </example>
19
+ </subsection>
20
+ <subsection id="6.2" title="Non-Functional Requirements">
21
+ <description>
22
+ - Define non-functional requirements such as security, performance, and scalability.
23
+ - Set the minimum standards for the MVP phase.
24
+ - Non-functional requirements are validated through Section 8 (MVP Metrics) or release testing.
25
+ </description>
26
+ <example>
27
+ | ID | Requirement | Priority |
28
+ |----|-------------|----------|
29
+ | NF1 | Minimum security (no email verification) | Must-Have |
30
+ | NF2 | Performance (up to 1,000 daily users) | Should-Have |
31
+ | NF3 | Latency (under 3 seconds) | Must-Have |
32
+ </example>
33
+ </subsection>
34
+ <subsection id="6.3" title="Feature Dependency Diagram">
35
+ <description>
36
+ - After completing 6.1 and 6.2, the AI automatically analyzes feature dependencies and generates this diagram.
37
+ - Visualize the dependency relationships between features using a Mermaid diagram.
38
+ - Use a top-down tree structure (graph TD) to show which features depend on other features.
39
+ - An arrow from A to B means "A depends on B" (B must be implemented before A).
40
+ - Features with no dependencies are root nodes in the tree.
41
+ - This diagram helps determine the implementation order and identify critical paths.
42
+ - Present the auto-generated diagram to the user for confirmation or correction.
43
+ </description>
44
+ <example>
45
+ ```mermaid
46
+ graph TD
47
+ F1[F1: Email Sign-up]
48
+ F2[F2: Email Login]
49
+ F3[F3: Main Screen]
50
+ F4[F4: Post Creation]
51
+ F5[F5: Post List/Detail]
52
+
53
+ F2 -->|depends on| F1
54
+ F3 -->|depends on| F2
55
+ F4 -->|depends on| F2
56
+ F5 -->|depends on| F3
57
+ ```
58
+ </example>
59
+ </subsection>
60
+ </section>
@@ -0,0 +1,84 @@
1
+ <section id="7" title="Feature-Level Specification">
2
+ <description>
3
+ - For every feature listed in Section 6.1, provide a detailed design using the same Fx ID and feature name.
4
+ - Each subsection must match the feature ID, name, and priority defined in Section 6.1.
5
+ - No additional features beyond those in Section 6.1 may be specified here.
6
+ </description>
7
+ <template id="7.x" title="Feature Template">
8
+ <header>Feature ID: Fx | Priority: Must-Have / Should-Have / Nice-to-Have</header>
9
+ <subsection id="7.x.1" title="User Story">
10
+ <description>
11
+ - Describe the user scenario for implementing this feature.
12
+ - Use this format: As a [persona], I want to [action], so that [benefit].
13
+ </description>
14
+ <example>
15
+ - As a new user, I want to sign up with my email, so that I can access the service.
16
+ </example>
17
+ </subsection>
18
+ <subsection id="7.x.2" title="User Flow">
19
+ <description>
20
+ - Describe the user flow for this feature.
21
+ - Keep the flow simple and concise.
22
+ </description>
23
+ <example>
24
+ 1. Display a sign-up form with:
25
+ - Email input field
26
+ - Password input field
27
+ - "Sign Up" button
28
+ 2. When the user submits the form:
29
+ - Validate input
30
+ - Trigger an API call
31
+ - Redirect to the main screen upon successful sign-up
32
+ </example>
33
+ </subsection>
34
+ <subsection id="7.x.3" title="Technical Description">
35
+ <description>
36
+ - Describe the implementation details from a developer's perspective.
37
+ - Break down each user story into detailed technical steps.
38
+ </description>
39
+ <example>
40
+ 1. Email Validation
41
+ - Validate email format using regex
42
+ - Check for duplicate emails in the database
43
+ 2. Password Processing
44
+ - Ensure a minimum of 8 characters, including at least one special character
45
+ - Hash the password using bcrypt
46
+ 3. User Creation Process
47
+ - Insert a new record into the users table
48
+ - Generate and return a JWT token
49
+ </example>
50
+ </subsection>
51
+ <subsection id="7.x.4" title="Edge Cases">
52
+ <description>List potential edge cases and how they should be handled.</description>
53
+ <example>
54
+ - User submits an already registered email → Show "Email already exists" error
55
+ - User enters a password with less than 8 characters → Show validation error
56
+ - Network timeout during API call → Show retry option
57
+ </example>
58
+ </subsection>
59
+ <subsection id="7.x.5" title="Error Handling">
60
+ <description>Define error scenarios and appropriate responses.</description>
61
+ <example>
62
+ | Error Type | HTTP Code | User Message |
63
+ |------------|-----------|--------------|
64
+ | Validation failure | 400 | "Please check your input" |
65
+ | Duplicate email | 409 | "Email already registered" |
66
+ | Server error | 500 | "Something went wrong. Please try again." |
67
+ </example>
68
+ </subsection>
69
+ <subsection id="7.x.6" title="Acceptance Criteria">
70
+ <description>
71
+ - Define the conditions that must be met for this feature to be considered complete.
72
+ - Use clear, testable statements.
73
+ </description>
74
+ <example>
75
+ - [ ] User can enter email and password in the sign-up form
76
+ - [ ] Form validates email format before submission
77
+ - [ ] Password must be at least 8 characters with one special character
78
+ - [ ] Successful sign-up redirects user to main screen
79
+ - [ ] Duplicate email shows appropriate error message
80
+ - [ ] All error states display user-friendly messages
81
+ </example>
82
+ </subsection>
83
+ </template>
84
+ </section>
@@ -0,0 +1,29 @@
1
+ <section id="8" title="MVP Metrics">
2
+ <description>
3
+ - List the key data points and methods for collecting them to measure the MVP's success.
4
+ - Define success thresholds for each key performance indicator.
5
+ - Non-functional requirements (from Section 6.2) are also validated here or through dedicated release testing.
6
+ </description>
7
+ <subsection id="8.1" title="Data Collection Methods">
8
+ <example>
9
+ | Metric | Collection Method | Related Feature/KPI |
10
+ |--------|-------------------|---------------------|
11
+ | Sign-up button clicks | Event tracking (Analytics) | F1 |
12
+ | Post creation count | Database query | F4 |
13
+ | Revisit count within 14 days | User session tracking | KPI |
14
+ | Average response latency | APM monitoring | NF3 |
15
+ | Uptime logs | Infrastructure monitoring | NF4 |
16
+ </example>
17
+ </subsection>
18
+ <subsection id="8.2" title="Success Thresholds">
19
+ <description>Define the target values that indicate MVP success.</description>
20
+ <example>
21
+ | KPI | Baseline | Target | Measurement Period |
22
+ |-----|----------|--------|-------------------|
23
+ | Sign-up conversion rate | N/A | ≥ 20% | First 30 days |
24
+ | Revisit rate (14 days) | N/A | ≥ 30% | Ongoing |
25
+ | Average response latency | N/A | &lt; 3 seconds | Ongoing |
26
+ | System uptime | N/A | ≥ 99.5% | Ongoing |
27
+ </example>
28
+ </subsection>
29
+ </section>
@@ -0,0 +1,25 @@
1
+ <section id="9" title="Out-of-Scope">
2
+ <description>
3
+ - List requirements and features excluded from the MVP.
4
+ - Provide a roadmap for managing technical debt and potential future enhancements.
5
+ </description>
6
+ <subsection id="9.1" title="Deferred Features">
7
+ <example>
8
+ | Feature | Reason for Deferral | Target Phase |
9
+ |---------|---------------------|--------------|
10
+ | OAuth support | Not critical for MVP validation | Phase 2 |
11
+ | Payment support | Requires additional compliance | Phase 2 |
12
+ | Advanced analytics | Nice-to-have, not core | Phase 3 |
13
+ </example>
14
+ </subsection>
15
+ <subsection id="9.2" title="Technical Debt Roadmap">
16
+ <description>Document known technical debt and plans for addressing it.</description>
17
+ <example>
18
+ | Item | Description | Priority | Target Phase |
19
+ |------|-------------|----------|--------------|
20
+ | Test coverage | Increase unit test coverage to 80% | High | Phase 2 |
21
+ | Error logging | Implement centralized error logging | Medium | Phase 2 |
22
+ | Code refactoring | Refactor authentication module | Low | Phase 3 |
23
+ </example>
24
+ </subsection>
25
+ </section>
@@ -0,0 +1,100 @@
1
+ # Product Requirements Document (PRD) Template
2
+
3
+ This document provides a comprehensive framework to capture and validate all essential information required for developing an MVP.
4
+
5
+ ## Sections
6
+
7
+ 1. Overview - Define the product vision, target users, core problem, solution strategy
8
+ 2. MVP Goals and Key Metrics - Articulate measurable goals that validate the MVP hypothesis
9
+ 3. Demo Scenario - Describe the demo scenario showing how key hypotheses can be validated _(references: Section 2)_
10
+ 4. High-Level Architecture - Provide C4 model diagrams illustrating the system architecture
11
+ 5. Design Specification - Detail the UX and page flow _(references: Section 6)_
12
+ 6. Requirements Summary - Enumerate all core functional and non-functional requirements
13
+ 7. Feature-Level Specification - Present complete user stories for each feature _(references: Section 6)_
14
+ 8. MVP Metrics - Detail methods for collecting and analyzing data _(references: Section 2, 6)_
15
+ 9. Out of Scope - List features deferred for future iterations
16
+
17
+ ---
18
+
19
+ ## Section Reference Rules
20
+
21
+ <section-references>
22
+ Some sections depend on other sections. Before working on a section with references, you MUST review the referenced sections first.
23
+
24
+ <reference-map>
25
+ - Section 3 (Demo Scenario) → MUST review Section 2 (MVP Goals)
26
+ - Section 5 (Design Specification) → MUST review Section 6 (Requirements Summary)
27
+ - Section 7 (Feature-Level Specification) → MUST review Section 6 (Requirements Summary)
28
+ - Section 8 (MVP Metrics) → MUST review Section 2 (MVP Goals) AND Section 6.2 (Non-Functional Requirements)
29
+ </reference-map>
30
+
31
+ <mandatory-actions>
32
+ 1. Call `read_prd_section(N)` for each referenced section
33
+ 2. Summarize key points from referenced sections before asking questions
34
+ 3. If referenced sections are incomplete, warn user and suggest completing them first
35
+ </mandatory-actions>
36
+ </section-references>
37
+
38
+ ---
39
+
40
+ ## Conversation Guide
41
+
42
+ <communication>
43
+ <section-tracking>
44
+ - Start each message with "Section" and its number (e.g., `## Section 1. Overview`).
45
+ </section-tracking>
46
+
47
+ <conversation-style>
48
+ - Ask ONE or at most TWO focused questions at a time. For complex topics, ask exactly ONE.
49
+ - Explain the purpose of each section before asking questions (1-2 sentences).
50
+ - Wait for user response before proceeding.
51
+ - Use numbered lists for decision points.
52
+ - Avoid code examples unless explicitly requested.
53
+ </conversation-style>
54
+
55
+ <emoji-usage>
56
+ - Use emojis purposefully, max 2 per section.
57
+ - Place emojis at the end of statements, not beginning or middle.
58
+ </emoji-usage>
59
+ </communication>
60
+
61
+ <conversation-flow>
62
+ For EVERY section:
63
+ 1. Call `get_prd_section_guide(N)` before writing
64
+ 2. Briefly explain section purpose (1-2 sentences)
65
+ 3. Ask 1 (max 2) focused questions from the guide
66
+ 4. Integrate answers iteratively
67
+ 5. When complete, print FULL section and ask for confirmation
68
+ 6. Call `save_prd_section(N, content)` only AFTER explicit "yes"
69
+ 7. Move to next section only after confirmation
70
+
71
+ <confirmation-required-sections>
72
+ Must obtain explicit confirmation before proceeding:
73
+ - Section 3. Demo Scenario
74
+ - Section 6. Requirements Summary
75
+ - Every subsection of Section 7 (confirm each 7.x individually)
76
+ </confirmation-required-sections>
77
+ </conversation-flow>
78
+
79
+ <change-requests>
80
+ When user asks to edit/update/modify/remove/add anything:
81
+ 1. Print only the modified subsection with `v{n}` suffix (e.g., `### 1.1 Purpose v2`)
82
+ 2. Include short change-log (1-3 bullets)
83
+ 3. Ask ONE follow-up question
84
+ 4. Do NOT reprint entire section unless requested
85
+ 5. After "no more changes", ask permission to proceed to next section
86
+ </change-requests>
87
+
88
+ <reference-document-handling>
89
+ When user provides PDF, PRD, or any reference:
90
+ 1. Say: "I'll use this as reference, but let's go through each section together."
91
+ 2. For each question: show what you found, ask user to confirm or modify
92
+ 3. NEVER auto-generate entire document without Q&A
93
+ </reference-document-handling>
94
+
95
+ <rules>
96
+ - NEVER generate multiple sections at once
97
+ - NEVER write section without calling get_prd_section_guide() first
98
+ - NEVER proceed without explicit user confirmation
99
+ - ALWAYS ask 1-2 questions at a time (1 for complex topics)
100
+ </rules>
@@ -0,0 +1,11 @@
1
+ import { DocumentService } from "./service.js";
2
+ export declare class DocumentController {
3
+ private service;
4
+ constructor(service: DocumentService);
5
+ initPrdDocument(projectName: string, outputPath: string): string;
6
+ loadPrdDocument(docPath: string): string;
7
+ savePrdSection(section: number, subsectionId: string, title: string, content: string): string;
8
+ readPrdSection(section: number, subsectionId?: string): string;
9
+ getPrdDocumentStatus(): string;
10
+ exportPrdMarkdown(outputPath?: string): string;
11
+ }
@@ -0,0 +1,24 @@
1
+ export class DocumentController {
2
+ service;
3
+ constructor(service) {
4
+ this.service = service;
5
+ }
6
+ initPrdDocument(projectName, outputPath) {
7
+ return this.service.initDocument(projectName, outputPath);
8
+ }
9
+ loadPrdDocument(docPath) {
10
+ return this.service.loadDocument(docPath);
11
+ }
12
+ savePrdSection(section, subsectionId, title, content) {
13
+ return this.service.saveSection(section, subsectionId, title, content);
14
+ }
15
+ readPrdSection(section, subsectionId) {
16
+ return this.service.readSection(section, subsectionId);
17
+ }
18
+ getPrdDocumentStatus() {
19
+ return this.service.getStatus();
20
+ }
21
+ exportPrdMarkdown(outputPath) {
22
+ return this.service.exportMarkdown(outputPath);
23
+ }
24
+ }
@@ -0,0 +1,18 @@
1
+ export declare class DocumentService {
2
+ private workingDoc;
3
+ private parseSections;
4
+ private parseSubsections;
5
+ private buildSubsection;
6
+ private buildSection;
7
+ private buildDocument;
8
+ private extractProjectName;
9
+ private get outputDir();
10
+ private expandPath;
11
+ initDocument(projectName: string, outputPath: string): string;
12
+ loadDocument(docPath: string): string;
13
+ saveSection(section: number, subsectionId: string, title: string, content: string): string;
14
+ readSection(section: number, subsectionId?: string): string;
15
+ getStatus(): string;
16
+ private contentToMarkdown;
17
+ exportMarkdown(outputPath?: string): string;
18
+ }