Skip to content

docs: add comprehensive cursor guidelines and rules for development practices#8401

Merged
ogabrielluiz merged 5 commits into
mainfrom
update-cursor-rules
Jun 12, 2025
Merged

docs: add comprehensive cursor guidelines and rules for development practices#8401
ogabrielluiz merged 5 commits into
mainfrom
update-cursor-rules

Conversation

@ogabrielluiz
Copy link
Copy Markdown
Contributor

@ogabrielluiz ogabrielluiz commented Jun 6, 2025

Summary by CodeRabbit

  • Documentation
    • Introduced comprehensive guideline documents for backend, frontend, and documentation development, covering environment setup, directory structures, coding standards, testing, and deployment practices.
    • Expanded and clarified existing rules for component structure and icon usage, including detailed checklists and file path specifications.
    • Added a thorough testing guideline outlining test locations, naming conventions, async patterns, best practices, and Langflow-specific testing scenarios.

@dosubot dosubot Bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Jun 6, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 6, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This update introduces a comprehensive set of documentation and rule files for backend, frontend, documentation, icons, component structure, and testing development practices within the Langflow project. The new and revised documents provide detailed guidelines, directory structures, conventions, code quality practices, and checklists to standardize and streamline development and testing workflows across the codebase.

Changes

File(s) Change Summary
.cursor/rules/backend_development.mdc Added a detailed backend development guideline covering environment setup, component structure, database usage, async patterns, integration testing, and a development checklist.
.cursor/rules/frontend_development.mdc Added comprehensive frontend development guidelines for React/TypeScript, including environment setup, architecture, state management, API integration, styling, testing, and deployment instructions, plus exported stores, components, hooks, and services.
.cursor/rules/docs_development.mdc Added documentation development guidelines for Docusaurus, including environment setup, directory structure, writing conventions, templates, style guide, deployment, and a documentation checklist.
.cursor/rules/testing.mdc Introduced a thorough testing guideline for backend and frontend, with conventions, patterns, async testing, fixtures, coverage, documentation, and Langflow-specific testing practices.
.cursor/rules/icons.mdc Expanded and clarified icon usage rules, added file globs for frontend and backend icon/component paths, improved formatting, rephrased instructions, and included a checklist for adding new icons; editorial and organizational only.
.cursor/rules/components/basic_component.mdc Expanded description, added file globs for Python component files, and clarified requirements; no functional or structural changes.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant Documentation
    participant Backend
    participant Frontend
    participant Testing

    Developer->>Documentation: Consults docs_development.mdc for writing docs
    Developer->>Backend: Follows backend_development.mdc for backend changes
    Developer->>Frontend: Follows frontend_development.mdc for frontend changes
    Developer->>Backend: Implements/tests components per basic_component.mdc
    Developer->>Frontend: Adds/updates icons per icons.mdc
    Developer->>Testing: Writes/tests code as per testing.mdc
    Testing->>Backend: Runs backend/unit/integration tests
    Testing->>Frontend: Runs frontend/component tests
    Developer->>Documentation: Updates docs per changes and guidelines
Loading

Suggested labels

size:M

Suggested reviewers

  • edwinjosechittilappilly

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot changed the title @coderabbitai docs: add comprehensive guidelines and rules for development practices Jun 6, 2025
@ogabrielluiz ogabrielluiz changed the title docs: add comprehensive guidelines and rules for development practices docs: add comprehensive cursor guidelines and rules for development practices Jun 6, 2025
@ogabrielluiz ogabrielluiz requested a review from mendonk June 6, 2025 17:42
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Jun 6, 2025
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🔭 Outside diff range comments (3)
.cursor/rules/components/basic_component.mdc (2)

35-48: 🛠️ Refactor suggestion

Complete the component example or provide a working implementation.

The example shows placeholder comments instead of actual implementation, which could confuse developers trying to follow the guide.

