You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AGENTS.md
+26-26Lines changed: 26 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,14 +3,14 @@
3
3
This is a **Kirby 5 CMS** project. Individual pages available as markdown by appending `.md` to any URL.
4
4
5
5
Docs: https://getkirby.com/llms.txt
6
-
6
+
7
7
## Existing Project Patterns
8
8
9
-
Before implementing anything, ALWAYS check what already exists in the project:
9
+
Before implementing anything, check what already exists in the project:
10
10
11
-
-**`site/plugins/`**— Check for installed plugins that already solve the problem. Also check `composer.json` for dependencies.
12
-
-**`site/snippets/`**— Use existing snippets. NEVER use raw `<img>` tags — use the `image` snippet for all images. It handles responsive images, lazy loading, and SVG inlining.
13
-
-**Existing blocks/templates**— Look at similar blocks for patterns before writing new ones.
11
+
-**`site/plugins/`**has installed plugins that may already solve the problem. Also check `composer.json` for dependencies.
12
+
-**`site/snippets/`**has existing snippets to reuse. Use the `image` snippet for all images instead of raw `<img>` tags. It handles responsive images, lazy loading, and SVG inlining.
13
+
-**Existing blocks/templates**show patterns to follow before writing new ones.
14
14
15
15
When told to "use X", check if X is an existing package/plugin in the project before doing anything else.
16
16
@@ -31,19 +31,19 @@ This ensures screen readers only announce the link once. Use `relative z-10` on
31
31
32
32
### Strings / i18n
33
33
34
-
ALWAYS use the `t()` function for hardcoded labels and strings. Pass the English translation as the argument, it serves as both the key and default value:
34
+
Use the `t()` function for hardcoded labels and strings. Pass the English translation as the argument, it serves as both the key and default value:
After adding new strings, run `kirby trawl:extract` to extract them into the JSON translation files. Let the user translate. DO NOT manually edit translation files.
42
+
After adding new strings, run `kirby trawl:extract` to extract them into the JSON translation files. Let the user translate and don't manually edit translation files.
43
43
44
-
In blueprints, most properties (`label`, `help`, `placeholder`, `before`, `after`, section `headline`/`text`) auto-resolve plain strings as translation keys — no special syntax needed.
44
+
In blueprints, most properties (`label`, `help`, `placeholder`, `before`, `after`, section `headline`/`text`) auto-resolve plain strings as translation keys, so no special syntax is needed.
45
45
46
-
Option `text` in select/radio/checkbox fields does NOT auto-resolve. Use `*:` to reference a translation key:
46
+
Option `text` in select/radio/checkbox fields does not auto-resolve. Use `*:` to reference a translation key:
47
47
48
48
```yaml
49
49
fields:
@@ -58,20 +58,20 @@ fields:
58
58
59
59
## Styling (Tailwind CSS v4)
60
60
61
-
**IMPORTANT:** This project resets ALL default Tailwind theme values (colors, font sizes, radii, shadows, etc.) using `--*: initial` in `src/styles/index.css` and only defines project-specific values. ALWAYS check `src/styles/index.css` for available theme tokens before using any Tailwind utility. For example, `text-red-500` or `rounded-lg` will NOT work unless explicitly defined in the theme.
61
+
This project resets all default Tailwind theme values (colors, font sizes, radii, shadows, etc.) using `--*: initial` in `src/styles/index.css` and only defines project-specific values. Check `src/styles/index.css` for available theme tokens before using any Tailwind utility. For example, `text-red-500` or `rounded-lg` won't work unless explicitly defined in the theme.
62
62
63
63
### Custom classes
64
64
65
65
Custom classes are valid in two cases:
66
66
67
-
1. **Single HTML elements** that need consistent styling (e.g. `.button`) — because creating a snippet for one element is overkill
67
+
1. **Single HTML elements** that need consistent styling (e.g. `.button`), because creating a snippet for one element is overkill
68
68
2. **Nested/prose content** where you need to style child elements you don't control (e.g. `.prose` targeting `p`, `h2`, `li` inside rich text)
69
69
70
-
If a component combines markup with styling (e.g. a badge with text + icon), create a **Kirby snippet** instead of a custom class, the rendering logic belongs with the styles.
70
+
If a component combines markup with styling (e.g. a badge with text + icon), create a **Kirby snippet** instead of a custom class. The rendering logic belongs with the styles.
71
71
72
72
### Focus Styles
73
73
74
-
ALWAYS add custom focus styles. Silence browser defaults with `outline-none` and add custom styles with `focus-visible:`:
74
+
Add custom focus styles to interactive elements. Silence browser defaults with `outline-none` and add custom styles with `focus-visible:`:
75
75
76
76
- Prefer `ring` utilities for interactive elements
77
77
- Use `underline` for links unless specified otherwise
@@ -84,7 +84,7 @@ This project uses **desktop-first** breakpoints (opposite of Tailwind's default
84
84
- **No prefix** = default (large screens)
85
85
- **With prefix** = applies at that width **and below**
86
86
87
-
DO NOT use a prefix like `min-xl` to target larger screens.
87
+
Don't use a prefix like `min-xl` to target larger screens.
88
88
89
89
```html
90
90
<div class="p-8 md:p-4"></div>
@@ -99,25 +99,25 @@ The config can be found in `src/styles/index.css`.
99
99
100
100
### !important
101
101
102
-
If you really need to force `!important`, use the `!` suffix (NOT prefix):
102
+
If you really need to force `!important`, use the `!` suffix (not the prefix):
103
103
104
104
```html
105
105
<div class="bg-white bg-black!"></div>
106
106
```
107
107
108
108
### Spacing scale
109
109
110
-
Tailwind 4 calculates spacing as `n * 0.25rem`. You DO NOT have to follow the known spacing scale. Use `h-128` instead of `h-[32rem]`.
110
+
Tailwind 4 calculates spacing as `n * 0.25rem`. You don't have to follow the known spacing scale, so use `h-128` instead of `h-[32rem]`.
111
111
112
112
## Tailwind Merge
113
113
114
-
If you need to conditionally apply classes, ALWAYS refer to one of the following functions:
114
+
When conditionally applying classes, use one of the following functions:
115
115
116
-
- `merge()`- outputs `class="..."` attribute with merged classes
117
-
- `cls()`- outputs just the merged class string
118
-
- `attr()`- like Kirby's built-in, but merges Tailwind classes in the `class` attribute
116
+
- `merge()`outputs a `class="..."` attribute with merged classes
117
+
- `cls()`outputs just the merged class string
118
+
- `attr()`works like Kirby's built-in, but merges Tailwind classes in the `class` attribute
119
119
120
-
You DO NOT need to use `cls()` inside `attr()`.
120
+
You don't need to use `cls()` inside `attr()`.
121
121
122
122
All support conditional syntax with arrays:
123
123
@@ -129,13 +129,13 @@ All support conditional syntax with arrays:
129
129
130
130
Define components with a default export in `src/components/`. These will be automatically registered and can be used in the frontend with `x-data`.
131
131
132
-
NEVER use document.querySelector() or similar document-level methods. ALWAYS scope to the component's elements, e.g. using `this.$root.querySelector()`. Generally, prefer Alpine's built-in methods like `x-on`, `x-show`, `x-transition`, to trigger methods, etc. Avoid global event listeners. Use Alpine.js plugins like Focus, Intersect, Resize, etc. when required.
132
+
Don't use `document.querySelector()` or similar document-level methods. Scope to the component's elements instead, e.g. using `this.$root.querySelector()`. Prefer Alpine's built-in methods like `x-on`, `x-show`, `x-transition` to trigger methods, etc. Avoid global event listeners. Use Alpine.js plugins like Focus, Intersect, Resize, etc. when required.
133
133
134
134
Documentation: https://alpinejs.dev
135
135
136
136
## Icons
137
137
138
-
SVG icons live in `assets/icons/` and are compiled into a sprite by Vite. Use the `icon()` helper to render them. Never inline SVGs or use `<img>` tags for icons.
138
+
SVG icons live in `assets/icons/` and are compiled into a sprite by Vite. Use the `icon()` helper to render them. Don't inline SVGs or use `<img>` tags for icons.
139
139
140
140
```php
141
141
<?= icon('angle-right', class: 'size-4') ?>
@@ -151,15 +151,15 @@ Fields store raw strings and need casting (`->toPage()`, `->toFiles()`, `->toBoo
151
151
152
152
### Code Style
153
153
154
-
AVOID setting preliminary variables in files. Prefer inline expressions instead UNLESS you'd need to repeat a statement.
154
+
Avoid setting preliminary variables in files. Prefer inline expressions instead, unless you'd need to repeat a statement.
0 commit comments