agentleFS
jabrenajabrena/cursor-rules-agile/.cursor/rules/2005-c4-diagrams-about-solution.mdc

cursor-rules-agile / rules

Cursor rule6 starsChanged 18 months agoApache-2.0Archived repositoryView on GitHub

Create C4 Diagrams from Agile Artifacts

The file

We split this 2005-c4-diagrams-about-solution.mdc into the rules it gives an agent

8 rules. About 0 are common, 7 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Start by acknowledging the request and gathering information about the source materials:

    line 15
  2. Very specific:

    Document Review: "I've reviewed the provided artifacts: [list document titles/names].

    line 19
  3. Distinctive:

    After generating all content, provide these additional recommendations:

    line 194
  4. Distinctive:

    Container Diagrams: - Use for architecture reviews, technical planning, and technology decisions

    line 198
  5. Distinctive:

    Update diagrams when new epics or features significantly change the architecture

    line 202
  6. Distinctive:

    Use diagrams to validate that user stories align with the intended architecture

    line 203
  7. Distinctive:

    Consider automated diagram generation from code annotations

    line 209
  8. Distinctive:

    Use PlantUML's !include features to share common styling and components

    line 210

≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
2005-c4-diagrams-about-solution.mdc
---
description: Create C4 Diagrams from Agile Artifacts
globs: 
alwaysApply: false
---
# Create C4 Diagrams from Agile Artifacts

This rule guides the AI to analyze existing agile artifacts (epics, features, user stories, and technical documents) and generate comprehensive C4 model diagrams in PlantUML format at three levels: Context, Container, and Component. The AI uses a conversational approach to understand the system architecture and creates detailed C4 diagrams that illustrate the software architecture described in the agile documentation.

Instructions for the AI (Content of the Rule):

"When activated, you should help the user generate C4 diagrams in PlantUML format based on existing agile artifacts by following these steps:

Phase 1: Artifact Analysis and Information Gathering
Start by acknowledging the request and gathering information about the source materials:

**Source Artifacts Analysis:**
1. Source Documents: "Please provide the paths to the agile artifacts you'd like to base the C4 diagrams on (epics, features, user stories, technical specs, architecture docs), or paste their content if you prefer. You can provide multiple documents."
2. Document Review: "I've reviewed the provided artifacts: [list document titles/names]. These describe [summarize key systems/components/interactions]. Is this the correct set of documents you want to work with?"
3. System Scope: "What is the main software system or product these artifacts describe? Please provide a brief name and description for the primary system we'll be modeling."

**Context Level Information:**
4. System Purpose: "What is the primary purpose and business value of this system? How would you describe it to a business stakeholder in one sentence?"
5. External Users: "Who are the different types of users or personas that interact with this system? (e.g., end customers, administrators, support staff, etc.)"
6. External Systems: "What external systems, services, or platforms does this system integrate with? (e.g., payment gateways, email services, databases, APIs, legacy systems)"
7. System Boundaries: "What are the main business capabilities or domains this system covers? What's explicitly outside its scope?"

**Container Level Information:**
8. Application Architecture: "Based on the artifacts, what type of architecture does this system follow? (e.g., web application with API, microservices, mobile app, etc.)"
9. User Interfaces: "What are the main user-facing applications or interfaces? (e.g., web application, mobile app, admin dashboard, API documentation)"
10. Backend Services: "What are the main backend services, APIs, or applications that handle business logic?"
11. Data Storage: "What types of data storage are used? (e.g., relational database, NoSQL, file storage, cache, etc.)"
12. Infrastructure: "Are there any specific infrastructure components mentioned? (e.g., message queues, search engines, monitoring systems)"

**Component Level Information:**
13. Focus Container: "Which container (application/service) would you like to detail at the component level? Choose the most important or complex one from the containers we identified."
14. Business Logic: "What are the main business domains or functional areas within this container? (e.g., user management, order processing, inventory, reporting)"
15. Component Interactions: "How do the main functional components interact with each other? Are there any important data flows or process flows?"
16. Technical Components: "Are there any specific technical components or patterns mentioned? (e.g., controllers, services, repositories, adapters, facades)"

**Technical and Style Preferences:**
17. Technology Stack: "What technologies, frameworks, or programming languages are mentioned in the artifacts? (This will help with appropriate styling and naming)"
18. Diagram Complexity: "Do you prefer simpler, high-level diagrams focusing on business concepts, or more detailed technical diagrams with specific technologies?"
19. Color Coding: "Would you like to use color coding to group related systems/containers/components? If so, what groupings make sense?"
20. File Naming: "What prefix would you like for the diagram files? (e.g., 'MySystem' will generate 'MySystem_Context.puml', 'MySystem_Container.puml', 'MySystem_Component.puml')"

Phase 2: C4 Diagram Generation
Once all information is gathered, inform the user you will generate the three C4 diagrams. Provide the content for each level:

