@brookmind/ai-toolkit 1.1.7 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +42 -14
- package/dist/__tests__/constants.test.d.ts +2 -0
- package/dist/__tests__/constants.test.d.ts.map +1 -0
- package/dist/__tests__/constants.test.js +102 -0
- package/dist/__tests__/constants.test.js.map +1 -0
- package/dist/__tests__/index.test.d.ts +2 -0
- package/dist/__tests__/index.test.d.ts.map +1 -0
- package/dist/__tests__/index.test.js +114 -0
- package/dist/__tests__/index.test.js.map +1 -0
- package/dist/__tests__/integration/installer.test.d.ts +2 -0
- package/dist/__tests__/integration/installer.test.d.ts.map +1 -0
- package/dist/__tests__/integration/installer.test.js +425 -0
- package/dist/__tests__/integration/installer.test.js.map +1 -0
- package/dist/__tests__/services/installers.test.d.ts +2 -0
- package/dist/__tests__/services/installers.test.d.ts.map +1 -0
- package/dist/__tests__/services/installers.test.js +222 -0
- package/dist/__tests__/services/installers.test.js.map +1 -0
- package/dist/__tests__/services/opencode.test.d.ts +2 -0
- package/dist/__tests__/services/opencode.test.d.ts.map +1 -0
- package/dist/__tests__/services/opencode.test.js +120 -0
- package/dist/__tests__/services/opencode.test.js.map +1 -0
- package/dist/__tests__/ui/categorize.test.d.ts +2 -0
- package/dist/__tests__/ui/categorize.test.d.ts.map +1 -0
- package/dist/__tests__/ui/categorize.test.js +194 -0
- package/dist/__tests__/ui/categorize.test.js.map +1 -0
- package/dist/__tests__/ui/choices.test.d.ts +2 -0
- package/dist/__tests__/ui/choices.test.d.ts.map +1 -0
- package/dist/__tests__/ui/choices.test.js +180 -0
- package/dist/__tests__/ui/choices.test.js.map +1 -0
- package/dist/__tests__/ui/display.test.d.ts +2 -0
- package/dist/__tests__/ui/display.test.d.ts.map +1 -0
- package/dist/__tests__/ui/display.test.js +142 -0
- package/dist/__tests__/ui/display.test.js.map +1 -0
- package/dist/__tests__/utils/fs.test.d.ts +2 -0
- package/dist/__tests__/utils/fs.test.d.ts.map +1 -0
- package/dist/__tests__/utils/fs.test.js +142 -0
- package/dist/__tests__/utils/fs.test.js.map +1 -0
- package/dist/__tests__/utils/terminal.test.d.ts +2 -0
- package/dist/__tests__/utils/terminal.test.d.ts.map +1 -0
- package/dist/__tests__/utils/terminal.test.js +97 -0
- package/dist/__tests__/utils/terminal.test.js.map +1 -0
- package/dist/constants.d.ts +11 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +40 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +49 -332
- package/dist/index.js.map +1 -1
- package/dist/services/installers.d.ts +8 -0
- package/dist/services/installers.d.ts.map +1 -0
- package/dist/services/installers.js +79 -0
- package/dist/services/installers.js.map +1 -0
- package/dist/services/opencode.d.ts +3 -0
- package/dist/services/opencode.d.ts.map +1 -0
- package/dist/services/opencode.js +33 -0
- package/dist/services/opencode.js.map +1 -0
- package/dist/types.d.ts +10 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/ui/categorize.d.ts +6 -0
- package/dist/ui/categorize.d.ts.map +1 -0
- package/dist/ui/categorize.js +69 -0
- package/dist/ui/categorize.js.map +1 -0
- package/dist/ui/choices.d.ts +6 -0
- package/dist/ui/choices.d.ts.map +1 -0
- package/dist/ui/choices.js +70 -0
- package/dist/ui/choices.js.map +1 -0
- package/dist/ui/display.d.ts +8 -0
- package/dist/ui/display.d.ts.map +1 -0
- package/dist/ui/display.js +86 -0
- package/dist/ui/display.js.map +1 -0
- package/dist/utils/fs.d.ts +5 -0
- package/dist/utils/fs.d.ts.map +1 -0
- package/dist/utils/fs.js +40 -0
- package/dist/utils/fs.js.map +1 -0
- package/dist/utils/terminal.d.ts +5 -0
- package/dist/utils/terminal.d.ts.map +1 -0
- package/dist/utils/terminal.js +18 -0
- package/dist/utils/terminal.js.map +1 -0
- package/package.json +29 -5
- package/agents/code-reviewer.md +0 -35
- package/agents/code-simplifier.md +0 -52
- package/commands/create-pr-description.md +0 -102
- package/commands/create-pr.md +0 -76
- package/commands/create-react-tests.md +0 -207
- package/mcps/context7/.mcp.json +0 -13
- package/mcps/expo-mcp/.mcp.json +0 -13
- package/mcps/figma-mcp/.mcp.json +0 -10
- package/skills/github-cli/SKILL.md +0 -125
- package/skills/pdf-processing-pro/FORMS.md +0 -610
- package/skills/pdf-processing-pro/OCR.md +0 -137
- package/skills/pdf-processing-pro/SKILL.md +0 -296
- package/skills/pdf-processing-pro/TABLES.md +0 -626
- package/skills/pdf-processing-pro/scripts/analyze_form.py +0 -307
- package/skills/react-best-practices/AGENTS.md +0 -915
- package/skills/react-best-practices/README.md +0 -127
- package/skills/react-best-practices/SKILL.md +0 -110
- package/skills/react-best-practices/metadata.json +0 -14
- package/skills/react-best-practices/rules/_sections.md +0 -41
- package/skills/react-best-practices/rules/_template.md +0 -28
- package/skills/react-best-practices/rules/advanced-event-handler-refs.md +0 -80
- package/skills/react-best-practices/rules/advanced-use-latest.md +0 -76
- package/skills/react-best-practices/rules/async-defer-await.md +0 -80
- package/skills/react-best-practices/rules/async-dependencies.md +0 -36
- package/skills/react-best-practices/rules/async-parallel.md +0 -28
- package/skills/react-best-practices/rules/async-suspense-boundaries.md +0 -100
- package/skills/react-best-practices/rules/bundle-barrel-imports.md +0 -42
- package/skills/react-best-practices/rules/bundle-conditional.md +0 -106
- package/skills/react-best-practices/rules/bundle-preload.md +0 -44
- package/skills/react-best-practices/rules/client-event-listeners.md +0 -131
- package/skills/react-best-practices/rules/client-swr-dedup.md +0 -133
- package/skills/react-best-practices/rules/js-batch-dom-css.md +0 -82
- package/skills/react-best-practices/rules/js-cache-function-results.md +0 -80
- package/skills/react-best-practices/rules/js-cache-property-access.md +0 -28
- package/skills/react-best-practices/rules/js-cache-storage.md +0 -70
- package/skills/react-best-practices/rules/js-combine-iterations.md +0 -32
- package/skills/react-best-practices/rules/js-early-exit.md +0 -50
- package/skills/react-best-practices/rules/js-hoist-regexp.md +0 -45
- package/skills/react-best-practices/rules/js-index-maps.md +0 -37
- package/skills/react-best-practices/rules/js-length-check-first.md +0 -49
- package/skills/react-best-practices/rules/js-min-max-loop.md +0 -82
- package/skills/react-best-practices/rules/js-set-map-lookups.md +0 -24
- package/skills/react-best-practices/rules/js-tosorted-immutable.md +0 -57
- package/skills/react-best-practices/rules/rendering-activity.md +0 -90
- package/skills/react-best-practices/rules/rendering-animate-svg-wrapper.md +0 -47
- package/skills/react-best-practices/rules/rendering-conditional-render.md +0 -40
- package/skills/react-best-practices/rules/rendering-content-visibility.md +0 -38
- package/skills/react-best-practices/rules/rendering-hoist-jsx.md +0 -65
- package/skills/react-best-practices/rules/rendering-svg-precision.md +0 -28
- package/skills/react-best-practices/rules/rerender-defer-reads.md +0 -39
- package/skills/react-best-practices/rules/rerender-dependencies.md +0 -45
- package/skills/react-best-practices/rules/rerender-derived-state.md +0 -29
- package/skills/react-best-practices/rules/rerender-functional-setstate.md +0 -74
- package/skills/react-best-practices/rules/rerender-lazy-state-init.md +0 -58
- package/skills/react-best-practices/rules/rerender-memo.md +0 -85
- package/skills/react-best-practices/rules/rerender-transitions.md +0 -40
- package/skills/skill-creator/LICENSE.txt +0 -202
- package/skills/skill-creator/SKILL.md +0 -209
- package/skills/skill-creator/scripts/init_skill.py +0 -303
- package/skills/skill-creator/scripts/package_skill.py +0 -110
- package/skills/skill-creator/scripts/quick_validate.py +0 -65
- package/skills/spring-boot-development/EXAMPLES.md +0 -2346
- package/skills/spring-boot-development/README.md +0 -595
- package/skills/spring-boot-development/SKILL.md +0 -1519
- package/themes/README.md +0 -68
- package/themes/claude-vivid.json +0 -72
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: code-simplifier
|
|
3
|
-
description: Simplifies and refines code for clarity, consistency, and maintainability while preserving all functionality. Focuses on recently modified code unless instructed otherwise.
|
|
4
|
-
model: opus
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
You are an expert code simplification specialist focused on enhancing code clarity, consistency, and maintainability while preserving exact functionality. Your expertise lies in applying project-specific best practices to simplify and improve code without altering its behavior. You prioritize readable, explicit code over overly compact solutions. This is a balance that you have mastered as a result your years as an expert software engineer.
|
|
8
|
-
|
|
9
|
-
You will analyze recently modified code and apply refinements that:
|
|
10
|
-
|
|
11
|
-
1. **Preserve Functionality**: Never change what the code does - only how it does it. All original features, outputs, and behaviors must remain intact.
|
|
12
|
-
|
|
13
|
-
2. **Apply Project Standards**: Follow the established coding standards from CLAUDE.md including:
|
|
14
|
-
|
|
15
|
-
- Use ES modules with proper import sorting and extensions
|
|
16
|
-
- Prefer `function` keyword over arrow functions
|
|
17
|
-
- Use explicit return type annotations for top-level functions
|
|
18
|
-
- Follow proper React component patterns with explicit Props types
|
|
19
|
-
- Use proper error handling patterns (avoid try/catch when possible)
|
|
20
|
-
- Maintain consistent naming conventions
|
|
21
|
-
|
|
22
|
-
3. **Enhance Clarity**: Simplify code structure by:
|
|
23
|
-
|
|
24
|
-
- Reducing unnecessary complexity and nesting
|
|
25
|
-
- Eliminating redundant code and abstractions
|
|
26
|
-
- Improving readability through clear variable and function names
|
|
27
|
-
- Consolidating related logic
|
|
28
|
-
- Removing unnecessary comments that describe obvious code
|
|
29
|
-
- IMPORTANT: Avoid nested ternary operators - prefer switch statements or if/else chains for multiple conditions
|
|
30
|
-
- Choose clarity over brevity - explicit code is often better than overly compact code
|
|
31
|
-
|
|
32
|
-
4. **Maintain Balance**: Avoid over-simplification that could:
|
|
33
|
-
|
|
34
|
-
- Reduce code clarity or maintainability
|
|
35
|
-
- Create overly clever solutions that are hard to understand
|
|
36
|
-
- Combine too many concerns into single functions or components
|
|
37
|
-
- Remove helpful abstractions that improve code organization
|
|
38
|
-
- Prioritize "fewer lines" over readability (e.g., nested ternaries, dense one-liners)
|
|
39
|
-
- Make the code harder to debug or extend
|
|
40
|
-
|
|
41
|
-
5. **Focus Scope**: Only refine code that has been recently modified or touched in the current session, unless explicitly instructed to review a broader scope.
|
|
42
|
-
|
|
43
|
-
Your refinement process:
|
|
44
|
-
|
|
45
|
-
1. Identify the recently modified code sections
|
|
46
|
-
2. Analyze for opportunities to improve elegance and consistency
|
|
47
|
-
3. Apply project-specific best practices and coding standards
|
|
48
|
-
4. Ensure all functionality remains unchanged
|
|
49
|
-
5. Verify the refined code is simpler and more maintainable
|
|
50
|
-
6. Document only significant changes that affect understanding
|
|
51
|
-
|
|
52
|
-
You operate autonomously and proactively, refining code immediately after it's written or modified without requiring explicit requests. Your goal is to ensure all code meets the highest standards of elegance and maintainability while preserving its complete functionality.
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Generate PR title and description following best practices
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Generate PR Description
|
|
6
|
-
|
|
7
|
-
Extract branch information:
|
|
8
|
-
|
|
9
|
-
!`git branch --show-current`
|
|
10
|
-
!`git log main..HEAD --oneline --no-merges`
|
|
11
|
-
!`git diff main...HEAD --name-only | grep -v __tests__ | grep -v .spec.`
|
|
12
|
-
|
|
13
|
-
## Extract Ticket Identifier
|
|
14
|
-
|
|
15
|
-
Parse the branch name to extract the ticket identifier dynamically:
|
|
16
|
-
|
|
17
|
-
**Pattern to detect:** `<type>/<prefix>-<number>` (e.g., `feat/api-123`, `fix/bug-456`)
|
|
18
|
-
|
|
19
|
-
**Extraction logic:**
|
|
20
|
-
1. Get branch name (e.g., `feat/api-123`)
|
|
21
|
-
2. Extract the part after the slash: `api-123`
|
|
22
|
-
3. Split by dash to get prefix (`api`) and number (`123`)
|
|
23
|
-
4. Convert prefix to uppercase: `API`
|
|
24
|
-
5. Combine to form ticket: `API-123`
|
|
25
|
-
|
|
26
|
-
**Examples:**
|
|
27
|
-
- `feat/dcp-994` → `DCP-994`
|
|
28
|
-
- `fix/api-123` → `API-123`
|
|
29
|
-
- `refactor/proj-456` → `PROJ-456`
|
|
30
|
-
|
|
31
|
-
**If no ticket pattern found:** Omit ticket from PR title.
|
|
32
|
-
|
|
33
|
-
## Generate PR Title
|
|
34
|
-
|
|
35
|
-
Format: `TICKET-123 type: brief description` or `type: brief description` (if no ticket)
|
|
36
|
-
|
|
37
|
-
**Rules:**
|
|
38
|
-
|
|
39
|
-
- Extract ticket dynamically from branch name (e.g., `feat/api-123` → `API-123`)
|
|
40
|
-
- Use conventional commit types: `feat:`, `fix:`, `refactor:`, `docs:`, `chore:`, etc.
|
|
41
|
-
- Title description starts uppercase, lowercase after colon
|
|
42
|
-
- Brief and descriptive
|
|
43
|
-
- NO emojis
|
|
44
|
-
|
|
45
|
-
**Examples:**
|
|
46
|
-
- `API-123 feat: add user authentication endpoint` (from branch `feat/api-123`)
|
|
47
|
-
- `PROJ-456 fix: resolve database connection timeout` (from branch `fix/proj-456`)
|
|
48
|
-
- `refactor: simplify error handling logic` (no ticket in branch name)
|
|
49
|
-
|
|
50
|
-
Generate PR description:
|
|
51
|
-
|
|
52
|
-
```
|
|
53
|
-
## Summary
|
|
54
|
-
|
|
55
|
-
Brief overview of what this PR accomplishes.
|
|
56
|
-
Avoid "Enhance", "Improve", "Fix". Focus on actual changes.
|
|
57
|
-
|
|
58
|
-
## Changes
|
|
59
|
-
|
|
60
|
-
### Category Name
|
|
61
|
-
|
|
62
|
-
- Main change with code elements in `backticks`
|
|
63
|
-
- Another key change
|
|
64
|
-
- Implementation detail
|
|
65
|
-
|
|
66
|
-
### Another Category (if needed)
|
|
67
|
-
|
|
68
|
-
- Key change in this category
|
|
69
|
-
- Another important change
|
|
70
|
-
|
|
71
|
-
### Minor Improvements (if applicable)
|
|
72
|
-
|
|
73
|
-
- Small cleanup items
|
|
74
|
-
- Minor refactoring
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
**Category examples based on context:**
|
|
78
|
-
- Backend: API, Database, Authentication, Performance, Error Handling
|
|
79
|
-
- Frontend: UI, Components, State Management, Routing, Styling
|
|
80
|
-
- Infrastructure: CI/CD, Docker, Configuration, Deployment
|
|
81
|
-
- General: Refactoring, Testing, Documentation, Dependencies
|
|
82
|
-
|
|
83
|
-
**Code formatting:** Use backticks for variables, components, functions, files, endpoints, config values.
|
|
84
|
-
|
|
85
|
-
**DO NOT include:**
|
|
86
|
-
|
|
87
|
-
- "Generated with AI" footer
|
|
88
|
-
- Test plan section (unless requested)
|
|
89
|
-
- Files changed list
|
|
90
|
-
- Test file mentions
|
|
91
|
-
- NO emojis
|
|
92
|
-
|
|
93
|
-
Provide title and description ready for GitHub PR creation.
|
|
94
|
-
|
|
95
|
-
**CRITICAL FORMATTING RULES:**
|
|
96
|
-
|
|
97
|
-
- The PR Description MUST be wrapped in a code block with triple backticks ONLY (no language specified)
|
|
98
|
-
- CORRECT: ` followed by content followed by `
|
|
99
|
-
- INCORRECT: `markdown followed by content followed by `
|
|
100
|
-
- All markdown symbols (##, ###, -, etc.) MUST be visible as plain text in the output
|
|
101
|
-
- User should be able to copy the entire code block content directly to GitHub
|
|
102
|
-
- Ensure clarity and conciseness in both title and description
|
package/commands/create-pr.md
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Create PR on GitHub with optional reviewer
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Create Pull Request
|
|
6
|
-
|
|
7
|
-
## Configuration
|
|
8
|
-
|
|
9
|
-
**Base branch:** Default is `main` (will be detected from repo)
|
|
10
|
-
|
|
11
|
-
## Pre-flight Checks
|
|
12
|
-
|
|
13
|
-
Check uncommitted changes:
|
|
14
|
-
!`git status --porcelain`
|
|
15
|
-
|
|
16
|
-
**If changes exist:** Ask user to commit first (conventional commit), continue anyway, or abort.
|
|
17
|
-
|
|
18
|
-
Check if branch pushed:
|
|
19
|
-
!`git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null`
|
|
20
|
-
|
|
21
|
-
**If not pushed:** Auto-push with `git push -u origin HEAD` and inform user.
|
|
22
|
-
|
|
23
|
-
## Generate PR Title and Description
|
|
24
|
-
|
|
25
|
-
Use the `/create-pr-description` command to generate the PR title and description.
|
|
26
|
-
|
|
27
|
-
This command will:
|
|
28
|
-
- Extract branch information and ticket identifiers
|
|
29
|
-
- Generate a properly formatted PR title
|
|
30
|
-
- Create a comprehensive PR description following best practices
|
|
31
|
-
|
|
32
|
-
**Important:** Store the title and description output from `/create-pr-description` for use in the PR creation step.
|
|
33
|
-
|
|
34
|
-
## Create PR
|
|
35
|
-
|
|
36
|
-
**Before creating PR, ask the user:**
|
|
37
|
-
|
|
38
|
-
"Would you like to add a reviewer to this PR?"
|
|
39
|
-
- If yes: Ask for the GitHub username
|
|
40
|
-
- If no: Skip the reviewer
|
|
41
|
-
|
|
42
|
-
Use `gh pr create` with the title and description from `/create-pr-description`:
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
# Without reviewer
|
|
46
|
-
gh pr create --base main --title "<TITLE_FROM_COMMAND>" --body "$(cat <<'EOF'
|
|
47
|
-
<DESCRIPTION_FROM_COMMAND>
|
|
48
|
-
EOF
|
|
49
|
-
)"
|
|
50
|
-
|
|
51
|
-
# With reviewer (if user provided username)
|
|
52
|
-
gh pr create --base main --title "<TITLE_FROM_COMMAND>" --reviewer <username> --body "$(cat <<'EOF'
|
|
53
|
-
<DESCRIPTION_FROM_COMMAND>
|
|
54
|
-
EOF
|
|
55
|
-
)"
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
**Notes:**
|
|
59
|
-
- Use the exact title generated by `/create-pr-description`
|
|
60
|
-
- Use the exact description generated by `/create-pr-description`
|
|
61
|
-
- Use the Question tool to ask about reviewer
|
|
62
|
-
|
|
63
|
-
## Output
|
|
64
|
-
|
|
65
|
-
After creating:
|
|
66
|
-
|
|
67
|
-
- Display PR URL as clickable link
|
|
68
|
-
- Confirm PR created
|
|
69
|
-
- Confirm reviewer assigned (if applicable)
|
|
70
|
-
|
|
71
|
-
## Error Handling
|
|
72
|
-
|
|
73
|
-
- No `gh` auth → tell user to run `gh auth login`
|
|
74
|
-
- PR exists → show existing URL
|
|
75
|
-
- On main/master → abort with error
|
|
76
|
-
- Reviewer can't be assigned → create anyway and inform
|
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Generate/update React/TypeScript tests with Jest + RTL (90% coverage)
|
|
3
|
-
agent: build
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Generate / Update React & Hook Tests
|
|
7
|
-
|
|
8
|
-
Generate or update comprehensive tests for TypeScript React components/hooks using Jest + React Testing Library.
|
|
9
|
-
|
|
10
|
-
**Target:** 90% coverage minimum
|
|
11
|
-
|
|
12
|
-
## Project Context
|
|
13
|
-
|
|
14
|
-
**Adapt these to your project:**
|
|
15
|
-
|
|
16
|
-
- **TypeScript**: Latest version (strict mode, no `any`)
|
|
17
|
-
- **Jest**: Latest version
|
|
18
|
-
- **Testing Library**: @testing-library/react, @testing-library/user-event
|
|
19
|
-
- **Coverage**: 90% all metrics
|
|
20
|
-
- **File Naming**: `*.spec.tsx` for components/hooks, `*.spec.ts` for utils
|
|
21
|
-
- **Location**: `__tests__` sibling folder (or configure as needed)
|
|
22
|
-
|
|
23
|
-
## Critical Rules
|
|
24
|
-
|
|
25
|
-
### TypeScript
|
|
26
|
-
|
|
27
|
-
- **NEVER `any`**. Use types, interfaces, `unknown`, generics
|
|
28
|
-
- Use `jest.mocked(moduleFn)` for typed mocks
|
|
29
|
-
- Safe checks: `Object.prototype.hasOwnProperty.call(obj, key)`
|
|
30
|
-
- ESM imports only
|
|
31
|
-
|
|
32
|
-
### Window & Browser APIs
|
|
33
|
-
|
|
34
|
-
**Best Practice**: Abstract browser APIs with utility functions:
|
|
35
|
-
|
|
36
|
-
```ts
|
|
37
|
-
// utils/windowUtils.ts
|
|
38
|
-
export const getLocationPathname = () => window.location.pathname;
|
|
39
|
-
export const getLocationHostname = () => window.location.hostname;
|
|
40
|
-
export const navigateToUrl = (url: string) => { window.location.href = url; };
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
Mock in tests:
|
|
44
|
-
|
|
45
|
-
```ts
|
|
46
|
-
jest.mock("utils/windowUtils", () => ({
|
|
47
|
-
getLocationPathname: jest.fn(() => "/mock/path"),
|
|
48
|
-
getLocationHostname: jest.fn(() => "localhost"),
|
|
49
|
-
navigateToUrl: jest.fn(),
|
|
50
|
-
}));
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### Routing
|
|
54
|
-
|
|
55
|
-
**NEVER hardcode routes.** Import constants:
|
|
56
|
-
|
|
57
|
-
```ts
|
|
58
|
-
import { ROUTES } from "constants/routes";
|
|
59
|
-
// or import from routing config
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
### Common Mocks
|
|
63
|
-
|
|
64
|
-
```ts
|
|
65
|
-
// State management (adjust to your store)
|
|
66
|
-
jest.mock("store/useUserStore");
|
|
67
|
-
|
|
68
|
-
// Feature flags (if applicable)
|
|
69
|
-
jest.mock("constants/feature-flags", () => ({
|
|
70
|
-
FEATURE_NAME: "feature-flag-key",
|
|
71
|
-
}));
|
|
72
|
-
|
|
73
|
-
// React Router (if applicable)
|
|
74
|
-
jest.mock("react-router-dom", () => ({
|
|
75
|
-
useNavigate: jest.fn(() => jest.fn()),
|
|
76
|
-
useParams: jest.fn(() => ({})),
|
|
77
|
-
}));
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
## Test Modes
|
|
81
|
-
|
|
82
|
-
### Create Mode (New File)
|
|
83
|
-
|
|
84
|
-
1. Happy Path - baseline render/behavior
|
|
85
|
-
2. Edge Cases - empty, null, undefined
|
|
86
|
-
3. Error Handling - API rejects, exceptions
|
|
87
|
-
4. Behavioral Variants - interactions, branches
|
|
88
|
-
5. Performance (only if memoization)
|
|
89
|
-
|
|
90
|
-
### Update Mode (Existing File)
|
|
91
|
-
|
|
92
|
-
1. Remove obsolete tests
|
|
93
|
-
2. Replace direct `window.*` with utility mocks
|
|
94
|
-
3. Add tests for new branches
|
|
95
|
-
4. Maintain ≥90% coverage
|
|
96
|
-
|
|
97
|
-
## Component Test Template
|
|
98
|
-
|
|
99
|
-
```ts
|
|
100
|
-
import { render, screen } from '@testing-library/react';
|
|
101
|
-
import userEvent from '@testing-library/user-event';
|
|
102
|
-
import { ComponentName } from '../ComponentName';
|
|
103
|
-
|
|
104
|
-
const PROP_VARIANTS = [
|
|
105
|
-
{ name: 'default', props: { title: 'Title' } },
|
|
106
|
-
{ name: 'minimal', props: { title: 'T' } },
|
|
107
|
-
];
|
|
108
|
-
|
|
109
|
-
const renderComponent = (override = {}) => {
|
|
110
|
-
const base = { title: 'Title', isVisible: true };
|
|
111
|
-
return render(<ComponentName {...base} {...override} />);
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
describe('ComponentName', () => {
|
|
115
|
-
beforeEach(() => jest.clearAllMocks());
|
|
116
|
-
|
|
117
|
-
describe('Happy Path', () => {
|
|
118
|
-
it('renders base state', () => {
|
|
119
|
-
renderComponent();
|
|
120
|
-
expect(screen.getByText('Title')).toBeInTheDocument();
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
describe('Edge Cases', () => {
|
|
125
|
-
[
|
|
126
|
-
{ label: 'empty title', props: { title: '' } },
|
|
127
|
-
].forEach(({ label, props }) => {
|
|
128
|
-
it(`handles ${label}`, () => {
|
|
129
|
-
renderComponent(props);
|
|
130
|
-
expect(screen.getByRole('main')).toBeInTheDocument();
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
## Hook Test Template
|
|
138
|
-
|
|
139
|
-
```ts
|
|
140
|
-
import { renderHook, act } from "@testing-library/react";
|
|
141
|
-
import { useCustomHook } from "../useCustomHook";
|
|
142
|
-
|
|
143
|
-
describe("useCustomHook", () => {
|
|
144
|
-
it("handles default init", () => {
|
|
145
|
-
const { result } = renderHook(() => useCustomHook(undefined));
|
|
146
|
-
expect(result.current).toBeDefined();
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
it("updates state", () => {
|
|
150
|
-
const { result } = renderHook(() => useCustomHook(undefined));
|
|
151
|
-
act(() => {
|
|
152
|
-
result.current.setValue?.(5);
|
|
153
|
-
});
|
|
154
|
-
expect(result.current).toBeDefined();
|
|
155
|
-
});
|
|
156
|
-
});
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
## Process
|
|
160
|
-
|
|
161
|
-
1. Determine path: `<dir>/__tests__/<name>.spec.ts[x]`
|
|
162
|
-
2. Check if exists → create or update mode
|
|
163
|
-
3. Parse implementation (branches, external calls, side-effects)
|
|
164
|
-
4. Generate test suites with data tables
|
|
165
|
-
5. Replace direct browser API calls with abstractions
|
|
166
|
-
6. Run quality gates
|
|
167
|
-
|
|
168
|
-
## Quality Gates
|
|
169
|
-
|
|
170
|
-
**ALL must pass:**
|
|
171
|
-
|
|
172
|
-
```bash
|
|
173
|
-
yarn lint # No warnings
|
|
174
|
-
yarn type-check # Zero errors
|
|
175
|
-
yarn test path/to/file.spec.tsx --coverage # ≥90%
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
## Anti-Patterns
|
|
179
|
-
|
|
180
|
-
- Direct `window.location.assign(...)` without abstraction
|
|
181
|
-
- Overwriting `window.location.pathname` directly
|
|
182
|
-
- Hardcoded routes like `/dashboard/settings`
|
|
183
|
-
- Deep nesting >3 levels
|
|
184
|
-
- Using `any`
|
|
185
|
-
- Mocking i18n/translation libraries (initialize properly in setup)
|
|
186
|
-
|
|
187
|
-
## Naming
|
|
188
|
-
|
|
189
|
-
✅ Good: `it('redirects to overview when role missing')`
|
|
190
|
-
❌ Bad: `it('test redirect 1')`
|
|
191
|
-
|
|
192
|
-
## Customization Notes
|
|
193
|
-
|
|
194
|
-
**This template uses:**
|
|
195
|
-
- **yarn** as package manager
|
|
196
|
-
- React Testing Library for component tests
|
|
197
|
-
- Jest as test runner
|
|
198
|
-
- TypeScript strict mode
|
|
199
|
-
- ESM module system
|
|
200
|
-
|
|
201
|
-
**Adapt for your project:**
|
|
202
|
-
- Different package manager (`npm`, `pnpm`)
|
|
203
|
-
- Different test location (e.g., `src/__tests__`, `tests/`)
|
|
204
|
-
- Different naming convention (e.g., `.test.tsx`)
|
|
205
|
-
- Different coverage thresholds
|
|
206
|
-
- Project-specific mocks and utilities
|
|
207
|
-
- Alternative testing libraries (Vitest, etc.)
|
package/mcps/context7/.mcp.json
DELETED
package/mcps/expo-mcp/.mcp.json
DELETED
package/mcps/figma-mcp/.mcp.json
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: github-cli
|
|
3
|
-
description: This skill should be used when the user wants to interact with GitHub repositories, issues, pull requests, releases, or any GitHub-related operations. Use the gh CLI instead of MCP tools for all GitHub operations.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# GitHub CLI Skill
|
|
7
|
-
|
|
8
|
-
This skill provides instructions for using the `gh` CLI to interact with GitHub, replacing the need for the GitHub MCP server.
|
|
9
|
-
|
|
10
|
-
## Prerequisites
|
|
11
|
-
|
|
12
|
-
The `gh` CLI is already authenticated. Verify with:
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
gh auth status
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Pull Requests
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
# List PRs
|
|
22
|
-
gh pr list
|
|
23
|
-
gh pr list --state=all --limit=20
|
|
24
|
-
|
|
25
|
-
# View PR details
|
|
26
|
-
gh pr view <number>
|
|
27
|
-
gh pr view <number> --comments
|
|
28
|
-
|
|
29
|
-
# Create PR
|
|
30
|
-
gh pr create --title "Title" --body "Description"
|
|
31
|
-
gh pr create --fill # Auto-fill from commits
|
|
32
|
-
|
|
33
|
-
# Review PR
|
|
34
|
-
gh pr review <number> --approve
|
|
35
|
-
gh pr review <number> --request-changes --body "Comments"
|
|
36
|
-
|
|
37
|
-
# Merge PR
|
|
38
|
-
gh pr merge <number> --squash
|
|
39
|
-
gh pr merge <number> --merge
|
|
40
|
-
|
|
41
|
-
# Check PR status
|
|
42
|
-
gh pr checks <number>
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## Issues
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
# List issues
|
|
49
|
-
gh issue list
|
|
50
|
-
gh issue list --label "bug" --state=open
|
|
51
|
-
|
|
52
|
-
# View issue
|
|
53
|
-
gh issue view <number>
|
|
54
|
-
|
|
55
|
-
# Create issue
|
|
56
|
-
gh issue create --title "Title" --body "Description"
|
|
57
|
-
|
|
58
|
-
# Close issue
|
|
59
|
-
gh issue close <number>
|
|
60
|
-
|
|
61
|
-
# Add comment
|
|
62
|
-
gh issue comment <number> --body "Comment text"
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## Repository Operations
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
# Clone
|
|
69
|
-
gh repo clone owner/repo
|
|
70
|
-
|
|
71
|
-
# View repo info
|
|
72
|
-
gh repo view owner/repo
|
|
73
|
-
|
|
74
|
-
# List branches
|
|
75
|
-
gh api repos/{owner}/{repo}/branches --jq '.[].name'
|
|
76
|
-
|
|
77
|
-
# Get file contents
|
|
78
|
-
gh api repos/{owner}/{repo}/contents/path/to/file --jq '.content' | base64 -d
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
## Search
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
# Search code
|
|
85
|
-
gh search code "pattern" --repo=owner/repo
|
|
86
|
-
|
|
87
|
-
# Search issues/PRs
|
|
88
|
-
gh search issues "query" --repo=owner/repo
|
|
89
|
-
gh search prs "query" --repo=owner/repo
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
## Releases
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
# List releases
|
|
96
|
-
gh release list
|
|
97
|
-
|
|
98
|
-
# View latest
|
|
99
|
-
gh release view --latest
|
|
100
|
-
|
|
101
|
-
# Create release
|
|
102
|
-
gh release create v1.0.0 --title "v1.0.0" --notes "Notes"
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
## API Access
|
|
106
|
-
|
|
107
|
-
For any operation not covered above, use the generic API:
|
|
108
|
-
|
|
109
|
-
```bash
|
|
110
|
-
# GET request
|
|
111
|
-
gh api repos/{owner}/{repo}/endpoint
|
|
112
|
-
|
|
113
|
-
# POST request
|
|
114
|
-
gh api repos/{owner}/{repo}/issues -f title="Title" -f body="Body"
|
|
115
|
-
|
|
116
|
-
# With JQ filtering
|
|
117
|
-
gh api repos/{owner}/{repo}/pulls --jq '.[].title'
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
## Tips
|
|
121
|
-
|
|
122
|
-
- Most commands accept `--json` for JSON output
|
|
123
|
-
- Use `--jq` to filter JSON responses
|
|
124
|
-
- From a git repo, `gh` auto-detects owner/repo
|
|
125
|
-
- Use `-R owner/repo` to specify a different repository
|