Skip to content

Conversation

@behnam-deriv
Copy link
Collaborator

@behnam-deriv behnam-deriv commented Feb 9, 2026

Clickup link:
Fixes issue: #

This PR contains the following changes:

  • ✨ New feature (non-breaking change which adds functionality)
  • πŸ› οΈ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • βœ… Build configuration change
  • πŸ“ Documentation
  • πŸ—‘οΈ Chore

Developers Note (Optional)

Pre-launch Checklist (For PR creator)

As a creator of this PR:

  • ✍️ I have included clickup id and package/app_name in the PR title.
  • πŸ‘οΈ I have gone through the code and removed any temporary changes (commented lines, prints, debug statements etc.).
  • βš’οΈ I have fixed any errors/warnings shown by the analyzer/linter.
  • πŸ“ I have added documentation, comments and logging wherever required.
  • πŸ§ͺ I have added necessary tests for these changes.
  • πŸ”Ž I have ensured all existing tests are passing.

Reviewers

Pre-launch Checklist (For Reviewers)

As a reviewer I ensure that:

  • ✴️ This PR follows the standard PR template.
  • πŸͺ© The information in this PR properly reflects the code changes.
  • πŸ§ͺ All the necessary tests for this PR's are passing.

Pre-launch Checklist (For QA)

  • πŸ‘Œ It passes the acceptance criteria.

Pre-launch Checklist (For Maintainer)

  • [MAINTAINER_NAME] I make sure this PR fulfills its purpose.

Summary by Sourcery

Documentation:

  • Document Flutter and Dart best practices, architecture patterns, theming, testing, accessibility, and tooling for AI-generated code.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Feb 9, 2026

Reviewer's Guide

Adds a new Claude AI rules document for Flutter/Dart to the repository, defining detailed coding, architecture, tooling, and UX guidelines for AI-generated Flutter code.

File-Level Changes

Change Details Files
Introduce a comprehensive AI rules documentation for Flutter and Dart to guide AI-assisted code generation and reviews.
  • Create a new markdown document under .claude/rules describing expectations for Flutter/Dart expertise, interaction guidelines, and project assumptions
  • Define coding standards and best practices for Dart and Flutter, including style, architecture, state management, testing, theming, layout, and accessibility
  • Document recommended tooling and workflows such as linting, formatting, code generation, package management, and testing commands for Flutter projects
.claude/rules/flutter-dart-rules.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions
Copy link

github-actions bot commented Feb 9, 2026

Dependency Review

βœ… No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Manifest Files

@claude
Copy link

claude bot commented Feb 9, 2026

Claude finished @behnam-deriv's task β€”β€” View job


PR Review: Add AI rules for Flutter and Dart

I've completed my review of this PR that adds comprehensive AI rules for Flutter and Dart development. Overall, this is a well-structured and valuable documentation addition, but I've identified several issues that should be addressed.


High Priority Issues

1. Duplicate and Inconsistent Content (Lines 446-465)

Location: .claude/rules/flutter-dart-rules.md:446-465

There's a problematic section with duplicated content and incomplete sentences:

## UI Theming and Styling Code

* **Responsiveness:** Use `LayoutBuilder` or `MediaQuery` to create responsive
  UIs.
* **Text:** Use `Theme.of(context).textTheme` for text styles.
* **Text Fields:** Configure `textCapitalization`, `keyboardType`, and
* **Responsiveness:** Use `LayoutBuilder` or `MediaQuery` to create responsive
  UIs.
* **Text:** Use `Theme.of(context).textTheme` for text styles.
  remote images.

Issues:

  • The "Text Fields" bullet point is incomplete (line 452)
  • "Responsiveness" and "Text" are duplicated (lines 449-450 vs 452-454)
  • The phrase "remote images" appears out of context
  • The code example that follows seems disconnected from the section header

Recommendation: Remove this entire section (lines 446-465) as the content is already covered in the "Material Theming Best Practices" section below, or restructure it with complete, non-duplicate content.

2. Broken Reference Link (Line 43)

Location: .claude/rules/flutter-dart-rules.md:43

See the [navigation guide](./navigation.md) for a detailed example using `go_router`.

Issue: This references a navigation.md file that doesn't exist in the .claude/rules/ directory.

