Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
ba3b42e
Claude context
kyle-ssg Oct 14, 2025
9746d13
Claude context
kyle-ssg Oct 14, 2025
5955f25
Claude context
kyle-ssg Oct 14, 2025
efedbdc
Add api-sync / optmimise contexts
kyle-ssg Oct 21, 2025
cae73d7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 21, 2025
23a6495
Add api-sync / optimise contexts
kyle-ssg Oct 21, 2025
af5bfda
Merge remote-tracking branch 'origin/chore/claude-context' into chore…
kyle-ssg Oct 21, 2025
ac641db
Update contexts
kyle-ssg Nov 4, 2025
0c03b8f
Update contexts
kyle-ssg Nov 4, 2025
fb2df65
Update contexts
kyle-ssg Nov 4, 2025
b064e81
Update contexts
kyle-ssg Nov 4, 2025
27019de
Update contexts
kyle-ssg Nov 4, 2025
96c81d6
Update contexts
kyle-ssg Nov 4, 2025
4a3bafa
Update contexts
kyle-ssg Nov 4, 2025
4b846d9
Update contexts
kyle-ssg Nov 4, 2025
6cbde85
Merge branch 'main' into chore/claude-context
kyle-ssg Nov 4, 2025
dd7b743
Update contexts
kyle-ssg Nov 10, 2025
df85873
Update claude contexts
kyle-ssg Nov 11, 2025
d4809c4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 11, 2025
885cfe0
Simplify contexts
kyle-ssg Nov 11, 2025
91b542e
Merge remote-tracking branch 'origin/chore/claude-context' into chore…
kyle-ssg Nov 11, 2025
7edc926
Merge branch 'main' into chore/claude-context
kyle-ssg Nov 11, 2025
5b64f88
Revert makefile changes
kyle-ssg Nov 11, 2025
d9132b3
- Add AGENTS.md
khvn26 Dec 31, 2025
3d7a4aa
rename api/README.md
khvn26 Dec 31, 2025
6df6fc0
fix typo
khvn26 Dec 31, 2025
31e3c5e
fix path separators
khvn26 Dec 31, 2025
fb75a62
fix typo
khvn26 Dec 31, 2025
30a7158
clarify migrations squashing recommendation
khvn26 Dec 31, 2025
5feac3c
fix grammar
khvn26 Dec 31, 2025
453b867
update pull request template to include additional checklist items
khvn26 Jan 2, 2026
1fcdb88
Merge branch 'chore/claude-context' of github.com:Flagsmith/flagsmith…
Zaimwa9 Jan 7, 2026
9c4a74b
docs: split-heavy-context-and-created-agents
Zaimwa9 Jan 7, 2026
6c2fcaf
docs: basic-readme-for-frontend
Zaimwa9 Jan 7, 2026
ce3e9d4
docs: fixed-broken-link
Zaimwa9 Jan 7, 2026
845ad75
Remove mobile draft
kyle-ssg Jan 20, 2026
750a2ad
feat: rebased
Zaimwa9 Jan 20, 2026
4213b50
Merge branch 'main' of github.com:Flagsmith/flagsmith into docs/backe…
Zaimwa9 Jan 21, 2026
5b6012e
feat(frontend): add Claude commands and update README (#6604)
talissoncosta Jan 28, 2026
13f36db
Merge branch 'main' of github.com:Flagsmith/flagsmith into docs/backe…
Zaimwa9 Jan 30, 2026
a9e1178
docs: deleted-draft-files
Zaimwa9 Jan 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions frontend/.claude/commands/api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
description: Generate a new RTK Query API service
---

<!-- TODO: Update /api-types-sync once OpenAPI schema is ready -->

Generate a new API service. Follow these steps:

1. Go through the process mentioned in `.claude/context/api-integration.md`
2. If I haven't specified, attempt to find where I'd want to create this component in the frontend

Context file: `.claude/context/api-integration.md`
14 changes: 14 additions & 0 deletions frontend/.claude/commands/backend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
description: Search the backend codebase for endpoint details
---

Search the `../api` codebase for the requested endpoint.

Look for:
1. Route definitions (URL path)
2. HTTP method (GET, POST, PUT, DELETE)
3. Request validation schema (request body/params types)
4. Response structure (what data is returned)
5. Authentication/authorization requirements

If the endpoint isn't found, check swagger docs: https://staging.flagsmith.com/api/v1/docs/
8 changes: 8 additions & 0 deletions frontend/.claude/commands/check-staged.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
description: Run type checking and linting on staged files
---

Run TypeScript checking and linting on all currently staged files, similar to pre-commit hooks. Steps:
1. Run `npm run check:staged` to typecheck and lint only staged files
2. Report any type errors or linting issues found
3. If errors exist, offer to fix them
9 changes: 9 additions & 0 deletions frontend/.claude/commands/check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
description: Run type checking and linting
---

Run the following checks on the codebase:

1. `npx lint-staged --allow-empty` - Fix linting issues on staged files only (same as git hook)

Report any errors found and offer to fix them.
12 changes: 12 additions & 0 deletions frontend/.claude/commands/context.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
description: Load detailed context files for specific topics
---

Available context files in `.claude/context/`:

1. **api-integration.md** - API integration workflow, Redux setup, cross-platform patterns
2. **architecture.md** - Environment config, tech stack, additional rules
3. **feature-flags/** - Flagsmith feature flags (usage + MCP workflows)
4. **patterns/** - Code patterns (API, mobile)

Which context would you like to explore?
5 changes: 5 additions & 0 deletions frontend/.claude/commands/feature-flag.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
description: Create a feature flag
---

1. Create a feature flag using the context defined in `.claude/context/feature-flags/`
62 changes: 62 additions & 0 deletions frontend/.claude/commands/find-usages.md
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
56 changes: 56 additions & 0 deletions frontend/.claude/commands/pr-review.md
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]
```
47 changes: 47 additions & 0 deletions frontend/.claude/commands/ui-patterns.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# UI Patterns & Best Practices

## Confirmation Dialogs

**NEVER use `window.confirm`** - Always use the `openConfirm` function from `components/base/Modal`.

### Correct Usage

```typescript
import { openConfirm } from 'components/base/Modal'

// Signature: openConfirm(title, body, onYes, onNo?, challenge?)
openConfirm(
'Delete Partner',
'Are you sure you want to delete this partner?',
async (closeModal) => {
const res = await deleteAction()
if (!res.error) {
toast(null, 'Partner deleted successfully')
closeModal() // Always call closeModal to dismiss the dialog
}
},
)
```

### Parameters
- `title: string` - Dialog title
- `body: ReactNode` - Dialog content (can be JSX)
- `onYes: (closeModal: () => void) => void` - Callback when user confirms
- `onNo?: () => void` - Optional callback when user cancels
- `challenge?: string` - Optional challenge text user must type to confirm

### Key Points
- The `onYes` callback receives a `closeModal` function
- Always call `closeModal()` when the action completes successfully
- Can be async - use `async (closeModal) => { ... }`

## Backend Integration

### Always Run API Types Sync Before API Work

When using `/api` to generate new API services, the command automatically runs `/api-types-sync` first to:
1. Pull latest backend changes (`git pull` in `../api`)
2. Sync frontend types with backend serializers
3. Ensure types are up-to-date before generating new services

This prevents type mismatches and ensures consistency.
61 changes: 61 additions & 0 deletions frontend/.claude/commands/unit-test.md
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`
Loading
Loading