@hiver/skills 1.0.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/README.md +394 -0
- package/build.js +15 -0
- package/collections/common/skills/create-prd/SKILL.md +43 -0
- package/collections/common/skills/discuss-problem/SKILL.md +55 -0
- package/collections/common/skills/explore-codebase/SKILL.md +79 -0
- package/collections/common/skills/prd-to-milestone/SKILL.md +40 -0
- package/collections/common/skills/refractor-and-clean/SKILL.md +41 -0
- package/collections/common/skills/solve-issue/SKILL.md +31 -0
- package/collections/common/skills/write-test-cases/SKILL.md +93 -0
- package/collections/web/agents/build-feature.md +42 -0
- package/collections/web/agents/build-milestone.md +61 -0
- package/collections/web/skills/build-component/SKILL.md +66 -0
- package/collections/web/skills/build-component/palette/README.md +3 -0
- package/collections/web/skills/build-component/palette/colors.md +87 -0
- package/collections/web/skills/build-component/references/best-practices.md +8 -0
- package/collections/web/skills/build-component/references/component-organization.md +21 -0
- package/collections/web/skills/build-component/references/figma-integration.md +5 -0
- package/collections/web/skills/build-component/references/icons.md +8 -0
- package/collections/web/skills/build-component/references/layout-and-structure.md +8 -0
- package/collections/web/skills/build-component/references/state-management.md +25 -0
- package/collections/web/skills/build-component/references/ui-kit-and-styling.md +13 -0
- package/collections/web/skills/build-component/typography/README.md +3 -0
- package/collections/web/skills/build-component/typography/variants.md +79 -0
- package/collections/web/skills/connect-api/SKILL.md +23 -0
- package/collections/web/skills/connect-api/references/api-call-structure.md +84 -0
- package/collections/web/skills/connect-api/references/best-practices.md +10 -0
- package/collections/web/skills/connect-api/references/data-fetchers.md +52 -0
- package/collections/web/skills/connect-api/references/error-handling.md +34 -0
- package/collections/web/skills/connect-api/references/hook-organization.md +11 -0
- package/collections/web/skills/connect-api/references/query-keys.md +21 -0
- package/collections/web/skills/connect-api/references/react-query-usage.md +83 -0
- package/collections/web/skills/connect-api/references/url-placeholders.md +17 -0
- package/collections/web/skills/scaffold-react-feature/SKILL.md +208 -0
- package/dist/cli.js +990 -0
- package/package.json +33 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: solve-issue
|
|
3
|
+
description: This skill is used to analyze the user issue, figure out the root cause and the fix to implement. Use it only when user explicitly asks to solve an issue or a problem statment.
|
|
4
|
+
dependencies: [build-milestone]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Solve issue
|
|
8
|
+
|
|
9
|
+
Helps to analyze the user's problem statement , their concerns and figure out the root causes and its solutions. Go through the problem statement in context of the codebase and help to come up with a good solution.
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
- Use this skill when user wanted to solve a specific bug or an issue in the codebase or a feature.
|
|
15
|
+
- This skill is helpful for solving an issue anywhere in the current codebase with proper implementation
|
|
16
|
+
|
|
17
|
+
## Instructions
|
|
18
|
+
|
|
19
|
+
- Get the problem statement from the user
|
|
20
|
+
- Analyze the problem, dig deep in it
|
|
21
|
+
- Analyze the problem statement in context of the current codebase
|
|
22
|
+
- Ask right questions until you are clear on the problem statment
|
|
23
|
+
- go through the codebase and figure out how we can solve this problem
|
|
24
|
+
- use the correct tools to explore the specific directory or file required to solve the or analyze the issue
|
|
25
|
+
- Provide your thoughts and opinions on how to tackle this
|
|
26
|
+
- Figure out problems, issues and edge cases which can come up while solving the problem
|
|
27
|
+
- take inputs from the user if he has any
|
|
28
|
+
- keep discussing until you and the user are not on the same page
|
|
29
|
+
- Keep discussing until all the issues being presented didn't got solved
|
|
30
|
+
- once both of you are on the same page ask the user if he needs to implement the fix or not
|
|
31
|
+
- if the users askes to implement it then implement the feature using the `/build-milestone` agent providing him the required inputs.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: write-test-cases
|
|
3
|
+
description: Writes structured behavioural test cases for a milestone into a progress-sheet markdown file. Invoked by build-milestone before any implementation begins (Normal Mode) or once per feedback round (Fix Mode). Never writes source code.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Write Test Cases
|
|
7
|
+
|
|
8
|
+
Generates a complete set of structured behavioural test cases for a milestone and saves them as a progress sheet that `build-milestone` uses to drive its TDD loop.
|
|
9
|
+
|
|
10
|
+
## When to Use
|
|
11
|
+
|
|
12
|
+
- Invoked by `build-milestone` at the start of **Normal Mode** — before any implementation begins
|
|
13
|
+
- Invoked by `build-milestone` at the start of **Fix Mode** — once per feedback round, scoped to the feedback
|
|
14
|
+
|
|
15
|
+
## Inputs
|
|
16
|
+
|
|
17
|
+
- Path to the milestone document (always required)
|
|
18
|
+
- Mode: `normal` or `feedback`
|
|
19
|
+
- If `feedback` mode: path to the feedback file
|
|
20
|
+
|
|
21
|
+
## Instructions
|
|
22
|
+
|
|
23
|
+
### Normal Mode
|
|
24
|
+
|
|
25
|
+
1. Read the milestone document thoroughly. Extract:
|
|
26
|
+
- Goal
|
|
27
|
+
- Acceptance criteria (2–3 product-level "done" conditions)
|
|
28
|
+
- Architectural approach and high-level areas affected
|
|
29
|
+
|
|
30
|
+
2. Explore the codebase **scoped strictly to the "High-level areas affected" section of the milestone doc**. Read only the files and directories explicitly named there. Do NOT fan out to unrelated modules. Limit reads to what is minimally needed to understand current state — what exists, what doesn't, what will change.
|
|
31
|
+
|
|
32
|
+
3. If the milestone doc contains Figma design links, load them using the Figma MCP tool. Analyze the designs to identify UI-specific behaviours and edge cases. Load only the specific nodes linked — do not traverse the full Figma file.
|
|
33
|
+
|
|
34
|
+
4. Derive test cases from the acceptance criteria and your codebase exploration. For each observable behaviour the milestone introduces or changes, write one test case. Aim for full coverage across:
|
|
35
|
+
- Happy path (primary user flows)
|
|
36
|
+
- Edge cases (boundary conditions, empty states, large data)
|
|
37
|
+
- Error states (API failures, invalid input, permission issues)
|
|
38
|
+
- Regressions (existing behaviours that must not break)
|
|
39
|
+
|
|
40
|
+
5. Write ALL test cases to `milestone-tests/<milestone-name>-tests.md` — create the file if it doesn't exist. All test cases start with `⬜ Pending` status.
|
|
41
|
+
|
|
42
|
+
6. Use this format for every test case:
|
|
43
|
+
|
|
44
|
+
```markdown
|
|
45
|
+
## TC-001 | Category: happy-path | ⬜ Pending
|
|
46
|
+
Given: <system or state precondition>
|
|
47
|
+
When: <user action or system trigger>
|
|
48
|
+
Then: <observable outcome — what the user sees or what changes in state>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
7. After writing all test cases, exit. Do not write any source code.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
### Feedback Mode
|
|
56
|
+
|
|
57
|
+
1. Read the milestone document to understand the original scope.
|
|
58
|
+
|
|
59
|
+
2. Read the feedback file. Identify the **active** (non-stale) feedback entry.
|
|
60
|
+
|
|
61
|
+
3. Explore the codebase to understand the current state of the implementation for this milestone.
|
|
62
|
+
|
|
63
|
+
4. Derive test cases scoped **only** to what the feedback describes. Write as many as needed to fully cover the feedback — happy path, edge cases, and regressions relevant to the fix.
|
|
64
|
+
|
|
65
|
+
5. Append the new test cases to the existing `milestone-tests/<milestone-name>-tests.md` under a new section:
|
|
66
|
+
|
|
67
|
+
```markdown
|
|
68
|
+
## Feedback Round N
|
|
69
|
+
|
|
70
|
+
### FTC-001 | Category: regression | ⬜ Pending
|
|
71
|
+
Given: <precondition>
|
|
72
|
+
When: <action>
|
|
73
|
+
Then: <expected outcome>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Where `N` is incremented from the last existing Feedback Round number in the file.
|
|
77
|
+
|
|
78
|
+
6. After appending, exit. Do not write any source code.
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Output
|
|
83
|
+
|
|
84
|
+
A `milestone-tests/<milestone-name>-tests.md` file (created or appended) with all new test cases set to `⬜ Pending`.
|
|
85
|
+
|
|
86
|
+
The `milestone-tests/` directory lives alongside the `milestones/` directory under the same parent.
|
|
87
|
+
|
|
88
|
+
## Rules
|
|
89
|
+
|
|
90
|
+
- NEVER write source code
|
|
91
|
+
- NEVER mark any test case as passing — all new TCs start as `⬜ Pending`
|
|
92
|
+
- NEVER modify existing test case entries — only append new ones
|
|
93
|
+
- In Feedback Mode, only write TCs scoped to the active feedback — do not add unrelated cases
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: build-feature
|
|
3
|
+
model: default
|
|
4
|
+
description: Senior Manager owning a PRD to build the feature from end to end
|
|
5
|
+
dependencies: [build-milestone]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
You are a Senior Manager who has owned a PRD to develop the feature or issue mentioned inside it from end to end.
|
|
9
|
+
|
|
10
|
+
> **HARD RULE — NEVER VIOLATE:**
|
|
11
|
+
> You are a **manager**, not an implementer. You MUST NEVER write, edit, or implement code yourself. Every milestone MUST be implemented exclusively by spawning a `build-milestone` subagent. Skipping subagent spawning and implementing directly is strictly forbidden, regardless of how simple a milestone appears.
|
|
12
|
+
|
|
13
|
+
**Token efficiency rules:**
|
|
14
|
+
- **Do NOT re-read milestone documents** after the initial analysis — you already know the scope.
|
|
15
|
+
- **Keep review conversations brief** — when presenting milestones to the user, summarize the changes in 3-5 bullet points instead of replaying the full milestone doc.
|
|
16
|
+
- **Spawn independent milestones in parallel** to avoid sequential context accumulation.
|
|
17
|
+
|
|
18
|
+
When invoked:
|
|
19
|
+
1. Ask for the directory path for the milestones implementation documents.
|
|
20
|
+
2. Analyze the documents inside that directory.
|
|
21
|
+
3. Create a `progress.md` in the same directory if not already present, listing all milestones in table format with status `Pending`:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
| Milestone | Status |
|
|
25
|
+
|-----------|--------|
|
|
26
|
+
| M1: <name> | Pending |
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Valid statuses: `Pending` | `In Progress` | `Review Required` | `Completed`
|
|
30
|
+
|
|
31
|
+
4. Pick the next milestone(s) that are not `Completed`. Start with all independent milestones first (they can be spawned in parallel). Dependent milestones only start after their dependencies are `Completed`.
|
|
32
|
+
5. **MANDATORY:** Spawn a `build-milestone` subagent in **normal mode** for each ready milestone, passing the milestone document path. You MUST spawn the subagent — do not implement the milestone yourself under any circumstances.
|
|
33
|
+
6. Wait for the subagent(s) to finish, then re-read `progress.md`.
|
|
34
|
+
7. If the milestone status is `Review Required`:
|
|
35
|
+
a. Present the milestone to the user with a brief summary (3-5 bullets of what changed) and ask for approval.
|
|
36
|
+
b. **If approved:** update `progress.md` → `Completed`. Repeat from step 4.
|
|
37
|
+
c. **If rejected:** collect the user's feedback. Write it to `milestone-feedbacks/<milestone-name>-feedback.md` in the same root directory (create the file if it doesn't exist; if it exists, mark all current active feedback entries as stale and append the new feedback as the active entry). **MANDATORY:** Spawn a `build-milestone` subagent in **fix mode**, passing both the milestone document path and the feedback file path. Repeat from step 6.
|
|
38
|
+
8. Once all milestones are `Completed`, run the following post-processing steps in order:
|
|
39
|
+
a. **Prettify** — get the list of all modified files via `git diff --name-only` and run the project formatter (Prettier / ESLint `--fix`) on them.
|
|
40
|
+
b. **Lint check** — run the linter on the same file set and surface any remaining errors to the user.
|
|
41
|
+
c. **Remove debug artifacts** — scan all modified files for leftover `console.log`, `debugger` statements, and agent-added `TODO` comments. Remove them.
|
|
42
|
+
9. Exit.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: build-milestone
|
|
3
|
+
model: sonnet
|
|
4
|
+
description: Senior Frontend specialist helping to complete a milestone from the PRD document.
|
|
5
|
+
dependencies: [write-test-cases]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
You are a Senior frontend developer with years of experience in frontend development, debugging issues and developing features from end to end.
|
|
9
|
+
|
|
10
|
+
**Source of truth principle:**
|
|
11
|
+
- The milestone document is the authority on **WHAT** — goal, architectural approach, feature flag, affected areas, skills to activate, and acceptance criteria.
|
|
12
|
+
- The `milestone-tests/<milestone-name>-tests.md` file is the authority on **test progress** — it is the single source of truth for what has been verified and what remains pending.
|
|
13
|
+
- The skills are the authority on **HOW** — exact files to create, exact registration lines, exact wiring and scaffolding. Never override a skill's output with anything written in the milestone doc. If there is a conflict, the skill wins.
|
|
14
|
+
|
|
15
|
+
**Token efficiency rules:**
|
|
16
|
+
- **Only load skills listed in the milestone doc's "Skills to activate" section**, with one exception below. Do NOT read or reference skills that are not listed. If the milestone says `skills: [build-component, connect-api]`, do NOT load `modify-extension`, `ci-cd`, `build-backbone-component`, or any other skill.
|
|
17
|
+
- **Auto-activate `build-component`**: Always activate the `build-component` skill by default for every milestone, even if it is not listed in "Skills to activate" — unless the milestone is explicitly backend-only or non-UI (e.g., pure API wiring, config changes, backend logic with no React/JSX involvement).
|
|
18
|
+
- **Within each skill, load reference files lazily** — only when you are about to perform the specific task that reference covers. Do NOT read all reference files upfront.
|
|
19
|
+
- **Minimize file re-reads** — read a file once, retain key details in your reasoning, do not re-read unless the file was modified.
|
|
20
|
+
|
|
21
|
+
**Invocation modes:**
|
|
22
|
+
|
|
23
|
+
## Normal Mode
|
|
24
|
+
Invoked with: milestone document path only.
|
|
25
|
+
|
|
26
|
+
1. Ask for the path to the milestone document.
|
|
27
|
+
2. Read the milestone document thoroughly. Extract: goal, architectural approach, feature flag decision, skills to activate, and acceptance criteria.
|
|
28
|
+
3. Update `progress.md` → status: **In Progress** for the current milestone.
|
|
29
|
+
4. **Invoke the `write-test-cases` skill (Normal Mode)** — pass the milestone document path. Wait for the skill to finish writing all test cases to `milestone-tests/<milestone-name>-tests.md` before proceeding. Do not write any implementation code before this step completes.
|
|
30
|
+
5. **Batched TDD loop** — read `milestone-tests/<milestone-name>-tests.md` **once** and load all `⬜ Pending` TCs into memory. Do NOT re-read the file on each iteration. **Group related TCs** (e.g., TCs that test the same component, same API, or same user flow) and implement them together in batches:
|
|
31
|
+
a. Pick the next batch of related `⬜ Pending` TCs from the in-memory list (2-4 TCs per batch when they share implementation scope).
|
|
32
|
+
b. If none remain → all TCs pass → go to step 6.
|
|
33
|
+
c. Reason: "what code do I need to write to make this batch of TCs pass?" — think before acting.
|
|
34
|
+
d. Implement using **only** the skills listed in the milestone doc's "Skills to activate" section, invoking them in this order as needed:
|
|
35
|
+
- `scaffold-react-feature` → folder structure, wiring, feature flag boilerplate
|
|
36
|
+
- `build-component` → UI (React path)
|
|
37
|
+
- `connect-api` → data fetching and mutations
|
|
38
|
+
e. Trace through the implemented code — do the `Then` conditions of all TCs in the batch hold?
|
|
39
|
+
- All pass → update all statuses to `✅ Pass` in the test file (single write) → go to step (a)
|
|
40
|
+
- Some fail → re-think → fix code → trace again → update statuses → go to step (a)
|
|
41
|
+
6. Once every test case passes, update `progress.md` → status: **Review Required** and exit.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Fix Mode
|
|
46
|
+
Invoked with: milestone document path + feedback file path.
|
|
47
|
+
|
|
48
|
+
1. Read the milestone document to understand the goal and scope.
|
|
49
|
+
2. Read the feedback file. Identify the **active** (non-stale) feedback entry — this is the only feedback to address.
|
|
50
|
+
3. Update `progress.md` → status: **In Progress** for the current milestone.
|
|
51
|
+
4. **Invoke the `write-test-cases` skill (Feedback Mode)** — pass the milestone document path and feedback file path. Wait for the skill to finish appending the new feedback-scoped TCs under `## Feedback Round N` in the existing `milestone-tests/<milestone-name>-tests.md`.
|
|
52
|
+
5. **Batched TDD loop** — read `milestone-tests/<milestone-name>-tests.md` **once**, load the `⬜ Pending` TCs from the current Feedback Round section into memory. Group related TCs and implement in batches:
|
|
53
|
+
a. Pick the next batch of related `⬜ Pending` TCs from the in-memory list.
|
|
54
|
+
b. If none remain → go to step 6.
|
|
55
|
+
c. Reason: "what change do I need to make to satisfy this batch of TCs?" — think before acting.
|
|
56
|
+
d. Apply only the changes needed to address the active feedback. Do **not** re-scaffold or re-implement what is already done. Load **only** the skills needed for the fix.
|
|
57
|
+
e. Trace through the changed code — do the `Then` conditions hold?
|
|
58
|
+
- All pass → update statuses in the test file → go to step (a)
|
|
59
|
+
- Some fail → re-think → fix → trace again → update statuses → go to step (a)
|
|
60
|
+
6. Once all feedback TCs pass, mark the active feedback entry in the feedback file as stale (strikethrough heading and body, append `(stale)` label). Keep the entry — do not delete it.
|
|
61
|
+
7. Update `progress.md` → status: **Review Required** and exit.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: build-component
|
|
3
|
+
description: Build UI React components following Hiver design system and patterns
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Build Component
|
|
7
|
+
|
|
8
|
+
**Scope:** Pure UI concerns only — Figma → React component, Hiver UI kit, layout, icons, typography, component organization, and UI-level state management.
|
|
9
|
+
|
|
10
|
+
**Out of scope:** Feature folder structure, Backbone mounting, `ReactBackboneModules` registration, lazy imports in `index.js`, and feature flag wiring. Those belong in the `scaffold-react-feature` skill.
|
|
11
|
+
|
|
12
|
+
When building UI React components, use the currently selected Figma node as the design reference and follow the Hiver design system. Use `@hiver/hiver-ui-kit` for all components; prefer `Stack` for layout and MUI/SVG for icons. Map Figma colors and text styles using the **palette** and **typography** references below.
|
|
13
|
+
|
|
14
|
+
## Mandatory Rules (always apply)
|
|
15
|
+
|
|
16
|
+
### UI Kit and Styling
|
|
17
|
+
|
|
18
|
+
- **Use `@hiver/hiver-ui-kit` package** for all UI components and styling
|
|
19
|
+
- This package uses Material-UI (MUI) internally, so follow MUI patterns
|
|
20
|
+
- Import components directly from `@hiver/hiver-ui-kit`: `import { Stack, Button, Typography, TextField, Select } from '@hiver/hiver-ui-kit'`
|
|
21
|
+
- **Map Figma to design tokens**: Use [palette/README.md](palette/README.md) for colors and [typography/README.md](typography/README.md) for text styles so Figma specs map to the correct `theme.palette.*` and `<Typography variant="...">`.
|
|
22
|
+
- **Analyze the Figma selection** to identify all required components:
|
|
23
|
+
- Form inputs: Use `TextField`, `Select`, `Checkbox`, `Radio`, etc.
|
|
24
|
+
- Typography: Use `Typography` with variants from the typography reference (e.g. `body1_regular`, `h2_medium`, `caption1_medium`)
|
|
25
|
+
- Layout: Use `Stack`, `Box`, `Grid` for layout structure
|
|
26
|
+
- Buttons: Use `Button` with appropriate variants (`contained`, `outlined`, `text`)
|
|
27
|
+
- Modals: Use `Modal`
|
|
28
|
+
- Other: `Tooltip`, `CircularProgress`, `IconButton`, etc.
|
|
29
|
+
|
|
30
|
+
### Layout and Structure
|
|
31
|
+
|
|
32
|
+
- **Prefer `Stack` component** for flex layouts instead of raw flexbox CSS
|
|
33
|
+
- Use `Stack` with `direction="row"` or `direction="column"`
|
|
34
|
+
- Use `gap` prop for spacing between items
|
|
35
|
+
- Example: `<Stack direction="row" gap={2} alignItems="center">`
|
|
36
|
+
- **Use `Box`** for simple container elements or when you need custom styling
|
|
37
|
+
- Use `sx` prop for component-specific styling
|
|
38
|
+
|
|
39
|
+
### Component Organization
|
|
40
|
+
|
|
41
|
+
- **Small sub-components** (less than ~50 lines, simple logic):
|
|
42
|
+
- Define them in the same file, outside the main component
|
|
43
|
+
- Place them above the main component export
|
|
44
|
+
- **Large sub-components** (complex logic, reusable, >50 lines):
|
|
45
|
+
- Extract to separate files in the same directory or `components/` subdirectory
|
|
46
|
+
- Follow the pattern: `ComponentName/index.js` for main component, `ComponentName/SubComponent.js` for sub-components
|
|
47
|
+
- Reference example: `react-extn/src/AiCopilot/Pages/Chat/components/` or `react-extn/src/AiCopilot/Pages/Tags/components/`
|
|
48
|
+
- **File naming**: Use PascalCase for component files (e.g., `TagItem.js`, `ModifyTagDialog.js`)
|
|
49
|
+
|
|
50
|
+
## Lazy-loaded References
|
|
51
|
+
|
|
52
|
+
**Load lazily — only read a reference file when you are about to perform that specific task. Do NOT read all files upfront.**
|
|
53
|
+
|
|
54
|
+
| Topic | File | When to load |
|
|
55
|
+
|-------|------|--------------|
|
|
56
|
+
| Figma integration | [references/figma-integration.md](references/figma-integration.md) | Only when a Figma link is present |
|
|
57
|
+
| Icons | [references/icons.md](references/icons.md) | Only when adding icons |
|
|
58
|
+
| State management | [references/state-management.md](references/state-management.md) | Only when adding local or shared state |
|
|
59
|
+
| Best practices | [references/best-practices.md](references/best-practices.md) | Only when uncertain about a pattern |
|
|
60
|
+
|
|
61
|
+
### Figma → design tokens (map colors and type from Figma here)
|
|
62
|
+
|
|
63
|
+
| Topic | File |
|
|
64
|
+
|-------|------|
|
|
65
|
+
| **Palette** (colors) | [palette/README.md](palette/README.md) |
|
|
66
|
+
| **Typography** (variants) | [typography/README.md](typography/README.md) |
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Palette reference (`@hiver/hiver-ui-kit`)
|
|
2
|
+
|
|
3
|
+
Use this to map Figma fill/text colors to theme tokens. Prefer `theme.palette.*` or `sx={{ color: '...' }}` with these tokens.
|
|
4
|
+
|
|
5
|
+
## Semantic / brand colors
|
|
6
|
+
|
|
7
|
+
| Token | Hex | Usage |
|
|
8
|
+
|-------|-----|--------|
|
|
9
|
+
| `palette.yellow.primary` | `#FFE250` | Primary yellow |
|
|
10
|
+
| `palette.yellow.hover` | `#FCCF59` | Yellow hover |
|
|
11
|
+
| `palette.yellow.light` | `#FFF0D3` | Yellow light bg |
|
|
12
|
+
| `palette.blue.primary` | `#196FE0` | Primary blue |
|
|
13
|
+
| `palette.blue.hover` | `#0456C2` | Blue hover |
|
|
14
|
+
| `palette.blue.light` | `#E2F1FF` | Blue light bg |
|
|
15
|
+
| `palette.purple.primary` | `#506DFF` | Primary purple (theme primary) |
|
|
16
|
+
| `palette.purple.hover` | `#4763F0` | Purple hover |
|
|
17
|
+
| `palette.purple.light` | `#F0F3FF` | Purple light bg |
|
|
18
|
+
| `palette.green.primary` | `#00BC7E` | Success / green |
|
|
19
|
+
| `palette.green.hover` | `#05A570` | Green hover |
|
|
20
|
+
| `palette.green.light` | `#E3FCF4` | Green light bg |
|
|
21
|
+
| `palette.red.primary` | `#CD3746` | Error / red |
|
|
22
|
+
| `palette.red.hover` | `#D24B58` | Red hover |
|
|
23
|
+
| `palette.red.light` | `#FFE0E3` | Red light bg |
|
|
24
|
+
| `palette.orange.primary` | `#FF8B00` | Warning / orange |
|
|
25
|
+
| `palette.orange.hover` | `#DE7D0A` | Orange hover |
|
|
26
|
+
| `palette.orange.light` | `#FFEFE0` | Orange light bg |
|
|
27
|
+
|
|
28
|
+
## Gray scale
|
|
29
|
+
|
|
30
|
+
| Token | Hex | Usage |
|
|
31
|
+
|-------|-----|--------|
|
|
32
|
+
| `palette.gray.gray1` | `#3E4C5A` | Darkest gray |
|
|
33
|
+
| `palette.gray.gray2` | `#4D596C` | Text primary |
|
|
34
|
+
| `palette.gray.gray3` | `#6F7C90` | |
|
|
35
|
+
| `palette.gray.gray4` | `#97A3B7` | Text secondary, disabled |
|
|
36
|
+
| `palette.gray.gray5` | `#D6DDE8` | |
|
|
37
|
+
| `palette.gray.gray6` | `#ECEFF6` | Borders, dividers |
|
|
38
|
+
| `palette.gray.gray6a` | `#F6F8FC` | |
|
|
39
|
+
| `palette.gray.gray7` | `#0F13160A` | Subtle overlay |
|
|
40
|
+
| `palette.gray.background` | `#FCFCFF` | Page background |
|
|
41
|
+
| `palette.gray.white16` | `rgba(255, 255, 255, 0.16)` | White 16% opacity |
|
|
42
|
+
| `palette.gray.white` | `#FFFFFF` | White |
|
|
43
|
+
| `palette.gray.black` | `#343C45` | Black / primary text |
|
|
44
|
+
|
|
45
|
+
## Tag colors
|
|
46
|
+
|
|
47
|
+
| Token | Hex |
|
|
48
|
+
|-------|-----|
|
|
49
|
+
| `palette.tag.gray` | `#90A4AE` |
|
|
50
|
+
| `palette.tag.green` | `#81C784` |
|
|
51
|
+
| `palette.tag.red` | `#E57373` |
|
|
52
|
+
| `palette.tag.yellow` | `#FFC107` |
|
|
53
|
+
| `palette.tag.blue` | `#64B5F6` |
|
|
54
|
+
| `palette.tag.teal` | `#4DD0E1` |
|
|
55
|
+
| `palette.tag.brown` | `#A1887F` |
|
|
56
|
+
| `palette.tag.pink` | `#FF5B92` |
|
|
57
|
+
| `palette.tag.purpleDark` | `#9575CD` |
|
|
58
|
+
| `palette.tag.purpleLight` | `#CE93D8` |
|
|
59
|
+
|
|
60
|
+
## Avatar colors (array)
|
|
61
|
+
|
|
62
|
+
Use `palette.avatar[index]` for avatar backgrounds (e.g. by user index).
|
|
63
|
+
|
|
64
|
+
| Index | Hex |
|
|
65
|
+
|-------|-----|
|
|
66
|
+
| 0 | `#F05388` |
|
|
67
|
+
| 1 | `#BE75CA` |
|
|
68
|
+
| 2 | `#E57373` |
|
|
69
|
+
| 3 | `#9575CD` |
|
|
70
|
+
| 4 | `#68B66B` |
|
|
71
|
+
| 5 | `#19ABBE` |
|
|
72
|
+
| 6 | `#A1887F` |
|
|
73
|
+
| 7 | `#64B5F6` |
|
|
74
|
+
|
|
75
|
+
## MUI theme mapping
|
|
76
|
+
|
|
77
|
+
Use these when wiring to MUI theme (e.g. `color="primary"`, `color="text.secondary"`).
|
|
78
|
+
|
|
79
|
+
- **Primary**: purple (main `#506DFF`)
|
|
80
|
+
- **Secondary**: yellow
|
|
81
|
+
- **Text primary**: `gray.gray2`
|
|
82
|
+
- **Text secondary**: `gray.gray4`
|
|
83
|
+
- **Success**: green
|
|
84
|
+
- **Error**: red
|
|
85
|
+
- **Info**: blue
|
|
86
|
+
- **Warning**: orange
|
|
87
|
+
- **Divider**: `gray.gray6`
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Best Practices
|
|
2
|
+
|
|
3
|
+
- **Follow existing code patterns** in the codebase
|
|
4
|
+
- **Use TypeScript/PropTypes** if the project uses them
|
|
5
|
+
- **Handle loading and error states** appropriately
|
|
6
|
+
- **Keep components focused** - single responsibility principle
|
|
7
|
+
- **Use meaningful variable and function names**
|
|
8
|
+
- **Add comments** for complex logic or non-obvious decisions
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Component Organization
|
|
2
|
+
|
|
3
|
+
- **Small sub-components** (less than ~50 lines, simple logic):
|
|
4
|
+
- Define them in the same file, outside the main component
|
|
5
|
+
- Place them above the main component export
|
|
6
|
+
- Example structure:
|
|
7
|
+
```javascript
|
|
8
|
+
const SubComponent = ({ prop1, prop2 }) => {
|
|
9
|
+
// component logic
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const MainComponent = () => {
|
|
13
|
+
// main component logic
|
|
14
|
+
return <SubComponent />;
|
|
15
|
+
};
|
|
16
|
+
```
|
|
17
|
+
- **Large sub-components** (complex logic, reusable, >50 lines):
|
|
18
|
+
- Extract to separate files in the same directory or `components/` subdirectory
|
|
19
|
+
- Reference example: `react-extn/src/AiCopilot/Pages/Chat/components/` or `react-extn/src/AiCopilot/Pages/Tags/components/`
|
|
20
|
+
- Follow the pattern: `ComponentName/index.js` for main component, `ComponentName/SubComponent.js` for sub-components
|
|
21
|
+
- **File naming**: Use PascalCase for component files (e.g., `TagItem.js`, `ModifyTagDialog.js`)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Icons
|
|
2
|
+
|
|
3
|
+
- **Use MUI icons only** - import from `@mui/icons-material` or `@hiver/hiver-ui-kit` icons
|
|
4
|
+
- **For SVG icons**: Import SVG files directly and use them in `<img>` tags
|
|
5
|
+
- Import SVG files: `import iconName from 'path/to/icon.svg'`
|
|
6
|
+
- Use in component: `<img src={iconName} alt="description" />`
|
|
7
|
+
- Example: `import AILogo from '../assets/ai_logo.svg'` then `<img src={AILogo} alt="AI Copilot" />`
|
|
8
|
+
- **Do not import icons from other packages** (no FontAwesome, Heroicons, etc.)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Layout and Structure
|
|
2
|
+
|
|
3
|
+
- **Prefer `Stack` component** for flex layouts instead of raw flexbox CSS
|
|
4
|
+
- Use `Stack` with `direction="row"` or `direction="column"`
|
|
5
|
+
- Use `gap` prop for spacing between items
|
|
6
|
+
- Example: `<Stack direction="row" gap={2} alignItems="center">`
|
|
7
|
+
- **Use `Box`** for simple container elements or when you need custom styling
|
|
8
|
+
- use `sx` prop for component-specific styling
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# State Management
|
|
2
|
+
|
|
3
|
+
## Identifying State
|
|
4
|
+
|
|
5
|
+
- **Connect dynamic elements to state**:
|
|
6
|
+
- User inputs (form fields, toggles, selections)
|
|
7
|
+
- Data that changes based on user interactions
|
|
8
|
+
- UI state (modals open/closed, tabs active, loading states)
|
|
9
|
+
|
|
10
|
+
## State Implementation
|
|
11
|
+
|
|
12
|
+
- **Use React hooks** for local component state:
|
|
13
|
+
- `useState` for simple state values
|
|
14
|
+
- `useReducer` for complex state with multiple sub-values
|
|
15
|
+
- `useMemo` for computed/derived values
|
|
16
|
+
- `useCallback` for memoized functions
|
|
17
|
+
- **Add proper event handlers**:
|
|
18
|
+
- `onChange` handlers for inputs
|
|
19
|
+
- `onClick` handlers for buttons/actions
|
|
20
|
+
- `onSubmit` handlers for forms
|
|
21
|
+
- Ensure handlers update state appropriately
|
|
22
|
+
- **Handle state updates correctly**:
|
|
23
|
+
- Use functional updates when state depends on previous state: `setCount(prev => prev + 1)`
|
|
24
|
+
- Batch related state updates when possible
|
|
25
|
+
- Clean up subscriptions/effects in `useEffect` cleanup functions
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# UI Kit and Styling
|
|
2
|
+
|
|
3
|
+
- **Use `@hiver/hiver-ui-kit` package** for all UI components and styling
|
|
4
|
+
- This package uses Material-UI (MUI) internally, so follow MUI patterns
|
|
5
|
+
- Import components directly from `@hiver/hiver-ui-kit`: `import { Stack, Button, Typography, TextField, Select } from '@hiver/hiver-ui-kit'`
|
|
6
|
+
- **Map Figma to design tokens**: Use [palette/README.md](../palette/README.md) for colors and [typography/README.md](../typography/README.md) for text styles so Figma specs map to the correct `theme.palette.*` and `<Typography variant="...">`.
|
|
7
|
+
- **Analyze the Figma selection** to identify all required components:
|
|
8
|
+
- Form inputs: Use `TextField`, `Select`, `Checkbox`, `Radio`, etc.
|
|
9
|
+
- Typography: Use `Typography` with variants from the typography reference (e.g. `body1_regular`, `h2_medium`, `caption1_medium`)
|
|
10
|
+
- Layout: Use `Stack`, `Box`, `Grid` for layout structure
|
|
11
|
+
- Buttons: Use `Button` with appropriate variants (`contained`, `outlined`, `text`)
|
|
12
|
+
- Modals: Use `Modal`
|
|
13
|
+
- Other: `Tooltip`, `CircularProgress`, `IconButton`, etc.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Typography reference (`@hiver/hiver-ui-kit`)
|
|
2
|
+
|
|
3
|
+
Map Figma text styles to `<Typography variant="...">`. Font family is **Open Sans**. Match by fontSize + fontWeight (regular 400, medium 500, semiBold 600, bold 700).
|
|
4
|
+
|
|
5
|
+
## Heading variants
|
|
6
|
+
|
|
7
|
+
| Variant | fontSize | fontWeight | lineHeight | letterSpacing | Figma match |
|
|
8
|
+
|---------|----------|------------|------------|---------------|-------------|
|
|
9
|
+
| `h1_medium` | 20 | 500 | 28px | -0.16px | Large title |
|
|
10
|
+
| `h1_semiBold` | 20 | 600 | 28px | -0.16px | |
|
|
11
|
+
| `h1_bold` | 20 | 700 | 28px | -0.16px | |
|
|
12
|
+
| `h2_regular` | 16 | 400 | 21px | -0.16px | Section title |
|
|
13
|
+
| `h2_medium` | 16 | 500 | 21px | -0.16px | |
|
|
14
|
+
| `h2_semiBold` | 16 | 600 | 21px | -0.16px | |
|
|
15
|
+
| `h2_5_regular` | 15 | 400 | 18px | -0.16px | |
|
|
16
|
+
| `h2_5_medium` | 15 | 500 | 18px | -0.16px | |
|
|
17
|
+
| `h2_5_semiBold` | 15 | 600 | 18px | -0.16px | |
|
|
18
|
+
| `h3_regular` | 14 | 400 | 18px | 0 | Subsection |
|
|
19
|
+
| `h3_medium` | 14 | 500 | 18px | 0 | |
|
|
20
|
+
| `h3_semiBold` | 14 | 600 | 18px | 0 | |
|
|
21
|
+
| `h4_regular` | 13 | 400 | 16px | 0 | |
|
|
22
|
+
| `h4_medium` | 13 | 500 | 16px | 0 | |
|
|
23
|
+
| `h4_semiBold` | 13 | 600 | 16px | 0 | |
|
|
24
|
+
| `h5_regular` | 12 | 400 | 14px | -0.12px | Small heading |
|
|
25
|
+
| `h5_medium` | 12 | 500 | 14px | -0.12px | |
|
|
26
|
+
| `h5_semiBold` | 12 | 600 | 14px | -0.12px | |
|
|
27
|
+
| `h5_bold` | 12 | 700 | 14px | -0.12px | |
|
|
28
|
+
|
|
29
|
+
## Body variants
|
|
30
|
+
|
|
31
|
+
| Variant | fontSize | fontWeight | lineHeight | letterSpacing |
|
|
32
|
+
|---------|----------|------------|------------|---------------|
|
|
33
|
+
| `body0_5_regular` | 16 | 400 | 22px | 0 |
|
|
34
|
+
| `body0_5_medium` | 16 | 500 | 22px | 0 |
|
|
35
|
+
| `body0_5_semiBold` | 16 | 600 | 22px | 0 |
|
|
36
|
+
| `body1_regular` | 14 | 400 | 21px | 0 |
|
|
37
|
+
| `body1_medium` | 14 | 500 | 21px | 0.25px |
|
|
38
|
+
| `body1_semiBold` | 14 | 600 | 21px | 0 |
|
|
39
|
+
| `body2_regular` | 13 | 400 | 18px | 0 |
|
|
40
|
+
| `body2_medium` | 13 | 500 | 18px | 0 |
|
|
41
|
+
| `body2_semiBold` | 13 | 600 | 18px | 0 |
|
|
42
|
+
| `body3_regular` | 12 | 400 | 14px | 0 |
|
|
43
|
+
| `body3_medium` | 12 | 500 | 14px | 0 |
|
|
44
|
+
| `body3_semiBold` | 12 | 600 | 14px | 0 |
|
|
45
|
+
| `body4_regular` | 11 | 400 | 12px | 0 |
|
|
46
|
+
| `body4_medium` | 11 | 500 | 12px | 0 |
|
|
47
|
+
| `body4_semiBold` | 11 | 600 | 12px | 0 |
|
|
48
|
+
|
|
49
|
+
## Caption & overline
|
|
50
|
+
|
|
51
|
+
| Variant | fontSize | fontWeight | lineHeight | letterSpacing | Notes |
|
|
52
|
+
|---------|----------|------------|------------|---------------|-------|
|
|
53
|
+
| `caption1_regular` | 12 | 400 | 16px | 0.25px | |
|
|
54
|
+
| `caption1_medium` | 12 | 500 | 16px | 0.25px | |
|
|
55
|
+
| `caption1_semiBold` | 12 | 600 | 16px | 0.25px | |
|
|
56
|
+
| `caption2_regular` | 11 | 400 | 14px | 0.20px | |
|
|
57
|
+
| `caption2_medium` | 11 | 500 | 14px | 0.20px | |
|
|
58
|
+
| `caption2_semiBold` | 11 | 600 | 14px | 0.20px | |
|
|
59
|
+
| `overline_medium` | 11 | 500 | 18px | 0 | UPPERCASE |
|
|
60
|
+
| `overline_semiBold` | 11 | 600 | 18px | 0 | UPPERCASE |
|
|
61
|
+
|
|
62
|
+
## Button & chip
|
|
63
|
+
|
|
64
|
+
| Variant | fontSize | fontWeight | lineHeight | letterSpacing |
|
|
65
|
+
|---------|----------|------------|------------|---------------|
|
|
66
|
+
| `buttonLarge` | 14 | 500 | 28px | 0.2px |
|
|
67
|
+
| `buttonMedium` | 13 | 500 | 24px | 0.2px |
|
|
68
|
+
| `buttonSmall` | 12 | 500 | 20px | 0.4px |
|
|
69
|
+
| `chip` | 12 | 500 | 12px | 0.4px |
|
|
70
|
+
|
|
71
|
+
## Usage
|
|
72
|
+
|
|
73
|
+
```jsx
|
|
74
|
+
<Typography variant="h2_medium">Section title</Typography>
|
|
75
|
+
<Typography variant="body1_regular">Body text</Typography>
|
|
76
|
+
<Typography variant="caption1_medium" color="text.secondary">Caption</Typography>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Figma → variant:** Compare Figma text style fontSize and weight (Regular/Medium/Semi Bold/Bold) to the tables above and pick the closest match.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: connect-api
|
|
3
|
+
description: API integration rules for React Query, custom hooks, and Hiver fetchers. Use when connecting to APIs, creating data-fetching or mutation hooks, or working with React Query and service utilities.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Connect API
|
|
7
|
+
|
|
8
|
+
When integrating APIs, use React Query for data and mutations, put hooks in a `hooks` folder, and use the correct fetcher from `react-extn/src/utils`. Define query keys in `constants/queries.js`.
|
|
9
|
+
|
|
10
|
+
## Reference files
|
|
11
|
+
|
|
12
|
+
**Load lazily — only read a reference file when you are about to perform that specific task. Do NOT read all files upfront.**
|
|
13
|
+
|
|
14
|
+
| Topic | File | When to load |
|
|
15
|
+
|-------|------|--------------|
|
|
16
|
+
| Hook organization | [references/hook-organization.md](references/hook-organization.md) | Before creating a new hook file |
|
|
17
|
+
| React Query (queries & mutations) | [references/react-query-usage.md](references/react-query-usage.md) | Before writing useQuery/useMutation |
|
|
18
|
+
| Query key management | [references/query-keys.md](references/query-keys.md) | Before defining query keys |
|
|
19
|
+
| Data fetcher selection | [references/data-fetchers.md](references/data-fetchers.md) | Before choosing a fetcher utility |
|
|
20
|
+
| API call structure | [references/api-call-structure.md](references/api-call-structure.md) | Before writing the fetch call body |
|
|
21
|
+
| URL and method placeholders | [references/url-placeholders.md](references/url-placeholders.md) | Only when constructing dynamic URLs |
|
|
22
|
+
| Error handling | [references/error-handling.md](references/error-handling.md) | Only when adding error/loading states |
|
|
23
|
+
| Best practices | [references/best-practices.md](references/best-practices.md) | Only when uncertain about a pattern |
|