Recommendation: Either remove this reference or clarify where the navigation guide can be found, or create the referenced file.

3. Inconsistent Tool References in "Interaction Guidelines"

Location: .claude/rules/flutter-dart-rules.md:19-24

The document references specific tools that may not be available in all AI contexts:

  • dart_format tool (line 19)
  • dart_fix tool (line 21)
  • analyze_files tool (line 24)
  • pub tool (line 47)
  • pub_dev_search tool (line 49)
  • run_tests tool (line 326)

Issue: These tool references assume a specific AI environment/toolset that may not match Claude Code's actual capabilities. Claude Code uses standard bash commands like dart format, flutter analyze, etc., not custom tools with these names.

Recommendation: Either:

  • Replace tool references with actual command examples (e.g., "run dart format ." instead of "Use the dart_format tool")
  • Add a note explaining these are example tool names and may vary by environment
  • Align with Claude Code's actual available tools

Medium Priority Issues

4. Logging Package Inconsistency

Location: .claude/rules/flutter-dart-rules.md:82 vs .claude/rules/flutter-dart-rules.md:288-310

Conflict:

  • Line 82 recommends: "Use the logging package instead of print"
  • Lines 288-310 recommend: "Use the log function from dart:developer"

Issue: These are two different approaches to logging with different use cases. The document should clarify when to use each.

Recommendation: Clarify that:

  • dart:developer.log() is preferred for development/debugging as it integrates with DevTools
  • The logging package is more suitable for production apps with structured logging needs
  • Or choose one consistent approach

5. Potential Conflict with Project-Specific CLAUDE.md

Location: Multiple sections

The project's CLAUDE.md already contains specific guidelines for this codebase:

  • Line length (80 chars in both - βœ… consistent)
  • Naming conventions (both match - βœ… consistent)
  • Function length (<20 lines in both - βœ… consistent)
  • Immutability emphasis (both emphasize this - βœ… consistent)

Good news: Most guidelines align well! However, the new rules file is very generic and doesn't reference the specific Deriv Chart project context.

Recommendation: Add a note at the top of flutter-dart-rules.md indicating:

  • These are general Flutter/Dart best practices
  • Project-specific rules in CLAUDE.md take precedence
  • Or consider if both files are needed, or if content should be merged

6. State Management Guidance May Not Fit Library Context

Location: .claude/rules/flutter-dart-rules.md:166-203

The extensive state management guidance focuses on app-level patterns (ValueNotifier, ChangeNotifier, Provider, MVVM), but this project is a charting library, not an application.

Issue: The guidance is application-centric and may not be relevant for library contributors.

Recommendation: Either:

  • Add context that these rules apply when building apps that use the library
  • Adjust the guidance to be more relevant to library development
  • Note that this section is less relevant for the core library code

Low Priority Issues

7. Overly Prescriptive Design Guidance

Location: .claude/rules/flutter-dart-rules.md:349-366 (Visual Design & Theming)

Guidance like "Apply subtle noise texture to the main background" and "Multi-layered drop shadows create a strong sense of depth" is very design-specific and may not apply to all projects, especially a charting library.

Recommendation: Consider making these suggestions rather than rules, or remove them as they're too prescriptive for a general-purpose guide.

8. Typo in Assets Section

Location: .claude/rules/flutter-dart-rules.md:426

* **Cached images:** For cached images, use NetworkImage a package like

Issue: Missing "with" or "or" - should be "use NetworkImage with a package like" or "use a package like"

9. Missing Comma in Example

Location: .claude/rules/flutter-dart-rules.md:720

labelSmall: TextStyle(fontSize: 11.0, color: Colors.grey),

Note: While this works, hardcoding Colors.grey in a TextTheme is not best practice - it should reference the theme's color scheme.


Positive Aspects

βœ… Comprehensive coverage of Flutter and Dart best practices
βœ… Well-structured with clear sections and hierarchy
βœ… Good code examples throughout
βœ… Accessibility section is excellent and important
βœ… Documentation philosophy section is very well written
βœ… Testing guidance is thorough and practical
βœ… Aligns well with existing project conventions in most areas


Summary

This is a valuable documentation addition, but requires refinement before merging:

