System Analysis and Design
A skill that produces a complete, exam-quality System Requirements Specification + system-design document from a project idea, delivered as Markdown and PDF with properly rendered diagrams.
Also: Evaluates existing codebases against computer science and mathematics principles using the PAOS Code Audit Framework v2.0. This is a separate workflow from SRS generation — see the reference file for the full three-phase process (coding principles benchmark → gaps/implementation plans → SWOT analysis).
Code Audit Workflow (v2.0 — Strict Evidence-Based)
The Three-Phase Assessment
Phase 1: Coding Principles Benchmark → Phase 2: Gaps + Implementation Plans → Phase 3: SWOT Analysis
Phase 1 — Run the Benchmark
Use the canonical benchmark at ~/AI_Workflow/Coding-Principles-Benchmark.md (v2.0). Key rules:
- Every question scored 0/1/2 with file:line evidence. No evidence = score 0.
- 110 questions across 13 categories (OOP, Data Structures, Graph Theory, Linear Algebra, Digital Logic, Numerical Analysis, System Analysis, Database, Calculus, UX/UI, Security, API Endpoints, Code Quality).
- Raw max is 220. Normalize to 100:
round(raw / 220 * 100).
- Grade thresholds: A ≥ 90, B ≥ 75, C ≥ 50, D ≥ 25, F < 25.
- Auto-grade penalty: Any ★ question scored 0 drops the grade one letter.
- Floor rule: 89 is B, not A. No rounding.
- Weight tiers: Heavy (48%: OOP, DS, Sys Analysis, Dig Logic, Security), Medium (25%: Code Quality, API, Database), Moderate (18%: UX/UI, Linear Algebra), Supporting (9%: Graph Theory, Calculus, Num Analysis).
Phase 2 — Gaps & Implementation Plans
For every question scored < 2, the auditor MUST:
- Document the gap with file:line evidence
- Create an individual gap file at
benchmarks/Benchmark_N_{date}/gaps/gap-{NN}-{title}.md
- Create a combined gaps file at
gaps.md (not gaps/index.md)
- Create an implementation spec at
implementation.md with concrete code per gap
- Create an implementation plan at
implementation-plan.md with 4 phases (Security, Data Integrity, Code Quality, API & Analytics)
- Generate SRS files using this skill (system-analysis-and-design):
SRS-as-is.md — current state requirements
SRS-to-be.md — target state with all gaps closed
- Send all files to Telegram — SRS-as-is.md, SRS-to-be.md, gaps.md, implementation.md, implementation-plan.md
Each gap file must contain:
- Source question number and category
- Severity (Critical / High / Medium)
- Score and evidence
- The Fix (concrete code steps)
- Files to modify
- Acceptance criteria
- Estimated effort
- Status line (
⏳ Pending / 🔄 In Progress / ✅ Fixed / 🚫 Won't Fix)
CRITICAL RULE — NEVER AUTO-EXECUTE:
🚫 The auditor must NOT execute any implementation plan, start any work
described in a gap, fix any code found during the audit, or trigger
dependents of any gap.
✅ ONLY the user can trigger work by saying:
"work on gap {N}"
"work on implementation plan benchmark-gap-{N}"
"implement benchmark-gap-{N}"
(These only trigger code changes — the pipeline is still created in builder for user to edit/run)
Gap→Pipeline conversion: Only create a pipeline for a gap when the user explicitly says "create pipeline for gap {N}". The pipeline opens in the builder with pre-filled prompts referencing SRS-to-be.md, gaps.md, implementation.md, and the individual gap file. Small gaps (5–10 min) show an alert with the direct fix instead.
Benchmark directory structure:
benchmarks/
└── Benchmark_{N}_{DD-MM-YYYY}---{HH-MM}/
├── README.md # Overview + scores + tier breakdown
├── full-audit.md # Complete audit report
├── SRS-as-is.md # Current state (via system-analysis-and-design)
├── SRS-to-be.md # Target state (via system-analysis-and-design)
├── gaps.md # ALL gaps combined (auto-removes Won't Fix)
├── implementation.md # Full implementation spec with code
├── implementation-plan.md # Prioritized fix plan
└── gaps/
├── gap-01-{title}.md # Individual gap
└── ...
Kanban status tracking (4 columns):
- Pending ↔ Won't Fix — click to toggle manually. Won't Fix gaps are auto-removed from gaps.md and implementation.md.
- In Progress — set by pipeline execution, not clickable in UI.
- Fixed — set by pipeline execution, not clickable in UI.
- The dashboard at
/benchmarks shows gaps in a 4-column Kanban board. The FileTreeExplorer in the flow builder shows benchmark files (SRS-as-is.md, SRS-to-be.md, gaps.md, implementation.md, per-gap files) when benchmarkId is provided.
Benchmark files in flow builder: When a benchmark is selected, the ConfigPanel's file tree shows a purple "Benchmark Files" section listing SRS-as-is.md, SRS-to-be.md, gaps.md, implementation.md, full-audit.md, and per-gap files. These can be toggled as file references for agent prompts.
Phase 3 — SWOT Analysis
Use ~/AI_Workflow/SWOT-Benchmark.md to evaluate the project as an investment. Score Strengths, Weaknesses, Opportunities, Threats across 31 sub-questions. Produce a Buy/Hold/Sell recommendation with a SWOT matrix.
What This Skill Produces
- One SRS document in Markdown and PDF
- 14 sections: Introduction, Literature Review, SWOT/PESTLE, Planning, Methodology, Requirements (FR + NFR), Process & Data Modelling, System Design, UML Diagrams, MVP Design, Testing, Deployment, Maintenance, References
- All UML diagram types: Use Case, Class, Object, Component, Deployment, Package, Activity, State Machine, Sequence, Communication, Interaction Overview, Timing, plus ERD, DFD levels 0 and 1, and Context Diagrams for both MVP and Scalable
- MVP-first, then Scalable — two tiers clearly separated
- Database schema + API endpoints as structured tables
- Requirements Traceability Matrix mapping every FR to test cases
- Design Rationale subsection explaining key trade-offs
The Non-Negotiable Core Workflow
Follow these steps in order. Do not skip the elicitation phase — an SRS written on assumptions rather than elicited facts is generic and unusable.
Step 1 — Read the References
Before doing anything else, consult:
references/srs-template.md — the canonical section-by-section template. Every deliverable follows this structure.
references/elicitation-workflow.md — the full interview flow, including which questions are critical vs nice-to-have.
references/diagram-cookbook.md — correct Mermaid syntax for every diagram type, plus the workarounds for the known rendering pitfalls (use-case diagrams with ((circles)) span multiple pages; ER diagrams break on PK_FK; labeled dotted arrows break on + characters; etc.).
references/pdf-build-guide.md — exact pandoc + xelatex + mermaid-cli command sequence.
Step 2 — Elicit the Project
Never start writing the SRS before completing elicitation. The user's initial brief will always be incomplete. Use the assets/elicitation-survey.md as the interview checklist. Resolve every Critical question before proceeding. For Important questions, offer defaults but get explicit sign-off. Surface the answers back to the user as a master checklist before committing to writing.
Pedagogical elicitation principle: when a user's answer reveals a misconception (e.g., they think OAuth requires a backend when it doesn't), explain the correct model with an analogy, confirm their understanding, and only then lock the decision in. The SRS is defensible only if the user can explain their own design choices.
Step 3 — Draft the SRS
Follow references/srs-template.md section by section. Fill every section. Do not skip. For each section, keep academic formal register; use "shall" for binding requirements; use tables for structured data; keep prose tight.
Step 4 — Render Diagrams
Use Mermaid for every diagram except use-case diagrams. For use-case diagrams, use the hand-crafted SVG template in assets/usecase-template.svg to avoid the known Mermaid pitfall where ((circles)) produce page-spanning output.
After embedding Mermaid blocks in the Markdown, extract them to diagrams/fig_NN.mmd files, render each to PNG via mmdc with -w 1600, check aspect ratios — any diagram with h/w > 1.5 must be rewritten horizontally (change TD/TB to LR). This check is not optional. Diagrams taller than 1.5× their width will span pages in the final PDF.
Step 5 — Build the PDF
Run pandoc with --pdf-engine=xelatex. Do NOT use --number-sections if section headings already contain numbers in the source — it duplicates them ("3.3 3.3 Lead Management"). Use  not  to suppress duplicate figure captions.
Step 6 — Present
Save both the .md and .pdf to the outputs folder. Present both files to the user via present_files.
Scope Discipline
An MVP SRS and a scalable SRS are different documents with different audiences. This skill produces one combined document with MVP and Scalable clearly separated per section. Requirements are tagged (MVP) or (Scalable) in the functional-requirements tables. Architecture has MVP and Scalable subsections. Evolution plan lays out Phase A → B → C.
Common Mistakes to Avoid
- Inventing facts about the user's project. If the brief doesn't specify a detail, elicit it — do not invent.
- Merging Activity Diagram and Flowchart. These are distinct diagrams with distinct roles. Activity diagram = happy-path swimlane flow. Flowchart = exhaustive decision-tree with a diamond for every
if.
- Using
flowchart LR for use-case diagrams. This produces unusable output. Use the SVG template instead.
- Forgetting the design rationale section. Examiners ask "why?" for every non-obvious choice. If the rationale isn't in the document, the student cannot defend it.
- Skipping the traceability matrix. FR → test-case mapping is the difference between "has tests" and "has verifiable tests."
- Copy-pasting a generic SRS. The document is only valuable if every section reflects this project's decisions. Repetition and vague prose are telltales of generic content.
- Auto-executing benchmark implementation plans. NEVER implement, start, or fix anything from a benchmark gap unless the user explicitly says "work on gap N". Rule is also in memory.
- Forgetting the canonical benchmark files. The authoritative documents are at
~/AI_Workflow/Coding-Principles.md, ~/AI_Workflow/Coding-Principles-Benchmark.md, and ~/AI_Workflow/SWOT-Benchmark.md. Read these directly instead of relying on stale references.
Quick Start for Urgent Tasks
If the user says "just do it" and declines elicitation, follow this fallback:
- Use sensible defaults for every Important question.
- Flag every assumption in a "Design Assumptions" appendix.
- Tell the user explicitly which assumptions they must review.
This path produces a lower-quality SRS but unblocks the user. Prefer full elicitation whenever possible.
Output Format Checklist
Before presenting the final deliverables:
1---2name: system-analysis-and-design3description: Generate a complete, academic-grade System Requirements Specification (SRS) and system-design document from a project idea, AND evaluate an existing codebase against computer science principles using strict evidence-based benchmarking. Use this skill whenever the user asks for an SRS, software requirements document, system design document, UML diagrams, code audit, code benchmark, quality grading, SWOT analysis of a software project, or anything resembling "design this system for me," "write an SRS," "audit this codebase," "benchmark the code," "grade the project," or "run the benchmark." Also triggers on "coding principles," "strict audit," "gaps report," "gaps kanban," "implementation plan," and "SWOT benchmark" in the context of evaluating code quality.4---56# System Analysis and Design78A skill that produces a complete, exam-quality System Requirements Specification + system-design document from a project idea, delivered as Markdown and PDF with properly rendered diagrams.910**Also:** Evaluates existing codebases against computer science and mathematics principles using the PAOS Code Audit Framework v2.0. This is a separate workflow from SRS generation — see the reference file for the full three-phase process (coding principles benchmark → gaps/implementation plans → SWOT analysis).1112## Code Audit Workflow (v2.0 — Strict Evidence-Based)1314### The Three-Phase Assessment1516```17Phase 1: Coding Principles Benchmark → Phase 2: Gaps + Implementation Plans → Phase 3: SWOT Analysis18```1920### Phase 1 — Run the Benchmark2122Use the canonical benchmark at `~/AI_Workflow/Coding-Principles-Benchmark.md` (v2.0). Key rules:2324- **Every question scored 0/1/2 with file:line evidence.** No evidence = score 0.25- **110 questions across 13 categories** (OOP, Data Structures, Graph Theory, Linear Algebra, Digital Logic, Numerical Analysis, System Analysis, Database, Calculus, UX/UI, Security, API Endpoints, Code Quality).26- **Raw max is 220.** Normalize to 100: `round(raw / 220 * 100)`.27- **Grade thresholds:** A ≥ 90, B ≥ 75, C ≥ 50, D ≥ 25, F < 25.28- **Auto-grade penalty:** Any ★ question scored 0 drops the grade one letter.29- **Floor rule:** 89 is B, not A. No rounding.30- **Weight tiers:** Heavy (48%: OOP, DS, Sys Analysis, Dig Logic, Security), Medium (25%: Code Quality, API, Database), Moderate (18%: UX/UI, Linear Algebra), Supporting (9%: Graph Theory, Calculus, Num Analysis).3132### Phase 2 — Gaps & Implementation Plans3334For every question scored < 2, the auditor MUST:35361. **Document the gap** with file:line evidence372. **Create an individual gap file** at `benchmarks/Benchmark_N_{date}/gaps/gap-{NN}-{title}.md`383. **Create a combined gaps file** at `gaps.md` (not `gaps/index.md`)394. **Create an implementation spec** at `implementation.md` with concrete code per gap405. **Create an implementation plan** at `implementation-plan.md` with 4 phases (Security, Data Integrity, Code Quality, API & Analytics)416. **Generate SRS files** using this skill (system-analysis-and-design):42 - `SRS-as-is.md` — current state requirements43 - `SRS-to-be.md` — target state with all gaps closed447. **Send all files to Telegram** — SRS-as-is.md, SRS-to-be.md, gaps.md, implementation.md, implementation-plan.md4546Each gap file must contain:47- Source question number and category48- Severity (Critical / High / Medium)49- Score and evidence50- The Fix (concrete code steps)51- Files to modify52- Acceptance criteria53- Estimated effort54- Status line (`⏳ Pending` / `🔄 In Progress` / `✅ Fixed` / `🚫 Won't Fix`)5556**CRITICAL RULE — NEVER AUTO-EXECUTE:**57```58🚫 The auditor must NOT execute any implementation plan, start any work59 described in a gap, fix any code found during the audit, or trigger60 dependents of any gap.61✅ ONLY the user can trigger work by saying:62 "work on gap {N}"63 "work on implementation plan benchmark-gap-{N}"64 "implement benchmark-gap-{N}"65 (These only trigger code changes — the pipeline is still created in builder for user to edit/run)66```6768**Gap→Pipeline conversion:** Only create a pipeline for a gap when the user explicitly says "create pipeline for gap {N}". The pipeline opens in the builder with pre-filled prompts referencing SRS-to-be.md, gaps.md, implementation.md, and the individual gap file. Small gaps (5–10 min) show an alert with the direct fix instead.6970**Benchmark directory structure:**71```72benchmarks/73└── Benchmark_{N}_{DD-MM-YYYY}---{HH-MM}/74 ├── README.md # Overview + scores + tier breakdown75 ├── full-audit.md # Complete audit report76 ├── SRS-as-is.md # Current state (via system-analysis-and-design)77 ├── SRS-to-be.md # Target state (via system-analysis-and-design)78 ├── gaps.md # ALL gaps combined (auto-removes Won't Fix)79 ├── implementation.md # Full implementation spec with code80 ├── implementation-plan.md # Prioritized fix plan81 └── gaps/82 ├── gap-01-{title}.md # Individual gap83 └── ...84```8586**Kanban status tracking (4 columns):**87- **Pending** ↔ **Won't Fix** — click to toggle manually. Won't Fix gaps are auto-removed from gaps.md and implementation.md.88- **In Progress** — set by pipeline execution, not clickable in UI.89- **Fixed** — set by pipeline execution, not clickable in UI.90- The dashboard at `/benchmarks` shows gaps in a 4-column Kanban board. The FileTreeExplorer in the flow builder shows benchmark files (SRS-as-is.md, SRS-to-be.md, gaps.md, implementation.md, per-gap files) when benchmarkId is provided.9192**Benchmark files in flow builder:** When a benchmark is selected, the ConfigPanel's file tree shows a purple "Benchmark Files" section listing SRS-as-is.md, SRS-to-be.md, gaps.md, implementation.md, full-audit.md, and per-gap files. These can be toggled as file references for agent prompts.9394### Phase 3 — SWOT Analysis9596Use `~/AI_Workflow/SWOT-Benchmark.md` to evaluate the project as an investment. Score Strengths, Weaknesses, Opportunities, Threats across 31 sub-questions. Produce a Buy/Hold/Sell recommendation with a SWOT matrix.9798## What This Skill Produces99100- **One SRS document** in Markdown and PDF101- **14 sections**: Introduction, Literature Review, SWOT/PESTLE, Planning, Methodology, Requirements (FR + NFR), Process & Data Modelling, System Design, UML Diagrams, MVP Design, Testing, Deployment, Maintenance, References102- **All UML diagram types**: Use Case, Class, Object, Component, Deployment, Package, Activity, State Machine, Sequence, Communication, Interaction Overview, Timing, plus ERD, DFD levels 0 and 1, and Context Diagrams for both MVP and Scalable103- **MVP-first, then Scalable** — two tiers clearly separated104- **Database schema + API endpoints** as structured tables105- **Requirements Traceability Matrix** mapping every FR to test cases106- **Design Rationale subsection** explaining key trade-offs107108## The Non-Negotiable Core Workflow109110Follow these steps in order. Do not skip the elicitation phase — an SRS written on assumptions rather than elicited facts is generic and unusable.111112### Step 1 — Read the References113114Before doing anything else, consult:1151161. `references/srs-template.md` — the canonical section-by-section template. Every deliverable follows this structure.1172. `references/elicitation-workflow.md` — the full interview flow, including which questions are critical vs nice-to-have.1183. `references/diagram-cookbook.md` — correct Mermaid syntax for every diagram type, plus the workarounds for the known rendering pitfalls (use-case diagrams with `((circles))` span multiple pages; ER diagrams break on `PK_FK`; labeled dotted arrows break on `+` characters; etc.).1194. `references/pdf-build-guide.md` — exact pandoc + xelatex + mermaid-cli command sequence.120121### Step 2 — Elicit the Project122123Never start writing the SRS before completing elicitation. The user's initial brief will always be incomplete. Use the `assets/elicitation-survey.md` as the interview checklist. Resolve every **Critical** question before proceeding. For **Important** questions, offer defaults but get explicit sign-off. Surface the answers back to the user as a master checklist before committing to writing.124125Pedagogical elicitation principle: when a user's answer reveals a misconception (e.g., they think OAuth requires a backend when it doesn't), explain the correct model with an analogy, confirm their understanding, and only then lock the decision in. The SRS is defensible only if the user can explain their own design choices.126127### Step 3 — Draft the SRS128129Follow `references/srs-template.md` section by section. Fill every section. Do not skip. For each section, keep academic formal register; use "shall" for binding requirements; use tables for structured data; keep prose tight.130131### Step 4 — Render Diagrams132133Use Mermaid for every diagram except use-case diagrams. For use-case diagrams, use the hand-crafted SVG template in `assets/usecase-template.svg` to avoid the known Mermaid pitfall where `((circles))` produce page-spanning output.134135After embedding Mermaid blocks in the Markdown, extract them to `diagrams/fig_NN.mmd` files, render each to PNG via `mmdc` with `-w 1600`, check aspect ratios — any diagram with h/w > 1.5 must be rewritten horizontally (change `TD`/`TB` to `LR`). This check is not optional. Diagrams taller than 1.5× their width will span pages in the final PDF.136137### Step 5 — Build the PDF138139Run `pandoc` with `--pdf-engine=xelatex`. Do NOT use `--number-sections` if section headings already contain numbers in the source — it duplicates them ("3.3 3.3 Lead Management"). Use `` not `` to suppress duplicate figure captions.140141### Step 6 — Present142143Save both the `.md` and `.pdf` to the outputs folder. Present both files to the user via `present_files`.144145## Scope Discipline146147An MVP SRS and a scalable SRS are different documents with different audiences. This skill produces **one combined document** with MVP and Scalable clearly separated per section. Requirements are tagged `(MVP)` or `(Scalable)` in the functional-requirements tables. Architecture has MVP and Scalable subsections. Evolution plan lays out Phase A → B → C.148149## Common Mistakes to Avoid150151- **Inventing facts about the user's project.** If the brief doesn't specify a detail, elicit it — do not invent.152- **Merging Activity Diagram and Flowchart.** These are distinct diagrams with distinct roles. Activity diagram = happy-path swimlane flow. Flowchart = exhaustive decision-tree with a diamond for every `if`.153- **Using `flowchart LR` for use-case diagrams.** This produces unusable output. Use the SVG template instead.154- **Forgetting the design rationale section.** Examiners ask "why?" for every non-obvious choice. If the rationale isn't in the document, the student cannot defend it.155- **Skipping the traceability matrix.** FR → test-case mapping is the difference between "has tests" and "has verifiable tests."156- **Copy-pasting a generic SRS.** The document is only valuable if every section reflects *this* project's decisions. Repetition and vague prose are telltales of generic content.157- **Auto-executing benchmark implementation plans.** NEVER implement, start, or fix anything from a benchmark gap unless the user explicitly says "work on gap N". Rule is also in memory.158- **Forgetting the canonical benchmark files.** The authoritative documents are at `~/AI_Workflow/Coding-Principles.md`, `~/AI_Workflow/Coding-Principles-Benchmark.md`, and `~/AI_Workflow/SWOT-Benchmark.md`. Read these directly instead of relying on stale references.159160## Quick Start for Urgent Tasks161162If the user says "just do it" and declines elicitation, follow this fallback:1631. Use sensible defaults for every Important question.1642. Flag every assumption in a "Design Assumptions" appendix.1653. Tell the user explicitly which assumptions they must review.166167This path produces a lower-quality SRS but unblocks the user. Prefer full elicitation whenever possible.168169## Output Format Checklist170171Before presenting the final deliverables:172173- [ ] All 14 sections present174- [ ] Every functional requirement tagged `(MVP)` or `(Scalable)`175- [ ] Use-case diagrams rendered as proper UML (stick-figure actor, system boundary, ellipse use cases)176- [ ] No diagram spans more than one page in the PDF177- [ ] Requirements Traceability Matrix present178- [ ] Design Rationale subsection present with at least 3 trade-off explanations179- [ ] References section includes all SDKs, frameworks, and RFCs actually mentioned in the body180- [ ] PDF opens cleanly (no LaTeX errors)181- [ ] Markdown source opens cleanly (no broken Mermaid syntax)