sdlc-workflow 1.0.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 (3) hide show
  1. package/README.md +77 -0
  2. package/bin/cli.js +440 -0
  3. package/package.json +27 -0
package/README.md ADDED
@@ -0,0 +1,77 @@
1
+ # sdlc-workflow
2
+
3
+ Scaffold SDLC workflow docs and templates into your project. Works with **Cursor** and **Claude**.
4
+
5
+ ## Flow
6
+
7
+ ```
8
+ User Request → PO → Business BA → Architect → Technical BA → Dev Teams → QE → Deploy
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ In your project directory:
14
+
15
+ ```bash
16
+ npx sdlc-workflow init
17
+ ```
18
+
19
+ This creates:
20
+
21
+ - `docs/sdlc/` — SDLC docs, templates, and phase folders
22
+ - `.cursor/rules/sdlc-workflow.mdc` — Cursor rule for this project
23
+ - `~/.cursor/skills/sdlc-workflow/` — Cursor skill (global, applies to all projects)
24
+ - `.claude/CLAUDE.md` — Claude Code instructions (project-level)
25
+
26
+ ## Generated Structure
27
+
28
+ ```
29
+ docs/sdlc/
30
+ ├── SDLC-WORKFLOW.md # Main workflow (use with Claude)
31
+ ├── reference.md
32
+ ├── po/ # Product Owner
33
+ │ ├── epic-brief.template.md
34
+ │ └── README.md
35
+ ├── ba/
36
+ │ ├── business/ # Business BA
37
+ │ │ ├── functional-requirement.template.md
38
+ │ │ └── README.md
39
+ │ └── technical/ # Technical BA
40
+ │ ├── api-spec.template.md
41
+ │ ├── team-breakdown.template.md
42
+ │ └── README.md
43
+ ├── architecture/ # Architect
44
+ │ ├── adr.template.md
45
+ │ └── README.md
46
+ └── qe/ # QE
47
+ ├── test-case.template.md
48
+ └── README.md
49
+
50
+ .cursor/rules/
51
+ └── sdlc-workflow.mdc # Cursor rule
52
+ ```
53
+
54
+ ## Use with Claude
55
+
56
+ - **Claude Code** (project): `.claude/CLAUDE.md` is created by init — Claude loads it automatically when you open this project.
57
+ - **Claude.ai** (web): Copy `docs/sdlc/SDLC-WORKFLOW.md` into Custom Instructions or @ mention it in chat.
58
+
59
+ ## Use with Cursor
60
+
61
+ The rule `.cursor/rules/sdlc-workflow.mdc` activates when working with `docs/sdlc/**` or `*.md`.
62
+
63
+ ## Release
64
+
65
+ 1. Add `NPM_TOKEN` (npm access token) to repo **Settings → Secrets → Actions**.
66
+ 2. Push a version tag:
67
+
68
+ ```bash
69
+ git tag v1.0.1
70
+ git push origin v1.0.1
71
+ ```
72
+
73
+ 3. GitHub Action publishes to npm and creates a GitHub Release.
74
+
75
+ ## License
76
+
77
+ MIT
package/bin/cli.js ADDED
@@ -0,0 +1,440 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { fileURLToPath } from "node:url";
4
+ import { dirname, join } from "node:path";
5
+ import { homedir } from "node:os";
6
+ import { mkdir, writeFile, readFile, cp } from "node:fs/promises";
7
+ import { existsSync } from "node:fs";
8
+
9
+ const __dirname = dirname(fileURLToPath(import.meta.url));
10
+ const PKG_ROOT = join(__dirname, "..");
11
+ const TEMPLATES_DIR = join(PKG_ROOT, "templates");
12
+
13
+ async function main() {
14
+ const cwd = process.cwd();
15
+ const args = process.argv.slice(2);
16
+ const command = args[0] || "init";
17
+
18
+ if (command !== "init") {
19
+ console.log("Usage: npx sdlc-workflow init");
20
+ console.log(" Scaffolds SDLC docs and templates into current project.");
21
+ console.log(" Installs Cursor skill (global) and Claude instructions (project).");
22
+ process.exit(1);
23
+ }
24
+
25
+ console.log("Scaffolding SDLC workflow...\n");
26
+
27
+ try {
28
+ const home = homedir();
29
+ await scaffold(cwd);
30
+ await installCursorSkill(home);
31
+ await installClaudeSkill(cwd);
32
+ console.log("\nDone.");
33
+ console.log(" - Project: docs/sdlc/, .cursor/rules/, .claude/");
34
+ console.log(" - Cursor skill: ~/.cursor/skills/sdlc-workflow/ (global)");
35
+ } catch (err) {
36
+ console.error("Error:", err.message);
37
+ process.exit(1);
38
+ }
39
+ }
40
+
41
+ async function installCursorSkill(home) {
42
+ const skillDir = join(home, ".cursor", "skills", "sdlc-workflow");
43
+ await mkdir(skillDir, { recursive: true });
44
+ await writeFile(join(skillDir, "SKILL.md"), CURSOR_SKILL_MD, "utf8");
45
+ await writeFile(join(skillDir, "reference.md"), CURSOR_REFERENCE_MD, "utf8");
46
+ console.log(" + ~/.cursor/skills/sdlc-workflow/ (skill installed)");
47
+ }
48
+
49
+ async function installClaudeSkill(cwd) {
50
+ const claudeDir = join(cwd, ".claude");
51
+ await mkdir(claudeDir, { recursive: true });
52
+ const claudeMdPath = join(claudeDir, "CLAUDE.md");
53
+ const sdlcContent = CLAUDE_SDLC_CONTENT;
54
+
55
+ if (existsSync(claudeMdPath)) {
56
+ const existing = await readFile(claudeMdPath, "utf8");
57
+ if (existing.includes("## SDLC Workflow")) {
58
+ console.log(" + .claude/CLAUDE.md (SDLC section already present)");
59
+ return;
60
+ }
61
+ await writeFile(
62
+ claudeMdPath,
63
+ existing.trimEnd() + "\n\n" + sdlcContent,
64
+ "utf8"
65
+ );
66
+ } else {
67
+ await writeFile(claudeMdPath, sdlcContent, "utf8");
68
+ }
69
+ console.log(" + .claude/CLAUDE.md (Claude instructions)");
70
+ }
71
+
72
+ async function scaffold(cwd) {
73
+ const templates = join(TEMPLATES_DIR, "project");
74
+ if (!existsSync(templates)) {
75
+ await generateFromInline(cwd);
76
+ } else {
77
+ await cp(templates, join(cwd, "docs", "sdlc"), { recursive: true });
78
+ }
79
+
80
+ const cursorRulesDir = join(cwd, ".cursor", "rules");
81
+ await mkdir(cursorRulesDir, { recursive: true });
82
+ await writeFile(
83
+ join(cursorRulesDir, "sdlc-workflow.mdc"),
84
+ CURSOR_RULE_CONTENT
85
+ );
86
+ console.log(" + .cursor/rules/sdlc-workflow.mdc");
87
+ }
88
+
89
+ async function generateFromInline(cwd) {
90
+ const base = join(cwd, "docs", "sdlc");
91
+ const dirs = [
92
+ base,
93
+ join(base, "po"),
94
+ join(base, "ba", "business"),
95
+ join(base, "ba", "technical"),
96
+ join(base, "architecture"),
97
+ join(base, "qe"),
98
+ ];
99
+
100
+ for (const d of dirs) {
101
+ await mkdir(d, { recursive: true });
102
+ }
103
+
104
+ const files = [
105
+ ["SDLC-WORKFLOW.md", SDLC_WORKFLOW_MD],
106
+ ["reference.md", REFERENCE_MD],
107
+ ["po/epic-brief.template.md", PO_EPIC_TEMPLATE],
108
+ ["po/README.md", PO_README],
109
+ ["ba/business/functional-requirement.template.md", BA_FR_TEMPLATE],
110
+ ["ba/business/README.md", BA_BUSINESS_README],
111
+ ["ba/technical/api-spec.template.md", TECH_API_TEMPLATE],
112
+ ["ba/technical/team-breakdown.template.md", TECH_TEAM_TEMPLATE],
113
+ ["ba/technical/README.md", BA_TECH_README],
114
+ ["architecture/adr.template.md", ARCH_ADR_TEMPLATE],
115
+ ["architecture/README.md", ARCH_README],
116
+ ["qe/test-case.template.md", QE_TC_TEMPLATE],
117
+ ["qe/README.md", QE_README],
118
+ ];
119
+
120
+ for (const [rel, content] of files) {
121
+ const path = join(base, rel);
122
+ await writeFile(path, content, "utf8");
123
+ console.log(" + docs/sdlc/" + rel);
124
+ }
125
+ }
126
+
127
+ const CURSOR_RULE_CONTENT = `---
128
+ description: SDLC multi-role workflow (PO → BA → Architect → Tech BA → Dev → QE)
129
+ alwaysApply: false
130
+ globs: docs/sdlc/**/*, **/*.md
131
+ ---
132
+
133
+ # SDLC Workflow
134
+
135
+ When working on requirements or docs, follow the SDLC phases:
136
+
137
+ 1. **PO** — PRD, user stories → docs/sdlc/po/
138
+ 2. **Business BA** — FRS, process flows → docs/sdlc/ba/business/
139
+ 3. **Architect** — ADRs, diagrams → docs/sdlc/architecture/
140
+ 4. **Technical BA** — API specs, team breakdown → docs/sdlc/ba/technical/
141
+ 5. **Dev Teams** — Implementation
142
+ 6. **QE** — Test plan, test cases → docs/sdlc/qe/
143
+
144
+ Full workflow: docs/sdlc/SDLC-WORKFLOW.md
145
+ `;
146
+
147
+ const CURSOR_SKILL_MD = `---
148
+ name: sdlc-workflow
149
+ description: Multi-role SDLC workflow from user requirements through PO, Business BA, Architect, Technical BA, Dev teams, and QE. Use when user mentions SDLC, requirements, PO, BA, Architect, technical spec, phased development, yêu cầu, phân rã, kiến trúc, or handoff between roles.
150
+ ---
151
+
152
+ # SDLC Workflow (Multi-Role)
153
+
154
+ Sequential workflow for approaching user requirements. Each phase produces docs/artifacts for the next. Apply when clarifying scope, breaking down features, or handing off between roles.
155
+
156
+ ## Flow Overview
157
+
158
+ \`\`\`
159
+ User Request → PO → Business BA → Architect → Technical BA → Dev Teams → QE → Deploy
160
+ \`\`\`
161
+
162
+ **Determine current phase** before acting. If unsure, ask: "Which phase are we in?"
163
+
164
+ ---
165
+
166
+ ## Phase 0: User Request / Discovery
167
+
168
+ **Trigger**: New feature request, bug report, or requirement from stakeholder.
169
+ **Output**: Initial request logged, ready for PO.
170
+
171
+ ## Phase 1: PO (Product Owner)
172
+
173
+ **Role**: Prioritize, clarify business value, create product docs.
174
+ **Deliverables**: Epic/Feature brief, user stories, acceptance criteria, priority, dependencies.
175
+ **Output**: \`docs/sdlc/po/\` — **Handoff to Business BA.**
176
+
177
+ ## Phase 2: Business BA (Business Analyst)
178
+
179
+ **Role**: Break down from business perspective.
180
+ **Deliverables**: Business process flows, functional requirements, use cases, glossary.
181
+ **Output**: \`docs/sdlc/ba/business/\` — **Handoff to Architect.**
182
+
183
+ ## Phase 3: Architect
184
+
185
+ **Role**: Design system architecture and technology choices.
186
+ **Deliverables**: System context, container diagram, ADRs, tech stack, cross-cutting concerns.
187
+ **Output**: \`docs/sdlc/architecture/\` — **Handoff to Technical BA.**
188
+
189
+ ## Phase 4: Technical BA
190
+
191
+ **Role**: Translate business + architecture into implementable specs.
192
+ **Deliverables**: API specs, DB schema, team breakdown, acceptance criteria per ticket.
193
+ **Output**: \`docs/sdlc/ba/technical/\` — **Handoff to Dev Teams.**
194
+
195
+ ## Phase 5: Dev Teams
196
+
197
+ **Role**: Implement. Backend | Frontend | Mobile | Data / DevOps.
198
+ **Output**: Code + tests. **Handoff to QE.**
199
+
200
+ ## Phase 6: QE (Quality Engineering)
201
+
202
+ **Role**: Test against acceptance criteria; ensure quality.
203
+ **Deliverables**: Test plan, test cases, sign-off.
204
+ **Output**: Test report. **Handoff to Deploy.**
205
+
206
+ ## Phase 7: Deploy & Maintenance
207
+
208
+ **Role**: Release, monitor, iterate.
209
+
210
+ ## Quick Phase Checklist
211
+
212
+ | Phase | Role | Key Output |
213
+ |-------|------|------------|
214
+ | 0 | Discovery | Raw request |
215
+ | 1 | PO | PRD, user stories |
216
+ | 2 | Business BA | FRS, process flows |
217
+ | 3 | Architect | ADRs, system diagrams |
218
+ | 4 | Technical BA | API specs, tech breakdown |
219
+ | 5 | Dev Teams | Code, tests |
220
+ | 6 | QE | Test plan, sign-off |
221
+ | 7 | Ops | Deploy, monitor |
222
+
223
+ See reference.md for templates.
224
+ `;
225
+
226
+ const CURSOR_REFERENCE_MD = `# SDLC Workflow — Reference
227
+
228
+ ## PO: Epic Brief Template
229
+ # Epic: [Name]
230
+ ## Problem / Success Metrics / User Stories / Acceptance Criteria / Priority
231
+
232
+ ## Business BA: Functional Requirement
233
+ FR-001: [Title] — Description, Trigger, Process Flow, Output, Constraints
234
+
235
+ ## Architect: ADR Template
236
+ # ADR-001: [Title] — Status, Context, Decision, Consequences
237
+
238
+ ## Technical BA: API Spec
239
+ POST /api/v1/[resource] — Purpose, Request, Response, Contract
240
+
241
+ ## QE: Test Case
242
+ TC-001: [Scenario] — Precondition, Steps, Expected, Links to AC
243
+ `;
244
+
245
+ const CLAUDE_SDLC_CONTENT = `## SDLC Workflow
246
+
247
+ When working on requirements, features, or handoffs, follow these phases:
248
+
249
+ 1. **PO** — PRD, user stories → docs/sdlc/po/
250
+ 2. **Business BA** — FRS, process flows → docs/sdlc/ba/business/
251
+ 3. **Architect** — ADRs, diagrams → docs/sdlc/architecture/
252
+ 4. **Technical BA** — API specs, team breakdown → docs/sdlc/ba/technical/
253
+ 5. **Dev Teams** — Implementation (Backend, Frontend, Mobile)
254
+ 6. **QE** — Test plan, test cases → docs/sdlc/qe/
255
+ 7. **Deploy** — Release, monitor
256
+
257
+ Flow: User Request → PO → Business BA → Architect → Technical BA → Dev Teams → QE → Deploy
258
+ Ask "Which phase are we in?" if unclear.
259
+ `;
260
+
261
+ const SDLC_WORKFLOW_MD = `# SDLC Workflow (Multi-Role)
262
+
263
+ Use this doc with **Claude** (copy to Custom Instructions / Projects) or **@ mention** in chat.
264
+ For Cursor, see .cursor/rules/sdlc-workflow.mdc
265
+
266
+ ## Flow
267
+
268
+ \`\`\`
269
+ User Request → PO → Business BA → Architect → Technical BA → Dev Teams → QE → Deploy
270
+ \`\`\`
271
+
272
+ ## Phase Checklist
273
+
274
+ | Phase | Role | Key Output |
275
+ |-------|------|------------|
276
+ | 0 | Discovery | Raw request |
277
+ | 1 | PO | PRD, user stories |
278
+ | 2 | Business BA | FRS, process flows |
279
+ | 3 | Architect | ADRs, system diagrams |
280
+ | 4 | Technical BA | API specs, tech breakdown |
281
+ | 5 | Dev Teams | Code, tests |
282
+ | 6 | QE | Test plan, sign-off |
283
+ | 7 | Ops | Deploy, monitor |
284
+
285
+ ## Phase Details
286
+
287
+ ### Phase 1: PO
288
+ - Epic brief, user stories, acceptance criteria
289
+ - Output: \`docs/sdlc/po/\`
290
+
291
+ ### Phase 2: Business BA
292
+ - Functional requirements, process flows, use cases
293
+ - Output: \`docs/sdlc/ba/business/\`
294
+
295
+ ### Phase 3: Architect
296
+ - System context, container diagram, ADRs, tech stack
297
+ - Output: \`docs/sdlc/architecture/\`
298
+
299
+ ### Phase 4: Technical BA
300
+ - API specs, DB schema, team breakdown
301
+ - Output: \`docs/sdlc/ba/technical/\`
302
+
303
+ ### Phase 5: Dev Teams
304
+ - Backend, Frontend, Mobile — implement per spec
305
+
306
+ ### Phase 6: QE
307
+ - Test plan, test cases, sign-off
308
+ - Output: \`docs/sdlc/qe/\`
309
+
310
+ See [reference.md](./reference.md) for templates.
311
+ `;
312
+
313
+ const REFERENCE_MD = `# SDLC Workflow — Reference
314
+
315
+ Templates and examples. Use \`*.template.md\` as starting points.
316
+ `;
317
+
318
+ const PO_EPIC_TEMPLATE = `# Epic: [Name]
319
+
320
+ ## Problem
321
+ [What problem are we solving?]
322
+
323
+ ## Success Metrics
324
+ - [Metric 1]
325
+ - [Metric 2]
326
+
327
+ ## User Stories
328
+ 1. As [persona], I want [action] so that [benefit].
329
+ 2. ...
330
+
331
+ ## Acceptance Criteria (High-level)
332
+ - [ ] Criterion 1
333
+ - [ ] Criterion 2
334
+
335
+ ## Priority
336
+ Must have / Should have / Could have
337
+
338
+ ## Dependencies & Risks
339
+ - ...
340
+ `;
341
+
342
+ const PO_README = `# PO (Product Owner)
343
+
344
+ Create PRD, epic briefs, user stories here.
345
+ Use epic-brief.template.md as starting point.
346
+ `;
347
+
348
+ const BA_FR_TEMPLATE = `## FR-001: [Title]
349
+
350
+ **Description**: [What the system must do]
351
+
352
+ **Trigger**: [When does this apply?]
353
+
354
+ **Process Flow**:
355
+ 1. Step 1
356
+ 2. Step 2
357
+ 3. Step 3
358
+
359
+ **Output**: [Result]
360
+
361
+ **Constraints**: [Compliance, SLA, etc.]
362
+ `;
363
+
364
+ const BA_BUSINESS_README = `# Business BA
365
+
366
+ Functional requirements, process flows, use cases.
367
+ Use functional-requirement.template.md for FRS items.
368
+ `;
369
+
370
+ const TECH_API_TEMPLATE = `## POST /api/v1/[resource]
371
+
372
+ **Purpose**: [One-line]
373
+
374
+ **Request**:
375
+ - Body: JSON schema
376
+ - Headers: Auth, Content-Type
377
+
378
+ **Response**:
379
+ - 200: Success payload
380
+ - 4xx/5xx: Error format
381
+
382
+ **Contract**: See OpenAPI spec
383
+ `;
384
+
385
+ const TECH_TEAM_TEMPLATE = `| Team | Scope | Dependencies |
386
+ |---------|--------------------------|------------------------|
387
+ | Backend | API, DB, business logic | Technical spec |
388
+ | Frontend| UI, API integration | API contract |
389
+ | Mobile | App UI, API integration | API contract |
390
+ `;
391
+
392
+ const BA_TECH_README = `# Technical BA
393
+
394
+ API specs, DB schema, team breakdown.
395
+ Use templates as starting points.
396
+ `;
397
+
398
+ const ARCH_ADR_TEMPLATE = `# ADR-001: [Decision Title]
399
+
400
+ ## Status
401
+ Accepted
402
+
403
+ ## Context
404
+ [Why we need this decision]
405
+
406
+ ## Decision
407
+ [What we decided]
408
+
409
+ ## Consequences
410
+ - Positive: ...
411
+ - Negative: ...
412
+ `;
413
+
414
+ const ARCH_README = `# Architecture
415
+
416
+ ADRs, system diagrams, tech stack decisions.
417
+ Use adr.template.md for new ADRs.
418
+ `;
419
+
420
+ const QE_TC_TEMPLATE = `## TC-001: [Scenario]
421
+
422
+ **Precondition**: [State before test]
423
+
424
+ **Steps**:
425
+ 1. Action 1
426
+ 2. Action 2
427
+ 3. Action 3
428
+
429
+ **Expected**: [Expected result]
430
+
431
+ **Links to**: AC-001, Story #42
432
+ `;
433
+
434
+ const QE_README = `# QE (Quality Engineering)
435
+
436
+ Test plan, test cases, sign-off checklist.
437
+ Use test-case.template.md for test cases.
438
+ `;
439
+
440
+ main();
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "sdlc-workflow",
3
+ "version": "1.0.0",
4
+ "description": "Scaffold SDLC workflow docs and templates for Cursor, Claude, and dev teams",
5
+ "type": "module",
6
+ "bin": {
7
+ "sdlc-workflow": "./bin/cli.js"
8
+ },
9
+ "keywords": [
10
+ "sdlc",
11
+ "workflow",
12
+ "scaffold",
13
+ "cursor",
14
+ "claude",
15
+ "po",
16
+ "ba",
17
+ "architecture"
18
+ ],
19
+ "author": "",
20
+ "license": "MIT",
21
+ "files": [
22
+ "bin"
23
+ ],
24
+ "engines": {
25
+ "node": ">=18"
26
+ }
27
+ }