Must Fix (Blockers):

  1. Fix duplicate/incomplete content in lines 446-465
  2. Remove or fix broken navigation.md reference
  3. Align tool references with actual available tools or clarify they're examples

Should Fix (Important):
4. Clarify logging approach (dart:developer vs logging package)
5. Add context about relationship with CLAUDE.md
6. Adjust or contextualize app-centric state management guidance for library use

Nice to Have:
7. Soften overly prescriptive design guidance
8. Fix minor typos and example issues

Recommendation: Request changes to address high-priority issues before merging. The document has strong foundations but needs cleanup to be production-ready.


Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 3 issues, and left some high level feedback:

  • In the 'UI Theming and Styling Code' section there are duplicated bullets for Responsiveness/Text and an incomplete 'Text Fields:' line ending with 'remote images.'β€”it would be good to clean this up for clarity and remove the repetition.
  • The logging guidance is slightly inconsistent: earlier you recommend the logging package instead of print, while the later 'Logging' section focuses on dart:developer.log; consider explicitly explaining when to choose each so the rules are not ambiguous.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In the 'UI Theming and Styling Code' section there are duplicated bullets for Responsiveness/Text and an incomplete 'Text Fields:' line ending with 'remote images.'β€”it would be good to clean this up for clarity and remove the repetition.
- The logging guidance is slightly inconsistent: earlier you recommend the `logging` package instead of `print`, while the later 'Logging' section focuses on `dart:developer.log`; consider explicitly explaining when to choose each so the rules are not ambiguous.

## Individual Comments

### Comment 1
<location> `.claude/rules/flutter-dart-rules.md:77-78` </location>
<code_context>
+    * Use `PascalCase` for classes, `camelCase` for
+      members/variables/functions/enums, and `snake_case` for files.
+* **Functions:**
+    * Functions short and with a single purpose (strive for less than 20 lines).
+* **Testing:** Write code with testing in mind. Use the `file`, `process`, and
+  `platform` packages, if appropriate, so you can inject in-memory and fake
</code_context>

<issue_to_address>
**issue (typo):** Clarify the functions guideline by adding the missing verb.

The wording is grammatically incomplete. Please rephrase, e.g. β€œKeep functions short and with a single purpose” or β€œFunctions should be short and have a single purpose.”

```suggestion
* **Functions:**
    * Keep functions short and with a single purpose (strive for less than 20 lines).
```
</issue_to_address>

### Comment 2
<location> `.claude/rules/flutter-dart-rules.md:426-427` </location>
<code_context>
+    Image.asset('assets/images/placeholder.png')
+    ```
+* **Network images:** Use NetworkImage for images loaded from the network.
+* **Cached images:** For cached images, use NetworkImage a package like
+  `cached_network_image`.
+* **Custom Icons:** Use `ImageIcon` to display an icon from an `ImageProvider`,
+  useful for custom icons not in the `Icons` class.
</code_context>

<issue_to_address>
**issue (typo):** Correct the grammar in the cached images guideline.

The phrase "use NetworkImage a package like `cached_network_image`" is missing a conjunction. Please change it to "use `NetworkImage` or a package like `cached_network_image`" and wrap `NetworkImage` in backticks for consistency with other API names.

```suggestion
* **Cached images:** For cached images, use `NetworkImage` or a package like
  `cached_network_image`.
```
</issue_to_address>

### Comment 3
<location> `.claude/rules/flutter-dart-rules.md:169-172` </location>
<code_context>
+### State Management
+* **Built-in Solutions:** Prefer Flutter's built-in state management solutions.
+  Do not use a third-party package unless explicitly requested.
+* **Streams:** Use `Streams` and `StreamBuilder` for handling a sequence of
+  asynchronous events.
+* **Futures:** Use `Futures` and `FutureBuilder` for handling a single
+  asynchronous operation that will complete in the future.
+* **ValueNotifier:** Use `ValueNotifier` with `ValueListenableBuilder` for
</code_context>

<issue_to_address>
**nitpick (typo):** Consider using singular type names `Stream` and `Future` in backticks.

In the bullet points, the backticked identifiers are currently `Streams` and `Futures`. Since the actual Dart types are `Stream` and `Future`, please update the backticked names accordingly (e.g., "Use `Stream` and `StreamBuilder`", "Use `Future` and `FutureBuilder`") for accuracy and consistency with Dart API naming.

```suggestion
* **Streams:** Use `Stream` and `StreamBuilder` for handling a sequence of
  asynchronous events.
* **Futures:** Use `Future` and `FutureBuilder` for handling a single
  asynchronous operation that will complete in the future.
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click πŸ‘ or πŸ‘Ž on each comment and I'll use the feedback to improve your reviews.

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
@claude
Copy link

claude bot commented Feb 9, 2026

Claude encountered an error β€”β€” View job


I'll analyze this and get back to you.

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
@claude
Copy link

claude bot commented Feb 9, 2026

Claude encountered an error β€”β€” View job


I'll analyze this and get back to you.

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
@claude
Copy link

claude bot commented Feb 9, 2026

Claude finished @behnam-deriv's task β€”β€” View job


PR Review: Add AI rules for Flutter and Dart

I've completed my review of this PR that adds comprehensive AI rules for Flutter and Dart development. The document is well-structured and covers important topics, but I've identified several issues that should be addressed before merging.


High Priority Issues (Must Fix)

1. Duplicate and Incomplete Content

Location: .claude/rules/flutter-dart-rules.md:446-465

There's a problematic section titled "UI Theming and Styling Code" with duplicated content and an incomplete sentence:

* **Text Fields:** Configure `textCapitalization`, `keyboardType`, and
* **Responsiveness:** Use `LayoutBuilder` or `MediaQuery` to create responsive

Issues:

  • Line 451: "Text Fields" bullet point is incomplete (cuts off after "and")
  • Lines 448-450 duplicate lines 452-454 (Responsiveness and Text bullets)
  • The phrase "remote images" on line 455 appears out of context
  • This entire section (lines 446-465) seems redundant since the same content is covered more thoroughly in the "Material Theming Best Practices" section below

Recommendation: Remove lines 446-465 entirely, or rewrite this section with complete, non-duplicate content.


2. Broken Reference Link

Location: .claude/rules/flutter-dart-rules.md:43

See the [navigation guide](./navigation.md) for a detailed example using `go_router`.

Issue: This references a navigation.md file that doesn't exist in the .claude/rules/ directory.

Recommendation: Either remove this reference or create the referenced file, or update the link to point to an existing resource.


3. Inconsistent Tool References

Location: Multiple locations (lines 19, 21, 24, 47, 49, 326)

The document references specific AI tools that may not match the actual environment:

  • dart_format tool (line 19)
  • dart_fix tool (line 21)
  • analyze_files tool (line 24)
  • pub tool (lines 47, 51, 53, 56, 59)
  • pub_dev_search tool (line 49)
  • run_tests tool (line 326)

Issue: These tool names suggest a specific AI environment/toolset. Claude Code uses standard bash commands like dart format, flutter analyze, flutter test, etc., not custom tools with these names. This mismatch could cause confusion.

Recommendation: Replace tool references with actual command examples:

  • "Use the dart_format tool" β†’ "Run dart format ."
  • "Use the dart_fix tool" β†’ "Run dart fix --apply"
  • "Use the analyze_files tool" β†’ "Run flutter analyze"
  • Or add a note explaining these are example tool names that may vary by environment

Medium Priority Issues (Should Fix)

4. Conflicting Logging Guidance

Location: .claude/rules/flutter-dart-rules.md:82 vs .claude/rules/flutter-dart-rules.md:288-310

Conflict:

  • Line 82 states: "Use the logging package instead of print"
  • Lines 288-310 recommend: "Use the log function from dart:developer"

Issue: These are two different approaches with different use cases, and the document presents them as if they're both the standard approach without clarifying when to use each.

Recommendation: Clarify the distinction:

  • dart:developer.log() is preferred for development/debugging (integrates with DevTools)
  • The logging package is more suitable for production apps with structured logging needs
  • Or consolidate to recommend a single approach

5. Type Name Inconsistency

Location: .claude/rules/flutter-dart-rules.md:169-172

* **Streams:** Use `Streams` and `StreamBuilder`...
* **Futures:** Use `Futures` and `FutureBuilder`...

