| name | frontend-implement |
| description | Implement an approved frontend scope by consuming the cross-repo contract exactly, with all required UI states, meeting the frontend engineering standards (accessibility, performance, security, i18n, resilience). Edits code within scope only. Front door for /frontend-implement. |
| allowed-tools | Read, Grep, Glob, Bash, Edit, Write, Task |
| tags | ["sdlc","implement","frontend"] |
frontend-implement
Implement the approved frontend scope. Consume the contract exactly as published —
never invent API shapes, ship happy-path-only UI, or ignore type errors. If invoked to
plan only, produce the task/UI-state list and stop.
Isolate first (before any edit)
If your instructions name a branch / ask you to work in a worktree (parallel runs always do),
this is a HARD prerequisite, not a suggestion — a sibling step may be writing the main tree
concurrently:
- Create and enter the worktree:
git worktree add -b <branch> <new-dir> HEAD (or
git worktree add <new-dir> <branch> if it already exists), then work from <new-dir>.
- Verify you are isolated:
git rev-parse --show-toplevel must NOT be the main checkout.
- If a worktree cannot be created (e.g. the repo has no commits), STOP and report it —
never fall back to editing the main working tree.
Before editing
- Read
AGENTS.md/CLAUDE.md, the frontend LLD — reuse the components/patterns it identified before
adding new ones — and the contract, the inputs your instructions point to.
- List pages affected, components to reuse/add, API hooks, form schema/validation,
analytics, and tests. List files to change.
Slice fan-out (owned by this skill)
This skill owns fanning the task DAG (the tasks.json your instructions point to) out into
slices — no orchestrator passes slices or worktrees in.
- Validate first — run
python3 engine/validate_tasks.py <the tasks.json path>;
it must print OK. Never build from an invalid tasks.json — fix or regenerate it first.
- With the Task tool (where the harness provides it): spawn one implementer subagent per
independent slice (
slices[] group), at most 3 concurrent. Each subagent works in its
own git worktree on branch maestro/<slug>/frontend-<group_id> — delegate worktree hygiene
to the using-git-worktrees skill when installed. Each subagent gets
its slice's tasks + the context manifest and follows the per-slice discipline below. When
all slices are green, merge the slice branches into the feature branch and resolve any
conflicts (disjoint writes across groups should make these rare).
- Without the Task tool: build the slices yourself, sequentially, in dependency order,
in the current checkout.
Either way, this skill is accountable for every slice building and testing clean — a
subagent's claim is not proof; its slice's tests must pass.
Per slice (subagent or inline):
- Batch-load context once —
cat every path in context_manifest.read_once +
context_manifest.reference in a SINGLE call, delimited by === <path> === (not one
Read per file). Keeps the run under ~50 SDK calls.
- Run the slice in order — for each
task_id in the slice's task_ids, batch-read its
reads delta, then build test-first, wiring every required UI state for that task.
- Human gates — stop and ask before any task with
needs_human_gate: true.
- Stay in scope — edit only files in the slice's tasks'
writes; commit the slice on
its branch.
This is distinct from Plan mode (produce the task/UI-state list and stop). If no
tasks.json exists (standalone run), author it first (plan mode), then proceed over its
slices as above.
Plan mode / fallback authoring (emit tasks.json)
When invoked in plan mode with no tasks.json present, write the tasks.json to the path
your instructions specify (run standalone? use a sensible path you choose)
conforming to engine/schemas/tasks.schema.json:
context_manifest (batched-read files), tasks[] (id, group_id, title, depends_on
intra-group only, reads, writes, test, standards, needs_human_gate), and slices[]
(one entry per independent group — two tasks share a group iff one depends on the other OR
they write a common file). Validate with
python3 engine/validate_tasks.py <the tasks.json path> (must print OK).
Return tasks_path, slices.
Consuming tech stack decisions
Before implementing, read the frontend LLD's "Tech Stack Decisions" section. The design
phase has already chosen:
- State management library & store structure
- Data-fetching & caching approach (library, cache strategy, pagination)
- Styling & design tokens approach (Tailwind? CSS Modules? styled-components?)
- Testing frameworks (unit, component, E2E, mocking)
- Form validation library & schema approach
- API client generation strategy (generated from OpenAPI? hand-written?)
- Error tracking & logging tool (Sentry? LogRocket? none?)
- Analytics tool & events to track
- Build & bundling approach (Next.js? Vite? Webpack?)
- Performance targets (Lighthouse scores, Core Web Vitals, bundle size)
- Accessibility testing approach (automated? manual? WCAG level?)
- i18n & localization (languages, library, RTL support)
- Authentication & authorization method (JWT? Sessions? Token storage?)
- Platform-specific considerations (web only? React Native? Flutter?)
Do not deviate from these decisions. If a choice seems suboptimal, escalate to the design
step before implementing — don't improvise or substitute a different library mid-feature.
Tech stack setup checklist
Complete these before implementing features — blocking setup tasks, not feature work.
State Management
Data-Fetching & Caching
Styling & Design Tokens
Testing Infrastructure
Form Validation
API Client & Types
Build & Environment
Error Handling & Logging
Analytics & Events
Do not start feature implementation until ALL setup tasks are complete. They unblock
everything else.
Steps
- Types/API client from the contract (generate or hand-write; single source of truth).
- State & data-fetching via the existing layer; define cache keys & invalidation.
- Component/page — build the happy path, then wire every required UI state.
- Form validation mirroring the contract's rules; inline field errors.
- Error handling & resilience — retries, messaging, optimistic-update rollback.
- Accessibility & i18n pass.
- Tests — component + the critical E2E flow; then Storybook if present.
- Run
/verify; on failure /fix-loop.
Required UI states (build AND test each)
loading · empty · success · validation error · API error · permission denied ·
retry / failed operation.
Standards every frontend change must satisfy
- Accessibility (WCAG AA) — keyboard operable, visible focus, correct roles/labels,
color contrast, screen-reader semantics, no keyboard traps, focus management on route/modal.
- All UI states — the seven above, each designed and tested.
- Performance — code-split heavy routes, lazy-load, memoize to avoid needless
re-renders, watch bundle size, virtualize large lists.
- Security — no secrets/tokens in client code; escape/encode to prevent XSS; CSRF-safe
requests; validate redirects/deep links; no PII in logs/analytics.
- Resilience — handle slow/failed/stale APIs with retry/backoff + clear messaging;
optimistic updates roll back on failure; guard against double-submit.
- Forms & validation — mirror the contract; field-level errors; disable submit while pending.
- Responsive & mobile — works across breakpoints; long text/overflow; touch targets.
- i18n/l10n — user-facing strings localizable; locale-aware dates/numbers; RTL if supported.
- Analytics — emit the spec's events without leaking PII.
Edge cases to handle and test
- Empty datasets; single vs many items; very long names/text; missing/broken images.
- Slow network, offline, request cancelled, race between rapid actions, stale cache.
- API 4xx/5xx, validation errors mapped to fields, permission denied, session expiry.
- Double-click / double-submit; back/forward navigation mid-flow; deep-link to a guarded page.
- Timezone/locale/number formatting; RTL layout; reduced-motion / high-contrast prefs.
- Large lists (virtualization); pagination first/last/empty; unstable ordering.
External skill (provision — the TDD engine)
If the test-driven-development skill (from the Superpowers pack) is installed, use it to
drive component work test-first; the tests must still cover the UI states and edge cases above.
If it is not installed, implement then test to that bar. Run the accessibility pass yourself either way — it
must cover keyboard, focus, roles/labels, and contrast (axe/WCAG-AA).
Safety
Never run destructive commands or write prod config/secrets. Stop and ask a human before
auth/permission, prod config, or dependency changes. Nothing auto-blocks this; you are the
backstop.
Verification
Invoke /verify (lint, typecheck, unit/component, build, Playwright E2E, a11y basics). On
failure invoke /fix-loop (one attempt per invocation — the workflow's max_visits on the fix
node, typically 3, bounds the overall loop).
Definition of done
Setup phase: tech stack setup checklist complete (all boxes checked); no "TBD" setup tasks.
Feature phase: all required UI states built and tested; every slice merged; standards
addressed; edge cases handled; no TypeScript errors; reuses existing components; contract
consumed exactly.
Output contract
Return branch, summary, tests_passed. In plan mode, return tasks_path and slices
instead. tests_passed MUST be the literal JSON boolean true or false (true only if every
test actually ran AND passed) — never a count, status phrase, or other prose. A workflow routes
on it, so prose reads as "not passing".