Skip to content

Commit e4bc905

Browse files
nmergetmfranzke
andauthored
chore: update _instructions.md files for better copilot outputs (#5197)
* chore: update _instructions.md files for better copilot outputs fix: add some missing variables * chore: update snapshot * Update .changeset/cold-chairs-tease.md Co-authored-by: Maximilian Franzke <[email protected]> * Update packages/foundations/agent/_instructions.md Co-authored-by: Maximilian Franzke <[email protected]> * Update packages/foundations/agent/_instructions.md Co-authored-by: Maximilian Franzke <[email protected]> * Update packages/foundations/agent/_instructions.md --------- Co-authored-by: Maximilian Franzke <[email protected]>
1 parent 04bdac3 commit e4bc905

File tree

12 files changed

+283
-78
lines changed

12 files changed

+283
-78
lines changed

.changeset/cold-chairs-tease.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"@db-ux/core-foundations": patch
3+
"@db-ux/core-components": patch
4+
"@db-ux/agent-cli": patch
5+
---
6+
7+
chore: update instructions files for better copilot outputs
8+
fix: add some missing variables

packages/agent-cli/src/copilot/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,12 @@ export const generateCopilot = (rootPath: string) => {
113113
).trim();
114114
}
115115

116-
copilotFileContent += `\n${startMarker}\n${copilotInstructionsContent}\n${endMarker}\n`;
116+
copilotFileContent += `
117+
${startMarker}
118+
> **NOTE**: Always use "DB UX" components and variables as project's conventions
119+
${copilotInstructionsContent}
120+
${endMarker}
121+
`;
117122

118123
fs.writeFileSync(copilotInstructionsPath, copilotFileContent);
119124
}

packages/agent-cli/test/__snapshots__/index.spec.ts.snap

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
exports[`default > check if docs are created 1`] = `
44
"
5-
--- START: DB UX Copilot Instructions – do not edit below ---
6-
5+
--- START: DB UX Copilot Instructions – do not edit below ---
6+
> **NOTE**: Always use "DB UX" components and variables as project's conventions
7+
78
# @db-ux/components
89
- use y for frontend/node_modules/@db-ux/components/test.md
910
@@ -12,6 +13,6 @@ exports[`default > check if docs are created 1`] = `
1213
- use x for frontend/node_modules/@db-ux/foundations/test.md
1314
1415
15-
--- END: DB UX Copilot Instructions – do not edit above ---
16-
"
16+
--- END: DB UX Copilot Instructions – do not edit above ---
17+
"
1718
`;

packages/components/agent/_instructions.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22

33
### `DBButton` or `db-button`
44

5-
- available variants are `outline`, `brand`, `filled`, `ghost`
6-
- always use variant `outline` as default
5+
- available variants are `outlined`, `brand`, `filled`, `ghost`
6+
- always use variant `outlined` as default
77
- use variant `brand` as CTA or primary action
88
- if `noText`/`no-text` property is used add a `DBTooltip` or `db-tooltip` inside the Button
99
- always add a `type` as property as best practise
10+
11+
### `DBStack` or `db-stack`
12+
13+
- there is no property `gap="fix-md"`, available values are `small`, `medium`, etc.
14+
- there is no property `direction="horizontal"`, available values are `row`, `column`, etc.
Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,55 @@
11
## CSS
22

33
- If you use CSS, follow these rules:
4-
- for `variables` like, sizing, spacing, elevation, border or container-size use the file **agent-path**/agent/css/Variables.md
4+
- Always reference the file `**agent-path**/agent/css/Variables.md` for variables like sizing, spacing, elevation, border, or container-size. This file contains the authoritative list of available variables.
5+
- Use the examples provided in `Variables.md` to ensure correct usage like:
6+
- `padding: var(--db-spacing-fixed-md);`
7+
- `height: var(--db-sizing-md);`
8+
- `width: var(--db-container-xs);`
9+
- `color: var(--db-adaptive-on-bg-basic-emphasis-90-default);`
10+
- `background-color: var(--db-adaptive-bg-basic-level-2-default);`
11+
- `font: var(--db-type-body-sm);`
512

613
## SCSS
714

815
- If you use SCSS, follow these rules:
9-
- for `variables` like, sizing, spacing, elevation, border or container-size use the file **agent-path**/agent/scss/Variables.md
16+
- Always reference the file `**agent-path**/agent/scss/Variables.md` for variables like sizing, spacing, elevation, border, or container-size. This file contains the authoritative list of available variables.
17+
- Use the examples provided in `Variables.md` to ensure correct usage.
18+
- Always use `@use` for imports:
19+
- Variables: `@use "@db-ux/core-foundations/build/styles/variables";`
20+
- Colors: `@use "@db-ux/core-foundations/build/styles/colors";`
21+
- Fonts: `@use "@db-ux/core-foundations/build/styles/fonts";`
22+
- Never use `as *` for the `@use`, use it like this:
23+
- `padding: variables.$db-spacing-fixed-md;`
24+
- `height: variables.$db-sizing-md;`
25+
- `width: variables.$db-container-xs;`
26+
- `color: colors.$db-adaptive-on-bg-basic-emphasis-90-default;`
27+
- `background-color: colors.$db-adaptive-bg-basic-level-2-default;`
28+
- `font: fonts.$db-type-body-sm;`
1029

1130
## Tailwind
1231

1332
- If you use Tailwind, follow these rules:
14-
- for `variables` like, sizing, spacing, elevation, border or container-size use the file **agent-path**/agent/tailwind/Variables.md
33+
- Always reference the file `**agent-path**/agent/tailwind/Variables.md` for variables like sizing, spacing, elevation, border, or container-size. This file contains the authoritative list of available variables.
34+
- Use the examples provided in `Variables.md` to ensure correct usage like:
35+
- padding: `p-fix-md`
36+
- height: `h-siz-md`
37+
- width: `w-container-xs`
38+
- color: `text-adaptive-on-bg-basic-emphasis-90-default`
39+
- background-color: `bg-adaptive-bg-basic-level-2-default`
40+
- font: `text-body-sm`
1541
- Always stick to the variables. Don't use values like `p-4` or `m-[16px]`; use `p-fix-xs` or `m-fix-md` instead.
42+
43+
## Figma MCP
44+
45+
- If you use Figma MCP always generate code with project's conventions, such as using @db-ux/core-components and @db-ux/core-foundations.
46+
- If a code snippet from Figma MCP has a font-family with "DB Neo Screen Head" use HTML headlines (`<h1>`, `<h2>`, `<h3>`, `<h4>`, `<h5>`, `<h6>` HTML tags).
47+
- If the headline has a `font-weight: 300;` use `data-variant="light"` additionally.
48+
- If a code snippet has a Figma `Mode`, add it as `data-xxx`, where `xxx` is the mode in lower-case.
49+
50+
### Tailwind
51+
52+
If you use tailwind follow those rules as well:
53+
54+
- Don't use values like `p-4` or `m-[16px]`; use `p-fix-xs` or `m-fix-md` instead.
55+
- Never use something like `font-['DB_Neo_Screen_Head']` and `leading-[48px]` instead use `text-head-xx` class, where `-xx` can be a t-shirt size from `3xs` to `3xl`; If it has a `font-wight:300;` use `text-head-light-xx` instead.

packages/foundations/agent/css/Variables.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
```css
22
.my-component {
3-
inline-size: var(--db-sizing-md); /* Use sizing for fixed widths */
3+
inline-size: var(
4+
--db-container-sm
5+
); /* Use container for larger fixed widths */
46
block-size: var(--db-sizing-lg); /* Use sizing for fixed heights */
57
padding: var(--db-spacing-fixed-sm); /* Use fixed spacing for paddings */
68
margin: var(

packages/foundations/agent/scss/Variables.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
@use "@db-ux/core-foundations/build/styles/variables";
33

44
.my-component {
5-
inline-size: variables.$db-sizing-md; // Use sizing for fixed widths
5+
inline-size: variables.$db-container-sm; // Use container for larger fixed widths
66
block-size: variables.$db-sizing-lg; // Use sizing for fixed heights
77
padding: variables.$db-spacing-fixed-sm; // Use fixed spacing for paddings
88
margin: variables.$db-spacing-responsive-md; // Use responsive spacing for margins
Lines changed: 127 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,136 @@
11
```html
22
<div class="flex flex-col gap-md">
33
<div class="grid grid-cols-2 md:grid-cols-3 gap-xs">
4-
<div class="w-siz-md h-siz-lg p-fix-md m-res-sm border-sm radius-md">
5-
Example
4+
<div
5+
class="w-container-md h-siz-lg p-fix-md m-res-sm border-sm radius-md"
6+
>
7+
<h1 class="text-head-lg">Headline</h1>
8+
<h2 class="text-head-light-md">Subline</h2>
9+
<p class="text-body-md">Normal Text</p>
10+
<p class="text-body-sm">Smaller Text</p>
611
</div>
712
</div>
813
</div>
914
```
1015

11-
## Available Variables
16+
## Custom utility classes
1217

13-
```css
14-
--spacing-fix-3xs: var(--db-spacing-fixed-3xs);
15-
--spacing-fix-2xs: var(--db-spacing-fixed-2xs);
16-
--spacing-fix-xs: var(--db-spacing-fixed-xs);
17-
--spacing-fix-sm: var(--db-spacing-fixed-sm);
18-
--spacing-fix-md: var(--db-spacing-fixed-md);
19-
--spacing-fix-lg: var(--db-spacing-fixed-lg);
20-
--spacing-fix-xl: var(--db-spacing-fixed-xl);
21-
--spacing-fix-2xl: var(--db-spacing-fixed-2xl);
22-
--spacing-fix-3xl: var(--db-spacing-fixed-3xl);
23-
--spacing-res-3xs: var(--db-spacing-responsive-3xs);
24-
--spacing-res-2xs: var(--db-spacing-responsive-2xs);
25-
--spacing-res-xs: var(--db-spacing-responsive-xs);
26-
--spacing-res-sm: var(--db-spacing-responsive-sm);
27-
--spacing-res-md: var(--db-spacing-responsive-md);
28-
--spacing-res-lg: var(--db-spacing-responsive-lg);
29-
--spacing-res-xl: var(--db-spacing-responsive-xl);
30-
--spacing-res-2xl: var(--db-spacing-responsive-2xl);
31-
--spacing-res-3xl: var(--db-spacing-responsive-3xl);
32-
--spacing-siz-3xs: var(--db-sizing-3xs);
33-
--spacing-siz-2xs: var(--db-sizing-2xs);
34-
--spacing-siz-xs: var(--db-sizing-xs);
35-
--spacing-siz-sm: var(--db-sizing-sm);
36-
--spacing-siz-md: var(--db-sizing-md);
37-
--spacing-siz-lg: var(--db-sizing-lg);
38-
--spacing-siz-xl: var(--db-sizing-xl);
39-
--spacing-siz-2xl: var(--db-sizing-2xl);
40-
--spacing-siz-3xl: var(--db-sizing-3xl);
41-
--gap-3xs: var(--db-spacing-fixed-3xs);
42-
--gap-2xs: var(--db-spacing-fixed-2xs);
43-
--gap-xs: var(--db-spacing-fixed-xs);
44-
--gap-sm: var(--db-spacing-fixed-sm);
45-
--gap-md: var(--db-spacing-fixed-md);
46-
--gap-lg: var(--db-spacing-fixed-lg);
47-
--gap-xl: var(--db-spacing-fixed-xl);
48-
--gap-2xl: var(--db-spacing-fixed-2xl);
49-
--gap-3xl: var(--db-spacing-fixed-3xl);
50-
--border: var(--db-border-width-3xs);
51-
--border-3xs: var(--db-border-width-3xs);
52-
--border-2xs: var(--db-border-width-2xs);
53-
--border-xs: var(--db-border-width-xs);
54-
--border-sm: var(--db-border-width-sm);
55-
--border-md: var(--db-border-width-md);
56-
--border-lg: var(--db-border-width-lg);
57-
--border-xl: var(--db-border-width-xl);
58-
--border-2xl: var(--db-border-width-2xl);
59-
--border-3xl: var(--db-border-width-3xl);
60-
--radius: var(--db-border-radius-xs);
61-
--radius-3xs: var(--db-border-radius-3xs);
62-
--radius-2xs: var(--db-border-radius-2xs);
63-
--radius-xs: var(--db-border-radius-xs);
64-
--radius-sm: var(--db-border-radius-sm);
65-
--radius-md: var(--db-border-radius-md);
66-
--radius-lg: var(--db-border-radius-lg);
67-
--radius-xl: var(--db-border-radius-xl);
68-
--radius-2xl: var(--db-border-radius-2xl);
69-
--radius-3xl: var(--db-border-radius-3xl);
70-
--radius-full: var(--db-border-radius-full);
71-
--shadow: var(--db-elevation-md);
72-
--shadow-sm: var(--db-elevation-sm);
73-
--shadow-md: var(--db-elevation-md);
74-
--shadow-lg: var(--db-elevation-lg);
75-
```
18+
### Padding
19+
20+
- `p-fix-3xs`
21+
- `p-fix-2xs`
22+
- `p-fix-xs`
23+
- `p-fix-sm`
24+
- `p-fix-md`
25+
- `p-fix-lg`
26+
- `p-fix-xl`
27+
- `p-fix-2xl`
28+
- `p-fix-3xl`
29+
- `p-res-3xs`
30+
- `p-res-2xs`
31+
- `p-res-xs`
32+
- `p-res-sm`
33+
- `p-res-md`
34+
- `p-res-lg`
35+
- `p-res-xl`
36+
- `p-res-2xl`
37+
- `p-res-3xl`
38+
39+
### Margin
40+
41+
- `m-fix-3xs`
42+
- `m-fix-2xs`
43+
- `m-fix-xs`
44+
- `m-fix-sm`
45+
- `m-fix-md`
46+
- `m-fix-lg`
47+
- `m-fix-xl`
48+
- `m-fix-2xl`
49+
- `m-fix-3xl`
50+
- `m-res-3xs`
51+
- `m-res-2xs`
52+
- `m-res-xs`
53+
- `m-res-sm`
54+
- `m-res-md`
55+
- `m-res-lg`
56+
- `m-res-xl`
57+
- `m-res-2xl`
58+
- `m-res-3xl`
59+
60+
### Width
61+
62+
- `w-container-3xs`
63+
- `w-container-2xs`
64+
- `w-container-xs`
65+
- `w-container-sm`
66+
- `w-container-md`
67+
- `w-container-lg`
68+
- `w-container-xl`
69+
- `w-container-2xl`
70+
- `w-container-3xl`
71+
- `w-siz-3xs`
72+
- `w-siz-2xs`
73+
- `w-siz-xs`
74+
- `w-siz-sm`
75+
- `w-siz-md`
76+
- `w-siz-lg`
77+
- `w-siz-xl`
78+
- `w-siz-2xl`
79+
- `w-siz-3xl`
80+
81+
### Height
82+
83+
- `h-container-3xs`
84+
- `h-container-2xs`
85+
- `h-container-xs`
86+
- `h-container-sm`
87+
- `h-container-md`
88+
- `h-container-lg`
89+
- `h-container-xl`
90+
- `h-container-2xl`
91+
- `h-container-3xl`
92+
- `h-siz-3xs`
93+
- `h-siz-2xs`
94+
- `h-siz-xs`
95+
- `h-siz-sm`
96+
- `h-siz-md`
97+
- `h-siz-lg`
98+
- `h-siz-xl`
99+
- `h-siz-2xl`
100+
- `h-siz-3xl`
101+
102+
### Border
103+
104+
- `border-3xs`
105+
- `border-2xs`
106+
- `border-xs`
107+
- `border-sm`
108+
- `border-md`
109+
- `border-lg`
110+
- `border-xl`
111+
- `border-2xl`
112+
- `border-3xl`
113+
114+
### Border Radius
115+
116+
- `radius-3xs`
117+
- `radius-2xs`
118+
- `radius-xs`
119+
- `radius-sm`
120+
- `radius-md`
121+
- `radius-lg`
122+
- `radius-xl`
123+
- `radius-2xl`
124+
- `radius-3xl`
125+
126+
### Gap
127+
128+
- `gap-3xs`
129+
- `gap-2xs`
130+
- `gap-xs`
131+
- `gap-sm`
132+
- `gap-md`
133+
- `gap-lg`
134+
- `gap-xl`
135+
- `gap-2xl`
136+
- `gap-3xl`
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
@forward "font-sizes";
2+
@forward "variables";
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/* Use for body tags like <p> */
2+
3+
$db-type-body-3xs: var(--db-type-body-3xs);
4+
$db-type-body-2xs: var(--db-type-body-2xs);
5+
$db-type-body-xs: var(--db-type-body-xs);
6+
$db-type-body-sm: var(--db-type-body-sm);
7+
$db-type-body-md: var(--db-type-body-md);
8+
$db-type-body-lg: var(--db-type-body-lg);
9+
$db-type-body-xl: var(--db-type-body-xl);
10+
$db-type-body-2xl: var(--db-type-body-2xl);
11+
$db-type-body-3xl: var(--db-type-body-3xl);
12+
13+
/* Use for headline tags like <h1> */
14+
15+
$db-type-headline-3xs: var(--db-type-headline-3xs);
16+
$db-type-headline-2xs: var(--db-type-headline-2xs);
17+
$db-type-headline-xs: var(--db-type-headline-xs);
18+
$db-type-headline-sm: var(--db-type-headline-sm);
19+
$db-type-headline-md: var(--db-type-headline-md);
20+
$db-type-headline-lg: var(--db-type-headline-lg);
21+
$db-type-headline-xl: var(--db-type-headline-xl);
22+
$db-type-headline-2xl: var(--db-type-headline-2xl);
23+
$db-type-headline-3xl: var(--db-type-headline-3xl);

0 commit comments

Comments
 (0)