create-claude-code-visualizer 0.1.0
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/index.js +393 -0
- package/package.json +31 -0
- package/templates/CLAUDE.md +108 -0
- package/templates/app/.env.local.example +14 -0
- package/templates/app/ecosystem.config.js +29 -0
- package/templates/app/next-env.d.ts +6 -0
- package/templates/app/next.config.ts +16 -0
- package/templates/app/package-lock.json +4581 -0
- package/templates/app/package.json +38 -0
- package/templates/app/postcss.config.js +5 -0
- package/templates/app/src/app/agents/[slug]/chat/loading.tsx +26 -0
- package/templates/app/src/app/agents/[slug]/chat/page.tsx +579 -0
- package/templates/app/src/app/agents/[slug]/loading.tsx +19 -0
- package/templates/app/src/app/agents/page.tsx +8 -0
- package/templates/app/src/app/api/agents/[slug]/capabilities/route.ts +11 -0
- package/templates/app/src/app/api/agents/[slug]/route.ts +57 -0
- package/templates/app/src/app/api/agents/route.ts +28 -0
- package/templates/app/src/app/api/ai/generate-agent/route.ts +87 -0
- package/templates/app/src/app/api/ai/improve-claude-md/route.ts +78 -0
- package/templates/app/src/app/api/ai/suggestions/route.ts +64 -0
- package/templates/app/src/app/api/ai/title/route.ts +88 -0
- package/templates/app/src/app/api/auth/role/route.ts +17 -0
- package/templates/app/src/app/api/commands/[slug]/route.ts +61 -0
- package/templates/app/src/app/api/commands/route.ts +6 -0
- package/templates/app/src/app/api/governance/costs/route.ts +117 -0
- package/templates/app/src/app/api/governance/sessions/route.ts +335 -0
- package/templates/app/src/app/api/notifications/route.ts +62 -0
- package/templates/app/src/app/api/preferences/route.ts +44 -0
- package/templates/app/src/app/api/runs/[id]/approve/route.ts +38 -0
- package/templates/app/src/app/api/runs/[id]/events/route.ts +28 -0
- package/templates/app/src/app/api/runs/[id]/metadata/route.ts +30 -0
- package/templates/app/src/app/api/runs/[id]/route.ts +21 -0
- package/templates/app/src/app/api/runs/[id]/start/route.ts +61 -0
- package/templates/app/src/app/api/runs/[id]/stop/route.ts +16 -0
- package/templates/app/src/app/api/runs/[id]/stream/route.ts +201 -0
- package/templates/app/src/app/api/runs/route.ts +95 -0
- package/templates/app/src/app/api/schedules/[id]/route.ts +81 -0
- package/templates/app/src/app/api/schedules/route.ts +75 -0
- package/templates/app/src/app/api/settings/access-logs/route.ts +33 -0
- package/templates/app/src/app/api/settings/claude-md/route.ts +44 -0
- package/templates/app/src/app/api/settings/env-keys/route.ts +271 -0
- package/templates/app/src/app/api/settings/users/route.ts +108 -0
- package/templates/app/src/app/api/skills/[slug]/route.ts +43 -0
- package/templates/app/src/app/api/skills/route.ts +6 -0
- package/templates/app/src/app/api/tools/route.ts +65 -0
- package/templates/app/src/app/api/uploads/cleanup/route.ts +29 -0
- package/templates/app/src/app/api/uploads/route.ts +77 -0
- package/templates/app/src/app/auth/callback/route.ts +19 -0
- package/templates/app/src/app/globals.css +115 -0
- package/templates/app/src/app/layout.tsx +24 -0
- package/templates/app/src/app/loading.tsx +16 -0
- package/templates/app/src/app/login/page.tsx +64 -0
- package/templates/app/src/app/not-authorized/page.tsx +33 -0
- package/templates/app/src/app/runs/page.tsx +55 -0
- package/templates/app/src/app/schedules/page.tsx +110 -0
- package/templates/app/src/app/settings/page.tsx +1294 -0
- package/templates/app/src/app/skills/page.tsx +7 -0
- package/templates/app/src/components/agent-card.tsx +58 -0
- package/templates/app/src/components/agent-grid.tsx +90 -0
- package/templates/app/src/components/auth/auth-context.tsx +79 -0
- package/templates/app/src/components/chat-thread.tsx +50 -0
- package/templates/app/src/components/chat-view.tsx +670 -0
- package/templates/app/src/components/commands-browser.tsx +349 -0
- package/templates/app/src/components/create-agent-modal.tsx +388 -0
- package/templates/app/src/components/governance-dashboard.tsx +397 -0
- package/templates/app/src/components/icons.tsx +401 -0
- package/templates/app/src/components/layout/agent-sidebar.tsx +504 -0
- package/templates/app/src/components/layout/app-shell.tsx +29 -0
- package/templates/app/src/components/layout/nav.tsx +87 -0
- package/templates/app/src/components/layout/overview-inner.tsx +14 -0
- package/templates/app/src/components/layout/profile-menu.tsx +95 -0
- package/templates/app/src/components/layout/sidebar.tsx +30 -0
- package/templates/app/src/components/markdown.tsx +57 -0
- package/templates/app/src/components/message-bar.tsx +161 -0
- package/templates/app/src/components/notifications/notification-bell.tsx +104 -0
- package/templates/app/src/components/notifications/notification-panel.tsx +116 -0
- package/templates/app/src/components/overview/overview-content.tsx +287 -0
- package/templates/app/src/components/overview/overview-context.tsx +88 -0
- package/templates/app/src/components/preferences-modal.tsx +112 -0
- package/templates/app/src/components/run-form.tsx +73 -0
- package/templates/app/src/components/run-history-table.tsx +226 -0
- package/templates/app/src/components/run-output.tsx +187 -0
- package/templates/app/src/components/schedule-form.tsx +148 -0
- package/templates/app/src/components/skills-browser.tsx +338 -0
- package/templates/app/src/components/tool-tooltip.tsx +82 -0
- package/templates/app/src/hooks/use-sse.ts +115 -0
- package/templates/app/src/instrumentation.ts +9 -0
- package/templates/app/src/lib/agent-cache.ts +19 -0
- package/templates/app/src/lib/agent-runner.ts +411 -0
- package/templates/app/src/lib/agents.ts +168 -0
- package/templates/app/src/lib/ai.ts +40 -0
- package/templates/app/src/lib/approval-store.ts +70 -0
- package/templates/app/src/lib/auth-guard.ts +116 -0
- package/templates/app/src/lib/capabilities.ts +191 -0
- package/templates/app/src/lib/line-diff.ts +96 -0
- package/templates/app/src/lib/queue.ts +22 -0
- package/templates/app/src/lib/redis.ts +12 -0
- package/templates/app/src/lib/role-permissions.ts +166 -0
- package/templates/app/src/lib/run-agent.ts +442 -0
- package/templates/app/src/lib/supabase-browser.ts +8 -0
- package/templates/app/src/lib/supabase-middleware.ts +63 -0
- package/templates/app/src/lib/supabase-server.ts +28 -0
- package/templates/app/src/lib/supabase.ts +6 -0
- package/templates/app/src/lib/tool-descriptions.ts +29 -0
- package/templates/app/src/lib/types.ts +73 -0
- package/templates/app/src/lib/typewriter-animation.ts +159 -0
- package/templates/app/src/middleware.ts +13 -0
- package/templates/app/tsconfig.json +21 -0
- package/templates/app/uploads/.gitkeep +0 -0
- package/templates/app/worker/index.ts +342 -0
- package/templates/claude/agents/ai-trends-scout.md +66 -0
- package/templates/claude/commands/add-to-todos.md +56 -0
- package/templates/claude/commands/check-todos.md +56 -0
- package/templates/claude/hooks/auto-approve-safe.sh +34 -0
- package/templates/claude/hooks/auto-format.sh +25 -0
- package/templates/claude/hooks/block-destructive.sh +32 -0
- package/templates/claude/hooks/compaction-preserver.sh +16 -0
- package/templates/claude/hooks/notify.sh +26 -0
- package/templates/claude/settings.local.json +66 -0
- package/templates/claude/skills/frontend-design/SKILL.md +127 -0
- package/templates/claude/skills/frontend-design/reference/color-and-contrast.md +132 -0
- package/templates/claude/skills/frontend-design/reference/interaction-design.md +123 -0
- package/templates/claude/skills/frontend-design/reference/motion-design.md +99 -0
- package/templates/claude/skills/frontend-design/reference/responsive-design.md +114 -0
- package/templates/claude/skills/frontend-design/reference/spatial-design.md +100 -0
- package/templates/claude/skills/frontend-design/reference/typography.md +131 -0
- package/templates/claude/skills/frontend-design/reference/ux-writing.md +107 -0
- package/templates/claude/skills/gws-admin-reports/SKILL.md +57 -0
- package/templates/claude/skills/gws-calendar/SKILL.md +108 -0
- package/templates/claude/skills/gws-calendar-agenda/SKILL.md +52 -0
- package/templates/claude/skills/gws-calendar-insert/SKILL.md +55 -0
- package/templates/claude/skills/gws-chat/SKILL.md +73 -0
- package/templates/claude/skills/gws-chat-send/SKILL.md +49 -0
- package/templates/claude/skills/gws-classroom/SKILL.md +75 -0
- package/templates/claude/skills/gws-docs/SKILL.md +48 -0
- package/templates/claude/skills/gws-docs-write/SKILL.md +49 -0
- package/templates/claude/skills/gws-drive/SKILL.md +137 -0
- package/templates/claude/skills/gws-drive-upload/SKILL.md +52 -0
- package/templates/claude/skills/gws-events/SKILL.md +67 -0
- package/templates/claude/skills/gws-events-renew/SKILL.md +48 -0
- package/templates/claude/skills/gws-events-subscribe/SKILL.md +59 -0
- package/templates/claude/skills/gws-forms/SKILL.md +45 -0
- package/templates/claude/skills/gws-gmail/SKILL.md +59 -0
- package/templates/claude/skills/gws-gmail-forward/SKILL.md +53 -0
- package/templates/claude/skills/gws-gmail-reply/SKILL.md +56 -0
- package/templates/claude/skills/gws-gmail-reply-all/SKILL.md +60 -0
- package/templates/claude/skills/gws-gmail-send/SKILL.md +55 -0
- package/templates/claude/skills/gws-gmail-triage/SKILL.md +50 -0
- package/templates/claude/skills/gws-gmail-watch/SKILL.md +58 -0
- package/templates/claude/skills/gws-keep/SKILL.md +48 -0
- package/templates/claude/skills/gws-meet/SKILL.md +51 -0
- package/templates/claude/skills/gws-modelarmor/SKILL.md +42 -0
- package/templates/claude/skills/gws-modelarmor-create-template/SKILL.md +53 -0
- package/templates/claude/skills/gws-modelarmor-sanitize-prompt/SKILL.md +48 -0
- package/templates/claude/skills/gws-modelarmor-sanitize-response/SKILL.md +48 -0
- package/templates/claude/skills/gws-people/SKILL.md +67 -0
- package/templates/claude/skills/gws-shared/SKILL.md +66 -0
- package/templates/claude/skills/gws-sheets/SKILL.md +53 -0
- package/templates/claude/skills/gws-sheets-append/SKILL.md +51 -0
- package/templates/claude/skills/gws-sheets-read/SKILL.md +47 -0
- package/templates/claude/skills/gws-slides/SKILL.md +43 -0
- package/templates/claude/skills/gws-tasks/SKILL.md +56 -0
- package/templates/claude/skills/gws-workflow/SKILL.md +44 -0
- package/templates/claude/skills/gws-workflow-email-to-task/SKILL.md +47 -0
- package/templates/claude/skills/gws-workflow-file-announce/SKILL.md +50 -0
- package/templates/claude/skills/gws-workflow-meeting-prep/SKILL.md +47 -0
- package/templates/claude/skills/gws-workflow-standup-report/SKILL.md +46 -0
- package/templates/claude/skills/gws-workflow-weekly-digest/SKILL.md +46 -0
- package/templates/claude/skills/persona-content-creator/SKILL.md +33 -0
- package/templates/claude/skills/persona-customer-support/SKILL.md +34 -0
- package/templates/claude/skills/persona-event-coordinator/SKILL.md +35 -0
- package/templates/claude/skills/persona-exec-assistant/SKILL.md +35 -0
- package/templates/claude/skills/persona-hr-coordinator/SKILL.md +33 -0
- package/templates/claude/skills/persona-it-admin/SKILL.md +30 -0
- package/templates/claude/skills/persona-project-manager/SKILL.md +35 -0
- package/templates/claude/skills/persona-researcher/SKILL.md +33 -0
- package/templates/claude/skills/persona-sales-ops/SKILL.md +35 -0
- package/templates/claude/skills/persona-team-lead/SKILL.md +36 -0
- package/templates/claude/skills/recipe-backup-sheet-as-csv/SKILL.md +25 -0
- package/templates/claude/skills/recipe-batch-invite-to-event/SKILL.md +25 -0
- package/templates/claude/skills/recipe-block-focus-time/SKILL.md +24 -0
- package/templates/claude/skills/recipe-bulk-download-folder/SKILL.md +25 -0
- package/templates/claude/skills/recipe-collect-form-responses/SKILL.md +25 -0
- package/templates/claude/skills/recipe-compare-sheet-tabs/SKILL.md +25 -0
- package/templates/claude/skills/recipe-copy-sheet-for-new-month/SKILL.md +25 -0
- package/templates/claude/skills/recipe-create-classroom-course/SKILL.md +25 -0
- package/templates/claude/skills/recipe-create-doc-from-template/SKILL.md +29 -0
- package/templates/claude/skills/recipe-create-events-from-sheet/SKILL.md +24 -0
- package/templates/claude/skills/recipe-create-expense-tracker/SKILL.md +26 -0
- package/templates/claude/skills/recipe-create-feedback-form/SKILL.md +25 -0
- package/templates/claude/skills/recipe-create-gmail-filter/SKILL.md +26 -0
- package/templates/claude/skills/recipe-create-meet-space/SKILL.md +25 -0
- package/templates/claude/skills/recipe-create-presentation/SKILL.md +25 -0
- package/templates/claude/skills/recipe-create-shared-drive/SKILL.md +25 -0
- package/templates/claude/skills/recipe-create-task-list/SKILL.md +26 -0
- package/templates/claude/skills/recipe-create-vacation-responder/SKILL.md +25 -0
- package/templates/claude/skills/recipe-draft-email-from-doc/SKILL.md +25 -0
- package/templates/claude/skills/recipe-email-drive-link/SKILL.md +25 -0
- package/templates/claude/skills/recipe-find-free-time/SKILL.md +25 -0
- package/templates/claude/skills/recipe-find-large-files/SKILL.md +24 -0
- package/templates/claude/skills/recipe-forward-labeled-emails/SKILL.md +27 -0
- package/templates/claude/skills/recipe-generate-report-from-sheet/SKILL.md +34 -0
- package/templates/claude/skills/recipe-label-and-archive-emails/SKILL.md +25 -0
- package/templates/claude/skills/recipe-log-deal-update/SKILL.md +25 -0
- package/templates/claude/skills/recipe-organize-drive-folder/SKILL.md +26 -0
- package/templates/claude/skills/recipe-plan-weekly-schedule/SKILL.md +26 -0
- package/templates/claude/skills/recipe-post-mortem-setup/SKILL.md +25 -0
- package/templates/claude/skills/recipe-reschedule-meeting/SKILL.md +25 -0
- package/templates/claude/skills/recipe-review-meet-participants/SKILL.md +25 -0
- package/templates/claude/skills/recipe-review-overdue-tasks/SKILL.md +25 -0
- package/templates/claude/skills/recipe-save-email-attachments/SKILL.md +26 -0
- package/templates/claude/skills/recipe-save-email-to-doc/SKILL.md +29 -0
- package/templates/claude/skills/recipe-schedule-recurring-event/SKILL.md +24 -0
- package/templates/claude/skills/recipe-send-team-announcement/SKILL.md +24 -0
- package/templates/claude/skills/recipe-share-doc-and-notify/SKILL.md +25 -0
- package/templates/claude/skills/recipe-share-event-materials/SKILL.md +25 -0
- package/templates/claude/skills/recipe-share-folder-with-team/SKILL.md +26 -0
- package/templates/claude/skills/recipe-sync-contacts-to-sheet/SKILL.md +25 -0
- package/templates/claude/skills/recipe-watch-drive-changes/SKILL.md +25 -0
- package/templates/mcp.json +12 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: List outstanding todos and select one to work on
|
|
3
|
+
allowed-tools:
|
|
4
|
+
- Read
|
|
5
|
+
- Edit
|
|
6
|
+
- Glob
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Check Todos
|
|
10
|
+
|
|
11
|
+
## Instructions
|
|
12
|
+
|
|
13
|
+
1. Read TO-DOS.md in the working directory (if doesn't exist, say "No outstanding todos" and exit)
|
|
14
|
+
|
|
15
|
+
2. Parse and display todos:
|
|
16
|
+
- Extract all list items starting with `- **` (active todos)
|
|
17
|
+
- If none exist, say "No outstanding todos" and exit
|
|
18
|
+
- Display compact numbered list showing:
|
|
19
|
+
- Number (for selection)
|
|
20
|
+
- Bold title only (part between `**` markers)
|
|
21
|
+
- Date from h2 heading above it
|
|
22
|
+
- Prompt: "Reply with the number of the todo you'd like to work on."
|
|
23
|
+
- Wait for user to reply with a number
|
|
24
|
+
|
|
25
|
+
3. Load full context for selected todo:
|
|
26
|
+
- Display complete line with all fields (Problem, Files, Solution)
|
|
27
|
+
- Display h2 heading (topic + date) for additional context
|
|
28
|
+
- Read and briefly summarize relevant files mentioned
|
|
29
|
+
|
|
30
|
+
4. Check for established workflows:
|
|
31
|
+
- Read CLAUDE.md (if exists) to understand project-specific workflows and rules
|
|
32
|
+
- Look for `.claude/skills/` directory
|
|
33
|
+
- Match file paths in todo to domain patterns (`plugins/` → plugin workflow, `mcp-servers/` → MCP workflow)
|
|
34
|
+
- Check CLAUDE.md for explicit workflow requirements for this type of work
|
|
35
|
+
|
|
36
|
+
5. Present action options to user:
|
|
37
|
+
- **If matching skill/workflow found**: "This looks like [domain] work. Would you like to:\n\n1. Invoke [skill-name] skill and start\n2. Work on it directly\n3. Brainstorm approach first\n4. Put it back and browse other todos\n\nReply with the number of your choice."
|
|
38
|
+
- **If no workflow match**: "Would you like to:\n\n1. Start working on it\n2. Brainstorm approach first\n3. Put it back and browse other todos\n\nReply with the number of your choice."
|
|
39
|
+
- Wait for user response
|
|
40
|
+
|
|
41
|
+
6. Handle user choice:
|
|
42
|
+
- **Option "Invoke skill" or "Start working"**: Remove todo from TO-DOS.md (and h2 heading if section becomes empty), then begin work (invoke skill if applicable, or proceed directly)
|
|
43
|
+
- **Option "Brainstorm approach"**: Keep todo in file, invoke `/brainstorm` with the todo description as argument
|
|
44
|
+
- **Option "Put it back"**: Keep todo in file, return to step 2 to display the full list again
|
|
45
|
+
|
|
46
|
+
## Display Format
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
Outstanding Todos:
|
|
50
|
+
|
|
51
|
+
1. Add structured format to add-to-todos (2025-11-15 14:23)
|
|
52
|
+
2. Create check-todos command (2025-11-15 14:23)
|
|
53
|
+
3. Fix cookie-extractor MCP workflow (2025-11-14 09:15)
|
|
54
|
+
|
|
55
|
+
Reply with the number of the todo you'd like to work on.
|
|
56
|
+
```
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Auto-approve safe, read-only bash commands (reduces permission fatigue)
|
|
3
|
+
INPUT=$(cat)
|
|
4
|
+
CMD=$(echo "$INPUT" | jq -r '.tool_input.command // empty')
|
|
5
|
+
|
|
6
|
+
SAFE_PATTERNS=(
|
|
7
|
+
"^ls "
|
|
8
|
+
"^ls$"
|
|
9
|
+
"^pwd$"
|
|
10
|
+
"^git status"
|
|
11
|
+
"^git log"
|
|
12
|
+
"^git diff"
|
|
13
|
+
"^git branch"
|
|
14
|
+
"^cat "
|
|
15
|
+
"^head "
|
|
16
|
+
"^tail "
|
|
17
|
+
"^wc "
|
|
18
|
+
"^which "
|
|
19
|
+
"^echo "
|
|
20
|
+
"^npx gws "
|
|
21
|
+
"^python3 scripts/lib/"
|
|
22
|
+
"^python3 /mnt/.*/scripts/lib/"
|
|
23
|
+
"^npm list"
|
|
24
|
+
"^node -"
|
|
25
|
+
"^jq "
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
for pattern in "${SAFE_PATTERNS[@]}"; do
|
|
29
|
+
if echo "$CMD" | grep -qE "$pattern"; then
|
|
30
|
+
exit 0
|
|
31
|
+
fi
|
|
32
|
+
done
|
|
33
|
+
|
|
34
|
+
exit 0
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Auto-format files after Claude edits them
|
|
3
|
+
INPUT=$(cat)
|
|
4
|
+
FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty')
|
|
5
|
+
|
|
6
|
+
if [ -z "$FILE_PATH" ] || [ ! -f "$FILE_PATH" ]; then
|
|
7
|
+
exit 0
|
|
8
|
+
fi
|
|
9
|
+
|
|
10
|
+
EXT="${FILE_PATH##*.}"
|
|
11
|
+
|
|
12
|
+
case "$EXT" in
|
|
13
|
+
py)
|
|
14
|
+
if command -v ruff &>/dev/null; then
|
|
15
|
+
ruff format "$FILE_PATH" 2>/dev/null
|
|
16
|
+
fi
|
|
17
|
+
;;
|
|
18
|
+
js|ts|jsx|tsx|json|css|html|md|yaml|yml)
|
|
19
|
+
if command -v npx &>/dev/null; then
|
|
20
|
+
npx prettier --write "$FILE_PATH" 2>/dev/null
|
|
21
|
+
fi
|
|
22
|
+
;;
|
|
23
|
+
esac
|
|
24
|
+
|
|
25
|
+
exit 0
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Block destructive bash commands
|
|
3
|
+
INPUT=$(cat)
|
|
4
|
+
CMD=$(echo "$INPUT" | jq -r '.tool_input.command // empty')
|
|
5
|
+
|
|
6
|
+
DANGEROUS_PATTERNS=(
|
|
7
|
+
"rm -rf /"
|
|
8
|
+
"rm -rf ~"
|
|
9
|
+
"rm -rf \."
|
|
10
|
+
"git reset --hard"
|
|
11
|
+
"git push.*--force"
|
|
12
|
+
"git push.*-f "
|
|
13
|
+
"git clean -f"
|
|
14
|
+
"git checkout \."
|
|
15
|
+
"git restore \."
|
|
16
|
+
"DROP TABLE"
|
|
17
|
+
"DROP DATABASE"
|
|
18
|
+
"TRUNCATE"
|
|
19
|
+
"> /dev/sda"
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
CMD_LOWER=$(echo "$CMD" | tr '[:upper:]' '[:lower:]')
|
|
23
|
+
|
|
24
|
+
for pattern in "${DANGEROUS_PATTERNS[@]}"; do
|
|
25
|
+
pattern_lower=$(echo "$pattern" | tr '[:upper:]' '[:lower:]')
|
|
26
|
+
if echo "$CMD_LOWER" | grep -qE "$pattern_lower"; then
|
|
27
|
+
echo "Blocked: destructive command detected matching '$pattern'" >&2
|
|
28
|
+
exit 2
|
|
29
|
+
fi
|
|
30
|
+
done
|
|
31
|
+
|
|
32
|
+
exit 0
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Inject preservation priorities before context compaction
|
|
3
|
+
# This tells Claude what to keep when compressing conversation history
|
|
4
|
+
cat <<'PRIORITIES'
|
|
5
|
+
CRITICAL CONTEXT TO PRESERVE DURING COMPACTION:
|
|
6
|
+
- Current pipeline step (which of the 8 blog pipeline steps we're on)
|
|
7
|
+
- Any WordPress post IDs, draft URLs, or publish URLs
|
|
8
|
+
- SEO audit findings not yet applied
|
|
9
|
+
- ClickUp task IDs being tracked
|
|
10
|
+
- Blog post title and target keyword
|
|
11
|
+
- LinkedIn post content if mid-creation
|
|
12
|
+
- Any file paths currently being edited
|
|
13
|
+
- Brand voice decisions made in this session
|
|
14
|
+
- Any user corrections or feedback given this session
|
|
15
|
+
PRIORITIES
|
|
16
|
+
exit 0
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Desktop notification when Claude needs attention (WSL2 compatible)
|
|
3
|
+
# Uses powershell.exe toast notifications on Windows/WSL2
|
|
4
|
+
|
|
5
|
+
MESSAGE="Claude Code needs your attention"
|
|
6
|
+
INPUT=$(cat)
|
|
7
|
+
TYPE=$(echo "$INPUT" | jq -r '.hook_event_name // "Notification"')
|
|
8
|
+
|
|
9
|
+
if [ "$TYPE" = "Notification" ]; then
|
|
10
|
+
SUBTYPE=$(echo "$INPUT" | jq -r '.notification_type // empty')
|
|
11
|
+
case "$SUBTYPE" in
|
|
12
|
+
permission_prompt) MESSAGE="Claude needs permission" ;;
|
|
13
|
+
idle_prompt) MESSAGE="Claude is waiting for input" ;;
|
|
14
|
+
*) MESSAGE="Claude Code notification" ;;
|
|
15
|
+
esac
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
# WSL2: use PowerShell toast notification
|
|
19
|
+
if command -v powershell.exe &>/dev/null; then
|
|
20
|
+
powershell.exe -Command "[void][System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms'); \$n = New-Object System.Windows.Forms.NotifyIcon; \$n.Icon = [System.Drawing.SystemIcons]::Information; \$n.Visible = \$true; \$n.ShowBalloonTip(5000, 'Claude Code', '$MESSAGE', 'Info'); Start-Sleep -Seconds 6; \$n.Dispose()" &>/dev/null &
|
|
21
|
+
# Linux native
|
|
22
|
+
elif command -v notify-send &>/dev/null; then
|
|
23
|
+
notify-send "Claude Code" "$MESSAGE" &>/dev/null &
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
exit 0
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Read",
|
|
5
|
+
"WebSearch",
|
|
6
|
+
"WebFetch(domain:github.com)",
|
|
7
|
+
"WebFetch(domain:raw.githubusercontent.com)"
|
|
8
|
+
]
|
|
9
|
+
},
|
|
10
|
+
"enableAllProjectMcpServers": true,
|
|
11
|
+
"hooks": {
|
|
12
|
+
"PreToolUse": [
|
|
13
|
+
{
|
|
14
|
+
"matcher": "Bash",
|
|
15
|
+
"hooks": [
|
|
16
|
+
{
|
|
17
|
+
"type": "command",
|
|
18
|
+
"command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/block-destructive.sh",
|
|
19
|
+
"statusMessage": "Checking command safety"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"type": "command",
|
|
23
|
+
"command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/auto-approve-safe.sh",
|
|
24
|
+
"statusMessage": "Evaluating command"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"PostToolUse": [
|
|
30
|
+
{
|
|
31
|
+
"matcher": "Edit|Write",
|
|
32
|
+
"hooks": [
|
|
33
|
+
{
|
|
34
|
+
"type": "command",
|
|
35
|
+
"command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/auto-format.sh",
|
|
36
|
+
"statusMessage": "Auto-formatting"
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
"PreCompact": [
|
|
42
|
+
{
|
|
43
|
+
"matcher": "",
|
|
44
|
+
"hooks": [
|
|
45
|
+
{
|
|
46
|
+
"type": "command",
|
|
47
|
+
"command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/compaction-preserver.sh",
|
|
48
|
+
"statusMessage": "Preserving context"
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
"Notification": [
|
|
54
|
+
{
|
|
55
|
+
"matcher": "",
|
|
56
|
+
"hooks": [
|
|
57
|
+
{
|
|
58
|
+
"type": "command",
|
|
59
|
+
"command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/notify.sh",
|
|
60
|
+
"async": true
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: frontend-design
|
|
3
|
+
description: Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts, posters, or applications. Generates creative, polished code that avoids generic AI aesthetics.
|
|
4
|
+
license: Apache 2.0. Based on Anthropic's frontend-design skill. See NOTICE.md for attribution.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
This skill guides creation of distinctive, production-grade frontend interfaces that avoid generic "AI slop" aesthetics. Implement real working code with exceptional attention to aesthetic details and creative choices.
|
|
8
|
+
|
|
9
|
+
## Design Direction
|
|
10
|
+
|
|
11
|
+
Commit to a BOLD aesthetic direction:
|
|
12
|
+
- **Purpose**: What problem does this interface solve? Who uses it?
|
|
13
|
+
- **Tone**: Pick an extreme: brutally minimal, maximalist chaos, retro-futuristic, organic/natural, luxury/refined, playful/toy-like, editorial/magazine, brutalist/raw, art deco/geometric, soft/pastel, industrial/utilitarian, etc. There are so many flavors to choose from. Use these for inspiration but design one that is true to the aesthetic direction.
|
|
14
|
+
- **Constraints**: Technical requirements (framework, performance, accessibility).
|
|
15
|
+
- **Differentiation**: What makes this UNFORGETTABLE? What's the one thing someone will remember?
|
|
16
|
+
|
|
17
|
+
**CRITICAL**: Choose a clear conceptual direction and execute it with precision. Bold maximalism and refined minimalism both work—the key is intentionality, not intensity.
|
|
18
|
+
|
|
19
|
+
Then implement working code that is:
|
|
20
|
+
- Production-grade and functional
|
|
21
|
+
- Visually striking and memorable
|
|
22
|
+
- Cohesive with a clear aesthetic point-of-view
|
|
23
|
+
- Meticulously refined in every detail
|
|
24
|
+
|
|
25
|
+
## Frontend Aesthetics Guidelines
|
|
26
|
+
|
|
27
|
+
### Typography
|
|
28
|
+
→ *Consult [typography reference](reference/typography.md) for scales, pairing, and loading strategies.*
|
|
29
|
+
|
|
30
|
+
Choose fonts that are beautiful, unique, and interesting. Pair a distinctive display font with a refined body font.
|
|
31
|
+
|
|
32
|
+
**DO**: Use a modular type scale with fluid sizing (clamp)
|
|
33
|
+
**DO**: Vary font weights and sizes to create clear visual hierarchy
|
|
34
|
+
**DON'T**: Use overused fonts—Inter, Roboto, Arial, Open Sans, system defaults
|
|
35
|
+
**DON'T**: Use monospace typography as lazy shorthand for "technical/developer" vibes
|
|
36
|
+
**DON'T**: Put large icons with rounded corners above every heading—they rarely add value and make sites look templated
|
|
37
|
+
|
|
38
|
+
### Color & Theme
|
|
39
|
+
→ *Consult [color reference](reference/color-and-contrast.md) for OKLCH, palettes, and dark mode.*
|
|
40
|
+
|
|
41
|
+
Commit to a cohesive palette. Dominant colors with sharp accents outperform timid, evenly-distributed palettes.
|
|
42
|
+
|
|
43
|
+
**DO**: Use modern CSS color functions (oklch, color-mix, light-dark) for perceptually uniform, maintainable palettes
|
|
44
|
+
**DO**: Tint your neutrals toward your brand hue—even a subtle hint creates subconscious cohesion
|
|
45
|
+
**DON'T**: Use gray text on colored backgrounds—it looks washed out; use a shade of the background color instead
|
|
46
|
+
**DON'T**: Use pure black (#000) or pure white (#fff)—always tint; pure black/white never appears in nature
|
|
47
|
+
**DON'T**: Use the AI color palette: cyan-on-dark, purple-to-blue gradients, neon accents on dark backgrounds
|
|
48
|
+
**DON'T**: Use gradient text for "impact"—especially on metrics or headings; it's decorative rather than meaningful
|
|
49
|
+
**DON'T**: Default to dark mode with glowing accents—it looks "cool" without requiring actual design decisions
|
|
50
|
+
|
|
51
|
+
### Layout & Space
|
|
52
|
+
→ *Consult [spatial reference](reference/spatial-design.md) for grids, rhythm, and container queries.*
|
|
53
|
+
|
|
54
|
+
Create visual rhythm through varied spacing—not the same padding everywhere. Embrace asymmetry and unexpected compositions. Break the grid intentionally for emphasis.
|
|
55
|
+
|
|
56
|
+
**DO**: Create visual rhythm through varied spacing—tight groupings, generous separations
|
|
57
|
+
**DO**: Use fluid spacing with clamp() that breathes on larger screens
|
|
58
|
+
**DO**: Use asymmetry and unexpected compositions; break the grid intentionally for emphasis
|
|
59
|
+
**DON'T**: Wrap everything in cards—not everything needs a container
|
|
60
|
+
**DON'T**: Nest cards inside cards—visual noise, flatten the hierarchy
|
|
61
|
+
**DON'T**: Use identical card grids—same-sized cards with icon + heading + text, repeated endlessly
|
|
62
|
+
**DON'T**: Use the hero metric layout template—big number, small label, supporting stats, gradient accent
|
|
63
|
+
**DON'T**: Center everything—left-aligned text with asymmetric layouts feels more designed
|
|
64
|
+
**DON'T**: Use the same spacing everywhere—without rhythm, layouts feel monotonous
|
|
65
|
+
|
|
66
|
+
### Visual Details
|
|
67
|
+
**DO**: Use intentional, purposeful decorative elements that reinforce brand
|
|
68
|
+
**DON'T**: Use glassmorphism everywhere—blur effects, glass cards, glow borders used decoratively rather than purposefully
|
|
69
|
+
**DON'T**: Use rounded elements with thick colored border on one side—a lazy accent that almost never looks intentional
|
|
70
|
+
**DON'T**: Use sparklines as decoration—tiny charts that look sophisticated but convey nothing meaningful
|
|
71
|
+
**DON'T**: Use rounded rectangles with generic drop shadows—safe, forgettable, could be any AI output
|
|
72
|
+
**DON'T**: Use modals unless there's truly no better alternative—modals are lazy
|
|
73
|
+
|
|
74
|
+
### Motion
|
|
75
|
+
→ *Consult [motion reference](reference/motion-design.md) for timing, easing, and reduced motion.*
|
|
76
|
+
|
|
77
|
+
Focus on high-impact moments: one well-orchestrated page load with staggered reveals creates more delight than scattered micro-interactions.
|
|
78
|
+
|
|
79
|
+
**DO**: Use motion to convey state changes—entrances, exits, feedback
|
|
80
|
+
**DO**: Use exponential easing (ease-out-quart/quint/expo) for natural deceleration
|
|
81
|
+
**DO**: For height animations, use grid-template-rows transitions instead of animating height directly
|
|
82
|
+
**DON'T**: Animate layout properties (width, height, padding, margin)—use transform and opacity only
|
|
83
|
+
**DON'T**: Use bounce or elastic easing—they feel dated and tacky; real objects decelerate smoothly
|
|
84
|
+
|
|
85
|
+
### Interaction
|
|
86
|
+
→ *Consult [interaction reference](reference/interaction-design.md) for forms, focus, and loading patterns.*
|
|
87
|
+
|
|
88
|
+
Make interactions feel fast. Use optimistic UI—update immediately, sync later.
|
|
89
|
+
|
|
90
|
+
**DO**: Use progressive disclosure—start simple, reveal sophistication through interaction (basic options first, advanced behind expandable sections; hover states that reveal secondary actions)
|
|
91
|
+
**DO**: Design empty states that teach the interface, not just say "nothing here"
|
|
92
|
+
**DO**: Make every interactive surface feel intentional and responsive
|
|
93
|
+
**DON'T**: Repeat the same information—redundant headers, intros that restate the heading
|
|
94
|
+
**DON'T**: Make every button primary—use ghost buttons, text links, secondary styles; hierarchy matters
|
|
95
|
+
|
|
96
|
+
### Responsive
|
|
97
|
+
→ *Consult [responsive reference](reference/responsive-design.md) for mobile-first, fluid design, and container queries.*
|
|
98
|
+
|
|
99
|
+
**DO**: Use container queries (@container) for component-level responsiveness
|
|
100
|
+
**DO**: Adapt the interface for different contexts—don't just shrink it
|
|
101
|
+
**DON'T**: Hide critical functionality on mobile—adapt the interface, don't amputate it
|
|
102
|
+
|
|
103
|
+
### UX Writing
|
|
104
|
+
→ *Consult [ux-writing reference](reference/ux-writing.md) for labels, errors, and empty states.*
|
|
105
|
+
|
|
106
|
+
**DO**: Make every word earn its place
|
|
107
|
+
**DON'T**: Repeat information users can already see
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## The AI Slop Test
|
|
112
|
+
|
|
113
|
+
**Critical quality check**: If you showed this interface to someone and said "AI made this," would they believe you immediately? If yes, that's the problem.
|
|
114
|
+
|
|
115
|
+
A distinctive interface should make someone ask "how was this made?" not "which AI made this?"
|
|
116
|
+
|
|
117
|
+
Review the DON'T guidelines above—they are the fingerprints of AI-generated work from 2024-2025.
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Implementation Principles
|
|
122
|
+
|
|
123
|
+
Match implementation complexity to the aesthetic vision. Maximalist designs need elaborate code with extensive animations and effects. Minimalist or refined designs need restraint, precision, and careful attention to spacing, typography, and subtle details.
|
|
124
|
+
|
|
125
|
+
Interpret creatively and make unexpected choices that feel genuinely designed for the context. No design should be the same. Vary between light and dark themes, different fonts, different aesthetics. NEVER converge on common choices across generations.
|
|
126
|
+
|
|
127
|
+
Remember: {{model}} is capable of extraordinary creative work. Don't hold back—show what can truly be created when thinking outside the box and committing fully to a distinctive vision.
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Color & Contrast
|
|
2
|
+
|
|
3
|
+
## Color Spaces: Use OKLCH
|
|
4
|
+
|
|
5
|
+
**Stop using HSL.** Use OKLCH (or LCH) instead. It's perceptually uniform, meaning equal steps in lightness *look* equal—unlike HSL where 50% lightness in yellow looks bright while 50% in blue looks dark.
|
|
6
|
+
|
|
7
|
+
```css
|
|
8
|
+
/* OKLCH: lightness (0-100%), chroma (0-0.4+), hue (0-360) */
|
|
9
|
+
--color-primary: oklch(60% 0.15 250); /* Blue */
|
|
10
|
+
--color-primary-light: oklch(85% 0.08 250); /* Same hue, lighter */
|
|
11
|
+
--color-primary-dark: oklch(35% 0.12 250); /* Same hue, darker */
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
**Key insight**: As you move toward white or black, reduce chroma (saturation). High chroma at extreme lightness looks garish. A light blue at 85% lightness needs ~0.08 chroma, not the 0.15 of your base color.
|
|
15
|
+
|
|
16
|
+
## Building Functional Palettes
|
|
17
|
+
|
|
18
|
+
### The Tinted Neutral Trap
|
|
19
|
+
|
|
20
|
+
**Pure gray is dead.** Add a subtle hint of your brand hue to all neutrals:
|
|
21
|
+
|
|
22
|
+
```css
|
|
23
|
+
/* Dead grays */
|
|
24
|
+
--gray-100: oklch(95% 0 0); /* No personality */
|
|
25
|
+
--gray-900: oklch(15% 0 0);
|
|
26
|
+
|
|
27
|
+
/* Warm-tinted grays (add brand warmth) */
|
|
28
|
+
--gray-100: oklch(95% 0.01 60); /* Hint of warmth */
|
|
29
|
+
--gray-900: oklch(15% 0.01 60);
|
|
30
|
+
|
|
31
|
+
/* Cool-tinted grays (tech, professional) */
|
|
32
|
+
--gray-100: oklch(95% 0.01 250); /* Hint of blue */
|
|
33
|
+
--gray-900: oklch(15% 0.01 250);
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The chroma is tiny (0.01) but perceptible. It creates subconscious cohesion between your brand color and your UI.
|
|
37
|
+
|
|
38
|
+
### Palette Structure
|
|
39
|
+
|
|
40
|
+
A complete system needs:
|
|
41
|
+
|
|
42
|
+
| Role | Purpose | Example |
|
|
43
|
+
|------|---------|---------|
|
|
44
|
+
| **Primary** | Brand, CTAs, key actions | 1 color, 3-5 shades |
|
|
45
|
+
| **Neutral** | Text, backgrounds, borders | 9-11 shade scale |
|
|
46
|
+
| **Semantic** | Success, error, warning, info | 4 colors, 2-3 shades each |
|
|
47
|
+
| **Surface** | Cards, modals, overlays | 2-3 elevation levels |
|
|
48
|
+
|
|
49
|
+
**Skip secondary/tertiary unless you need them.** Most apps work fine with one accent color. Adding more creates decision fatigue and visual noise.
|
|
50
|
+
|
|
51
|
+
### The 60-30-10 Rule (Applied Correctly)
|
|
52
|
+
|
|
53
|
+
This rule is about **visual weight**, not pixel count:
|
|
54
|
+
|
|
55
|
+
- **60%**: Neutral backgrounds, white space, base surfaces
|
|
56
|
+
- **30%**: Secondary colors—text, borders, inactive states
|
|
57
|
+
- **10%**: Accent—CTAs, highlights, focus states
|
|
58
|
+
|
|
59
|
+
The common mistake: using the accent color everywhere because it's "the brand color." Accent colors work *because* they're rare. Overuse kills their power.
|
|
60
|
+
|
|
61
|
+
## Contrast & Accessibility
|
|
62
|
+
|
|
63
|
+
### WCAG Requirements
|
|
64
|
+
|
|
65
|
+
| Content Type | AA Minimum | AAA Target |
|
|
66
|
+
|--------------|------------|------------|
|
|
67
|
+
| Body text | 4.5:1 | 7:1 |
|
|
68
|
+
| Large text (18px+ or 14px bold) | 3:1 | 4.5:1 |
|
|
69
|
+
| UI components, icons | 3:1 | 4.5:1 |
|
|
70
|
+
| Non-essential decorations | None | None |
|
|
71
|
+
|
|
72
|
+
**The gotcha**: Placeholder text still needs 4.5:1. That light gray placeholder you see everywhere? Usually fails WCAG.
|
|
73
|
+
|
|
74
|
+
### Dangerous Color Combinations
|
|
75
|
+
|
|
76
|
+
These commonly fail contrast or cause readability issues:
|
|
77
|
+
|
|
78
|
+
- Light gray text on white (the #1 accessibility fail)
|
|
79
|
+
- **Gray text on any colored background**—gray looks washed out and dead on color. Use a darker shade of the background color, or transparency
|
|
80
|
+
- Red text on green background (or vice versa)—8% of men can't distinguish these
|
|
81
|
+
- Blue text on red background (vibrates visually)
|
|
82
|
+
- Yellow text on white (almost always fails)
|
|
83
|
+
- Thin light text on images (unpredictable contrast)
|
|
84
|
+
|
|
85
|
+
### Never Use Pure Gray or Pure Black
|
|
86
|
+
|
|
87
|
+
Pure gray (`oklch(50% 0 0)`) and pure black (`#000`) don't exist in nature—real shadows and surfaces always have a color cast. Even a chroma of 0.005-0.01 is enough to feel natural without being obviously tinted. (See tinted neutrals example above.)
|
|
88
|
+
|
|
89
|
+
### Testing
|
|
90
|
+
|
|
91
|
+
Don't trust your eyes. Use tools:
|
|
92
|
+
|
|
93
|
+
- [WebAIM Contrast Checker](https://webaim.org/resources/contrastchecker/)
|
|
94
|
+
- Browser DevTools → Rendering → Emulate vision deficiencies
|
|
95
|
+
- [Polypane](https://polypane.app/) for real-time testing
|
|
96
|
+
|
|
97
|
+
## Theming: Light & Dark Mode
|
|
98
|
+
|
|
99
|
+
### Dark Mode Is Not Inverted Light Mode
|
|
100
|
+
|
|
101
|
+
You can't just swap colors. Dark mode requires different design decisions:
|
|
102
|
+
|
|
103
|
+
| Light Mode | Dark Mode |
|
|
104
|
+
|------------|-----------|
|
|
105
|
+
| Shadows for depth | Lighter surfaces for depth (no shadows) |
|
|
106
|
+
| Dark text on light | Light text on dark (reduce font weight) |
|
|
107
|
+
| Vibrant accents | Desaturate accents slightly |
|
|
108
|
+
| White backgrounds | Never pure black—use dark gray (oklch 12-18%) |
|
|
109
|
+
|
|
110
|
+
```css
|
|
111
|
+
/* Dark mode depth via surface color, not shadow */
|
|
112
|
+
:root[data-theme="dark"] {
|
|
113
|
+
--surface-1: oklch(15% 0.01 250);
|
|
114
|
+
--surface-2: oklch(20% 0.01 250); /* "Higher" = lighter */
|
|
115
|
+
--surface-3: oklch(25% 0.01 250);
|
|
116
|
+
|
|
117
|
+
/* Reduce text weight slightly */
|
|
118
|
+
--body-weight: 350; /* Instead of 400 */
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Token Hierarchy
|
|
123
|
+
|
|
124
|
+
Use two layers: primitive tokens (`--blue-500`) and semantic tokens (`--color-primary: var(--blue-500)`). For dark mode, only redefine the semantic layer—primitives stay the same.
|
|
125
|
+
|
|
126
|
+
## Alpha Is A Design Smell
|
|
127
|
+
|
|
128
|
+
Heavy use of transparency (rgba, hsla) usually means an incomplete palette. Alpha creates unpredictable contrast, performance overhead, and inconsistency. Define explicit overlay colors for each context instead. Exception: focus rings and interactive states where see-through is needed.
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
**Avoid**: Relying on color alone to convey information. Creating palettes without clear roles for each color. Using pure black (#000) for large areas. Skipping color blindness testing (8% of men affected).
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Interaction Design
|
|
2
|
+
|
|
3
|
+
## The Eight Interactive States
|
|
4
|
+
|
|
5
|
+
Every interactive element needs these states designed:
|
|
6
|
+
|
|
7
|
+
| State | When | Visual Treatment |
|
|
8
|
+
|-------|------|------------------|
|
|
9
|
+
| **Default** | At rest | Base styling |
|
|
10
|
+
| **Hover** | Pointer over (not touch) | Subtle lift, color shift |
|
|
11
|
+
| **Focus** | Keyboard/programmatic focus | Visible ring (see below) |
|
|
12
|
+
| **Active** | Being pressed | Pressed in, darker |
|
|
13
|
+
| **Disabled** | Not interactive | Reduced opacity, no pointer |
|
|
14
|
+
| **Loading** | Processing | Spinner, skeleton |
|
|
15
|
+
| **Error** | Invalid state | Red border, icon, message |
|
|
16
|
+
| **Success** | Completed | Green check, confirmation |
|
|
17
|
+
|
|
18
|
+
**The common miss**: Designing hover without focus, or vice versa. They're different. Keyboard users never see hover states.
|
|
19
|
+
|
|
20
|
+
## Focus Rings: Do Them Right
|
|
21
|
+
|
|
22
|
+
**Never `outline: none` without replacement.** It's an accessibility violation. Instead, use `:focus-visible` to show focus only for keyboard users:
|
|
23
|
+
|
|
24
|
+
```css
|
|
25
|
+
/* Hide focus ring for mouse/touch */
|
|
26
|
+
button:focus {
|
|
27
|
+
outline: none;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* Show focus ring for keyboard */
|
|
31
|
+
button:focus-visible {
|
|
32
|
+
outline: 2px solid var(--color-accent);
|
|
33
|
+
outline-offset: 2px;
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Focus ring design**:
|
|
38
|
+
- High contrast (3:1 minimum against adjacent colors)
|
|
39
|
+
- 2-3px thick
|
|
40
|
+
- Offset from element (not inside it)
|
|
41
|
+
- Consistent across all interactive elements
|
|
42
|
+
|
|
43
|
+
## Form Design: The Non-Obvious
|
|
44
|
+
|
|
45
|
+
**Placeholders aren't labels**—they disappear on input. Always use visible `<label>` elements. **Validate on blur**, not on every keystroke (exception: password strength). Place errors **below** fields with `aria-describedby` connecting them.
|
|
46
|
+
|
|
47
|
+
## Loading States
|
|
48
|
+
|
|
49
|
+
**Optimistic updates**: Show success immediately, rollback on failure. Use for low-stakes actions (likes, follows), not payments or destructive actions. **Skeleton screens > spinners**—they preview content shape and feel faster than generic spinners.
|
|
50
|
+
|
|
51
|
+
## Modals: The Inert Approach
|
|
52
|
+
|
|
53
|
+
Focus trapping in modals used to require complex JavaScript. Now use the `inert` attribute:
|
|
54
|
+
|
|
55
|
+
```html
|
|
56
|
+
<!-- When modal is open -->
|
|
57
|
+
<main inert>
|
|
58
|
+
<!-- Content behind modal can't be focused or clicked -->
|
|
59
|
+
</main>
|
|
60
|
+
<dialog open>
|
|
61
|
+
<h2>Modal Title</h2>
|
|
62
|
+
<!-- Focus stays inside modal -->
|
|
63
|
+
</dialog>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Or use the native `<dialog>` element:
|
|
67
|
+
|
|
68
|
+
```javascript
|
|
69
|
+
const dialog = document.querySelector('dialog');
|
|
70
|
+
dialog.showModal(); // Opens with focus trap, closes on Escape
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## The Popover API
|
|
74
|
+
|
|
75
|
+
For tooltips, dropdowns, and non-modal overlays, use native popovers:
|
|
76
|
+
|
|
77
|
+
```html
|
|
78
|
+
<button popovertarget="menu">Open menu</button>
|
|
79
|
+
<div id="menu" popover>
|
|
80
|
+
<button>Option 1</button>
|
|
81
|
+
<button>Option 2</button>
|
|
82
|
+
</div>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**Benefits**: Light-dismiss (click outside closes), proper stacking, no z-index wars, accessible by default.
|
|
86
|
+
|
|
87
|
+
## Destructive Actions: Undo > Confirm
|
|
88
|
+
|
|
89
|
+
**Undo is better than confirmation dialogs**—users click through confirmations mindlessly. Remove from UI immediately, show undo toast, actually delete after toast expires. Use confirmation only for truly irreversible actions (account deletion), high-cost actions, or batch operations.
|
|
90
|
+
|
|
91
|
+
## Keyboard Navigation Patterns
|
|
92
|
+
|
|
93
|
+
### Roving Tabindex
|
|
94
|
+
|
|
95
|
+
For component groups (tabs, menu items, radio groups), one item is tabbable; arrow keys move within:
|
|
96
|
+
|
|
97
|
+
```html
|
|
98
|
+
<div role="tablist">
|
|
99
|
+
<button role="tab" tabindex="0">Tab 1</button>
|
|
100
|
+
<button role="tab" tabindex="-1">Tab 2</button>
|
|
101
|
+
<button role="tab" tabindex="-1">Tab 3</button>
|
|
102
|
+
</div>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Arrow keys move `tabindex="0"` between items. Tab moves to the next component entirely.
|
|
106
|
+
|
|
107
|
+
### Skip Links
|
|
108
|
+
|
|
109
|
+
Provide skip links (`<a href="#main-content">Skip to main content</a>`) for keyboard users to jump past navigation. Hide off-screen, show on focus.
|
|
110
|
+
|
|
111
|
+
## Gesture Discoverability
|
|
112
|
+
|
|
113
|
+
Swipe-to-delete and similar gestures are invisible. Hint at their existence:
|
|
114
|
+
|
|
115
|
+
- **Partially reveal**: Show delete button peeking from edge
|
|
116
|
+
- **Onboarding**: Coach marks on first use
|
|
117
|
+
- **Alternative**: Always provide a visible fallback (menu with "Delete")
|
|
118
|
+
|
|
119
|
+
Don't rely on gestures as the only way to perform actions.
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
**Avoid**: Removing focus indicators without alternatives. Using placeholder text as labels. Touch targets <44x44px. Generic error messages. Custom controls without ARIA/keyboard support.
|