izanagi-ai 2.3.0 → 2.3.2

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "izanagi-ai",
3
- "version": "2.3.0",
3
+ "version": "2.3.2",
4
4
  "description": "Izanagi AI - Modular Skill-Oriented AI Prompt & Agent Framework for Autonomous Software Engineering",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -11,5 +11,5 @@
11
11
  - [CNCF Landscape — Scalability](https://landscape.cncf.io) — ecossistema de ferramentas para escalar workloads cloud-native.
12
12
 
13
13
  ## Comunidade / tutorial / exemplos
14
- - [High Scalability](http://highscalability.com) — estudos de caso de arquiteturas de sistemas de alta escala.
14
+ - [High Scalability](https://highscalability.com) — estudos de caso de arquiteturas de sistemas de alta escala.
15
15
  - [AWS Architecture Center](https://aws.amazon.com/architecture/) — exemplos de arquiteturas escaláveis de referência.
@@ -72,7 +72,11 @@ Bug encontrado? Escreva teste falhando que reproduz o bug → siga o ciclo → o
72
72
 
73
73
  Não marcou todos? Você pulou TDD. Recomece.
74
74
 
75
+ ## Testes bons (referência local)
76
+
77
+ Antes de escrever ou mudar testes, leia `references/writing-good-tests.md` — regras de testes honestos: nomeie a quebra que o teste pega (bug, não decisão), derive expectativas à mão (nunca com o código sob teste), mock só o nível lento/externo, mocks espelham a estrutura real, e rode o **mutation check** antes de terminar.
78
+
75
79
  ## References
76
80
 
77
- - Repo original: [obra/superpowers](https://github.com/obra/superpowers) — skill `skills/test-driven-development/SKILL.md` (+ `writing-good-tests.md`).
81
+ - Repo original: [obra/superpowers](https://github.com/obra/superpowers) — skill `skills/test-driven-development/SKILL.md` (+ `writing-good-tests.md`, portado localmente em `references/writing-good-tests.md`).
78
82
  - Curadoria completa em `references.md`.
@@ -0,0 +1,198 @@
1
+ # Writing Good Tests
2
+
3
+ **Load this reference when:** writing or changing tests, adding mocks, or
4
+ adding cleanup/helper methods for tests.
5
+
6
+ ## Overview
7
+
8
+ A test exists to catch a specific break. Two principles govern everything
9
+ here:
10
+
11
+ ```
12
+ 1. Every test names the break it catches
13
+ 2. Every test exercises the real thing
14
+ ```
15
+
16
+ Strict TDD produces both naturally: a test written first and watched
17
+ failing against real code has already proven it can fail, and only earns
18
+ a mock when the real dependency proves slow or external.
19
+
20
+ ## Principle 1: Name the Break
21
+
22
+ Before writing the test body, answer: **what production change should
23
+ make this test fail — and is that change a bug or a decision?** A test
24
+ earns its place by catching a wrong branch, missing side effect, wrong
25
+ argument, boundary case, or broken contract.
26
+
27
+ **Derive expectations independently.** Use literals and hand-checked
28
+ fixtures; table-driven tests with literal `want` values are the preferred
29
+ shape. An expectation computed by the code under test — or its helpers —
30
+ passes no matter what that code does:
31
+
32
+ ```typescript
33
+ // ❌ Mirror assertion: the same builder computes both sides — always true
34
+ const expected = buildSearchQuery({ tag: 'urgent' });
35
+ expect(buildSearchQuery({ tag: 'urgent' })).toBe(expected);
36
+
37
+ // ✅ Hand-derived literal
38
+ expect(buildSearchQuery({ tag: 'urgent' })).toBe('tag:"urgent"');
39
+ ```
40
+
41
+ **No change detectors.** If only intentional decisions can fail a test —
42
+ a constant's value, exact message wording, private structure — it fires
43
+ on redesign and sleeps through bugs. Test the behavior that depends on
44
+ the decision: not `expect(MAX_RETRIES).toBe(5)` but "a failing call is
45
+ retried 5 times and the 6th attempt never happens."
46
+
47
+ **Behavior, not text.** Asserting that a script, skill, or config
48
+ contains an exact line proves only that the source is the source. Run
49
+ scripts against controlled inputs and assert outputs, side effects, or
50
+ exit codes. Documents that instruct agents are tested by the consuming
51
+ agent's behavior (superpowers:writing-skills); prose for humans earns no
52
+ test at all.
53
+
54
+ **Your code, not the framework.** Test the contract your code makes at
55
+ its boundaries — the route you register, the query you emit, the payload
56
+ you produce. Upstream mechanics are their maintainers' tests to write
57
+ (the classic: asserting your router invokes a registered handler — that
58
+ is the framework's test, not yours). When upstream behavior genuinely
59
+ surprised you, write one narrow characterization test naming the
60
+ assumption. The same boundary applies inside your code: constructors,
61
+ getters, constants, and trivial forwarding earn tests only when they
62
+ validate, normalize, default, derive, enforce, or cause side effects —
63
+ otherwise assert the first consumer-visible result that depends on them.
64
+
65
+ ### Gate Function
66
+
67
+ ```
68
+ BEFORE writing the test body:
69
+ Name the production change that would make this test fail.
70
+
71
+ Cannot name one → redesign around an observable behavior
72
+ "The source text changed" → run the artifact and assert its effects
73
+ Only intentional decisions → change detector; test the behavior
74
+ that depends on the decision
75
+
76
+ Confirm the expected value is derived without the code under test.
77
+ IF it reuses the code's logic or helpers:
78
+ Replace it with a literal or hand-checked fixture
79
+ ```
80
+
81
+ ## Principle 2: Exercise the Real Thing
82
+
83
+ **The mock earns no assertions.** A mock assertion passes when the mock
84
+ is present and fails when it is absent — it says nothing about the
85
+ component. Assert the real component's behavior; if the mock is what you
86
+ are checking, unmock it or delete the assertion.
87
+
88
+ ```typescript
89
+ // ✅ Real behavior
90
+ expect(screen.getByRole('navigation')).toBeInTheDocument();
91
+
92
+ // ❌ Mock existence
93
+ expect(screen.getByTestId('sidebar-mock')).toBeInTheDocument();
94
+ ```
95
+
96
+ **your human partner's correction:** "Are we testing the behavior of a
97
+ mock?"
98
+
99
+ **Mock at the right level.** Learn every side effect of the real method
100
+ before replacing it; mock the slow or external operation and keep what
101
+ the test depends on real. When unsure, run the test against the real
102
+ implementation first and observe what actually needs to happen.
103
+
104
+ ```typescript
105
+ // ❌ The mock swallows the config write that duplicate detection reads
106
+ vi.mock('ToolCatalog', () => ({
107
+ discoverAndCacheTools: vi.fn().mockResolvedValue(undefined)
108
+ }));
109
+
110
+ // ✅ Mock only the slow server startup; the config write stays real
111
+ vi.mock('MCPServerManager');
112
+ ```
113
+
114
+ **Make doubles specific.** When arguments, call counts, or ordering are
115
+ part of the contract, assert them — a fake that accepts anything verifies
116
+ nothing. Give each branch (success, error, malformed) its own fixture or
117
+ spy, so the wrong branch cannot satisfy the expectation.
118
+
119
+ **Mirror real data completely.** Mock the complete structure as it exists
120
+ in reality — all documented fields — not just the ones your test reads.
121
+ Partial mocks fail silently when downstream code reads an omitted field:
122
+ the test passes while integration breaks.
123
+
124
+ **Production classes carry production methods only.** Cleanup that only
125
+ tests need lives in test utilities, never as a `destroy()` on the
126
+ production class. Ask: is this method called only from tests? Does this
127
+ class own this resource's lifecycle? Wrong answers → test utility.
128
+
129
+ **Prefer real components over complex mocks.** When mock setup outgrows
130
+ the test logic, mocks miss methods the real components have, or tests
131
+ break when the mock changes, switch to an integration test with real
132
+ components. **your human partner's question:** "Do we need to be using a
133
+ mock here?"
134
+
135
+ ### Gate Function
136
+
137
+ ```
138
+ BEFORE adding a mock or test helper:
139
+ List the real method's side effects; keep the ones the test
140
+ depends on real — mock the slow/external level below them.
141
+
142
+ Mock responses mirror the complete real structure.
143
+
144
+ A method only tests call lives in test utilities, not production.
145
+
146
+ About to assert on the mock itself?
147
+ Unmock it or delete the assertion.
148
+ ```
149
+
150
+ ## Tests Ship With the Implementation
151
+
152
+ The TDD cycle — failing test, minimal implementation, refactor — is what
153
+ "complete" means. Ship the tests the behavior needs and only those:
154
+ trivial code and human prose earn none, and a test written to satisfy
155
+ process costs maintenance forever.
156
+
157
+ ## The Mutation Check
158
+
159
+ Before finishing, mentally mutate the production code; at least one test
160
+ should fail for each realistic mutation:
161
+
162
+ - Wrong constant or argument
163
+ - Wrong branch handler
164
+ - Missing state change or side effect
165
+ - Empty or default return
166
+ - Missing validation for zero, empty, nil, unauthorized, or malformed input
167
+
168
+ A mutation nothing catches marks the behavior as unprotected — or the
169
+ test as tautological.
170
+
171
+ ## Quick Reference
172
+
173
+ | When you... | Do |
174
+ |-------------|-----|
175
+ | Write any test | Name the break it catches — a bug, not a decision |
176
+ | Build an expected value | Derive it by hand; never with the code under test |
177
+ | Test a script or document | Run it / pressure-test its consumer; never grep its text |
178
+ | Reach for a dependency test | Test your boundary contract, not their documented mechanics |
179
+ | Want to assert on a mocked element | Test the real component, or unmock it |
180
+ | Are about to mock a method | Learn its side effects; mock the slow/external level |
181
+ | Build a mock response | Mirror the real structure completely |
182
+ | Need cleanup only tests use | Put it in test utilities |
183
+ | Watch mock setup balloon | Switch to an integration test with real components |
184
+ | Finish a test file | Run the mutation check |
185
+
186
+ ## Warning Signs
187
+
188
+ - Setup and assertion share the same object, guaranteeing equality
189
+ - The test can fail only through a panic, crash, or missing selector
190
+ - The test fails on every intentional change, never on accidental breakage
191
+ - Expected values are hidden behind loops, builders, or helpers
192
+ - The test greps source text, or asserts a removed symbol stays removed
193
+ - The test would still matter if only the framework remained
194
+ - The test exists for coverage, checking no side effect or outcome
195
+ - An assertion checks a `*-mock` test ID, or fails if you remove the mock
196
+ - A method is called only from test files
197
+ - Mock setup is more than half the test, or you can't explain why the mock is needed
198
+ - Mocking "just to be safe"
@@ -6,7 +6,7 @@ Curadoria da skill TDD do framework Superpowers.
6
6
 
7
7
  - **Repositório**: https://github.com/obra/superpowers — 264k+ stars, MIT
8
8
  - **Skill original**: `skills/test-driven-development/SKILL.md`
9
- - **Auxiliar**: `skills/test-driven-development/writing-good-tests.md` — regras para testes honestos (nomeie a mudança de produção que faria o teste falhar; asserts em comportamento real; helpers só em código de teste...)
9
+ - **Auxiliar**: `skills/test-driven-development/writing-good-tests.md` — regras para testes honestos (nomeie a mudança de produção que faria o teste falhar; asserts em comportamento real; helpers só em código de teste...) — **portado localmente em `references/writing-good-tests.md`**
10
10
 
11
11
  ## Aproveitado no Izanagi
12
12
 
@@ -65,8 +65,15 @@ Minimalism & Swiss, Neumorphism, Glassmorphism, Brutalism, 3D & Hyperrealism, Vi
65
65
 
66
66
  Não fabrique. Retente com keywords mais amplas (produto + estilo separados). Se ainda vazio, use defaults do nicho e **diga explicitamente** que a recomendação veio dos defaults, não de um match.
67
67
 
68
+ ## Arquivos locais (referências portadas)
69
+
70
+ Leia **sob demanda** — nunca carregue ambos de uma vez:
71
+
72
+ - `references/quick-reference.md` — regras UX completas em 10 categorias priorizadas (a11y, touch, performance, estilo, layout, tipografia/cor, animação, forms, navegação, charts). Use em **reviews/auditorias de UI** ou para o checklist completo de uma categoria.
73
+ - `references/pro-rules.md` — polish de **apps nativas** (iOS/Android/RN/Flutter): ícones, interação, light/dark, layout com safe-areas + checklist canônico pré-entrega. Use antes de entregar UI de app nativo.
74
+
68
75
  ## References
69
76
 
70
- - Repo: [nextlevelbuilder/ui-ux-pro-max-skill](https://github.com/nextlevelbuilder/ui-ux-pro-max-skill) — 113k stars, MIT. Instalável via `npx ui-ux-pro-max-cli init --ai opencode` (traz scripts Python de busca, dados CSV completos e 161 regras de raciocínio por indústria).
77
+ - Repo: [nextlevelbuilder/ui-ux-pro-max-skill](https://github.com/nextlevelbuilder/ui-ux-pro-max-skill) — 113k stars, MIT. Instalação opcional via `npx ui-ux-pro-max-cli init --ai opencode` traz a busca Python + dados CSV completos (~1.5MB) não necessária aqui (versão texto portada em `references/`).
71
78
  - Docs: https://uupm.cc — comparativo básico vs premium.
72
79
  - Veja `references.md` para a curadoria completa de fontes.
@@ -0,0 +1,109 @@
1
+ # Common Rules for Professional UI + Pre-Delivery Checklist
2
+
3
+ Load this file before final delivery of native/mobile app UI (iOS/Android/React Native/Flutter), or when the user reports the UI "doesn't look professional" and the cause isn't obvious from the priority table in SKILL.md.
4
+
5
+ **Scope notice:** everything below targets native/mobile app UI. For web/desktop interaction patterns, use `references/quick-reference.md` (stack-agnostic) instead — these tables assume touch targets, safe areas, and platform gesture conventions that don't apply 1:1 to desktop web.
6
+
7
+ These are frequently overlooked issues that make UI look unprofessional.
8
+
9
+ ## Icons & Visual Elements
10
+
11
+ | Rule | Standard | Avoid | Why It Matters |
12
+ |------|----------|--------|----------------|
13
+ | **No Emoji as Structural Icons** | Use vector-based icons (e.g., Lucide, react-native-vector-icons, @expo/vector-icons). | Using emojis (🎨 🚀 ⚙️) for navigation, settings, or system controls. | Emojis are font-dependent, inconsistent across platforms, and cannot be controlled via design tokens. |
14
+ | **Vector-Only Assets** | Use SVG or platform vector icons that scale cleanly and support theming. | Raster PNG icons that blur or pixelate. | Ensures scalability, crisp rendering, and dark/light mode adaptability. |
15
+ | **Stable Interaction States** | Use color, opacity, or elevation transitions for press states without changing layout bounds. | Layout-shifting transforms that move surrounding content or trigger visual jitter. | Prevents unstable interactions and preserves smooth motion/perceived quality on mobile. |
16
+ | **Correct Brand Logos** | Use official brand assets and follow their usage guidelines (spacing, color, clear space). | Guessing logo paths, recoloring unofficially, or modifying proportions. | Prevents brand misuse and ensures legal/platform compliance. |
17
+ | **Consistent Icon Sizing** | Define icon sizes as design tokens (e.g., icon-sm, icon-md = 24pt, icon-lg). | Mixing arbitrary values like 20pt / 24pt / 28pt randomly. | Maintains rhythm and visual hierarchy across the interface. |
18
+ | **Stroke Consistency** | Use a consistent stroke width within the same visual layer (e.g., 1.5px or 2px). | Mixing thick and thin stroke styles arbitrarily. | Inconsistent strokes reduce perceived polish and cohesion. |
19
+ | **Filled vs Outline Discipline** | Use one icon style per hierarchy level. | Mixing filled and outline icons at the same hierarchy level. | Maintains semantic clarity and stylistic coherence. |
20
+ | **Touch Target Minimum** | Minimum 44×44pt interactive area (use hitSlop if icon is smaller). | Small icons without expanded tap area. | Meets accessibility and platform usability standards. |
21
+ | **Icon Alignment** | Align icons to text baseline and maintain consistent padding. | Misaligned icons or inconsistent spacing around them. | Prevents subtle visual imbalance that reduces perceived quality. |
22
+ | **Icon Contrast** | Follow WCAG contrast standards: 4.5:1 for small elements, 3:1 minimum for larger UI glyphs. | Low-contrast icons that blend into the background. | Ensures accessibility in both light and dark modes. |
23
+
24
+ ## Interaction (App)
25
+
26
+ | Rule | Do | Don't |
27
+ |------|----|----- |
28
+ | **Tap feedback** | Provide clear pressed feedback (ripple/opacity/elevation) within 80-150ms | No visual response on tap |
29
+ | **Animation timing** | Keep micro-interactions around 150-300ms with platform-native easing | Instant transitions or slow animations (>500ms) |
30
+ | **Accessibility focus** | Ensure screen reader focus order matches visual order and labels are descriptive | Unlabeled controls or confusing focus traversal |
31
+ | **Disabled state clarity** | Use disabled semantics (`disabled`/native disabled props), reduced emphasis, and no tap action | Controls that look tappable but do nothing |
32
+ | **Touch target minimum** | Keep tap areas >=44x44pt (iOS) or >=48x48dp (Android), expand hit area when icon is smaller | Tiny tap targets or icon-only hit areas without padding |
33
+ | **Gesture conflict prevention** | Keep one primary gesture per region and avoid nested tap/drag conflicts | Overlapping gestures causing accidental actions |
34
+ | **Semantic native controls** | Prefer native interactive primitives (`Button`, `Pressable`, platform equivalents) with proper accessibility roles | Generic containers used as primary controls without semantics |
35
+
36
+ ## Light/Dark Mode Contrast
37
+
38
+ | Rule | Do | Don't |
39
+ |------|----|----- |
40
+ | **Surface readability (light)** | Keep cards/surfaces clearly separated from background with sufficient opacity/elevation | Overly transparent surfaces that blur hierarchy |
41
+ | **Text contrast (light)** | Maintain body text contrast >=4.5:1 against light surfaces | Low-contrast gray body text |
42
+ | **Text contrast (dark)** | Maintain primary text contrast >=4.5:1 and secondary text >=3:1 on dark surfaces | Dark mode text that blends into background |
43
+ | **Border and divider visibility** | Ensure separators are visible in both themes (not just light mode) | Theme-specific borders disappearing in one mode |
44
+ | **State contrast parity** | Keep pressed/focused/disabled states equally distinguishable in light and dark themes | Defining interaction states for one theme only |
45
+ | **Token-driven theming** | Use semantic color tokens mapped per theme across app surfaces/text/icons | Hardcoded per-screen hex values |
46
+ | **Scrim and modal legibility** | Use a modal scrim strong enough to isolate foreground content (typically 40-60% black) | Weak scrim that leaves background visually competing |
47
+
48
+ ## Layout & Spacing
49
+
50
+ | Rule | Do | Don't |
51
+ |------|----|----- |
52
+ | **Safe-area compliance** | Respect top/bottom safe areas for all fixed headers, tab bars, and CTA bars | Placing fixed UI under notch, status bar, or gesture area |
53
+ | **System bar clearance** | Add spacing for status/navigation bars and gesture home indicator | Let tappable content collide with OS chrome |
54
+ | **Consistent content width** | Keep predictable content width per device class (phone/tablet) | Mixing arbitrary widths between screens |
55
+ | **8dp spacing rhythm** | Use a consistent 4/8dp spacing system for padding/gaps/section spacing | Random spacing increments with no rhythm |
56
+ | **Readable text measure** | Keep long-form text readable on large devices (avoid edge-to-edge paragraphs on tablets) | Full-width long text that hurts readability |
57
+ | **Section spacing hierarchy** | Define clear vertical rhythm tiers (e.g., 16/24/32/48) by hierarchy | Similar UI levels with inconsistent spacing |
58
+ | **Adaptive gutters by breakpoint** | Increase horizontal insets on larger widths and in landscape | Same narrow gutter on all device sizes/orientations |
59
+ | **Scroll and fixed element coexistence** | Add bottom/top content insets so lists are not hidden behind fixed bars | Scroll content obscured by sticky headers/footers |
60
+
61
+ ---
62
+
63
+ ## Pre-Delivery Checklist (canonical — the only one)
64
+
65
+ Before delivering app UI code, verify every item below. Start with the process steps, then the per-area checkboxes.
66
+
67
+ ### Process
68
+ - [ ] Applied the Accessibility/Performance/Animation rules from `quick-reference.md` (`color-contrast`, `z-index-management`, `motion-meaning`, `loading-states`) as a validation pass before implementation
69
+ - [ ] Reviewed `quick-reference.md` §1–§3 (CRITICAL + HIGH) as a final pass
70
+ - [ ] Tested on 375px (small phone) and in landscape orientation
71
+ - [ ] Verified behavior with **reduced-motion** enabled and **Dynamic Type**/largest system text size
72
+ - [ ] Checked dark mode contrast independently (never assume light-mode values carry over)
73
+ - [ ] Confirmed all touch targets ≥44pt and no content hidden behind safe areas
74
+
75
+ ### Visual Quality
76
+ - [ ] No emojis used as icons (use SVG instead)
77
+ - [ ] All icons come from a consistent icon family and style
78
+ - [ ] Official brand assets are used with correct proportions and clear space
79
+ - [ ] Pressed-state visuals do not shift layout bounds or cause jitter
80
+ - [ ] Semantic theme tokens are used consistently (no ad-hoc per-screen hardcoded colors)
81
+
82
+ ### Interaction
83
+ - [ ] All tappable elements provide clear pressed feedback (ripple/opacity/elevation)
84
+ - [ ] Touch targets meet minimum size (>=44x44pt iOS, >=48x48dp Android)
85
+ - [ ] Micro-interaction timing stays in the 150-300ms range with native-feeling easing
86
+ - [ ] Disabled states are visually clear and non-interactive
87
+ - [ ] Screen reader focus order matches visual order, and interactive labels are descriptive
88
+ - [ ] Gesture regions avoid nested/conflicting interactions (tap/drag/back-swipe conflicts)
89
+
90
+ ### Light/Dark Mode
91
+ - [ ] Primary text contrast >=4.5:1 in both light and dark mode
92
+ - [ ] Secondary text contrast >=3:1 in both light and dark mode
93
+ - [ ] Dividers/borders and interaction states are distinguishable in both modes
94
+ - [ ] Modal/drawer scrim opacity is strong enough to preserve foreground legibility (typically 40-60% black)
95
+ - [ ] Both themes are tested before delivery (not inferred from a single theme)
96
+
97
+ ### Layout
98
+ - [ ] Safe areas are respected for headers, tab bars, and bottom CTA bars
99
+ - [ ] Scroll content is not hidden behind fixed/sticky bars
100
+ - [ ] Verified on small phone, large phone, and tablet (portrait + landscape)
101
+ - [ ] Horizontal insets/gutters adapt correctly by device size and orientation
102
+ - [ ] 4/8dp spacing rhythm is maintained across component, section, and page levels
103
+ - [ ] Long-form text measure remains readable on larger devices (no edge-to-edge paragraphs)
104
+
105
+ ### Accessibility
106
+ - [ ] All meaningful images/icons have accessibility labels
107
+ - [ ] Form fields have labels, hints, and clear error messages
108
+ - [ ] Color is not the only indicator
109
+ - [ ] Reduced motion and dynamic text size are supported without layout breakage
@@ -0,0 +1,240 @@
1
+ # Quick Reference — Full Rule Set (all 10 categories)
2
+
3
+ Load this file when doing a UI review/audit pass, or when you need the full checklist for a category beyond the priority table in SKILL.md. This is the static index of the complete rule set — scan the relevant category on demand (avoid loading the whole file every time).
4
+
5
+ ## Quick Reference
6
+
7
+ ### 1. Accessibility (CRITICAL)
8
+
9
+ - `color-contrast` - Minimum 4.5:1 ratio for normal text (large text 3:1); Material Design
10
+ - `focus-states` - Visible focus rings on interactive elements (2–4px; Apple HIG, MD)
11
+ - `alt-text` - Descriptive alt text for meaningful images
12
+ - `aria-labels` - aria-label for icon-only buttons; accessibilityLabel in native (Apple HIG)
13
+ - `keyboard-nav` - Tab order matches visual order; full keyboard support (Apple HIG)
14
+ - `form-labels` - Use label with for attribute
15
+ - `skip-links` - Skip to main content for keyboard users
16
+ - `heading-hierarchy` - Sequential h1→h6, no level skip
17
+ - `color-not-only` - Don't convey info by color alone (add icon/text)
18
+ - `dynamic-type` - Support system text scaling; avoid truncation as text grows (Apple Dynamic Type, MD)
19
+ - `reduced-motion` - Respect prefers-reduced-motion; reduce/disable animations when requested (Apple Reduced Motion API, MD)
20
+ - `voiceover-sr` - Meaningful accessibilityLabel/accessibilityHint; logical reading order for VoiceOver/screen readers (Apple HIG, MD)
21
+ - `escape-routes` - Provide cancel/back in modals and multi-step flows (Apple HIG)
22
+ - `keyboard-shortcuts` - Preserve system and a11y shortcuts; offer keyboard alternatives for drag-and-drop (Apple HIG)
23
+
24
+ ### 2. Touch & Interaction (CRITICAL)
25
+
26
+ - `touch-target-size` - Min 44×44pt (Apple) / 48×48dp (Material); extend hit area beyond visual bounds if needed
27
+ - `touch-spacing` - Minimum 8px/8dp gap between touch targets (Apple HIG, MD)
28
+ - `hover-vs-tap` - Use click/tap for primary interactions; don't rely on hover alone
29
+ - `loading-buttons` - Disable button during async operations; show spinner or progress
30
+ - `error-feedback` - Clear error messages near problem
31
+ - `cursor-pointer` - Add cursor-pointer to clickable elements (Web)
32
+ - `gesture-conflicts` - Avoid horizontal swipe on main content; prefer vertical scroll
33
+ - `tap-delay` - Use touch-action: manipulation to reduce 300ms delay (Web)
34
+ - `standard-gestures` - Use platform standard gestures consistently; don't redefine (e.g. swipe-back, pinch-zoom) (Apple HIG)
35
+ - `system-gestures` - Don't block system gestures (Control Center, back swipe, etc.) (Apple HIG)
36
+ - `press-feedback` - Visual feedback on press (ripple/highlight; MD state layers)
37
+ - `haptic-feedback` - Use haptic for confirmations and important actions; avoid overuse (Apple HIG)
38
+ - `gesture-alternative` - Don't rely on gesture-only interactions; always provide visible controls for critical actions
39
+ - `safe-area-awareness` - Keep primary touch targets away from notch, Dynamic Island, gesture bar and screen edges
40
+ - `no-precision-required` - Avoid requiring pixel-perfect taps on small icons or thin edges
41
+ - `swipe-clarity` - Swipe actions must show clear affordance or hint (chevron, label, tutorial)
42
+ - `drag-threshold` - Use a movement threshold before starting drag to avoid accidental drags
43
+
44
+ ### 3. Performance (HIGH)
45
+
46
+ - `image-optimization` - Use WebP/AVIF, responsive images (srcset/sizes), lazy load non-critical assets
47
+ - `image-dimension` - Declare width/height or use aspect-ratio to prevent layout shift (Core Web Vitals: CLS)
48
+ - `font-loading` - Use font-display: swap/optional to avoid invisible text (FOIT); reserve space to reduce layout shift (MD)
49
+ - `font-preload` - Preload only critical fonts; avoid overusing preload on every variant
50
+ - `critical-css` - Prioritize above-the-fold CSS (inline critical CSS or early-loaded stylesheet)
51
+ - `lazy-loading` - Lazy load non-hero components via dynamic import / route-level splitting
52
+ - `bundle-splitting` - Split code by route/feature (React Suspense / Next.js dynamic) to reduce initial load and TTI
53
+ - `third-party-scripts` - Load third-party scripts async/defer; audit and remove unnecessary ones (MD)
54
+ - `reduce-reflows` - Avoid frequent layout reads/writes; batch DOM reads then writes
55
+ - `content-jumping` - Reserve space for async content to avoid layout jumps (Core Web Vitals: CLS)
56
+ - `lazy-load-below-fold` - Use loading="lazy" for below-the-fold images and heavy media
57
+ - `virtualize-lists` - Virtualize lists with 50+ items to improve memory efficiency and scroll performance
58
+ - `main-thread-budget` - Keep per-frame work under ~16ms for 60fps; move heavy tasks off main thread (HIG, MD)
59
+ - `progressive-loading` - Use skeleton screens / shimmer instead of long blocking spinners for >1s operations (Apple HIG)
60
+ - `input-latency` - Keep input latency under ~100ms for taps/scrolls (Material responsiveness standard)
61
+ - `tap-feedback-speed` - Provide visual feedback within 100ms of tap (Apple HIG)
62
+ - `debounce-throttle` - Use debounce/throttle for high-frequency events (scroll, resize, input)
63
+ - `offline-support` - Provide offline state messaging and basic fallback (PWA / mobile)
64
+ - `network-fallback` - Offer degraded modes for slow networks (lower-res images, fewer animations)
65
+
66
+ ### 4. Style Selection (HIGH)
67
+
68
+ - `style-match` - Match style to product type (use the design system generator in SKILL.md)
69
+ - `consistency` - Use same style across all pages
70
+ - `no-emoji-icons` - Use SVG icons (Heroicons, Lucide), not emojis
71
+ - `color-palette-from-product` - Choose palette matching product/industry (query SKILL.md for style/palette guidance)
72
+ - `effects-match-style` - Shadows, blur, radius aligned with chosen style (glass / flat / clay etc.)
73
+ - `platform-adaptive` - Respect platform idioms (iOS HIG vs Material): navigation, controls, typography, motion
74
+ - `state-clarity` - Make hover/pressed/disabled states visually distinct while staying on-style (Material state layers)
75
+ - `elevation-consistent` - Use a consistent elevation/shadow scale for cards, sheets, modals; avoid random shadow values
76
+ - `dark-mode-pairing` - Design light/dark variants together to keep brand, contrast, and style consistent
77
+ - `icon-style-consistent` - Use one icon set/visual language (stroke width, corner radius) across the product
78
+ - `system-controls` - Prefer native/system controls over fully custom ones; only customize when branding requires it (Apple HIG)
79
+ - `blur-purpose` - Use blur to indicate background dismissal (modals, sheets), not as decoration (Apple HIG)
80
+ - `primary-action` - Each screen should have only one primary CTA; secondary actions visually subordinate (Apple HIG)
81
+
82
+ ### 5. Layout & Responsive (HIGH)
83
+
84
+ - `viewport-meta` - width=device-width initial-scale=1 (never disable zoom)
85
+ - `mobile-first` - Design mobile-first, then scale up to tablet and desktop
86
+ - `breakpoint-consistency` - Use systematic breakpoints (e.g. 375 / 768 / 1024 / 1440)
87
+ - `readable-font-size` - Minimum 16px body text on mobile (avoids iOS auto-zoom)
88
+ - `line-length-control` - Mobile 35–60 chars per line; desktop 60–75 chars
89
+ - `horizontal-scroll` - No horizontal scroll on mobile; ensure content fits viewport width
90
+ - `spacing-scale` - Use 4pt/8dp incremental spacing system (Material Design)
91
+ - `touch-density` - Keep component spacing comfortable for touch: not cramped, not causing mis-taps
92
+ - `container-width` - Consistent max-width on desktop (max-w-6xl / 7xl)
93
+ - `z-index-management` - Define layered z-index scale (e.g. 0 / 10 / 20 / 40 / 100 / 1000)
94
+ - `fixed-element-offset` - Fixed navbar/bottom bar must reserve safe padding for underlying content
95
+ - `scroll-behavior` - Avoid nested scroll regions that interfere with the main scroll experience
96
+ - `viewport-units` - Prefer min-h-dvh over 100vh on mobile
97
+ - `orientation-support` - Keep layout readable and operable in landscape mode
98
+ - `content-priority` - Show core content first on mobile; fold or hide secondary content
99
+ - `visual-hierarchy` - Establish hierarchy via size, spacing, contrast — not color alone
100
+
101
+ ### 6. Typography & Color (MEDIUM)
102
+
103
+ - `line-height` - Use 1.5-1.75 for body text
104
+ - `line-length` - Limit to 65-75 characters per line
105
+ - `font-pairing` - Match heading/body font personalities
106
+ - `font-scale` - Consistent type scale (e.g. 12 14 16 18 24 32)
107
+ - `contrast-readability` - Darker text on light backgrounds (e.g. slate-900 on white)
108
+ - `text-styles-system` - Use platform type system: iOS 11 Dynamic Type styles / Material 5 type roles (display, headline, title, body, label) (HIG, MD)
109
+ - `weight-hierarchy` - Use font-weight to reinforce hierarchy: Bold headings (600–700), Regular body (400), Medium labels (500) (MD)
110
+ - `color-semantic` - Define semantic color tokens (primary, secondary, error, surface, on-surface) not raw hex in components (Material color system)
111
+ - `color-dark-mode` - Dark mode uses desaturated / lighter tonal variants, not inverted colors; test contrast separately (HIG, MD)
112
+ - `color-accessible-pairs` - Foreground/background pairs must meet 4.5:1 (AA) or 7:1 (AAA); use tools to verify (WCAG, MD)
113
+ - `color-not-decorative-only` - Functional color (error red, success green) must include icon/text; avoid color-only meaning (HIG, MD)
114
+ - `truncation-strategy` - Prefer wrapping over truncation; when truncating use ellipsis and provide full text via tooltip/expand (Apple HIG)
115
+ - `letter-spacing` - Respect default letter-spacing per platform; avoid tight tracking on body text (HIG, MD)
116
+ - `number-tabular` - Use tabular/monospaced figures for data columns, prices, and timers to prevent layout shift
117
+ - `whitespace-balance` - Use whitespace intentionally to group related items and separate sections; avoid visual clutter (Apple HIG)
118
+
119
+ ### 7. Animation (MEDIUM)
120
+
121
+ - `duration-timing` - Use 150–300ms for micro-interactions; complex transitions ≤400ms; avoid >500ms (MD)
122
+ - `transform-performance` - Use transform/opacity only; avoid animating width/height/top/left
123
+ - `loading-states` - Show skeleton or progress indicator when loading exceeds 300ms
124
+ - `excessive-motion` - Animate 1-2 key elements per view max
125
+ - `easing` - Use ease-out for entering, ease-in for exiting; avoid linear for UI transitions
126
+ - `motion-meaning` - Every animation must express a cause-effect relationship, not just be decorative (Apple HIG)
127
+ - `state-transition` - State changes (hover / active / expanded / collapsed / modal) should animate smoothly, not snap
128
+ - `continuity` - Page/screen transitions should maintain spatial continuity (shared element, directional slide) (Apple HIG)
129
+ - `parallax-subtle` - Use parallax sparingly; must respect reduced-motion and not cause disorientation (Apple HIG)
130
+ - `spring-physics` - Prefer spring/physics-based curves over linear or cubic-bezier for natural feel (Apple HIG fluid animations)
131
+ - `exit-faster-than-enter` - Exit animations shorter than enter (~60–70% of enter duration) to feel responsive (MD motion)
132
+ - `stagger-sequence` - Stagger list/grid item entrance by 30–50ms per item; avoid all-at-once or too-slow reveals (MD)
133
+ - `shared-element-transition` - Use shared element / hero transitions for visual continuity between screens (MD, HIG)
134
+ - `interruptible` - Animations must be interruptible; user tap/gesture cancels in-progress animation immediately (Apple HIG)
135
+ - `no-blocking-animation` - Never block user input during an animation; UI must stay interactive (Apple HIG)
136
+ - `fade-crossfade` - Use crossfade for content replacement within the same container (MD)
137
+ - `scale-feedback` - Subtle scale (0.95–1.05) on press for tappable cards/buttons; restore on release (HIG, MD)
138
+ - `gesture-feedback` - Drag, swipe, and pinch must provide real-time visual response tracking the finger (MD Motion)
139
+ - `hierarchy-motion` - Use translate/scale direction to express hierarchy: enter from below = deeper, exit upward = back (MD)
140
+ - `motion-consistency` - Unify duration/easing tokens globally; all animations share the same rhythm and feel
141
+ - `opacity-threshold` - Fading elements should not linger below opacity 0.2; either fade fully or remain visible
142
+ - `modal-motion` - Modals/sheets should animate from their trigger source (scale+fade or slide-in) for spatial context (HIG, MD)
143
+ - `navigation-direction` - Forward navigation animates left/up; backward animates right/down — keep direction logically consistent (HIG)
144
+ - `layout-shift-avoid` - Animations must not cause layout reflow or CLS; use transform for position changes
145
+
146
+ ### 8. Forms & Feedback (MEDIUM)
147
+
148
+ - `input-labels` - Visible label per input (not placeholder-only)
149
+ - `error-placement` - Show error below the related field
150
+ - `submit-feedback` - Loading then success/error state on submit
151
+ - `required-indicators` - Mark required fields (e.g. asterisk)
152
+ - `empty-states` - Helpful message and action when no content
153
+ - `toast-dismiss` - Auto-dismiss toasts in 3-5s
154
+ - `confirmation-dialogs` - Confirm before destructive actions
155
+ - `input-helper-text` - Provide persistent helper text below complex inputs, not just placeholder (Material Design)
156
+ - `disabled-states` - Disabled elements use reduced opacity (0.38–0.5) + cursor change + semantic attribute (MD)
157
+ - `progressive-disclosure` - Reveal complex options progressively; don't overwhelm users upfront (Apple HIG)
158
+ - `inline-validation` - Validate on blur (not keystroke); show error only after user finishes input (MD)
159
+ - `input-type-keyboard` - Use semantic input types (email, tel, number) to trigger the correct mobile keyboard (HIG, MD)
160
+ - `password-toggle` - Provide show/hide toggle for password fields (MD)
161
+ - `autofill-support` - Use autocomplete / textContentType attributes so the system can autofill (HIG, MD)
162
+ - `undo-support` - Allow undo for destructive or bulk actions (e.g. "Undo delete" toast) (Apple HIG)
163
+ - `success-feedback` - Confirm completed actions with brief visual feedback (checkmark, toast, color flash) (MD)
164
+ - `error-recovery` - Error messages must include a clear recovery path (retry, edit, help link) (HIG, MD)
165
+ - `multi-step-progress` - Multi-step flows show step indicator or progress bar; allow back navigation (MD)
166
+ - `form-autosave` - Long forms should auto-save drafts to prevent data loss on accidental dismissal (Apple HIG)
167
+ - `sheet-dismiss-confirm` - Confirm before dismissing a sheet/modal with unsaved changes (Apple HIG)
168
+ - `error-clarity` - Error messages must state cause + how to fix (not just "Invalid input") (HIG, MD)
169
+ - `field-grouping` - Group related fields logically (fieldset/legend or visual grouping) (MD)
170
+ - `read-only-distinction` - Read-only state should be visually and semantically different from disabled (MD)
171
+ - `focus-management` - After submit error, auto-focus the first invalid field (WCAG, MD)
172
+ - `error-summary` - For multiple errors, show summary at top with anchor links to each field (WCAG)
173
+ - `touch-friendly-input` - Mobile input height ≥44px to meet touch target requirements (Apple HIG)
174
+ - `destructive-emphasis` - Destructive actions use semantic danger color (red) and are visually separated from primary actions (HIG, MD)
175
+ - `toast-accessibility` - Toasts must not steal focus; use aria-live="polite" for screen reader announcement (WCAG)
176
+ - `aria-live-errors` - Form errors use aria-live region or role="alert" to notify screen readers (WCAG)
177
+ - `contrast-feedback` - Error and success state colors must meet 4.5:1 contrast ratio (WCAG, MD)
178
+ - `timeout-feedback` - Request timeout must show clear feedback with retry option (MD)
179
+
180
+ ### 9. Navigation Patterns (HIGH)
181
+
182
+ - `bottom-nav-limit` - Bottom navigation max 5 items; use labels with icons (Material Design)
183
+ - `drawer-usage` - Use drawer/sidebar for secondary navigation, not primary actions (Material Design)
184
+ - `back-behavior` - Back navigation must be predictable and consistent; preserve scroll/state (Apple HIG, MD)
185
+ - `deep-linking` - All key screens must be reachable via deep link / URL for sharing and notifications (Apple HIG, MD)
186
+ - `tab-bar-ios` - iOS: use bottom Tab Bar for top-level navigation (Apple HIG)
187
+ - `top-app-bar-android` - Android: use Top App Bar with navigation icon for primary structure (Material Design)
188
+ - `nav-label-icon` - Navigation items must have both icon and text label; icon-only nav harms discoverability (MD)
189
+ - `nav-state-active` - Current location must be visually highlighted (color, weight, indicator) in navigation (HIG, MD)
190
+ - `nav-hierarchy` - Primary nav (tabs/bottom bar) vs secondary nav (drawer/settings) must be clearly separated (MD)
191
+ - `modal-escape` - Modals and sheets must offer a clear close/dismiss affordance; swipe-down to dismiss on mobile (Apple HIG)
192
+ - `search-accessible` - Search must be easily reachable (top bar or tab); provide recent/suggested queries (MD)
193
+ - `breadcrumb-web` - Web: use breadcrumbs for 3+ level deep hierarchies to aid orientation (MD)
194
+ - `state-preservation` - Navigating back must restore previous scroll position, filter state, and input (HIG, MD)
195
+ - `gesture-nav-support` - Support system gesture navigation (iOS swipe-back, Android predictive back) without conflict (HIG, MD)
196
+ - `tab-badge` - Use badges on nav items sparingly to indicate unread/pending; clear after user visits (HIG, MD)
197
+ - `overflow-menu` - When actions exceed available space, use overflow/more menu instead of cramming (MD)
198
+ - `bottom-nav-top-level` - Bottom nav is for top-level screens only; never nest sub-navigation inside it (MD)
199
+ - `adaptive-navigation` - Large screens (≥1024px) prefer sidebar; small screens use bottom/top nav (Material Adaptive)
200
+ - `back-stack-integrity` - Never silently reset the navigation stack or unexpectedly jump to home (HIG, MD)
201
+ - `navigation-consistency` - Navigation placement must stay the same across all pages; don't change by page type
202
+ - `avoid-mixed-patterns` - Don't mix Tab + Sidebar + Bottom Nav at the same hierarchy level
203
+ - `modal-vs-navigation` - Modals must not be used for primary navigation flows; they break the user's path (HIG)
204
+ - `focus-on-route-change` - After page transition, move focus to main content region for screen reader users (WCAG)
205
+ - `persistent-nav` - Core navigation must remain reachable from deep pages; don't hide it entirely in sub-flows (HIG, MD)
206
+ - `destructive-nav-separation` - Dangerous actions (delete account, logout) must be visually and spatially separated from normal nav items (HIG, MD)
207
+ - `empty-nav-state` - When a nav destination is unavailable, explain why instead of silently hiding it (MD)
208
+
209
+ ### 10. Charts & Data (LOW)
210
+
211
+ - `chart-type` - Match chart type to data type (trend → line, comparison → bar, proportion → pie/donut)
212
+ - `color-guidance` - Use accessible color palettes; avoid red/green only pairs for colorblind users (WCAG, MD)
213
+ - `data-table` - Provide table alternative for accessibility; charts alone are not screen-reader friendly (WCAG)
214
+ - `pattern-texture` - Supplement color with patterns, textures, or shapes so data is distinguishable without color (WCAG, MD)
215
+ - `legend-visible` - Always show legend; position near the chart, not detached below a scroll fold (MD)
216
+ - `tooltip-on-interact` - Provide tooltips/data labels on hover (Web) or tap (mobile) showing exact values (HIG, MD)
217
+ - `axis-labels` - Label axes with units and readable scale; avoid truncated or rotated labels on mobile
218
+ - `responsive-chart` - Charts must reflow or simplify on small screens (e.g. horizontal bar instead of vertical, fewer ticks)
219
+ - `empty-data-state` - Show meaningful empty state when no data exists ("No data yet" + guidance), not a blank chart (MD)
220
+ - `loading-chart` - Use skeleton or shimmer placeholder while chart data loads; don't show an empty axis frame
221
+ - `animation-optional` - Chart entrance animations must respect prefers-reduced-motion; data should be readable immediately (HIG)
222
+ - `large-dataset` - For 1000+ data points, aggregate or sample; provide drill-down for detail instead of rendering all (MD)
223
+ - `number-formatting` - Use locale-aware formatting for numbers, dates, currencies on axes and labels (HIG, MD)
224
+ - `touch-target-chart` - Interactive chart elements (points, segments) must have ≥44pt tap area or expand on touch (Apple HIG)
225
+ - `no-pie-overuse` - Avoid pie/donut for >5 categories; switch to bar chart for clarity
226
+ - `contrast-data` - Data lines/bars vs background ≥3:1; data text labels ≥4.5:1 (WCAG)
227
+ - `legend-interactive` - Legends should be clickable to toggle series visibility (MD)
228
+ - `direct-labeling` - For small datasets, label values directly on the chart to reduce eye travel
229
+ - `tooltip-keyboard` - Tooltip content must be keyboard-reachable and not rely on hover alone (WCAG)
230
+ - `sortable-table` - Data tables must support sorting with aria-sort indicating current sort state (WCAG)
231
+ - `axis-readability` - Axis ticks must not be cramped; maintain readable spacing, auto-skip on small screens
232
+ - `data-density` - Limit information density per chart to avoid cognitive overload; split into multiple charts if needed
233
+ - `trend-emphasis` - Emphasize data trends over decoration; avoid heavy gradients/shadows that obscure the data
234
+ - `gridline-subtle` - Grid lines should be low-contrast (e.g. gray-200) so they don't compete with data
235
+ - `focusable-elements` - Interactive chart elements (points, bars, slices) must be keyboard-navigable (WCAG)
236
+ - `screen-reader-summary` - Provide a text summary or aria-label describing the chart's key insight for screen readers (WCAG)
237
+ - `error-state-chart` - Data load failure must show error message with retry action, not a broken/empty chart
238
+ - `export-option` - For data-heavy products, offer CSV/image export of chart data
239
+ - `drill-down-consistency` - Drill-down interactions must maintain a clear back-path and hierarchy breadcrumb
240
+ - `time-scale-clarity` - Time series charts must clearly label time granularity (day/week/month) and allow switching
@@ -18,6 +18,15 @@ Fonte da inteligência de design (curada do pacote `ui-ux-pro-max-skill`).
18
18
  3. **Anti-patterns por indústria** — ex.: "AI purple/pink gradients" para banking; neon para wellness; dark mode avulsa.
19
19
  4. **Dials**: `--variance 1-10`, `--motion 1-10`, `--density 1-10` para tunar o design system sem mudar a query.
20
20
 
21
+ ## Assets incorporados localmente (portados)
22
+
23
+ - `references/quick-reference.md` — regras UX completas (10 categorias priorizadas) em formato estático indexável.
24
+ - `references/pro-rules.md` — polish de UI nativa/mobile + checklist canônico pré-entrega.
25
+
26
+ **Deliberadamente NÃO portados** (decisão de token-economics):
27
+ - `data/*.csv` (~1.5MB) — só são úteis com os scripts Python de busca; lê-los custaria ~400k tokens; disponíveis opcionalmente via `npx ui-ux-pro-max-cli init --ai opencode`.
28
+ - `scripts/*.py` (busca/design-system) — exigiriam Python como dependência de runtime; o Izanagi é Node/TS puro.
29
+
21
30
  ## Estilos de UI citados (84)
22
31
 
23
32
  - **General (49)**: Minimalism & Swiss, Neumorphism, Glassmorphism, Brutalism, 3D & Hyperrealism, Vibrant & Block-based, Dark Mode OLED, Accessible & Ethical, Claymorphism, Aurora UI, Retro-Futurism, Flat, Skeuomorphism, Liquid Glass, Motion-Driven, Micro-interactions, Inclusive, Zero Interface, Soft UI Evolution, Neubrutalism, Bento Box Grid, Y2K, Cyberpunk, Organic Biophilic, AI-Native UI, Memphis, Vaporwave, Dimensional Layering, Exaggerated Minimalism, Kinetic Typography, Parallax Storytelling, Swiss Modernism 2.0, HUD/FUI, Pixel Art, Bento Grids, Spatial UI (Vision), E-Ink/Paper, Gen Z Maximalism, Biomimetic, Anti-Polish, Tactile Digital, Nature Distilled, Interactive Cursor, Voice-First, 3D Product Preview, Gradient Mesh, Editorial Grid, Chromatic Aberration, Vintage Analog.
@@ -69,8 +69,19 @@ with sync_playwright() as p:
69
69
  - Waits: `wait_for_selector()` / `wait_for_timeout()` quando necessário.
70
70
  - Para fluxos complexos múltiplos servidores: gerencie ambos (backend + frontend).
71
71
 
72
+ ## Exemplos locais (`examples/`)
73
+
74
+ Scripts de referência (Playwright Python; use como caixa-preta — não edite a menos que necessário):
75
+
76
+ - `with_server.py` — sobe 1+ servidores locais, espera as portas ficarem prontas e roda seu script. Uso: `python examples/with_server.py --server "npm run dev" --port 5173 -- python examples/element_discovery.py`
77
+ - `element_discovery.py` — descobre botões/links/inputs no estado renderizado + screenshot full-page.
78
+ - `console_logging.py` — captura mensagens do console do navegador durante a automação.
79
+ - `static_html_automation.py` — automação de arquivos HTML estáticos via `file://`.
80
+
81
+ Requisitos: `pip install playwright` + `playwright install chromium`. Saídas (screenshots/logs) vão para `outputs/` do projeto.
82
+
72
83
  ## References
73
84
 
74
- - Repo original: [ComposioHQ/awesome-claude-skills](https://github.com/ComposioHQ/awesome-claude-skills) — skill `webapp-testing/` (índice curado, 66k stars).
85
+ - Repo original: [ComposioHQ/awesome-claude-skills](https://github.com/ComposioHQ/awesome-claude-skills) — skill `webapp-testing/` (índice curado, 66k stars); scripts portados localmente em `examples/`.
75
86
  - Playwright docs: https://playwright.dev/docs/intro
76
87
  - Curadoria completa em `references.md`.
@@ -0,0 +1,36 @@
1
+ from playwright.sync_api import sync_playwright
2
+ import os
3
+
4
+ # Example: Capturing console logs during browser automation
5
+ url = 'http://localhost:5173' # Replace with your URL
6
+
7
+ console_logs = []
8
+ os.makedirs('outputs', exist_ok=True)
9
+
10
+ with sync_playwright() as p:
11
+ browser = p.chromium.launch(headless=True)
12
+ page = browser.new_page(viewport={'width': 1920, 'height': 1080})
13
+
14
+ # Set up console log capture
15
+ def handle_console_message(msg):
16
+ console_logs.append(f"[{msg.type}] {msg.text}")
17
+ print(f"Console: [{msg.type}] {msg.text}")
18
+
19
+ page.on("console", handle_console_message)
20
+
21
+ # Navigate to page
22
+ page.goto(url)
23
+ page.wait_for_load_state('networkidle')
24
+
25
+ # Interact with the page (triggers console logs)
26
+ page.click('text=Dashboard')
27
+ page.wait_for_timeout(1000)
28
+
29
+ browser.close()
30
+
31
+ # Save console logs to file
32
+ with open('outputs/console.log', 'w') as f:
33
+ f.write('\n'.join(console_logs))
34
+
35
+ print(f"\nCaptured {len(console_logs)} console messages")
36
+ print("Logs saved to: outputs/console.log")
@@ -0,0 +1,42 @@
1
+ from playwright.sync_api import sync_playwright
2
+ import os
3
+
4
+ # Example: Discovering buttons and other elements on a page
5
+ os.makedirs('outputs', exist_ok=True)
6
+
7
+ with sync_playwright() as p:
8
+ browser = p.chromium.launch(headless=True)
9
+ page = browser.new_page()
10
+
11
+ # Navigate to page and wait for it to fully load
12
+ page.goto('http://localhost:5173')
13
+ page.wait_for_load_state('networkidle')
14
+
15
+ # Discover all buttons on the page
16
+ buttons = page.locator('button').all()
17
+ print(f"Found {len(buttons)} buttons:")
18
+ for i, button in enumerate(buttons):
19
+ text = button.inner_text() if button.is_visible() else "[hidden]"
20
+ print(f" [{i}] {text}")
21
+
22
+ # Discover links
23
+ links = page.locator('a[href]').all()
24
+ print(f"\nFound {len(links)} links:")
25
+ for link in links[:5]: # Show first 5
26
+ text = link.inner_text().strip()
27
+ href = link.get_attribute('href')
28
+ print(f" - {text} -> {href}")
29
+
30
+ # Discover input fields
31
+ inputs = page.locator('input, textarea, select').all()
32
+ print(f"\nFound {len(inputs)} input fields:")
33
+ for input_elem in inputs:
34
+ name = input_elem.get_attribute('name') or input_elem.get_attribute('id') or "[unnamed]"
35
+ input_type = input_elem.get_attribute('type') or 'text'
36
+ print(f" - {name} ({input_type})")
37
+
38
+ # Take screenshot for visual reference
39
+ page.screenshot(path='outputs/page_discovery.png', full_page=True)
40
+ print("\nScreenshot saved to outputs/page_discovery.png")
41
+
42
+ browser.close()
@@ -0,0 +1,34 @@
1
+ from playwright.sync_api import sync_playwright
2
+ import os
3
+
4
+ # Example: Automating interaction with static HTML files using file:// URLs
5
+ html_file_path = os.path.abspath('path/to/your/file.html')
6
+ file_url = f'file://{html_file_path}'
7
+
8
+ os.makedirs('outputs', exist_ok=True)
9
+
10
+ with sync_playwright() as p:
11
+ browser = p.chromium.launch(headless=True)
12
+ page = browser.new_page(viewport={'width': 1920, 'height': 1080})
13
+
14
+ # Navigate to local HTML file
15
+ page.goto(file_url)
16
+
17
+ # Take screenshot
18
+ page.screenshot(path='outputs/static_page.png', full_page=True)
19
+
20
+ # Interact with elements
21
+ page.click('text=Click Me')
22
+ page.fill('#name', 'John Doe')
23
+ page.fill('#email', 'john@example.com')
24
+
25
+ # Submit form
26
+ page.click('button[type="submit"]')
27
+ page.wait_for_timeout(500)
28
+
29
+ # Take final screenshot
30
+ page.screenshot(path='outputs/after_submit.png', full_page=True)
31
+
32
+ browser.close()
33
+
34
+ print("Static HTML automation completed! Outputs saved to outputs/")
@@ -0,0 +1,106 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Start one or more servers, wait for them to be ready, run a command, then clean up.
4
+
5
+ Usage:
6
+ # Single server
7
+ python scripts/with_server.py --server "npm run dev" --port 5173 -- python automation.py
8
+ python scripts/with_server.py --server "npm start" --port 3000 -- python test.py
9
+
10
+ # Multiple servers
11
+ python scripts/with_server.py \
12
+ --server "cd backend && python server.py" --port 3000 \
13
+ --server "cd frontend && npm run dev" --port 5173 \
14
+ -- python test.py
15
+ """
16
+
17
+ import subprocess
18
+ import socket
19
+ import time
20
+ import sys
21
+ import argparse
22
+
23
+ def is_server_ready(port, timeout=30):
24
+ """Wait for server to be ready by polling the port."""
25
+ start_time = time.time()
26
+ while time.time() - start_time < timeout:
27
+ try:
28
+ with socket.create_connection(('localhost', port), timeout=1):
29
+ return True
30
+ except (socket.error, ConnectionRefusedError):
31
+ time.sleep(0.5)
32
+ return False
33
+
34
+
35
+ def main():
36
+ parser = argparse.ArgumentParser(description='Run command with one or more servers')
37
+ parser.add_argument('--server', action='append', dest='servers', required=True, help='Server command (can be repeated)')
38
+ parser.add_argument('--port', action='append', dest='ports', type=int, required=True, help='Port for each server (must match --server count)')
39
+ parser.add_argument('--timeout', type=int, default=30, help='Timeout in seconds per server (default: 30)')
40
+ parser.add_argument('command', nargs=argparse.REMAINDER, help='Command to run after server(s) ready')
41
+
42
+ args = parser.parse_args()
43
+
44
+ # Remove the '--' separator if present
45
+ if args.command and args.command[0] == '--':
46
+ args.command = args.command[1:]
47
+
48
+ if not args.command:
49
+ print("Error: No command specified to run")
50
+ sys.exit(1)
51
+
52
+ # Parse server configurations
53
+ if len(args.servers) != len(args.ports):
54
+ print("Error: Number of --server and --port arguments must match")
55
+ sys.exit(1)
56
+
57
+ servers = []
58
+ for cmd, port in zip(args.servers, args.ports):
59
+ servers.append({'cmd': cmd, 'port': port})
60
+
61
+ server_processes = []
62
+
63
+ try:
64
+ # Start all servers
65
+ for i, server in enumerate(servers):
66
+ print(f"Starting server {i+1}/{len(servers)}: {server['cmd']}")
67
+
68
+ # Use shell=True to support commands with cd and &&
69
+ process = subprocess.Popen(
70
+ server['cmd'],
71
+ shell=True,
72
+ stdout=subprocess.PIPE,
73
+ stderr=subprocess.PIPE
74
+ )
75
+ server_processes.append(process)
76
+
77
+ # Wait for this server to be ready
78
+ print(f"Waiting for server on port {server['port']}...")
79
+ if not is_server_ready(server['port'], timeout=args.timeout):
80
+ raise RuntimeError(f"Server failed to start on port {server['port']} within {args.timeout}s")
81
+
82
+ print(f"Server ready on port {server['port']}")
83
+
84
+ print(f"\nAll {len(servers)} server(s) ready")
85
+
86
+ # Run the command
87
+ print(f"Running: {' '.join(args.command)}\n")
88
+ result = subprocess.run(args.command)
89
+ sys.exit(result.returncode)
90
+
91
+ finally:
92
+ # Clean up all servers
93
+ print(f"\nStopping {len(server_processes)} server(s)...")
94
+ for i, process in enumerate(server_processes):
95
+ try:
96
+ process.terminate()
97
+ process.wait(timeout=5)
98
+ except subprocess.TimeoutExpired:
99
+ process.kill()
100
+ process.wait()
101
+ print(f"Server {i+1} stopped")
102
+ print("All servers stopped")
103
+
104
+
105
+ if __name__ == '__main__':
106
+ main()
@@ -5,7 +5,7 @@ Curadoria de automação de testes web com navegador.
5
5
  ## Fonte principal
6
6
 
7
7
  - **Índice**: https://github.com/ComposioHQ/awesome-claude-skills — 66k stars, maior lista curada de Claude Skills
8
- - **Skill original**: `webapp-testing/` no repo (scripts Python `with_server.py`, `element_discovery.py`, exemplos)
8
+ - **Skill original**: `webapp-testing/` no repo (scripts Python `with_server.py`, `element_discovery.py`, exemplos) — **portados localmente em `examples/`** (paths de saída adaptados para `outputs/` do projeto)
9
9
  - **Playwright**: https://playwright.dev/docs/intro — docs oficiais (Node, Python, .NET, Java)
10
10
 
11
11
  ## O que aproveitar no Izanagi