@canonical/design-system 0.2.0 → 0.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/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "types": "src/index.ts",
5
5
  "type": "module",
6
6
  "license": "LGPL-3.0",
7
- "version": "0.2.0",
7
+ "version": "0.2.1",
8
8
  "bin": {
9
9
  "collect-implementations": "./src/collect-implementations.ts"
10
10
  },
@@ -50,6 +50,33 @@ Fonts are opt-in and must be imported FIRST. The canonical form, in the root sty
50
50
  fonts entry loads Ubuntu Sans as variable fonts, self-hosted from
51
51
  `@canonical/ds-assets` via its `@font-face` rules — no external font host.
52
52
 
53
+ ## Declare the surface: context and density classes
54
+
55
+ The density system is class-driven, and it starts at the root. The app's root element
56
+ (`<body>`, or the app's root container) must carry TWO classes:
57
+
58
+ ```html
59
+ <body class="app comfortable">
60
+ ```
61
+
62
+ - **Context** — `app`, `site`, or `docs`: which surface this is. Applications take
63
+ `app`; marketing/brochure surfaces take `site`; documentation surfaces take `docs`
64
+ (`docs` shares `site`'s values).
65
+ - **Density** — `comfortable` or `dense`: picks within the context's pair.
66
+ `comfortable` is the default choice unless the product's design calls for `dense`.
67
+
68
+ Components never read these classes directly — they read the `--density-*` custom
69
+ properties the classes emit (control heights, inline padding, vertical spacing rungs,
70
+ baseline seating). A section can locally tighten by carrying its own `dense` class on
71
+ an ancestor of just that region.
72
+
73
+ **Failure mode: missing root classes fail SILENTLY.** The primitives fall back to
74
+ app-comfortable values, so an application looks right by accident — while a site or
75
+ docs surface, or any intended `dense` region, quietly renders with the wrong control
76
+ heights and spacing. This step has historically been forgotten precisely because
77
+ nothing errors. If control heights or spacing look subtly off, check the root classes
78
+ before debugging component CSS.
79
+
53
80
  ## The /icons serving contract (and its silent failure)
54
81
 
55
82
  Icons are per-file SVGs in `@canonical/ds-assets` (`icons/<name>.svg`, 16x16 viewBox,
@@ -103,6 +130,12 @@ imported preview.
103
130
  ## Verify
104
131
 
105
132
  - [ ] Computed `font-family` on body text shows Ubuntu Sans.
133
+ - [ ] The root element carries one context class (`app`/`site`/`docs`) and one
134
+ density class (`comfortable`/`dense`).
135
+ - [ ] Computed `--density-line-height` on a control matches the intended cell
136
+ (e.g. `32px` for app-comfortable, `36px` for site-comfortable) — a fallback
137
+ value on a class-less root passes visual inspection and still fails this check
138
+ on non-app surfaces.
106
139
  - [ ] `/icons/<name>.svg` returns 200 with SVG content, and an icon visibly renders.
107
140
  - [ ] The `@layer normalize, ds.reset, ds.modifiers, ds.components` rule is present in
108
141
  the served CSS.
@@ -113,3 +146,14 @@ imported preview.
113
146
  ## Next
114
147
 
115
148
  Foundation in place — continue with `adoption-a2-components`.
149
+
150
+ ## Support
151
+
152
+ If this skill leads somewhere broken — a command that errors, guidance that
153
+ contradicts what the live system answers, a gap the flow cannot cover — you are not
154
+ stuck:
155
+
156
+ - Raise an issue in the pragma repo: https://github.com/canonical/pragma/issues —
157
+ include the skill name, what was run, and expected vs. actual outcome.
158
+ - Or contact the design-system team owners directly through your organization's
159
+ professional messaging channels for assistance.
@@ -7,7 +7,10 @@ description: Swap an application's UI to Canonical design-system components one
7
7
 
8
8
  The second adoption track: replace the app's existing UI elements with design-system
9
9
  components. Prerequisite: track A1 is done — styles, fonts, and icons are live, so
10
- swapped components land on the right foundation.
10
+ swapped components land on the right foundation. That includes the root context and
11
+ density classes (`class="app comfortable"` — A1's "Declare the surface" section):
12
+ component geometry reads the `--density-*` channel those classes emit, and a swap onto
13
+ a class-less root looks subtly wrong rather than broken.
11
14
 
12
15
  ## When to Use
13
16
 
@@ -161,6 +164,8 @@ yet — check the component's types before writing it.
161
164
 
162
165
  ## Verify per PR
163
166
 
167
+ - [ ] Root context and density classes present (track A1) — swapped components size
168
+ from the `--density-*` channel, not from luck.
164
169
  - [ ] Zero dev-console warnings from the swapped components.
165
170
  - [ ] Keyboard pass on each swapped instance (focus, activation, escape where relevant).
166
171
  - [ ] Visual pass against the component's Storybook stories.
@@ -168,3 +173,14 @@ yet — check the component's types before writing it.
168
173
  ## Next
169
174
 
170
175
  Forms are their own programming model — continue with `adoption-a3-forms`.
176
+
177
+ ## Support
178
+
179
+ If this skill leads somewhere broken — a command that errors, guidance that
180
+ contradicts what the live system answers, a gap the flow cannot cover — you are not
181
+ stuck:
182
+
183
+ - Raise an issue in the pragma repo: https://github.com/canonical/pragma/issues —
184
+ include the skill name, what was run, and expected vs. actual outcome.
185
+ - Or contact the design-system team owners directly through your organization's
186
+ professional messaging channels for assistance.
@@ -39,6 +39,14 @@ Then BOTH stylesheets in the root stylesheet:
39
39
  The first brings the global reset and tokens; the second the input chrome and field
40
40
  layout. The package builds on top of `@canonical/react-ds-global`.
41
41
 
42
+ Forms are the heaviest consumer of the density system: control heights, field spacing,
43
+ and baseline seating all read the `--density-*` channel, which only emits real values
44
+ when the app root carries its context and density classes
45
+ (`class="app comfortable"` — track A1's "Declare the surface" section). Confirm those
46
+ classes before judging any form layout: without them the primitives silently fall back
47
+ to app-comfortable values, and a `dense` or site-surface form renders with the wrong
48
+ geometry.
49
+
42
50
  ## The react-hook-form switch
43
51
 
44
52
  Form state moves INTO the form system:
@@ -129,6 +137,19 @@ live react-hook-form state while you exercise a story.
129
137
 
130
138
  ## Verify
131
139
 
140
+ - [ ] Root context and density classes present (track A1) — field spacing and control
141
+ seating read the `--density-*` channel.
132
142
  - [ ] Submit round-trip works, with validation errors surfaced per field.
133
143
  - [ ] The whole form is completable keyboard-only.
134
144
  - [ ] Zero dev-console warnings from the form components.
145
+
146
+ ## Support
147
+
148
+ If this skill leads somewhere broken — a command that errors, guidance that
149
+ contradicts what the live system answers, a gap the flow cannot cover — you are not
150
+ stuck:
151
+
152
+ - Raise an issue in the pragma repo: https://github.com/canonical/pragma/issues —
153
+ include the skill name, what was run, and expected vs. actual outcome.
154
+ - Or contact the design-system team owners directly through your organization's
155
+ professional messaging channels for assistance.
@@ -26,6 +26,27 @@ The Anatomy DSL represents design system components as YAML trees with:
26
26
 
27
27
  This skill helps you author these specifications correctly and consistently.
28
28
 
29
+ ## Working mode: assistant to a design authority
30
+
31
+ Most of the time this skill runs in collaboration with a senior designer or engineer —
32
+ they are the design authority, you are the assistant whose job is to make them
33
+ successful. Default to that mode: lay out where the flow stands, do the legwork
34
+ (discovery queries, template drafting, validation) and return digestible findings, and
35
+ bring structural decisions to the person as a recommendation plus a question rather
36
+ than a fait accompli. An anatomy encodes opinions the graph cannot settle alone —
37
+ draw the person's knowledge out and use it.
38
+
39
+ Full autonomy is the exception, not the default: run the whole flow alone only when
40
+ explicitly asked to. Even then, list every judgment call made unilaterally in the
41
+ final report so a human can revisit them.
42
+
43
+ Decision gates — in collaboration, pause at each and resolve it WITH the person:
44
+
45
+ 1. Node boundaries: what is a named subcomponent vs. an anonymous structural role.
46
+ 2. Slot names — they become API surface.
47
+ 3. Cardinality choices, especially optional vs. required parts.
48
+ 4. What the anatomy fixes vs. what is deliberately left free.
49
+
29
50
  The full specification ships beside this file as `ANATOMY_DSL_SPEC.md` in the
30
51
  installed skill folder — `pragma skill lookup anatomy-author` renders only this
31
52
  SKILL.md, so open the sibling file directly when you need the complete spec (the
@@ -1091,3 +1112,14 @@ The following features would require additional work:
1091
1112
  - Representation of related nodes displayed in portals
1092
1113
  - Representation of conditional display
1093
1114
  - Inheritance reference for styles (e.g., "NetworkCard inherits from Card")
1115
+
1116
+ ## Support
1117
+
1118
+ If this skill leads somewhere broken — a command that errors, guidance that
1119
+ contradicts what the live system answers, a gap the flow cannot cover — you are not
1120
+ stuck:
1121
+
1122
+ - Raise an issue in the pragma repo: https://github.com/canonical/pragma/issues —
1123
+ include the skill name, what was run, and expected vs. actual outcome.
1124
+ - Or contact the design-system team owners directly through your organization's
1125
+ professional messaging channels for assistance.
@@ -5,7 +5,36 @@ description: Audit design system coverage, consistency, and quality
5
5
 
6
6
  # Design Auditor
7
7
 
8
- Audit design system coverage, consistency, and quality. This semantic skill analyzes the ontology to find gaps, inconsistencies, and opportunities for improvement across components, patterns, and documentation.
8
+ Audit design system coverage, consistency, and quality. This semantic skill analyzes
9
+ the knowledge graph to find gaps, inconsistencies, and opportunities for improvement
10
+ across components, patterns, layouts, and documentation.
11
+
12
+ In a fresh session, orient first:
13
+
14
+ ```bash
15
+ pragma capabilities
16
+ ```
17
+
18
+ ## Working mode: assistant to a design authority
19
+
20
+ An audit produces judgments, and most of the time those judgments belong to a senior
21
+ designer or engineer — you are the assistant whose job is to make them successful.
22
+ Default to that mode: lay out the audit direction, run the queries and return
23
+ digestible findings, and bring each judgment to the person as a recommendation plus a
24
+ question rather than a verdict. They know which gaps are deliberate, which components
25
+ are on the way out, and which numbers actually worry the team — the graph does not.
26
+
27
+ Full autonomy is the exception, not the default: run a whole audit alone only when
28
+ explicitly asked to. Even then, list every judgment call made unilaterally in the
29
+ final report so a human can revisit them.
30
+
31
+ Decision gates — in collaboration, pause at each and resolve it WITH the person:
32
+
33
+ 1. Scope: which audit dimensions matter right now, and which tiers are in scope.
34
+ 2. What counts as concerning: agree the thresholds with the team instead of importing
35
+ folklore numbers — a "low" pattern count may be a young catalog, not a problem.
36
+ 3. Prioritization of the recommendations.
37
+ 4. Any promote/demote/deprecate suggestion — these are roadmap calls, not data calls.
9
38
 
10
39
  ## When to Use
11
40
 
@@ -16,20 +45,45 @@ Audit design system coverage, consistency, and quality. This semantic skill anal
16
45
  - Preparing for design system roadmap planning
17
46
  - Auditing before a major release
18
47
 
48
+ ## When NOT to Use
49
+
50
+ - Auditing an APP's adoption of the design system — that is the
51
+ `adoption-a1-styles`/`a2`/`a3` tracks
52
+ - Fixing what the audit finds — route gaps to `specify-component`/`specify-pattern`,
53
+ missing anatomies to `anatomy-author`
54
+
19
55
  ## Discovery Flow
20
56
 
21
57
  Start with a broad inventory, then drill into specific concerns:
22
58
 
59
+ ```bash
60
+ pragma block list # every component, pattern, layout and subcomponent, with type and tier
61
+ pragma modifier list # every modifier family with its values
62
+ pragma tier list # the tiers blocks can live in
63
+ pragma graph query "…" # the audit queries below
64
+ pragma graph inspect <IRI-or-ds:name> # every triple on one entity
23
65
  ```
24
- sem_readme(package: "design-system")
25
- → Get overview of classes and counts
26
66
 
27
- sem_lookup_batch(types: ["ds:Component", "ds:Pattern", "ds:Layout"])
28
- → Get full inventory across types
67
+ Two graph-query mechanics to know (shared with the sibling skills):
29
68
 
30
- sem_sparql({quality queries})
31
- → Run specific audit queries
32
- ```
69
+ - Common prefixes (`ds:`, `cs:`) are applied automatically — no PREFIX preamble.
70
+ - Inside a SPARQL body, a local name with more than one dot
71
+ (`ds:global.component.button`) does not parse — use the full IRI there
72
+ (`<https://ds.canonical.com/global.component.button>`). Single-dot and dot-free
73
+ prefixed names (`ds:global`, `ds:Component`) work as-is.
74
+
75
+ Note that `block list` deliberately omits the `ds:Group` class — an audit that counts
76
+ only the list under-counts. The queries below go to the graph directly, so they see
77
+ groups too.
78
+
79
+ > The covered set is whatever the graph answers today. Query it live — never copy its
80
+ > output (counts, names, ratios) into documentation, PRs, or this skill.
81
+
82
+ One more live-data rule: before trusting any query, confirm its predicates against the
83
+ current ontology (`pragma ontology lookup ds`). The vocabulary evolves — for example,
84
+ `ds:usage` subsumed the former `whenToUse`/`whenNotToUse` predicates, and queries
85
+ against retired names return empty tables, not errors. An empty result must be
86
+ distinguished from a wrong query before it becomes a finding.
33
87
 
34
88
  ## Audit Dimensions
35
89
 
@@ -47,81 +101,94 @@ What's connected vs. orphaned?
47
101
 
48
102
  ## Key Queries
49
103
 
50
- ### Coverage: Components by Tier
104
+ Documentation-completeness queries must catch BOTH the absent predicate and the empty
105
+ string — many entries carry a field that is present but blank, and a
106
+ `FILTER NOT EXISTS` alone misses them.
51
107
 
52
- ```sparql
53
- PREFIX ds: <https://ds.canonical.com/>
108
+ ### Coverage: Components by Tier
54
109
 
55
- SELECT ?tierName (COUNT(?c) as ?componentCount) WHERE {
110
+ ```bash
111
+ pragma graph query "SELECT ?tierName (COUNT(?c) as ?componentCount) WHERE {
56
112
  ?c a ds:Component ;
57
113
  ds:tier ?tier .
58
114
  ?tier ds:name ?tierName .
59
115
  } GROUP BY ?tierName
60
- ORDER BY DESC(?componentCount)
116
+ ORDER BY DESC(?componentCount)"
61
117
  ```
62
118
 
63
- **Interpretation**: Identify tiers with few components - may indicate gaps or opportunities.
119
+ **What it asks**: where the catalog's weight sits. A tier with few components can be a
120
+ gap, a young tier, or a deliberate scope — which one is a question for the team.
64
121
 
65
122
  ### Coverage: UIBlock Types Distribution
66
123
 
67
- ```sparql
68
- PREFIX ds: <https://ds.canonical.com/>
69
-
70
- SELECT ?type (COUNT(?block) as ?count) WHERE {
71
- VALUES ?type { ds:Component ds:Pattern ds:Layout ds:Subcomponent }
124
+ ```bash
125
+ pragma graph query "SELECT ?type (COUNT(?block) as ?count) WHERE {
126
+ VALUES ?type { ds:Component ds:Pattern ds:Layout ds:Subcomponent ds:Group }
72
127
  ?block a ?type .
73
- } GROUP BY ?type
128
+ } GROUP BY ?type"
74
129
  ```
75
130
 
76
- **Interpretation**: Healthy ratio is roughly 3:1:0.5 for Component:Pattern:Layout. Low pattern count may indicate missing UX documentation.
131
+ **What it asks**: the shape of the catalog. There is no universally healthy ratio —
132
+ compare against the previous audit's numbers and let the team judge the trend.
133
+
134
+ ### Quality: Blocks Missing or Blank Summary
77
135
 
78
- ### Quality: Components Missing Descriptions
136
+ ```bash
137
+ pragma graph query "SELECT ?block ?name WHERE {
138
+ ?block a ?type ;
139
+ ds:name ?name .
140
+ VALUES ?type { ds:Component ds:Pattern ds:Layout ds:Subcomponent ds:Group }
141
+ FILTER NOT EXISTS { ?block ds:summary ?s . FILTER(STR(?s) != '') }
142
+ }"
143
+ ```
144
+
145
+ **What it asks**: which blocks have no base definition at all. These rows are also
146
+ what `implement-component` treats as "no spec here to implement".
79
147
 
80
- ```sparql
81
- PREFIX ds: <https://ds.canonical.com/>
148
+ ### Quality: Components Missing or Blank Usage
82
149
 
83
- SELECT ?component ?name WHERE {
150
+ ```bash
151
+ pragma graph query "SELECT ?component ?name WHERE {
84
152
  ?component a ds:Component ;
85
153
  ds:name ?name .
86
- FILTER(!bound(?desc) || ?desc = "")
87
- OPTIONAL { ?component ds:summary ?desc }
88
- }
154
+ FILTER NOT EXISTS { ?component ds:usage ?u . FILTER(STR(?u) != '') }
155
+ }"
89
156
  ```
90
157
 
91
- **Interpretation**: Components without descriptions are undocumented. High priority to fix.
92
-
93
- ### Quality: Components Missing Usage Guidance
158
+ **What it asks**: where When-to-use / When-not-to-use guidance is missing (`ds:usage`
159
+ subsumes both). Without it, adopters cannot tell what replaces what — these gaps
160
+ directly hurt the adoption tracks.
94
161
 
95
- ```sparql
96
- PREFIX ds: <https://ds.canonical.com/>
162
+ ### Quality: Components Missing or Blank Guidelines
97
163
 
98
- SELECT ?component ?name WHERE {
164
+ ```bash
165
+ pragma graph query "SELECT ?component ?name WHERE {
99
166
  ?component a ds:Component ;
100
167
  ds:name ?name .
101
- FILTER NOT EXISTS { ?component ds:whenToUse ?when }
102
- }
168
+ FILTER NOT EXISTS { ?component ds:guidelines ?g . FILTER(STR(?g) != '') }
169
+ }"
103
170
  ```
104
171
 
105
- **Interpretation**: `whenToUse` is critical for adoption. Missing guidance means designers don't know when to apply the component.
172
+ **What it asks**: where accessibility and best-practice material is missing —
173
+ `ds:guidelines` is its conventional home.
106
174
 
107
- ### Quality: Components Missing Guidelines
175
+ ### Quality: Blocks Missing or Blank Anatomy
108
176
 
109
- ```sparql
110
- PREFIX ds: <https://ds.canonical.com/>
111
-
112
- SELECT ?component ?name WHERE {
113
- ?component a ds:Component ;
114
- ds:name ?name .
115
- FILTER NOT EXISTS { ?component ds:guidelines ?g }
116
- }
177
+ ```bash
178
+ pragma graph query "SELECT ?block ?name WHERE {
179
+ ?block a ?type ;
180
+ ds:name ?name .
181
+ VALUES ?type { ds:Component ds:Pattern }
182
+ FILTER NOT EXISTS { ?block ds:anatomyDsl ?a . FILTER(STR(?a) != '') }
183
+ }"
117
184
  ```
118
185
 
119
- ### Consistency: Modifier Family Usage
186
+ **What it asks**: `anatomy-author` candidates.
120
187
 
121
- ```sparql
122
- PREFIX ds: <https://ds.canonical.com/>
188
+ ### Consistency: Modifier Family Usage
123
189
 
124
- SELECT ?family ?familyName (COUNT(?component) as ?usage) WHERE {
190
+ ```bash
191
+ pragma graph query "SELECT ?family ?familyName (COUNT(?component) as ?usage) WHERE {
125
192
  ?family a ds:ModifierFamily ;
126
193
  ds:name ?familyName .
127
194
  OPTIONAL {
@@ -129,250 +196,126 @@ SELECT ?family ?familyName (COUNT(?component) as ?usage) WHERE {
129
196
  ds:hasModifierFamily ?family .
130
197
  }
131
198
  } GROUP BY ?family ?familyName
132
- ORDER BY DESC(?usage)
199
+ ORDER BY DESC(?usage)"
133
200
  ```
134
201
 
135
- **Interpretation**: Modifier families with 0 usage may be unused or missing adoption. Families with very high usage are core to the system.
202
+ **What it asks**: which families are core and which are unused. A zero-usage family is
203
+ a question — premature abstraction, or adoption that has not landed yet?
136
204
 
137
205
  ### Consistency: Components Without Modifier Families
138
206
 
139
- ```sparql
140
- PREFIX ds: <https://ds.canonical.com/>
141
-
142
- SELECT ?component ?name WHERE {
207
+ ```bash
208
+ pragma graph query "SELECT ?component ?name WHERE {
143
209
  ?component a ds:Component ;
144
210
  ds:name ?name .
145
211
  FILTER NOT EXISTS { ?component ds:hasModifierFamily ?mf }
146
- }
212
+ }"
147
213
  ```
148
214
 
149
- **Interpretation**: Not all components need modifiers, but many do. Review whether these components should have variants.
215
+ **What it asks**: candidates to review — not every component needs modifiers, but
216
+ many do.
150
217
 
151
218
  ### Usage: Orphaned Subcomponents
152
219
 
153
- ```sparql
154
- PREFIX ds: <https://ds.canonical.com/>
155
-
156
- SELECT ?sub ?name WHERE {
220
+ ```bash
221
+ pragma graph query "SELECT ?sub ?name WHERE {
157
222
  ?sub a ds:Subcomponent ;
158
223
  ds:name ?name .
159
224
  FILTER NOT EXISTS { ?sub ds:parentComponent ?parent }
160
- }
225
+ }"
161
226
  ```
162
227
 
163
- **Interpretation**: Subcomponents without parents are orphaned - either fix the relationship or promote to Component.
228
+ **What it asks**: subcomponents without parents — either the relationship is missing,
229
+ or the block should be promoted to Component. Which one is a team call.
164
230
 
165
231
  ### Usage: Components With Subcomponents
166
232
 
167
- ```sparql
168
- PREFIX ds: <https://ds.canonical.com/>
169
-
170
- SELECT ?component ?componentName (COUNT(?sub) as ?subCount) WHERE {
233
+ ```bash
234
+ pragma graph query "SELECT ?component ?componentName (COUNT(?sub) as ?subCount) WHERE {
171
235
  ?component a ds:Component ;
172
236
  ds:name ?componentName .
173
237
  ?sub ds:parentComponent ?component .
174
238
  } GROUP BY ?component ?componentName
175
- ORDER BY DESC(?subCount)
239
+ ORDER BY DESC(?subCount)"
176
240
  ```
177
241
 
178
- **Interpretation**: Complex components have more subcomponents. Very high counts may indicate over-decomposition.
242
+ **What it asks**: where composition complexity concentrates. A very high count is a
243
+ prompt to ask whether the decomposition still serves its users.
179
244
 
180
245
  ### Cross-Tier: Potential Promotion Candidates
181
246
 
182
- ```sparql
183
- PREFIX ds: <https://ds.canonical.com/>
184
-
185
- SELECT ?component ?name ?tierName WHERE {
247
+ ```bash
248
+ pragma graph query "SELECT ?component ?name ?tierName WHERE {
186
249
  ?component a ds:Component ;
187
250
  ds:name ?name ;
188
251
  ds:tier ?tier .
189
252
  ?tier ds:name ?tierName .
190
-
191
- # Find non-global components that might be universal
192
- FILTER(?tier != <https://ds.canonical.com/data/global>)
193
-
194
- # Heuristic: has modifier families (suggests maturity)
253
+ FILTER(?tier != ds:global)
195
254
  FILTER EXISTS { ?component ds:hasModifierFamily ?mf }
196
- FILTER EXISTS { ?component ds:summary ?d }
197
- FILTER EXISTS { ?component ds:whenToUse ?w }
198
- }
255
+ FILTER EXISTS { ?component ds:summary ?d . FILTER(STR(?d) != '') }
256
+ FILTER EXISTS { ?component ds:usage ?u . FILTER(STR(?u) != '') }
257
+ }"
199
258
  ```
200
259
 
201
- **Interpretation**: Well-documented tier-specific components may be candidates for promotion to global.
260
+ **What it asks**: well-documented tier-specific components that MIGHT be universal.
261
+ Promotion is a roadmap decision — present these as candidates, never as conclusions.
262
+
263
+ ## Audit Report
202
264
 
203
- ## Audit Report Template
265
+ Build the report from the live query results, structured as:
204
266
 
205
267
  ```markdown
206
268
  ## Design System Audit Report
207
269
 
208
- **Generated:** {date}
209
- **Package:** design-system
210
- **Version:** {version}
211
-
212
- ---
270
+ **Generated:** {date} **Scope:** {tiers/dimensions agreed at the scope gate}
213
271
 
214
272
  ### Executive Summary
273
+ Counts per UIBlock type and per tier, documentation coverage percentages, and the
274
+ headline findings — with each "concern" label traced to a threshold the team agreed,
275
+ not an imported one.
215
276
 
216
- | Metric | Count | Health |
217
- |--------|-------|--------|
218
- | Components | {n} | {status} |
219
- | Patterns | {n} | {status} |
220
- | Layouts | {n} | {status} |
221
- | Subcomponents | {n} | {status} |
222
- | Modifier Families | {n} | {status} |
223
- | Documentation Coverage | {%} | {status} |
224
-
225
- **Overall Health:** {Good/Needs Attention/Critical}
226
-
227
- ---
228
-
229
- ### Coverage Analysis
230
-
231
- #### By Tier
232
-
233
- | Tier | Components | Patterns | Layouts |
234
- |------|------------|----------|---------|
235
- | global | {n} | {n} | {n} |
236
- | apps | {n} | {n} | {n} |
237
- | site | {n} | {n} | {n} |
238
- | ... | ... | ... | ... |
239
-
240
- **Observations:**
241
- - {observation 1}
242
- - {observation 2}
243
-
244
- **Recommendations:**
245
- - {recommendation 1}
246
- - {recommendation 2}
247
-
248
- ---
249
-
250
- ### Quality Analysis
251
-
252
- #### Documentation Completeness
253
-
254
- | Property | Present | Missing | Coverage |
255
- |----------|---------|---------|----------|
256
- | description | {n} | {n} | {%} |
257
- | whenToUse | {n} | {n} | {%} |
258
- | whenNotToUse | {n} | {n} | {%} |
259
- | guidelines | {n} | {n} | {%} |
260
- | figmaLink | {n} | {n} | {%} |
261
-
262
- **Components Needing Attention:**
263
- 1. {component}: missing {properties}
264
- 2. {component}: missing {properties}
265
-
266
- ---
267
-
268
- ### Consistency Analysis
269
-
270
- #### Modifier Family Usage
271
-
272
- | Family | Components Using | Coverage |
273
- |--------|-----------------|----------|
274
- | importance | {n} | {assessment} |
275
- | criticality | {n} | {assessment} |
276
- | density | {n} | {assessment} |
277
- | ... | ... | ... |
278
-
279
- **Inconsistencies Found:**
280
- - {inconsistency 1}
281
- - {inconsistency 2}
282
-
283
- ---
284
-
285
- ### Structural Analysis
286
-
287
- #### Component Composition
288
-
289
- | Component | Subcomponents | Assessment |
290
- |-----------|---------------|------------|
291
- | {name} | {n} | {assessment} |
292
-
293
- **Orphaned Elements:**
294
- - {list of orphaned subcomponents}
295
-
296
- ---
277
+ ### Findings per dimension
278
+ Coverage / Quality / Consistency / Usage — for each: the numbers, the specific blocks
279
+ affected, and the open question or recommendation. Route each actionable gap to its
280
+ skill: missing spec → specify-component / specify-pattern; missing anatomy →
281
+ anatomy-author.
297
282
 
298
283
  ### Recommendations
284
+ Prioritized WITH the person (decision gate 3). Mark which items are data-driven
285
+ (e.g. "12 components have a blank summary") and which are judgment
286
+ (e.g. "consider promoting X to global").
299
287
 
300
- #### High Priority
301
- 1. {action item with specific components}
302
- 2. {action item}
303
-
304
- #### Medium Priority
305
- 1. {action item}
306
- 2. {action item}
307
-
308
- #### Low Priority / Nice to Have
309
- 1. {action item}
310
- 2. {action item}
311
-
312
- ---
313
-
314
- ### Appendix: Raw Data
315
-
316
- <details>
317
- <summary>Components Missing Documentation</summary>
318
-
319
- {list}
320
-
321
- </details>
322
-
323
- <details>
324
- <summary>Unused Modifier Families</summary>
325
-
326
- {list}
327
-
328
- </details>
288
+ ### Appendix
289
+ The raw query results the findings rest on, in collapsible sections.
329
290
  ```
330
291
 
331
292
  ## Workflow
332
293
 
333
294
  ### Quick Health Check
334
295
 
335
- For a rapid assessment:
336
-
337
- ```
338
- 1. sem_readme(package: "design-system")
339
- → Check class counts
340
-
341
- 2. Run "Components Missing Descriptions" query
342
- → If > 20% missing, flag as concern
343
-
344
- 3. Run "Modifier Family Usage" query
345
- → If any family has 0 usage, investigate
296
+ ```text
297
+ 1. pragma block list + pragma modifier list — the big picture
298
+ 2. Run the three Quality queries (summary, usage, guidelines)
299
+ 3. Run Modifier Family Usage
300
+ 4. Report the counts and the specific blocks; agree with the person what, if
301
+ anything, is alarming
346
302
  ```
347
303
 
348
304
  ### Full Audit
349
305
 
350
- For comprehensive review:
351
-
352
- ```
353
- 1. Inventory
354
- sem_lookup_batch(types: ["ds:Component", "ds:Pattern", "ds:Layout", "ds:Subcomponent"])
355
-
356
- 2. Coverage queries (all)
357
-
358
- 3. Quality queries (all)
359
-
360
- 4. Consistency queries (all)
361
-
362
- 5. Usage queries (all)
363
-
364
- 6. Generate report using template
365
-
366
- 7. Prioritize recommendations
306
+ ```text
307
+ 1. Scope gate: agree dimensions and tiers with the person
308
+ 2. Inventory: block list, tier list, modifier list, types-distribution query
309
+ 3. Coverage queries, Quality queries, Consistency queries, Usage queries
310
+ 4. Compare against the previous audit's report where one exists
311
+ 5. Draft the report; resolve interpretation and priorities with the person
367
312
  ```
368
313
 
369
314
  ### Targeted Audit
370
315
 
371
- For specific concerns:
372
-
373
316
  | Concern | Queries to Run |
374
317
  |---------|----------------|
375
- | "Are we missing patterns?" | Coverage by tier, Component:Pattern ratio |
318
+ | "Are we missing patterns?" | Coverage by tier, types distribution |
376
319
  | "Is documentation complete?" | All Quality queries |
377
320
  | "Are modifiers consistent?" | Modifier Family Usage, Components Without Modifiers |
378
321
  | "Any orphaned elements?" | Orphaned Subcomponents |
@@ -380,54 +323,34 @@ For specific concerns:
380
323
 
381
324
  ## Interpreting Results
382
325
 
383
- ### Health Indicators
384
-
385
- | Metric | Good | Warning | Critical |
386
- |--------|------|---------|----------|
387
- | Description coverage | >90% | 70-90% | <70% |
388
- | whenToUse coverage | >80% | 60-80% | <60% |
389
- | Orphaned elements | 0 | 1-3 | >3 |
390
- | Unused modifier families | 0-1 | 2-3 | >3 |
391
- | Component:Pattern ratio | 2:1 to 4:1 | 5:1 to 7:1 | >7:1 |
392
-
393
- ### Common Issues and Fixes
394
-
395
- | Issue | Likely Cause | Recommended Action |
396
- |-------|--------------|-------------------|
397
- | Many components missing descriptions | Rapid growth without documentation | Documentation sprint |
398
- | Low pattern count | Focus on components over UX | Pattern extraction workshop |
399
- | Unused modifier families | Premature abstraction | Remove or document intended use |
400
- | Orphaned subcomponents | Refactoring without cleanup | Link to parents or promote |
401
- | Tier imbalance | Organic growth | Review tier definitions |
402
-
403
- ## Following next_steps
404
-
405
- After running queries, sem tools provide contextual guidance:
406
-
407
- ```json
408
- {
409
- "results": [...],
410
- "next_steps": [
411
- "Use sem_context on specific components to understand relationships",
412
- "Use sem_describe to see full property definitions"
413
- ]
414
- }
415
- ```
326
+ Interpretation is where the working mode matters most. The queries return facts; what
327
+ they MEAN is judged against the team's intent:
416
328
 
417
- Follow these to drill deeper into specific findings.
418
-
419
- ## Tips
420
-
421
- 1. **Start with sem_readme**: Get the big picture before diving into queries
422
- 2. **Run all coverage queries first**: Establishes baseline
423
- 3. **Don't fix everything at once**: Prioritize by impact
424
- 4. **Track metrics over time**: Run audits regularly to measure improvement
425
- 5. **Share reports with stakeholders**: Visibility drives improvement
426
- 6. **Automate recurring audits**: Consider scheduling monthly checks
329
+ - Prefer trends over absolutes: compare with the previous audit rather than against a
330
+ fixed "healthy" number.
331
+ - A gap can be deliberate (out-of-scope tier, deprecation in progress) — ask before
332
+ flagging.
333
+ - Distinguish data findings (a blank field IS blank) from judgment findings (a ratio
334
+ "looks" off) and label them differently in the report.
335
+ - Follow up drill-downs with `pragma graph inspect <IRI>` on the specific blocks a
336
+ query surfaced, and `pragma block lookup <Name>` for the human-readable view.
427
337
 
428
338
  ## Limitations
429
339
 
430
340
  - Cannot assess visual design quality (only metadata)
431
341
  - Cannot verify Figma link validity (only presence)
432
342
  - Pattern quality is subjective (coverage is objective)
433
- - Does not analyze implementation libraries (ImplementationObject)
343
+ - Does not analyze implementation packages — the graph records what is DOCUMENTED,
344
+ and packages ship what is BUILT; the two run ahead of each other in both directions
345
+ (see `adoption-a2-components` for the export check)
346
+
347
+ ## Support
348
+
349
+ If this skill leads somewhere broken — a command that errors, guidance that
350
+ contradicts what the live system answers, a gap the flow cannot cover — you are not
351
+ stuck:
352
+
353
+ - Raise an issue in the pragma repo: https://github.com/canonical/pragma/issues —
354
+ include the skill name, what was run, and expected vs. actual outcome.
355
+ - Or contact the design-system team owners directly through your organization's
356
+ professional messaging channels for assistance.
@@ -9,6 +9,16 @@ Take an APPROVED spec — from `specify-component`, or an existing documented bl
9
9
  working code. The defining discipline: the applicable code standards are pulled and held
10
10
  open DURING implementation, so they shape the code as it is written, not only in review.
11
11
 
12
+ ## Working mode
13
+
14
+ This skill often runs alongside a senior engineer or designer. When it does, work as
15
+ their assistant: lay out where the flow stands, do the legwork (spec reads, standard
16
+ pulls, scaffolding), and surface decisions rather than absorbing them silently. The
17
+ points to raise with the person rather than decide alone: a thin or ambiguous spec
18
+ field, any deviation from a pulled standard, the target package for a tier outside the
19
+ naming convention, and API naming the spec does not fix. When running fully
20
+ autonomously (only on explicit request), list those judgment calls in the PR.
21
+
12
22
  ## When to Use
13
23
 
14
24
  - An approved spec — from `specify-component`, or an existing documented block — needs
@@ -221,3 +231,14 @@ unavailable.
221
231
 
222
232
  - `specify-component` — upstream: produces the spec this skill implements
223
233
  - `anatomy-author` — the structure contract the implementation must honor
234
+
235
+ ## Support
236
+
237
+ If this skill leads somewhere broken — a command that errors, guidance that
238
+ contradicts what the live system answers, a gap the flow cannot cover — you are not
239
+ stuck:
240
+
241
+ - Raise an issue in the pragma repo: https://github.com/canonical/pragma/issues —
242
+ include the skill name, what was run, and expected vs. actual outcome.
243
+ - Or contact the design-system team owners directly through your organization's
244
+ professional messaging channels for assistance.
@@ -17,6 +17,32 @@ In a fresh session, orient first:
17
17
  pragma capabilities
18
18
  ```
19
19
 
20
+ ## Working mode: assistant to a design authority
21
+
22
+ Most of the time this skill runs in collaboration with a senior designer or engineer —
23
+ they are the design authority, you are the assistant whose job is to make them
24
+ successful. Default to that mode:
25
+
26
+ - Lay out the workflow direction: say which step comes next and why, so the person
27
+ always knows where the flow stands.
28
+ - Do the legwork yourself — graph searches, ontology reads, benchmark research — and
29
+ bring back digestible findings, not raw dumps.
30
+ - Bring each decision to the person as a recommendation plus a question, never as a
31
+ fait accompli. They hold context the graph does not — history, intent, naming
32
+ precedent, roadmap — so ask the questions that draw that knowledge out, and use it.
33
+
34
+ Full autonomy is the exception, not the default: run the whole flow alone only when
35
+ explicitly asked to. Even then, list every judgment call made unilaterally in the
36
+ final report so a human can revisit them.
37
+
38
+ Decision gates — in collaboration, pause at each and resolve it WITH the person:
39
+
40
+ 1. The step-1 verdict: exists/extend vs. a named gap.
41
+ 2. The step-2 category choice (which `ds:UIBlock` subclass the entry is).
42
+ 3. The step-3 boundary: how the definition disambiguates from its neighbors.
43
+ 4. The step-4 adopt/reject decisions from the benchmark.
44
+ 5. Whether the step-5 state gate fires, and the state model when it does.
45
+
20
46
  ## When to Use
21
47
 
22
48
  - A component is proposed that the design system may not cover yet
@@ -193,3 +219,14 @@ Spec: specs/<tier>.<type>.<snake_name>.md
193
219
  - `anatomy-author` — the step-7 engine
194
220
  - `specify-pattern` — the same skeleton, context-first, for recurring arrangements
195
221
  - `implement-component` — what happens after the spec is approved
222
+
223
+ ## Support
224
+
225
+ If this skill leads somewhere broken — a command that errors, guidance that
226
+ contradicts what the live system answers, a gap the flow cannot cover — you are not
227
+ stuck:
228
+
229
+ - Raise an issue in the pragma repo: https://github.com/canonical/pragma/issues —
230
+ include the skill name, what was run, and expected vs. actual outcome.
231
+ - Or contact the design-system team owners directly through your organization's
232
+ professional messaging channels for assistance.
@@ -21,6 +21,30 @@ In a fresh session, orient first:
21
21
  pragma capabilities
22
22
  ```
23
23
 
24
+ ## Working mode: assistant to a design authority
25
+
26
+ Most of the time this skill runs in collaboration with a senior designer or engineer —
27
+ they are the design authority, you are the assistant whose job is to make them
28
+ successful. Default to that mode: lay out the workflow direction step by step, do the
29
+ legwork (graph searches, ontology reads, benchmark research) and return digestible
30
+ findings, and bring each decision to the person as a recommendation plus a question
31
+ rather than a fait accompli. They hold context the graph does not — which situations
32
+ actually recur across products, history, naming precedent — so ask the questions that
33
+ draw that knowledge out; for patterns especially, the recurring CONTEXT often lives in
34
+ the person's experience before it lives in any data.
35
+
36
+ Full autonomy is the exception, not the default: run the whole flow alone only when
37
+ explicitly asked to. Even then, list every judgment call made unilaterally in the
38
+ final report so a human can revisit them.
39
+
40
+ Decision gates — in collaboration, pause at each and resolve it WITH the person:
41
+
42
+ 1. The step-1 verdicts: for the pattern AND for each composed component.
43
+ 2. Whether the entry IS a pattern (a recurring arrangement, not a component or layout).
44
+ 3. The step-3 context definition and composition rule — what is fixed, what varies.
45
+ 4. The step-4 adopt/reject decisions from the benchmark.
46
+ 5. The step-5 state model spanning the composed components.
47
+
24
48
  ## When to Use
25
49
 
26
50
  - A recurring arrangement of components (a flow, a page region, a repeated pairing)
@@ -155,3 +179,14 @@ composed components named in step 1; the composition rule stated in step 3).
155
179
  step 1 uncovers)
156
180
  - `anatomy-author` — the step-7 engine
157
181
  - `implement-component` — after the spec is approved
182
+
183
+ ## Support
184
+
185
+ If this skill leads somewhere broken — a command that errors, guidance that
186
+ contradicts what the live system answers, a gap the flow cannot cover — you are not
187
+ stuck:
188
+
189
+ - Raise an issue in the pragma repo: https://github.com/canonical/pragma/issues —
190
+ include the skill name, what was run, and expected vs. actual outcome.
191
+ - Or contact the design-system team owners directly through your organization's
192
+ professional messaging channels for assistance.