Skip to content

feat(wix-cli-auto-patterns-dashboard): add auto patterns dashboard skill#78

Open
AlonTzukermanWIX wants to merge 9 commits into
wix:mainfrom
AlonTzukermanWIX:feat/auto-patterns-dashboard
Open

feat(wix-cli-auto-patterns-dashboard): add auto patterns dashboard skill#78
AlonTzukermanWIX wants to merge 9 commits into
wix:mainfrom
AlonTzukermanWIX:feat/auto-patterns-dashboard

Conversation

@AlonTzukermanWIX

Copy link
Copy Markdown

Summary

  • Add new wix-cli-auto-patterns-dashboard skill for declarative CRUD dashboard pages (single-collection management with standard table/grid views and forms)
  • Update wix-cli-orchestrator SKILL.md with auto-patterns routing logic and decision tree
  • Add skill to README.md available skills table and .claude-plugin/plugin.json skills array

Test plan

  • Verify wix-cli-auto-patterns-dashboard skill loads correctly in Claude Code
  • Verify orchestrator routes to auto-patterns for simple CRUD use cases
  • Verify orchestrator still routes to wix-cli-dashboard-page for complex use cases

🤖 Generated with Claude Code

@AlonTzukermanWIX AlonTzukermanWIX force-pushed the feat/auto-patterns-dashboard branch 2 times, most recently from cdd3e1a to 8cd5fe9 Compare April 30, 2026 07:38
@mirivoWix

Copy link
Copy Markdown
Contributor

Update — actually typechecked the snippets against @wix/auto-patterns@latest.

Built a harness (TS strict, real @wix/auto-patterns + @wix/patterns + @wix/design-system types) and compiled both example-patterns.json (as AppConfig) and the resolver shapes from each markdown file. Retracting my earlier resolved-action.md line-7 comment about icon being optional — the real ResolvedAction.icon is required, the docs match. Deleted that comment.

What the typecheck did surface, in order of impact:

  1. action-cell.md collapses two distinct resolver types into one. The docs declare a single CustomActionCellResolver returning ResolvedAction. The real package exports two:

    • CustomActionCellPrimaryActionResolverResolvedActionCellPrimaryAction (= Omit<ResolvedAction, 'icon'> with optional prefixIcon / suffixIcon)
    • CustomActionCellSecondaryActionResolverResolvedAction

    A user following the docs to write a primary-action resolver will use icon, but the real type doesn't accept icon on primary-cell actions — it expects prefixIcon / suffixIcon. Worth either documenting both resolver types or steering primary actions to prefixIcon.

  2. resolved-action.md line 9 marks biName as required, but real type is biName?: string. The docs' "MUST include biName" is a project convention, not enforced by the type. Either say so explicitly or note that the type is optional but the convention is to always set it.

  3. resolved-action.md line 13 narrows skin to 'standard' | 'inverted' | 'premium' | 'dark' | 'destructive'. Real type is skin?: string. Narrowing in docs is fine for guidance; just worth flagging that the type itself is wider.

  4. resolved-action.md line 8 declares onClick: () => void | Promise<void>; real is () => void. Async handlers still typecheck (TS void-return bivariance), so this is a documentation accuracy point, not a type error in practice.

  5. example-patterns.json cast as AppConfig typechecks cleanly against the real AppConfig — the cast is needed only because import ... from '*.json' widens string-literal discriminators.

Net: snippets are mostly type-safe in spirit, but the inline type definitions in the markdown drift from the real package types in the four spots above. Long-term fix is a proper typecheck harness in CI; short-term fix is reconciling those four declarations with the published @wix/auto-patterns types.

@mirivoWix mirivoWix left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still reviewing

Comment thread skills/wix-app/SKILL.md Outdated

3. **Where will it appear?**
- Dashboard sidebar/page → Dashboard Page or Modal
- Dashboard sidebar/page → Dashboard Page or Modal (for simple single-collection CRUD with no custom logic, prefer [Auto Patterns Dashboard](references/AUTO_PATTERNS_DASHBOARD.md))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add more info about auto patters (e.g faster and cheaper way... )
And also add about iteration (e.g pattern.json...)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — moved the decision criteria into SKILL.md with the why (declarative patterns.json, faster to author, iterate by editing JSON) and disqualifiers inline. See skills/wix-app/SKILL.md:63-64.

Comment on lines +15 to +34
## When to Use Auto Patterns

**Use auto patterns when ALL are true:**
- Single-collection CRUD operations (Create, Read, Update, Delete)
- Standard table/grid views with sorting and filtering
- Basic form layouts for entity pages
- No custom business logic or calculations
- No embedded script configuration
- No external API integrations

**Use custom code ([DASHBOARD_PAGE.md](DASHBOARD_PAGE.md)) when ANY are true:**
- Multi-collection data joining or aggregation
- Custom business logic or calculations
- External API integrations or webhooks
- Embedded script parameter management
- Custom UI components beyond standard forms/tables
- Complex workflows or state management
- Advanced search or filtering logic

---

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should move it into SKILL.md

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — "When to Use" section dropped from this file; criteria now live in SKILL.md so the model self-routes without needing to load this reference.

Comment on lines +114 to +119
1. **Create `extensions.ts`** in the page directory:
```typescript
import { createDashboardExtension } from '@wix/cli-app';

export const myPageExtension = createDashboardExtension();
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not how we write a dashboard page extension, please go over the dashboard page extension, for example:

### Step 1: Create Page-Specific Extension File

Each dashboard page requires an `extensions.ts` file in its folder:

**File:** `src/extensions/dashboard/pages/<page-name>/extensions.ts`

```typescript
import { extensions } from "@wix/astro/builders";

export const dashboardpageMyPage = extensions.dashboardPage({
  id: "{{GENERATE_UUID}}",
  title: "My Page",
  routePath: "my-page",
  component: "./extensions/dashboard/pages/my-page/page.tsx",
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also add about UUID Generation same as in dashboard page

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you maybe also add how the directory should look like (e.g patterns.json, page.tsx, extensions.ts ...) ? we have it in our other extensions refernces.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — rewrote the snippet to use extensions.dashboardPage() from @wix/astro/builders matching the canonical pattern in DASHBOARD_PAGE.md. Also added directory-layout block and UUID generation note in the same edit (replying to your follow-ups on this thread).

Comment on lines +1 to +33
# Auto-Patterns Core Rules

## Logic
### Configuration Generation
1. **Analyze** schema requirements.
2. **Select** fields based on data types (max 3 initially).
3. **Validate** against Core Rules.

### Enum Handling
- **IF** `enumConfig` is required (implicit or explicit):
- **THEN** ASK user for possible option values.
- **THEN** Derive `label` from `value` (e.g., "dog" -> "Dog") unless specified.
- **NEVER** guess or invent enum values.

## Constraints
### Structural Limits
- **MUST** have exactly 2 pages in `pages` array (`collectionPage` + `entityPage`).
- **MUST** have exactly 1 component with `layout` array in `collectionPage`.
- **MUST** use TypeScript for configuration.

### Field Selection
- **MAX** 3 columns initially for `collectionPage`.
- **MUST** include `create` action in `collectionPage` navigating to `entityPage`.
- **NEVER** fill optional fields unless explicitly requested.

### Type Binding
- **IF** `type: 'collectionPage'` **THEN** only `collectionPage` field allowed.
- **IF** `type: 'entityPage'` **THEN** only `entityPage` field allowed.
- **NEVER** mix types in single page config.

### Validation
- **MUST** align with `AppConfig` structure.
- **MUST** remove unsupported configuration entries.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can put it in AUTO_PATTERNS_DASHBOARD.md, it's very short, and adding us more tool calls to read this very short file

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — inlined as a new "Core Rules" section at the top of AUTO_PATTERNS_DASHBOARD.md and deleted the file. Topic-index row removed too.

@AlonTzukermanWIX AlonTzukermanWIX force-pushed the feat/auto-patterns-dashboard branch from 8cd5fe9 to 4d72098 Compare May 4, 2026 10:38
@AlonTzukermanWIX

Copy link
Copy Markdown
Author

Thanks for the typecheck pass — addressed all four findings:

  1. action-cell.md — split into CustomActionCellPrimaryActionResolver (returns ResolvedActionCellPrimaryAction, uses prefixIcon/suffixIcon) and CustomActionCellSecondaryActionResolver (returns ResolvedAction). Canonical example now shows both forms with the correct icon prop for each.
  2. resolved-action.md:9biName?: string with note that the project convention is to always set it.
  3. resolved-action.md:13skin?: string with the recommended values listed inline.
  4. resolved-action.md:8onClick: () => void with note about TS bivariance.

Force-pushed as 4d72098.

Comment thread skills/wix-app/SKILL.md Outdated

3. **Where will it appear?**
- Dashboard sidebar/page → Dashboard Page or Modal
- Default for single-collection CRUD: [Auto Patterns Dashboard](references/AUTO_PATTERNS_DASHBOARD.md) — declarative `patterns.json` (faster to author, iterate by editing JSON, no React rewrite). Skip when you need multi-collection joins, custom business logic, embedded scripts, or external APIs.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make it more stronger, add more description, i tried to run it 4 times and it keep ignoring AUTO_PATTERNS_DASHBOARD.md and not loading it at all.
Another solution is maybe move it into the Dashboard Page file? and there add explanation about auto patterns.

@AlonTzukermanWIX AlonTzukermanWIX force-pushed the feat/auto-patterns-dashboard branch from 4d72098 to 76444e5 Compare May 5, 2026 15:16
@AlonTzukermanWIX

Copy link
Copy Markdown
Author

Routing fix for real-world feedback: agents weren't picking auto-patterns unless the user explicitly said "use auto patterns". Promoted auto-patterns from suggestion to MANDATORY default for single-collection CRUD admin pages (with disqualifiers as the explicit opt-out).

5 surgical edits across 2 files:

  • SKILL.md: 🛑 Auto-Patterns Gate sub-step in MANDATORY WORKFLOW Step 1; new anti-pattern row; Decision Flow Admin sentence flipped to lead with auto-patterns; Quick Decision Helper restructured to put auto-patterns first.
  • DASHBOARD_PAGE.md: STOP banner at the top redirecting to AUTO_PATTERNS_DASHBOARD.md when the use case fits.

Disqualifiers (multi-collection joins / custom business logic / embedded scripts / external APIs / explicit user request for custom React) are listed inline at every gate so the model evaluates them before descending. Force-pushed as 76444e5.

@AlonTzukermanWIX AlonTzukermanWIX force-pushed the feat/auto-patterns-dashboard branch 2 times, most recently from 324efdc to f36732f Compare May 5, 2026 15:52
@AlonTzukermanWIX

Copy link
Copy Markdown
Author

Iteration-flow fix for second round of real-world feedback: when iterating on an existing auto-patterns page, agents were editing page.tsx directly to add banners/headers instead of using the override pattern (custom-slots-override.md etc.).

3 edits, same shape as the previous routing fix:

  • SKILL.md: 🛑 Iteration Gate sub-step in MANDATORY WORKFLOW Step 1 (detect sibling patterns.json before editing any dashboard page file → use AUTO_PATTERNS_DASHBOARD.md Part B + the override topic-index).
  • SKILL.md: anti-pattern row for editing page.tsx to add UI when patterns.json exists.
  • AUTO_PATTERNS_DASHBOARD.md Part B: STOP banner reinforcing "UI changes go through overrides, not page.tsx edits".

Force-pushed as f36732f.

@AlonTzukermanWIX AlonTzukermanWIX force-pushed the feat/auto-patterns-dashboard branch 2 times, most recently from c605269 to 11f72a9 Compare May 18, 2026 07:05
@AlonTzukermanWIX AlonTzukermanWIX force-pushed the feat/auto-patterns-dashboard branch from 11f72a9 to db4538a Compare May 24, 2026 13:51
Comment on lines +62 to +73
## Part A: Creating a New Auto-Patterns Page

### Directory Layout

Create the page folder under `src/extensions/dashboard/pages/<page-name>/` with this structure:

```
src/extensions/dashboard/pages/<page-name>/
├── extensions.ts # Extension registration
├── page.tsx # Thin React wrapper (generated)
└── patterns.json # Declarative AppConfig — edit this to iterate
```

@mirivoWix mirivoWix May 26, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have switched to non-interactive mode, so please delete this. Make sure Auto Patterns generates extensions.ts with commands instead of writing it manually (see #196)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 7be38c8 — replaced the manual directory block with a new Step 1: Scaffold the Dashboard Page that uses wix generate --params '{"extensionType":"DASHBOARD_PAGE",...}'. The CLI now creates the folder, page.tsx, builder file, UUID, and src/extensions.ts registration; the "resulting structure" snippet is now just orientation, not something to hand-create.

Comment on lines +152 to +165
1. **Create `extensions.ts`** in the page directory:

**File:** `src/extensions/dashboard/pages/<page-name>/extensions.ts`

```typescript
import { extensions } from "@wix/astro/builders";

export const dashboardpageMyPage = extensions.dashboardPage({
id: "{{GENERATE_UUID}}",
title: "My Page",
routePath: "my-page",
component: "./extensions/dashboard/pages/my-page/page.tsx",
});
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have switched to non-interactive mode, so please delete this. Make sure Auto Patterns generates extensions.ts with commands instead of writing it manually (see #196)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 7be38c8 — dropped the manual "Create extensions.ts" and "Register the extension" sub-steps entirely. The page is scaffolded via wix generate (new Step 1), and the generator script's --output now targets that scaffolded folder, overwriting the stub page.tsx and adding patterns.json. No hand-written registration anymore — aligned with #196.

AlonTzukermanWIX and others added 2 commits June 1, 2026 16:14
Migrates the auto-patterns dashboard content into the consolidated wix-app skill:
- New top-level reference: skills/wix-app/references/AUTO_PATTERNS_DASHBOARD.md
- 20 sub-references + example JSON in skills/wix-app/references/auto-patterns-dashboard/
- Generator script at skills/wix-app/scripts/generate-auto-patterns.js
- Discoverability hooks in skills/wix-app/SKILL.md (Quick Decision Helper + Cross-Cutting References)
Auto-patterns calls @wix/data at runtime but the app-builder flow does not
add app scopes automatically. Make AUTO_PATTERNS_DASHBOARD.md self-contained
for users running auto-patterns outside the app-builder context by listing
the required SCOPE.DC-DATA.READ / WRITE scopes and the Dev Center URL where
they are configured.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@AlonTzukermanWIX AlonTzukermanWIX force-pushed the feat/auto-patterns-dashboard branch from ca297cc to 320dd92 Compare June 1, 2026 13:15
AlonTzukermanWIX and others added 4 commits June 1, 2026 16:20
Address review feedback (PR wix#78): the skill switched to non-interactive
mode, so the auto-patterns page must be scaffolded with
`wix generate --params` (extensionType DASHBOARD_PAGE) instead of
hand-writing extensions.ts. The CLI now creates the folder, page.tsx,
builder file, UUID, and src/extensions.ts registration; the generator
script overwrites the scaffolded page.tsx and adds patterns.json.

- New Step 1: scaffold via wix generate
- Renumber schema/generator steps to 2-5
- Drop the manual "Create extensions.ts" + "Register the extension" steps
- Point generator --output at the scaffolded page folder

Aligns auto-patterns with the CLI-delegated scaffolding from wix#196.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Empty commit to move the branch tip to a fresh, fetchable SHA without
rewriting history. Used to verify whether the App Builder re-extracts
skills from branch HEAD (restoring auto-patterns) after the prior
force-push orphaned its cached commit.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mirivoWix

Copy link
Copy Markdown
Contributor

Bug: auto-patterns scaffolding leaves a stray default component and the registered component is never the auto-patterns wrapper

When the skill runs wix generate to scaffold a new dashboard page, the CLI creates <page-name>.tsx (e.g. shift-manager.tsx) as the component stub and writes extensions.ts pointing to that file. The generator script then writes page.tsx (the actual auto-patterns wrapper) into the same folder — but extensions.ts is never updated, so the registered component remains the empty EmptyState stub, not the auto-patterns app.

End result: two component files exist side-by-side:

src/extensions/dashboard/pages/shift-manager/
├── shift-manager.ts        # builder file — component still points to shift-manager.tsx
├── shift-manager.tsx       # original CLI stub with EmptyState (registered but wrong)
├── page.tsx                # auto-patterns wrapper (correct, but never registered)
└── patterns.json           # declarative config

The patterns.json and page.tsx are correct, but the registered component in extensions.ts (shift-manager.tsx) is the boilerplate — so the dashboard shows an empty page instead of the auto-patterns UI.

AlonTzukermanWIX and others added 3 commits June 9, 2026 09:17
The CLI scaffolds the page component as `<folder>.tsx` and registers it in
`<folder>.extension.ts`, but the generator wrote `page.tsx` — leaving the
auto-patterns wrapper unregistered next to the empty CLI stub, so the
dashboard rendered blank (reported on PR wix#78).

Fix: the generator now writes the wrapper to `<folder>.tsx` (derived from the
--output basename), overwriting the stub the builder already points at — no
manual registration edit, no stray page.tsx. Docs corrected: builder is
`<page-name>.extension.ts`, CLI component is `<page-name>.tsx`, and the
override references' "page.tsx" shorthand means that component (don't create
a new page.tsx).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…rdless of size

An agent added a working column (badge) override but placed it inline in the
page component instead of components/columns/, citing CODE_QUALITY's
"split only if >300 lines" rule (the page was 34 lines). The specific
placement mandate in the override references lost to the general size
heuristic.

- CODE_QUALITY.md: carve-out so the ~300-line rule never licenses inlining an
  auto-patterns override; overrides are a structural split, not size-based.
- AUTO_PATTERNS_DASHBOARD.md Part B: state up front that every override lives
  in components/<type>/ with a use* hook regardless of size, never inline —
  covering all override types in one place.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@mirivoWix mirivoWix left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants