Skip to content

Commit d033bd3

Browse files
Oleksandr123234SergK
authored andcommitted
feat: Add create-diagram task (#521)
1 parent f21fb13 commit d033bd3

File tree

2 files changed

+156
-0
lines changed

2 files changed

+156
-0
lines changed

.krci-ai/agents/tw.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,12 @@ agent:
2929
doc-review: "Review and improve documentation pages"
3030
doc-build: "Run the documentation build process and spell check"
3131
doc-design: "Guide the user on how to contribute to KubeRocketCI documentation"
32+
create-diagram: "Create a diagram for the documentation page"
3233
exit: "Exit Technical Writer persona and return to normal mode"
3334

3435
tasks:
3536
- ./.krci-ai/tasks/doc-review.md
3637
- ./.krci-ai/tasks/doc-build.md
3738
- ./.krci-ai/tasks/doc-design.md
39+
- ./.krci-ai/tasks/create-diagram.md
40+

.krci-ai/tasks/create-diagram.md

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
---
2+
dependencies:
3+
data:
4+
mcp_servers:
5+
---
6+
7+
# Task: Documentation Diagram Design
8+
9+
## Description
10+
11+
This task helps users create clear and consistent diagrams for KubeRocketCI documentation using Mermaid syntax.
12+
13+
The goal of this task is to transform a user-provided algorithm, workflow, or interaction description into a Mermaid diagram that can be embedded directly into Markdown documentation.
14+
15+
The task focuses on visualizing:
16+
17+
- component interactions,
18+
- system logic and control flow,
19+
- step-by-step algorithms and workflows.
20+
21+
## Prerequisites
22+
23+
<prerequisites>
24+
- User has an algorithm, workflow, or logic description they want to visualize **or**
25+
- User knows where this logic is already described (documentation page, section, or code reference).
26+
- Mermaid configuration: The documentation system (Docusaurus, MkDocs, etc.) has Mermaid support enabled with required modules and configurations for the diagram type being created.
27+
</prerequisites>
28+
29+
## Instructions
30+
31+
<instructions>
32+
1. When the **"doc-diagram"** task is requested, ensure the user has provided:
33+
- an algorithm, workflow, or logic description **or**
34+
- a reference to where this logic is already documented. If not provided, ask the user to describe the logic in a step-by-step or structured form.
35+
36+
2. Check Mermaid configuration: Verify that the project's Mermaid configuration includes the required modules and settings for the diagram type you plan to create. Check configuration files (e.g., `docusaurus.config.js`, `mkdocs.yml`, or project-specific Mermaid config files). If modules or configurations are missing, update them accordingly. Common requirements include:
37+
- Enabling specific Mermaid diagram types (flowchart, sequenceDiagram, stateDiagram, etc.)
38+
- Configuring theme and styling options
39+
- Setting up security policies if needed
40+
- Ensuring proper initialization in the documentation framework
41+
42+
3. Show the user an example of the expected input format, such as:
43+
44+
CI/CD pipeline logic:
45+
1. Pipeline is triggered by an external event
46+
2. Application is built
47+
3. Code quality checks are executed (linters, scanners, tests)
48+
4. Application is deployed
49+
5. Application is promoted to the next environment
50+
51+
4. Analyze the provided logic and determine:
52+
- the most suitable Mermaid diagram type, for example:
53+
- flowchart — for algorithms and step-by-step processes
54+
- sequenceDiagram — for component interactions
55+
- stateDiagram — for lifecycle or state transitions
56+
- graph TD/LR — for high-level architecture
57+
- whether a single diagram is sufficient or the logic should be split into multiple diagrams.
58+
- required Mermaid modules and configurations for the selected diagram type
59+
60+
5. Build a Mermaid diagram that accurately reflects the provided logic, uses clear and meaningful node names, follows a readable layout direction (TD, LR, etc.), and avoids unnecessary visual complexity.
61+
6. Generate the diagram in pure Mermaid syntax, ready to be embedded into Markdown, for example:
62+
63+
```mermaid
64+
flowchart TD
65+
A[External Trigger] --> B[Build Application]
66+
B --> C[Quality Checks]
67+
C --> D[Deploy Application]
68+
D --> E[Promote to Next Environment]
69+
```
70+
71+
7. If the logic is ambiguous, incomplete, or overloaded, ask clarifying questions before generating the diagram, or propose assumptions explicitly and ask the user to confirm them.
72+
8. When relevant, recommend splitting the logic into sub-diagrams, adding diagram titles or comments, and placing the diagram in a specific documentation section or page.
73+
9. Verify configuration completeness: After generating the diagram, confirm that all required Mermaid modules and configurations are present in the project configuration files. If any are missing, update the configuration files to include them, ensuring the diagram will render correctly in the documentation system.
74+
</instructions>
75+
76+
## Output Format
77+
78+
As an output, you are expected to provide:
79+
80+
- A Mermaid diagram wrapped in a Markdown-compatible code block.
81+
- A short explanation of:
82+
- what the diagram represents,
83+
- why this Mermaid diagram type was chosen.
84+
- Optional improvement suggestions (if applicable), such as:
85+
- alternative diagram types,
86+
- additional diagrams for clarity,
87+
- alignment with existing documentation pages.
88+
89+
## Mermaid Diagram Guidelines
90+
91+
- Prefer simplicity over visual density.
92+
- Use descriptive node labels instead of internal abbreviations when possible.
93+
- Keep diagrams readable in documentation layouts (Docusaurus, MkDocs).
94+
- Do not include platform-specific styling unless explicitly requested.
95+
- Ensure the diagram can be rendered by standard Mermaid implementations.
96+
- Verify required modules: Different diagram types may require specific Mermaid modules to be enabled in the project configuration (e.g., `mermaid.flowchart`, `mermaid.sequence`, `mermaid.state`).
97+
- Check configuration files: Ensure the documentation framework's Mermaid configuration includes all necessary modules and settings for the diagram type being used.
98+
99+
## Framework Context: KubeRocketCI Documentation
100+
101+
Diagrams are primarily used to:
102+
103+
- explain CI/CD workflows and deployment flows,
104+
- visualize interactions between KubeRocketCI components and third-party tools,
105+
- support Use Cases and Guides with visual explanations.
106+
107+
Diagrams should complement the text and not replace step-by-step instructions entirely.
108+
109+
## Success Criteria
110+
111+
<success_criteria>
112+
- User-provided logic analyzed and understood
113+
- Appropriate Mermaid diagram type selected
114+
- Diagram accurately reflects the algorithm or interaction
115+
- Output is valid Mermaid syntax and Markdown-ready
116+
- Diagram improves understanding of the documented process
117+
- User receives clear next steps or improvement suggestions (if needed)
118+
</success_criteria>
119+
120+
## Execution Checklist
121+
122+
### Preparation Phase
123+
124+
<execution_phase>
125+
- User intent and diagram goal identified
126+
- Algorithm or logic description collected or referenced
127+
</execution_phase>
128+
129+
### Analysis Phase
130+
131+
<execution_phase>
132+
- Diagram type selected with justification
133+
- Diagram scope defined (single vs multiple diagrams)
134+
- Ambiguities identified and resolved or documented
135+
</execution_phase>
136+
137+
### Generation Phase
138+
139+
<execution_phase>
140+
- Mermaid diagram generated using best practices
141+
- Node naming and flow validated for clarity
142+
- Diagram wrapped in Markdown-compatible format
143+
- Required Mermaid modules and configurations verified and updated if missing
144+
</execution_phase>
145+
146+
### Validation Phase
147+
148+
<validation_phase>
149+
- Diagram ready for embedding into documentation
150+
- Mermaid configuration verified and complete for the diagram type
151+
- User informed about placement and possible extensions
152+
- Task completed with minimal iteration friction
153+
</validation_phase>

0 commit comments

Comments
 (0)