Add or change a dictionary browse view (any `?view=` surface) on the shared `<dictionary-trick-row>` partial. Use when a task adds a new browse view or changes grouping or ordering on an existing one. Preserves the row contract, which is mechanically tested across every browse view.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Add Browse View?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/davidleberknight-add-browse-view)
---
name: add-browse-view
description: Add or change a dictionary browse view (any `?view=` surface) on the shared `<dictionary-trick-row>` partial. Use when a task adds a new browse view or changes grouping or ordering on an existing one. Preserves the row contract, which is mechanically tested across every browse view.
---
# Add Browse View
## When to use this skill
Use this skill (not general editing) when a task does any of the following:
- Adds a new browse view at `/freestyle/tricks?view={new}`
- Renames a view (an unknown `?view=` value falls through to ADD, so an inbound link to the old name needs an explicit redirect; the precedent is `freestyleService.tricksIndexRedirectTarget`)
- Adds a new grouping wrapper that consumes existing `DictionaryTrickCard[]` data
- Changes within-group ordering rules for any browse view
- Touches the ADD view's per-tier URL (`/freestyle/tricks/:add`, `tricksByAdd`), which renders the ADD branch
Do **not** use this skill to:
- Modify the `<dictionary-trick-row>` partial itself. That changes every browse view at once, so it is a row-contract change: route through `extend-service-contract` + `add-public-page`
- Touch ontology, ADD math, parser, alias, or schema (forbidden across every browse-view change)
- Add new modifier-link types or new symbolic-grammar groups (curator-track work)
## The pattern this skill encodes
Every browse view in the `allowedViews` list in `src/services/freestyleService.ts` renders the same
row. There is no per-view density choice and no view-specific row variant: a trick reads the same
way whichever view a visitor arrived through, and that is the whole point. A view that grows a
rendering of its own is the defect this skill exists to prevent.
```
Step 1 → READ the row contract and one shipped view (no writing yet)
Step 2 → SERVICE: group type + builder
Step 3 → TEMPLATE: grouping wrapper around the shared row
Step 4 → CSS: group-wrapper level only
Step 5 → TESTS: per-view integration test + the shared guard
Step 6 → VERIFY and hand off
```
## Step 1: Read the contract before writing
- `src/views/partials/dictionary-trick-row.hbs`: the shared partial every view renders. Its header
comment is the row contract: two columns, what a row may carry, and what it may never carry.
- `tests/integration/freestyle.browse-row-contract.routes.test.ts`: the guard that pins that
contract across every view. Read it before changing a view; it is what will fail if the change
breaks uniformity.
- One shipped view whose shape resembles the new work, read in `src/views/freestyle/tricks.hbs`:
By family for one group with banded sub-groups, By set or By modifier for one flat group, each
chosen from a chip row and given its own address.
- The existing group type for the view being changed (`FreestyleTrickAddGroup`,
`FreestyleFamilyGroup`, `FreestyleBrowseGroup` for the set and modifier views).
A new browse view needs curator approval before it joins `allowedViews`. That is a decision for the
human, not something this skill authorises.
## Step 2: The service group type and builder
A group type carries its identity, its label, its anchor, and its rows:
```ts
export interface FreestyleSomeGroup {
label: string;
anchorId: string; // `{view}-{slug}`: used in template ids
cards: DictionaryTrickCard[]; // the shared row view-model, ADD ascending then name
}
```
Build it from sorted rows, shaping each row through the one helper:
```ts
const buildGroup = (key: string, rows: FreestyleTrickRowWithStatus[]): FreestyleSomeGroup => {
const sorted = rows.slice().sort(/* per-view ordering rule */);
const indexRows = sorted.map(r => shapeTrickIndexRow(r, ctx));
return {
label: labelFor(key),
anchorId: `{view}-${key}`,
cards: sorted.map((r, i) => shapeDictionaryTrickCard(r, indexRows[i]!, ctx)),
};
};
```
For a brand-new view, add a `*Group` interface in `freestyleService.ts`, add the view key to
`FreestyleTricksActiveView` and `allowedViews`, and add the group array to
`FreestyleTricksIndexContent`.
### Required invariants (every browse view)
- **Sort within groups: ADD ascending, then trick name alphabetical.** Documented per-view
exception: the family view puts the family anchor first, then ADD ascending.
- **Empty groups hidden** via an `entries.length > 0` filter. A per-view exception needs curator
approval.
- **Modifier-stub rows excluded** at the row-filtering step. Modifier rows are foreign-key targets,
not public tricks, and never render on a browse view.
- **Rows built via `shapeDictionaryTrickCard()`.** Never inline the shaping, never bypass the helper.
- **`FreestyleTrickRowWithStatus`** is the row type the shaper needs; the operational-notation column
lives there, not on the base `FreestyleTrickRow`.
- **Browse builders filter to active rows.** An inactive row never reaches a browse view, so any
branch keyed on an inactive-only state is unreachable there and must not be written.
## Step 3: The template branch wraps the shared row
In `src/views/freestyle/tricks.hbs`, each view is a `{{#if (eq content.activeView "...")}}` branch.
The branch owns grouping, headings and prose; the row owns everything inside a row:
```handlebars
{{#if (eq content.activeView "{view}")}}
{{#each content.{viewModel}}}
<section class="content-section trick-{view}-group" id="{{anchorId}}">
<div class="section-heading">
<h2><a href="{{siteHref href}}">{{label}}</a></h2>
<span class="section-count">{{countLabel}}</span>
</div>
{{#if intro}}
<p class="section-intro">{{intro}}</p>
{{/if}}
<ul class="dict-trick-row-stack" role="list">
{{#each cards}}
{{> dictionary-trick-row}}
{{/each}}
</ul>
</section>
{{/each}}
{{/if}}
```
### Template rules (load-bearing)
- **One heading system.** A group heading is the site `.section-heading` with an `<h2>` and a
`.section-count` chip; a sub-group heading is a plain `<h3>`, never a second `.section-heading`.
Never a per-view heading class: a view with its own heading treatment fails uniformity exactly as
a view with its own row would.
- **Service-provided hrefs only**, per the `footbag-freestyle-dictionary` skill, "Hashtag and dictionary-filter links".
Render a query-string href through the `siteHref` helper, `{{siteHref href}}`, which
leaves `=` as written and escapes what could close the attribute.
- **Section ID format `{view}-{slug}`.** Anchor IDs are public API. Never rename one without
updating every cross-link in the same change.
- **Heading link.** The family view's heading links to the family's own page. A set or modifier
heading links to that group's reference entry (its Set Encyclopedia page, or its entry on the
Operators & Modifiers page), and stays plain text when the reference holds none; the chip row
and the page's own address give the shareable link.
- **Update the view toggle** unless the view is deliberately unlisted. A renamed view also needs an
explicit redirect for the old value.
- **No row-internal markup.** The template never renders a name, difficulty value, hashtag, control
or notation itself. That is the partial's job.
## Step 4: CSS at the group-wrapper level only
The row has stable CSS (`.dict-trick-row`, `.dict-trick-row-identity`, `.dict-trick-row-notation`).
A view adds CSS only for:
- The group-wrapper class (`.trick-{view}-group`), including its `scroll-margin-top`
- Any one-line definition rendering
- Framing prose or footer styling if the view is observational
Do **not** touch:
- `.dict-trick-row*` rules
- `.dict-trick-row-stack`
- `.op-token--*` rules
- `.section-heading` or `.section-count`
- Any rule shared across browse views
Use `var(--anchor-offset)` for a group's `scroll-margin-top`, never a literal. The site header is
sticky and its height steps up twice as the viewport narrows and the nav row wraps, so a literal
offset lands the heading behind the header at one width or another.
If the new CSS exceeds ~40 lines, the change is probably reshaping the row: that is out of scope.
## Step 5: Tests
Each view ships a focused integration test under `tests/integration/` (see the existing add-,
family-, set- and modifier-view suites) covering:
1. **Route + view toggle**: the view's toggle entry is active (or deliberately absent), asserted in the same case as the 200 rather than in a standalone status test
2. **Grouping wrapper**: anchor IDs render; the heading carries its link (per the heading-link rule) and count chip
3. **Heading system**: the group heading uses `.section-heading`, so a bespoke one cannot creep back
4. **Within-group ordering**: assert the sort with an example spanning three or more ADD values
5. **Empty-group hiding**: groups with zero members render no anchor
6. **Intentional duplication** where a trick can appear in several groups (set, modifier)
The cases read one shared response per path, per the repeated-requests anti-pattern in `.claude/rules/testing.md`.
Then add the view to the shared guard in
`tests/integration/freestyle.browse-row-contract.routes.test.ts`, which loops every browse view and
asserts the row markup, the control-separation rule and the alias slot. There is no exclusion list
and no view may be added to one.
`tests/integration/freestyle.browse-row-rendering.routes.test.ts` holds the cross-view rendering
contracts (required row slots, sparse and deep tricks through one template, group placement, no
authoring status, no accounting prose). Update it when a change affects what a row renders anywhere.
### Test seeding requirements
- Modifier links: `insertFreestyleTrickModifier` + `insertFreestyleTrickModifierLink`, required when
membership depends on links (set, modifier).
- Operational notation: set `operational_notation` on seeded tricks so the row renders role-tagged
token spans; the stack assertion alone only checks the wrapper.
- Anchor coverage: seed at least one trick per group you assert renders.
- A view whose groups this fixture does not populate renders its empty state, so assert the positive
only for views the fixture actually fills.
## Step 6: Verify and hand off
- Verify per the test-targets line in root `CLAUDE.md`; the targets always include the view's
own suite, the shared row-contract guard and the cross-view rendering suite.
- A view change is UI work: run `./run_dev.sh` and read the view in a browser beside a neighbouring
view at desktop and at 390px (the phone width page-check measures), confirming row rhythm, heading weight, count-chip treatment and the
controls all match. The stylesheet is read once at boot and memoized, so a CSS edit needs a restart
to be visible.
- List the changed files for the human to stage. Claude never stages, commits or pushes.
## Constraints beyond the steps
- Never render authoring status on a browse row: no incomplete badge, no pending placeholder, no
decomposition-under-review pill. A row renders notation when it exists and nothing otherwise;
status lives on the trick detail page.
- View key: lowercase, hyphenated when compound (`add`, `family`, `set`, `modifier`); a sub-axis
anchor is `axis-{name}`. Group-internal elements use shared classes (`.section-intro` for a
definition line); a view adds no class of its own beyond the group wrapper.
## Observational vs canonical view check
Before adding a new view, decide its layer:
- **Canonical view** (ADD, family, set): groups derived from canonical columns. No framing
needed beyond an ordinary intro.
- **Observational view** (future symbolic axes): groups
derived from observational data such as modifier links or curator-tagged bases. Required: a
status label at the top of the view stating in plain words that it is exploratory and not an
official grouping, and a closing footer cross-referencing the canonical view.
The footer convention is `<p class="symbolic-layer-footer">`; the status label renders with the
shared `.notice` primitive and adds no class. The `symbolic-layer-badge` chip belongs to the
trick-detail and glossary surfaces, not to a browse view.