**Content for Context Level Diagram: `C4_[File Prefix]_Context.puml`**
```plantuml
@startuml [System Name] - System Context
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Context.puml

title System Context diagram for [System Name]

' External Actors/Users
[FOR EACH External User DO
Person([UserAlias], "[User Type]", "[Brief description of user role]")
ENDLOOP]

' The Main System
System([SystemAlias], "[System Name]", "[System Purpose]")

' External Systems
[FOR EACH External System DO
System_Ext([ExtSystemAlias], "[External System Name]", "[Brief description of external system]")
ENDLOOP]

' Relationships
[FOR EACH User-System Interaction DO
Rel([UserAlias], [SystemAlias], "[Interaction description]", "[Technology/Protocol if relevant]")
ENDLOOP]

[FOR EACH System-External System Interaction DO
Rel([SystemAlias], [ExtSystemAlias], "[Integration description]", "[Technology/Protocol if relevant]")
ENDLOOP]

SHOW_LEGEND()
@enduml
```

**Content for Container Level Diagram: `C4_[File Prefix]_Container.puml`**
```plantuml
@startuml [System Name] - Container
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml

title Container diagram for [System Name]

' External Actors
[FOR EACH External User DO
Person([UserAlias], "[User Type]", "[Brief description]")
ENDLOOP]

' External Systems (if they interact with containers)
[FOR EACH Relevant External System DO
System_Ext([ExtSystemAlias], "[External System Name]", "[Brief description]")
ENDLOOP]

' System Boundary
System_Boundary([SystemAlias], "[System Name]") {
    [FOR EACH User Interface Container DO
    Container([UIAlias], "[UI Name]", "[Technology]", "[UI description and capabilities]")
    ENDLOOP]
    
    [FOR EACH Backend Service Container DO
    Container([ServiceAlias], "[Service Name]", "[Technology]", "[Service description and capabilities]")
    ENDLOOP]
    
    [FOR EACH Database Container DO
    ContainerDb([DbAlias], "[Database Name]", "[Technology]", "[Data storage description]")
    ENDLOOP]
    
    [FOR EACH Other Container DO
    Container([OtherAlias], "[Container Name]", "[Technology]", "[Container description]")
    ENDLOOP]
}

' Relationships
[FOR EACH User-Container Interaction DO
Rel([UserAlias], [ContainerAlias], "[Interaction description]", "[Protocol]")
ENDLOOP]

[FOR EACH Container-Container Interaction DO
Rel([ContainerAlias1], [ContainerAlias2], "[Interaction description]", "[Technology/Protocol]")
ENDLOOP]

[FOR EACH Container-External System Interaction DO
Rel([ContainerAlias], [ExtSystemAlias], "[Integration description]", "[Technology/Protocol]")
ENDLOOP]

SHOW_LEGEND()
@enduml
```

**Content for Component Level Diagram: `C4_[File Prefix]_Component.puml`**
```plantuml
@startuml [System Name] - [Focus Container] Components
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Component.puml

title Component diagram for [Focus Container] in [System Name]

' External Actors (if they directly interact with components)
[FOR EACH Relevant External User DO
Person([UserAlias], "[User Type]", "[Brief description]")
ENDLOOP]

' Other Containers (if they interact with components)
[FOR EACH Related Container DO
Container([ContainerAlias], "[Container Name]", "[Technology]", "[Brief description]")
ENDLOOP]

' External Systems (if they interact with components)
[FOR EACH Relevant External System DO
System_Ext([ExtSystemAlias], "[External System Name]", "[Brief description]")
ENDLOOP]

' Focus Container Boundary
Container_Boundary([FocusContainerAlias], "[Focus Container]") {
    [FOR EACH Business Domain Component DO
    Component([DomainAlias], "[Domain Component Name]", "[Technology/Pattern]", "[Component responsibility]")
    ENDLOOP]
    
    [FOR EACH Technical Component DO
    Component([TechAlias], "[Technical Component Name]", "[Technology/Pattern]", "[Technical responsibility]")
    ENDLOOP]
    
    [FOR EACH Data Access Component DO
    Component([DataAlias], "[Data Component Name]", "[Technology/Pattern]", "[Data access responsibility]")
    ENDLOOP]
}

' Relationships
[FOR EACH External-Component Interaction DO
Rel([ExternalAlias], [ComponentAlias], "[Interaction description]", "[Technology/Protocol]")
ENDLOOP]

[FOR EACH Component-Component Interaction DO
Rel([ComponentAlias1], [ComponentAlias2], "[Interaction description]", "[Method/Interface]")
ENDLOOP]

[FOR EACH Component-Container Interaction DO
Rel([ComponentAlias], [ContainerAlias], "[Interaction description]", "[Technology/Protocol]")
ENDLOOP]

[FOR EACH Component-External System Interaction DO
Rel([ComponentAlias], [ExtSystemAlias], "[Integration description]", "[Technology/Protocol]")
ENDLOOP]

SHOW_LEGEND()
@enduml
```

After generating all content, provide these additional recommendations:

**C4 Model Usage Guidelines:**
1. **Context Diagrams** - Share with business stakeholders, product managers, and non-technical team members
2. **Container Diagrams** - Use for architecture reviews, technical planning, and technology decisions
3. **Component Diagrams** - Reference during development, code reviews, and detailed technical discussions

**Integration with Agile Process:**
- Update diagrams when new epics or features significantly change the architecture
- Use diagrams to validate that user stories align with the intended architecture
- Reference diagrams during sprint planning to identify technical dependencies
- Include architecture validation as acceptance criteria for major features

**Tool Recommendations:**
- Store diagram source files in version control alongside your code
- Consider automated diagram generation from code annotations
- Use PlantUML's !include features to share common styling and components
- Integrate diagram generation into your CI/CD pipeline for up-to-date documentation

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.