Consider providing a complete working example:

 class ConditionalRouterComponent(Component):
     display_name = "If-Else"
     description = "Routes an input message to a corresponding output based on text comparison."
     icon = "split"
     name = "ConditionalRouter"
     inputs = [
-        # Define your inputs here
+        MessageTextInput(
+            name="message",
+            display_name="Input Message",
+            info="The message to route based on condition",
+        ),
+        StrInput(
+            name="condition_text",
+            display_name="Condition Text", 
+            info="Text to compare against for routing decision",
+        ),
     ]
     outputs = [
-        # Define your outputs here
+        Output(display_name="True Output", name="true_output", method="true_response"),
+        Output(display_name="False Output", name="false_output", method="false_response"),
     ]
-    # Implement your logic methods here
+    
+    def true_response(self) -> Message:
+        return Message(text=f"Condition met: {self.message}")
+    
+    def false_response(self) -> Message:  
+        return Message(text=f"Condition not met: {self.message}")

52-65: 🛠️ Refactor suggestion

Complete the CurrentDate component example.

Similar to the previous example, this shows placeholders instead of a working implementation.

 class CurrentDateComponent(Component):
     display_name = "Current Date"
     description = "Returns the current date and time in the selected timezone."
     icon = "clock"
     name = "CurrentDate"
     inputs = [
-        # Define your inputs here
+        DropdownInput(
+            name="timezone",
+            display_name="Timezone",
+            options=["UTC", "US/Eastern", "US/Pacific", "Europe/London"],
+            value="UTC",
+            info="Select the timezone for the current date/time",
+        ),
     ]
     outputs = [
-        # Define your outputs here
+        Output(display_name="Current Date", name="current_date", method="get_current_date"),
     ]
-    # Implement your logic methods here
+    
+    def get_current_date(self) -> Message:
+        from datetime import datetime
+        import pytz
+        tz = pytz.timezone(self.timezone)
+        current_time = datetime.now(tz)
+        return Message(text=current_time.strftime("%Y-%m-%d %H:%M:%S %Z"))
.cursor/rules/backend_development.mdc (1)

269-269: ⚠️ Potential issue

Complete the final checklist item.

The last line appears to be cut off mid-sentence.

-- [ ] External API calls use appropriate pytest markers
+- [ ] External API calls use appropriate pytest markers
+- [ ] Documentation updated for new components or API changes

Or if the line was intended to be longer, please complete the thought about external API calls.

🧹 Nitpick comments (4)
.cursor/rules/components/basic_component.mdc (1)

73-73: Fix the file path reference.

The path reference has an incorrect format.

-- Use a Lucide icon or if you want a custom icon follow the icon rules (`./cursor/rules/icons.mdc`)
+- Use a Lucide icon or if you want a custom icon follow the icon rules (`.cursor/rules/icons.mdc`)
.cursor/rules/testing.mdc (2)

3-9: Glob patterns may not work as intended on all runners

The brace‐expansion syntax (*.test.{ts,tsx,js,jsx}) is Bash-style, but many Python glob implementations (e.g. pathlib, glob) do not support it. If these rules are consumed by tooling that relies on pure Python globbing you may silently miss files.
Consider splitting the patterns or using multiple explicit entries:

-  - "src/frontend/**/*.test.{ts,tsx,js,jsx}"
-  - "src/frontend/**/*.spec.{ts,tsx,js,jsx}"
+  - "src/frontend/**/*.test.ts"
+  - "src/frontend/**/*.test.tsx"
+  - "src/frontend/**/*.test.js"
+  - "src/frontend/**/*.test.jsx"
+  - "src/frontend/**/*.spec.ts"
+  - "src/frontend/**/*.spec.tsx"
+  - "src/frontend/**/*.spec.js"
+  - "src/frontend/**/*.spec.jsx"

118-123: Mention the pytest-asyncio dependency explicitly

All async examples rely on @pytest.mark.asyncio, but the guidelines never state that pytest-asyncio (or equivalent) must be installed and enabled.
Add an explicit note in section 4. Async Testing Patterns to prevent new contributors from encountering “asyncio marker not found” errors.

.cursor/rules/frontend_development.mdc (1)

74-84: Undefined helper stringToBool

The icon example uses stringToBool but neither imports nor defines it. Newcomers copying this snippet will run into runtime errors.
Add a short util snippet or replace with a simple boolean cast:

-         fill={stringToBool(props.isdark) ? "#ffffff" : "#0A0A0A"}
+         fill={props.isdark === 'true' ? "#ffffff" : "#0A0A0A"}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e23e543 and 474dfa1.

📒 Files selected for processing (6)
  • .cursor/rules/backend_development.mdc (1 hunks)
  • .cursor/rules/components/basic_component.mdc (1 hunks)
  • .cursor/rules/docs_development.mdc (1 hunks)
  • .cursor/rules/frontend_development.mdc (1 hunks)
  • .cursor/rules/icons.mdc (5 hunks)
  • .cursor/rules/testing.mdc (1 hunks)
🔇 Additional comments (7)
.cursor/rules/icons.mdc (1)

1-137: Excellent comprehensive icon guidelines.

This documentation provides thorough coverage of icon implementation across both backend and frontend with clear examples, proper file organization, and a useful checklist. The integration between backend Python components and frontend React implementation is well-explained.

.cursor/rules/docs_development.mdc (1)

14-441: Comprehensive documentation guidelines with excellent structure.

This document provides thorough coverage of documentation development including environment setup, content structure, writing conventions, API documentation templates, and deployment processes. The examples and templates are well-crafted and will be very helpful for maintainers.

.cursor/rules/backend_development.mdc (3)

82-103: Excellent emphasis on formatting workflow.

The strong emphasis on running make format_backend early and often is excellent advice that will save developers significant time. This proactive approach to code quality is a best practice.


156-211: Comprehensive async development patterns.

The async patterns section provides excellent examples of proper async/await usage, background task management, and queue operations with appropriate error handling. This will help prevent common async pitfalls.


13-268: Comprehensive backend development guidelines.

This document provides excellent coverage of backend development practices including environment setup, component structure, code quality workflows, API development, database patterns, and async programming. The practical examples and testing patterns are particularly valuable.

.cursor/rules/testing.mdc (1)

154-162: Marker name inconsistency

You introduce a no_blockbuster marker here, while the earlier fixture section references noclient. Double-check naming conventions (no_blockbuster vs no_blockbuster**?**, noclient vs no_client) and document them in pytest.ini to avoid confusion.

.cursor/rules/frontend_development.mdc (1)

24-26: Node.js version is not yet LTS

Node 22 will not enter LTS until late 2025; current LTS is 20.x. Requiring 22.12 may force contributors onto a non-LTS toolchain and break CI images.
Recommend downgrading to the current Active LTS (20.x) or clarifying that 22 is only tested, not required.

Comment thread .cursor/rules/docs_development.mdc Outdated
Comment thread .cursor/rules/docs_development.mdc Outdated
Comment thread .cursor/rules/frontend_development.mdc
@github-actions github-actions Bot added documentation Improvements or additions to documentation and removed documentation Improvements or additions to documentation labels Jun 6, 2025
ogabrielluiz and others added 2 commits June 6, 2025 14:55
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@github-actions github-actions Bot added documentation Improvements or additions to documentation and removed documentation Improvements or additions to documentation labels Jun 6, 2025
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (2)
.cursor/rules/docs_development.mdc (2)

121-121: Fix the image path placeholder (duplicate issue).

This image path still contains the template placeholder that was flagged in previous reviews.

-![Component Overview](mdc:img/components/overview.png)
+![Component Overview](/img/components/overview.png)

124-124: Fix the second image path placeholder (duplicate issue).

This image path also contains the template placeholder that was flagged in previous reviews.

-![Langflow interface showing the flow editor with nodes and connections](mdc:img/flow-editor.png)
+![Langflow interface showing the flow editor with nodes and connections](/img/flow-editor.png)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 474dfa1 and 39ba4c7.

📒 Files selected for processing (1)
  • .cursor/rules/docs_development.mdc (1 hunks)
🧰 Additional context used
🪛 Gitleaks (8.26.0)
.cursor/rules/docs_development.mdc

238-239: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)

🔇 Additional comments (6)
.cursor/rules/docs_development.mdc (6)

1-11: LGTM! Well-structured documentation configuration.

The YAML frontmatter is properly configured with appropriate glob patterns covering all relevant documentation file types and a clear description.


132-183: Excellent component documentation template.

The component documentation template is comprehensive and well-structured, covering all essential aspects including configuration, inputs/outputs, usage examples, and common issues. This will help ensure consistent documentation across all components.


238-239: Security scanner false positive - documentation placeholder.

The static analysis tool flagged this curl example as a potential security issue, but this is clearly a documentation placeholder ("your-token") meant to be replaced by users with their actual tokens.

This is a false positive from the security scanner. The "Bearer your-token" is clearly a placeholder in documentation examples, not an actual exposed token.

🧰 Tools
🪛 Gitleaks (8.26.0)

238-239: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


306-331: Well-designed sidebar configuration example.

The sidebar configuration demonstrates proper hierarchical organization with clear categories and logical grouping of documentation sections.


394-412: Comprehensive and clear style guide.

The style guide provides excellent guidelines for tone, formatting, and terminology that will ensure consistent documentation quality across the project.


430-441: Thorough development checklist.

The checklist covers all critical aspects of documentation development from local setup to deployment verification, ensuring quality and completeness.

Comment thread .cursor/rules/docs_development.mdc
Copy link
Copy Markdown
Collaborator

@mfortman11 mfortman11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff Gabriel!

Comment thread .cursor/rules/frontend_development.mdc Outdated
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jun 9, 2025
… outdated icon development instructions, and update checklist for clarity and consistency.
@ogabrielluiz ogabrielluiz enabled auto-merge June 10, 2025 13:20
@github-actions github-actions Bot added documentation Improvements or additions to documentation and removed documentation Improvements or additions to documentation labels Jun 10, 2025
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
.cursor/rules/frontend_development.mdc (1)

169-183: Missing type imports cause TS compile errors

NodeChange and EdgeChange are referenced in the props but not imported from reactflow.

🧹 Nitpick comments (2)
.cursor/rules/frontend_development.mdc (2)

370-374: Remove duplicated checklist items.

The checklist contains duplicate items that should be removed for clarity:

  • "Components styled with Tailwind CSS" (appears on lines 364 and 370)
  • "Dark mode support implemented where needed" (appears on lines 365 and 371)
  • "Code formatted with make format_frontend" (appears on lines 366 and 372)
  • "Changes tested in both light and dark mode" (appears on lines 368 and 373)
-- [ ] Components styled with Tailwind CSS
-- [ ] Dark mode support implemented where needed
-- [ ] Code formatted with `make format_frontend`
-- [ ] Changes tested in both light and dark mode
-

220-235: Consider using Lucide React icons for consistency.

The ComponentNode example uses an img tag for icons, but the tech stack mentions Lucide React. For consistency, consider using Lucide React components:

+import { Icon } from 'lucide-react';
+
 export const ComponentNode = memo(({ data }: ComponentNodeProps) => {
   return (
     <div className="px-4 py-2 shadow-md rounded-md bg-white border">
       <Handle type="target" position={Position.Top} />
 
       <div className="flex items-center">
-        {data.icon && (
-          <img src={data.icon} alt="" className="w-4 h-4 mr-2" />
-        )}
+        {data.icon && <Icon name={data.icon} className="w-4 h-4 mr-2" />}
         <span className="text-sm">{data.label}</span>
       </div>
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 39ba4c7 and aa2cd4b.

📒 Files selected for processing (1)
  • .cursor/rules/frontend_development.mdc (1 hunks)

@ogabrielluiz ogabrielluiz added this pull request to the merge queue Jun 12, 2025
@github-actions github-actions Bot added documentation Improvements or additions to documentation and removed documentation Improvements or additions to documentation labels Jun 12, 2025
Merged via the queue into main with commit ab1ed8e Jun 12, 2025
11 checks passed
@ogabrielluiz ogabrielluiz deleted the update-cursor-rules branch June 12, 2025 13:02
ogabrielluiz added a commit to bkatya2001/langflow that referenced this pull request Jun 24, 2025
…ractices (langflow-ai#8401)

* Update cursor rules with specific backend, frontend, docs

* Update image example

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* update image example

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Refactor frontend development guidelines: streamline sections, remove outdated icon development instructions, and update checklist for clarity and consistency.

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation lgtm This PR has been approved by a maintainer size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants