Agent Skillskdlbs/kandev › mobile-parity

mobile-parity

GitHub

确保 Kandev UI 在移动端使用原生交互模式而非桌面适配,实现响应式设计与 Playwright E2E 测试覆盖。适用于涉及前端或用户界面变更的任务,强制检查布局、触摸行为及视口表现,保障多端体验一致性与质量。

.agents/skills/mobile-parity/SKILL.md kdlbs/kandev

触发场景

实施新功能或页面组件 审查 UI 变更设计 测试前端用户界面 修复布局或触摸相关 Bug

安装

npx skills add kdlbs/kandev --skill mobile-parity -g -y
更多选项

非标准路径

npx skills add https://github.com/kdlbs/kandev/tree/main/.agents/skills/mobile-parity -g -y

不安装直接使用

npx skills use kdlbs/kandev@mobile-parity

指定 Agent (Claude Code)

npx skills add kdlbs/kandev --skill mobile-parity -a claude-code -g -y

安装 repo 全部 skill

npx skills add kdlbs/kandev --all -g -y

预览 repo 内 skill

npx skills add kdlbs/kandev --list

SKILL.md

Frontmatter
{
    "name": "mobile-parity",
    "kandev": {
        "system": true,
        "version": "0.51.0",
        "default_for_roles": []
    },
    "description": "Ensures Kandev UI work uses native mobile interaction patterns instead of compressed desktop adaptations while preserving desktop\/mobile capability parity, responsive behavior, and mobile Playwright E2E coverage. Use when implementing, planning, reviewing, or testing any new feature, page, component, workflow, form, dialog, sidebar, navigation, dashboard, or visual UI change; if work touches frontend or user-facing UI, this skill must run even when user mentions only desktop or says \"new feature\"."
}

Mobile Parity

Use this skill before planning or changing UI. Goal: desktop and mobile deliver the same user value, while each viewport gets an intentional composition and tests prove the mobile path.

Before proposing a mobile design, read Kandev Mobile UI Language and inspect the closest shipped mobile surface. Responsive CSS alone does not establish mobile parity.

When It Applies

Apply when task changes user-facing UI:

  • new or changed pages, routes, components, forms, dialogs, drawers, navigation, dashboards, tables, cards, toolbars, editors, settings, onboarding, or visual states
  • new frontend behavior attached to backend/API work
  • bug fixes where layout, touch behavior, scrolling, or viewport width can affect success

If task has no UI surface, say why this skill does not apply and continue.

Specification ownership

When the task uses durable specifications, put mobile outcomes in the system that owns the feature contract. Do not create a second UI requirement or design only because the feature needs a phone surface. Use the UI system only for an independent reusable interaction contract.

Keep the mobile composition in the owning feature design with its backend and desktop boundaries. Link to an existing UI contract when the feature reuses one.

Mobile Design Contract

When a task changes composition, navigation, overlays, touch behavior, scrolling, or breakpoint behavior, state these choices in the working plan or task notes. Keep them brief; do not create a separate document unless the task already uses a spec or committed plan. For copy, icon, color, or content-only styling inside an unchanged surface, identify the nearest mobile exemplar and the rendered mobile check instead of forcing the full contract.

  • desktop user outcome and mobile entry point
  • nearest shipped mobile exemplar and which interaction/geometry it contributes
  • mobile information hierarchy and primary action
  • presentation choice: inline, inset bottom drawer, full-height surface, or direct navigation
  • surface rationale: why task frequency and content depth make that choice preferable to the alternatives
  • single scroll owner, dynamic viewport behavior, safe-area handling, and touch targets
  • shared state, view-model, filtering/selection, and business logic versus mobile-specific presentation
  • mobile Playwright scenario proving the same user value

Workflow

  1. Map affected surfaces.

    • Identify every page, modal, menu, tab, empty state, loading state, and error state the feature touches.
    • Check where desktop layout assumptions can fail: fixed widths, hover-only controls, sidebars, tables, dense toolbars, keyboard shortcuts, overflow, and absolute positioning.
    • Use rg to find the nearest existing mobile component and the route's current useResponsiveBreakpoint branch. Name the closest curated exemplar from the reference and state which parts are reused.
    • Treat live code as the source of truth for APIs, state, and current behavior. Treat this skill's curated guide and exemplar list as the desired mobile interaction baseline; nearby legacy surfaces that deviate from it need justification, not automatic reuse.
  2. Design desktop and mobile behavior together.

    • Preserve capability, data, and state semantics; do not require identical markup or navigation.
    • Apply the surface decision guide in the mobile UI language reference. Prefer a focused, one-dimensional phone flow over stacked desktop panes or two-axis scrolling.
    • Explicitly distinguish temporary choices that belong in a drawer from primary or dense content that deserves direct navigation or a full-height surface.
    • When a card or row has an obvious primary destination and no competing selection, drag, or inline-control behavior, make its body tap perform that action. Otherwise expose an explicit touch control. Put secondary actions behind a visible target, never hover, right-click, or undiscoverable long press.
    • Define mobile navigation, hierarchy, scroll owner, touch targets, truncation, empty/error states, and responsive fallback behavior before coding.
  3. Implement responsive UI.

    • Reuse domain hooks, state, view-model derivation, filtering/selection, and action handlers across viewports; keep responsive wrappers focused on presentation. Branch composition when the desktop interaction model depends on width or a fine pointer. Do not mount a heavyweight desktop workbench and merely hide or squeeze it on phones.
    • Use useResponsiveBreakpoint and existing @kandev/ui or mobile primitives. Reuse current Dropdown/ContextMenu primitives for contextual actions; use Drawer or an existing picker shell for structured phone navigation and choices. Use useTouchDrawer when a hover disclosure needs a coarse-pointer alternative.
    • Keep coarse-pointer and mobile touch targets large enough for touch use, generally at least 44px in the active dimension. This is an active hit-area rule, not a universal desktop visual-size rule: fine-pointer desktop controls should retain the surrounding design-system density, and touch-sized classes such as h-11 must not become the shared desktop button size.
    • Use dynamic viewport units and an explicit internal scroll region for viewport-bound/full-height or potentially overflowing surfaces. Ensure bottom-fixed controls and tall drawers clear safe-area insets; short drawers can retain the shared primitive's intrinsic sizing. Keep document-level horizontal overflow at zero.
    • If mobile substitutes an unsupported desktop view, derive an effective mobile view without overwriting the user's saved desktop preference.
    • Use semantic controls, visible labels or accessible names, focus return, and existing design-system components.
    • Avoid hiding required functionality on mobile unless there is a clear alternate path.
  4. Add E2E coverage.

    • Add or update Playwright tests for the feature's happy path on desktop if missing.
    • Add mobile Playwright coverage for the same user value, using existing mobile projects/devices when configured.
    • In this repo, name mobile test files mobile-*.spec.ts so the mobile-chrome Playwright project picks them up automatically.
    • Cover the actual mobile composition: drawer or full-height surface, visible overflow action, focused navigation, direct route, or bottom control.
    • For overlay and dense-navigation changes, assert viewport containment, internal scrolling, and the absence of document horizontal overflow where those properties are part of the regression.
    • When a touch-only control is replaced or hidden, run rg across mobile E2E tests for the removed control. Replace every affected interaction with the intended gesture or alternate control, then run those tests together.
  5. Verify visually and behaviorally.

    • Run the narrowest relevant viewport locally or with screenshots when possible.
    • Even small user-facing UI tweaks need at least focused rendered verification when feasible: dev-server/browser check, Playwright screenshot, or targeted E2E. If not run, report the exact reason.
    • Check phone ergonomics, not only responsive fit: entry point is discoverable, primary action is thumb-reachable, hierarchy is understandable, sheet shape matches nearby surfaces, and back/dismiss behavior is predictable.
    • Check that text does not overlap, controls remain clickable, focus/keyboard flows still work, safe-area content is unobstructed, and no unintended horizontal scroll appears.
    • Run the focused Playwright tests. If full E2E cannot run, report the command and blocker.
    • E2E runs against the production Vite build served by the Go backend, not a dev server, so rebuild after frontend changes: make build-web (and make build-backend for Go), or use make test-e2e which rebuilds both. Skipping this silently tests stale code. See /e2e.

Mobile E2E Expectations

Every UI feature should end with one of these:

  • mobile Playwright test added or updated
  • existing mobile Playwright test explicitly identified as covering the changed behavior
  • written justification for no mobile test, limited to impossible-to-test infrastructure gaps

For frontend changes that are purely state/data normalization inside an existing component and do not alter rendered layout, touch behavior, scrolling, navigation, or viewport-dependent interaction, targeted unit/component tests plus an explicit note can satisfy mobile parity. New mobile Playwright coverage is not required for that narrow case.

Good mobile tests assert real user outcomes, not only visibility. Prefer:

  • open feature from mobile navigation and complete primary action
  • use drawer/menu/sheet variant of desktop controls
  • submit form and verify result
  • handle empty/error/loading state on narrow viewport
  • confirm no required action is desktop-only

Playwright Routing

Create mobile-*.spec.ts files and let the mobile-chrome project apply its configured Pixel 5 device; do not add per-test device overrides. Follow /e2e for fixtures, page objects, selectors, build requirements, and local reproduction. Top-level tests/mobile-*.spec.ts files import ../fixtures/test-base; nested specs adjust the depth, commonly using ../../fixtures/test-base. Mobile parity owns which interaction and geometry contracts need proof; /e2e owns test mechanics.

Done Checklist

  • Desktop path still works.
  • Structural/touch changes include a mobile design contract naming entry point, nearest shipped exemplar, hierarchy, surface, scroll owner, and primary action.
  • For those changes, surface rationale explains why the chosen composition fits task frequency and content depth.
  • Content-only styling changes identify the nearest mobile exemplar and focused rendered mobile check instead.
  • Mobile path follows a shipped Kandev pattern or explains why a new pattern is needed.
  • Mobile composition is intentional, not desktop UI stacked, squeezed, or hidden with CSS.
  • Required controls are reachable by touch.
  • No required workflow depends on hover, wide viewport, or hidden desktop-only UI.
  • Viewport-bound/full-height or potentially overflowing surfaces use dynamic viewport sizing, safe-area clearance, and internal scrolling.
  • Responsive fallbacks do not overwrite saved desktop preferences.
  • Mobile E2E tests no longer invoke touch controls that the change replaced or hid.
  • Mobile Playwright coverage exists or absence is justified.
  • Focused rendered/visual verification was run for UI tweaks, or exact "not run" reason is reported.
  • Focused tests were run, or exact blocker is reported.

版本历史

  • 0e4ae86 当前 2026-08-27 18:28

    新增 Specification ownership(规范所有权)章节,明确移动成果应归入拥有功能契约的系统,避免创建独立的 UI 需求文档;调整 Mobile Design Contract 结构以强化复用与上下文关联。

  • b4239d8 2026-07-24 17:32

同 Skill 集合

.agents/skills/acp-debug/SKILL.md
.agents/skills/add-integration/SKILL.md
.agents/skills/clean-branches/SKILL.md
.agents/skills/code-review/SKILL.md
.agents/skills/commit/SKILL.md
.agents/skills/context-engineering/SKILL.md
.agents/skills/create-kandev-plugin/SKILL.md
.agents/skills/debug/SKILL.md
.agents/skills/docs-maintainer/SKILL.md
.agents/skills/e2e/SKILL.md
.agents/skills/fix/SKILL.md
.agents/skills/harness-improvement/SKILL.md
.agents/skills/interview-me/SKILL.md
.agents/skills/plan/SKILL.md
.agents/skills/planner-orchestration/SKILL.md
.agents/skills/playwright-cli/SKILL.md
.agents/skills/pr-fixup/SKILL.md
.agents/skills/pr/SKILL.md
.agents/skills/product-demo-seeding/SKILL.md
.agents/skills/product-video-capture/SKILL.md
.agents/skills/push/SKILL.md
.agents/skills/qa/SKILL.md
.agents/skills/record/SKILL.md
.agents/skills/release/SKILL.md
.agents/skills/runtime-feature-flags/SKILL.md
.agents/skills/simplify/SKILL.md
.agents/skills/spec-driven-development/SKILL.md
.agents/skills/spec/SKILL.md
.agents/skills/tdd/SKILL.md
.agents/skills/using-agent-skills/SKILL.md
.agents/skills/verify/SKILL.md

元信息

文件数
0
版本
0e4ae86
Hash
c1e7890e
收录时间
2026-07-24 17:32

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-28 01:05
浙ICP备14020137号-1 $访客地图$