-
Notifications
You must be signed in to change notification settings - Fork 469
feat(frontend): add Claude commands and update README #6604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
talissoncosta
merged 2 commits into
docs/backend-frontend-agents-context
from
feat/unit-test-command
Jan 28, 2026
+207
−1
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| --- | ||
| description: Find all usages of a component, function, or type | ||
| --- | ||
|
|
||
| Find all usages of `$ARGUMENTS` across the frontend codebase. | ||
|
|
||
| ## Steps | ||
|
|
||
| 1. **Identify what we're searching for** | ||
| - Component name (e.g., `Switch`, `Button`) | ||
| - Function name (e.g., `isFreeEmailDomain`, `formatDate`) | ||
| - Type/interface name (e.g., `FeatureState`, `ProjectFlag`) | ||
|
|
||
| 2. **Find the definition** | ||
| - Search for where it's defined/exported | ||
| - Note the file path and export type (default vs named) | ||
|
|
||
| 3. **Search for imports** | ||
| ```bash | ||
| # For named exports | ||
| grep -r "import.*{ $SYMBOL" --include="*.ts" --include="*.tsx" | ||
|
|
||
| # For default exports | ||
| grep -r "import $SYMBOL" --include="*.ts" --include="*.tsx" | ||
| ``` | ||
|
|
||
| 4. **Search for direct usages** | ||
| - JSX usage: `<ComponentName` | ||
| - Function calls: `functionName(` | ||
| - Type annotations: `: TypeName` or `as TypeName` | ||
|
|
||
| 5. **Categorise usages** | ||
| - Group by file/directory | ||
| - Note the context (component, hook, utility, test) | ||
|
|
||
| ## Output format | ||
|
|
||
| ``` | ||
| ## Definition | ||
| [File path where it's defined] | ||
|
|
||
| ## Usages (X files) | ||
|
|
||
| ### components/ | ||
| - ComponentA.tsx:42 - Used in render | ||
| - ComponentB.tsx:15 - Passed as prop | ||
|
|
||
| ### pages/ | ||
| - FeaturePage.tsx:88 - Used in modal | ||
|
|
||
| ### hooks/ | ||
| - useFeature.ts:12 - Called in effect | ||
|
|
||
| ## Impact Assessment | ||
| [Brief note on how widespread the usage is and what to consider when modifying] | ||
| ``` | ||
|
|
||
| ## Use cases | ||
|
|
||
| - Before refactoring: understand what will be affected | ||
| - Before deleting: ensure nothing depends on it | ||
| - Before renaming: find all places that need updates | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| --- | ||
| description: Review a GitHub pull request | ||
| --- | ||
|
|
||
| Review the pull request at `$ARGUMENTS`. | ||
|
|
||
| ## Steps | ||
|
|
||
| 1. **Fetch PR details** | ||
| ```bash | ||
| gh pr view <PR_NUMBER_OR_URL> --json title,body,files,additions,deletions,state,headRefName | ||
| ``` | ||
|
|
||
| 2. **Get the diff** | ||
| ```bash | ||
| gh pr diff <PR_NUMBER_OR_URL> | ||
| ``` | ||
|
|
||
| 3. **Analyse the changes** | ||
| - Summarise what the PR does | ||
| - Check if the approach makes sense | ||
| - Identify potential issues: | ||
| - Missing edge cases | ||
| - Inconsistencies with existing patterns | ||
| - Code style issues (indentation, naming) | ||
| - Missing tests for new functionality | ||
| - Check if related files need updates | ||
|
|
||
| 4. **Review against project patterns** | ||
| - Does it follow patterns in `.claude/context/`? | ||
| - Are imports using path aliases (`common/`, `components/`)? | ||
| - Is state management using RTK Query where appropriate? | ||
|
|
||
| 5. **Provide feedback** | ||
| - Summary of what the PR does | ||
| - What's good about the approach | ||
| - Potential concerns or suggestions | ||
| - Questions for the author (if any) | ||
|
|
||
| ## Output format | ||
|
|
||
| ``` | ||
| ## PR Summary | ||
| [Brief description of what the PR does] | ||
|
|
||
| ## Changes | ||
| [List of files changed and what each change does] | ||
|
|
||
| ## Assessment | ||
| ✅ What looks good | ||
| ⚠️ Potential concerns | ||
| 💡 Suggestions | ||
|
|
||
| ## Questions | ||
| [Any clarifying questions for the author] | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| --- | ||
| description: Analyse a frontend file and generate unit tests (Jest) | ||
| --- | ||
|
|
||
| Generate unit tests for the frontend file at `$ARGUMENTS`. | ||
|
|
||
| **Note:** This command is for frontend code only. For backend (Python) tests, see `../api/README.md`. | ||
|
|
||
| ## Steps | ||
|
|
||
| 1. **Check for existing tests** | ||
| - Look for `__tests__/{filename}.test.ts` in the same directory | ||
| - If tests exist, analyse them for coverage gaps | ||
|
|
||
| 2. **Read and analyse the source file** | ||
| - Identify all exported functions, classes, and constants | ||
| - Note dependencies and imports | ||
| - Determine testability: | ||
| - Pure functions (no side effects) → highly testable | ||
| - React components → may need mocking | ||
| - Functions with external dependencies → note what needs mocking | ||
|
|
||
| 3. **Generate test file** | ||
| - Follow the pattern in `common/utils/__tests__/format.test.ts` | ||
| - Location: `{sourceDir}/__tests__/{filename}.test.ts` | ||
| - Use path aliases for imports (`common/...`, `components/...`) | ||
|
|
||
| 4. **Test structure requirements** | ||
| - Use `describe` block for each exported function | ||
| - Use `it.each` for table-driven tests when function has multiple input/output cases | ||
| - Include edge cases: `null`, `undefined`, empty strings, empty arrays | ||
| - Include boundary cases where applicable | ||
|
|
||
| 5. **After generating, run the tests** | ||
| ```bash | ||
| npm run test:unit -- --testPathPatterns={filename} | ||
| ``` | ||
|
|
||
| ## Test file pattern | ||
|
|
||
| ```typescript | ||
| import { functionName } from 'common/path/to/file' | ||
|
|
||
| describe('functionName', () => { | ||
| it.each` | ||
| input | expected | ||
| ${value1} | ${result1} | ||
| ${value2} | ${result2} | ||
| ${null} | ${expectedForNull} | ||
| ${undefined} | ${expectedForUndefined} | ||
| `('functionName($input) returns $expected', ({ input, expected }) => { | ||
| expect(functionName(input)).toBe(expected) | ||
| }) | ||
| }) | ||
| ``` | ||
|
|
||
| ## Reference | ||
|
|
||
| See existing tests at: | ||
| - `common/utils/__tests__/format.test.ts` | ||
| - `common/utils/__tests__/featureFilterParams.test.ts` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import isFreeEmailDomain from 'common/utils/isFreeEmailDomain' | ||
|
|
||
| describe('isFreeEmailDomain', () => { | ||
| it.each` | ||
| input | expected | ||
| ${'user@gmail.com'} | ${true} | ||
| ${'user@yahoo.com'} | ${true} | ||
| ${'user@hotmail.com'} | ${true} | ||
| ${'user@outlook.com'} | ${true} | ||
| ${'user@company.com'} | ${false} | ||
| ${'user@flagsmith.com'} | ${false} | ||
| ${'user@enterprise.co.uk'} | ${false} | ||
| ${null} | ${false} | ||
| ${undefined} | ${false} | ||
| ${''} | ${false} | ||
| ${'invalid-email'} | ${false} | ||
| ${'@gmail.com'} | ${true} | ||
| `('isFreeEmailDomain($input) returns $expected', ({ expected, input }) => { | ||
| expect(isFreeEmailDomain(input)).toBe(expected) | ||
| }) | ||
| }) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
really nice one