Issue: The actual Dart types are Stream and Future (singular), not Streams and Futures (plural).

Recommendation: Update to use correct type names:

  • "Use Stream and StreamBuilder"
  • "Use Future and FutureBuilder"

(This was also flagged by Sourcery-ai)


6. Grammar Error in Cached Images

Location: .claude/rules/flutter-dart-rules.md:426-427

* **Cached images:** For cached images, use NetworkImage a package like
  `cached_network_image`.

Issue: Missing conjunction - should be "use NetworkImage or a package like"

Recommendation: Fix to: "use NetworkImage or a package like cached_network_image"

(Also flagged by Sourcery-ai)


7. Incomplete Sentence in Functions Guideline

Location: .claude/rules/flutter-dart-rules.md:78

* **Functions:**
    * Keep functions short and with a single purpose (strive for less than 20 lines).

Issue: The original text reads "Functions short and with a single purpose" - missing a verb.

Recommendation: Should read "Keep functions short..." or "Functions should be short..."

(Also flagged by Sourcery-ai)


Low Priority Issues (Nice to Have)

8. Context Mismatch: App-Centric Guidance for a Library

Location: .claude/rules/flutter-dart-rules.md:166-203 (State Management section)

Issue: This project is a charting library, not an application. The extensive state management guidance (ValueNotifier, ChangeNotifier, Provider, MVVM) is very app-centric and may not be directly relevant for library contributors.

Recommendation: Add a note clarifying that these rules are more relevant for applications using the library, or adjust the guidance to be more library-focused.


9. Overly Prescriptive Design Guidance

Location: .claude/rules/flutter-dart-rules.md:349-366

Guidance like:

  • "Apply subtle noise texture to the main background"
  • "Multi-layered drop shadows create a strong sense of depth"

Issue: This is very design-specific and opinionated. It may not apply to all projects, especially a technical charting library.

Recommendation: Consider softening these as suggestions rather than rules, or remove them as they're too prescriptive for general-purpose guidance.


10. Hardcoded Color in Theme Example

Location: .claude/rules/flutter-dart-rules.md:719

labelSmall: TextStyle(fontSize: 11.0, color: Colors.grey),

Issue: While this code works, hardcoding Colors.grey in a TextTheme example isn't best practice - colors should reference the theme's color scheme.

Recommendation: Update example to use theme colors, or add a comment explaining this is just an example.


11. Potential Relationship Confusion with CLAUDE.md

Observation: The repository already has a CLAUDE.md file with project-specific guidelines. The new flutter-dart-rules.md is generic Flutter/Dart guidance.

Good news: Most guidelines align well between the two files:

  • βœ… Line length (80 chars)
  • βœ… Naming conventions (PascalCase, camelCase, snake_case)
  • βœ… Function length (<20 lines)
  • βœ… Immutability emphasis

Recommendation: Consider adding a note at the top of flutter-dart-rules.md clarifying:

  • These are general Flutter/Dart best practices
  • Project-specific rules in CLAUDE.md take precedence when working on this codebase
  • Or explain the relationship between these two files

Positive Aspects βœ…

  • Comprehensive coverage of Flutter and Dart best practices
  • Well-structured with clear sections and logical flow
  • Good code examples throughout that illustrate concepts effectively
  • Excellent accessibility section with specific, actionable guidance
  • Strong documentation philosophy section with practical advice
  • Thorough testing guidance following industry best practices
  • Good alignment with existing project conventions in CLAUDE.md

Summary and Recommendation

This is a valuable documentation addition that will help AI assistants generate better Flutter/Dart code. However, it requires refinement before merging.

Blocking Issues (Must Fix Before Merge):

  1. βœ‹ Remove or fix duplicate/incomplete content (lines 446-465)
  2. βœ‹ Fix or remove broken navigation.md reference
  3. βœ‹ Align tool references with actual available tools or clarify they're examples

Important Issues (Should Fix):
4. ⚠️ Clarify logging approach (dart:developer vs logging package)
5. ⚠️ Fix type name inconsistencies (Stream/Future singular)
6. ⚠️ Fix grammar errors in cached images and functions guidelines

Recommendation: Request changes to address high-priority issues before merging. The document has strong foundations but needs cleanup to be production-ready.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant