@workingpayload/agent-skills 1.0.1 → 2.0.1
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/APIForge/skill.md +165 -0
- package/AccessPlus/skill.md +136 -0
- package/AlgoMaster/skill.md +125 -0
- package/Architekt AI/skill.md +140 -0
- package/AuthCraft/skill.md +144 -0
- package/AutoScriptor/skill.md +137 -0
- package/BoilerCore/skill.md +136 -0
- package/BugHunter Pro/skill.md +133 -0
- package/ChangeScribe/skill.md +113 -0
- package/CodeMap/skill.md +194 -0
- package/CodeSage/skill.md +163 -0
- package/CommitCraft/skill.md +113 -0
- package/CoverageMax/skill.md +161 -0
- package/CronGenius/skill.md +157 -0
- package/DataPolish/skill.md +142 -0
- package/DataWeaver/skill.md +151 -0
- package/DockMaster/skill.md +158 -0
- package/DocuGenie/skill.md +138 -0
- package/EdgeGuard/skill.md +160 -0
- package/EnvWizard/skill.md +156 -0
- package/ErrorMedic/skill.md +152 -0
- package/FeatureSmith/skill.md +139 -0
- package/FlexiLayout/skill.md +144 -0
- package/FlowTester/skill.md +154 -0
- package/FunctionForge/skill.md +136 -0
- package/InputShield/skill.md +144 -0
- package/IssueForge/skill.md +148 -0
- package/KubeCrafter/skill.md +149 -0
- package/LogicLens/skill.md +132 -0
- package/MockSmith/skill.md +146 -0
- package/ModelSensei/skill.md +138 -0
- package/PRMentor/skill.md +103 -0
- package/PerfDetective/skill.md +90 -0
- package/PipelinePro/skill.md +146 -0
- package/PolyglotShift/skill.md +94 -0
- package/PromptForge/skill.md +118 -0
- package/QueryPulse/skill.md +123 -0
- package/README.md +327 -216
- package/ReadMeCraft/skill.md +127 -0
- package/RefactorX/skill.md +110 -0
- package/RenderBoost/skill.md +148 -0
- package/SEOMancer/skill.md +156 -0
- package/ScrapeMaster/skill.md +157 -0
- package/SecretSniffer/skill.md +123 -0
- package/SecureScan/skill.md +130 -0
- package/ServiceSplitter/skill.md +153 -0
- package/SpeedSmith/skill.md +155 -0
- package/StackWise/skill.md +155 -0
- package/TaskOrchestrator/skill.md +135 -0
- package/TestCrafter/skill.md +158 -0
- package/TraceMind/skill.md +143 -0
- package/UISmith/skill.md +131 -0
- package/bin/cli.js +436 -0
- package/extension-extender/SKILL.md +122 -0
- package/fastapi-furious/SKILL.md +148 -0
- package/package.json +42 -32
- package/python-master/SKILL.md +108 -0
- package/react-ranger/SKILL.md +93 -0
- package/scripts/build_index.py +282 -0
- package/scripts/doctor.py +542 -0
- package/scripts/install.py +436 -0
- package/scripts/route.py +348 -0
- package/scripts/score.py +355 -0
- package/scripts/test_skill.py +501 -0
- package/scripts/validate.py +254 -0
- package/skills-routing.json +1156 -0
- package/skills.json +3389 -0
- package/cli.js +0 -181
- package/skills/APIForge/skill.md +0 -32
- package/skills/AccessPlus/skill.md +0 -32
- package/skills/AlgoMaster/skill.md +0 -32
- package/skills/Architekt AI/skill.md +0 -32
- package/skills/AuthCraft/skill.md +0 -32
- package/skills/AutoScriptor/skill.md +0 -32
- package/skills/BoilerCore/skill.md +0 -32
- package/skills/BugHunter Pro/skill.md +0 -32
- package/skills/ChangeScribe/skill.md +0 -32
- package/skills/CodeSage/skill.md +0 -32
- package/skills/CommitCraft/skill.md +0 -32
- package/skills/CoverageMax/skill.md +0 -32
- package/skills/CronGenius/skill.md +0 -32
- package/skills/DataPolish/skill.md +0 -32
- package/skills/DataWeaver/skill.md +0 -32
- package/skills/DockMaster/skill.md +0 -32
- package/skills/DocuGenie/skill.md +0 -32
- package/skills/EdgeGuard/skill.md +0 -32
- package/skills/EnvWizard/skill.md +0 -32
- package/skills/ErrorMedic/skill.md +0 -32
- package/skills/Extension-Extender/SKILL.md +0 -41
- package/skills/Extension-Extender/references/ui-guidelines.md +0 -26
- package/skills/Fastapi-Furious/README.md +0 -16
- package/skills/Fastapi-Furious/SKILL.md +0 -37
- package/skills/FeatureSmith/skill.md +0 -32
- package/skills/FlexiLayout/skill.md +0 -32
- package/skills/FlowTester/skill.md +0 -32
- package/skills/FunctionForge/skill.md +0 -32
- package/skills/InputShield/skill.md +0 -32
- package/skills/IssueForge/skill.md +0 -32
- package/skills/KubeCrafter/skill.md +0 -32
- package/skills/LogicLens/skill.md +0 -32
- package/skills/MockSmith/skill.md +0 -32
- package/skills/ModelSensei/skill.md +0 -32
- package/skills/PRMentor/skill.md +0 -32
- package/skills/PerfDetective/skill.md +0 -32
- package/skills/PipelinePro/skill.md +0 -32
- package/skills/PolyglotShift/skill.md +0 -32
- package/skills/PromptForge/skill.md +0 -32
- package/skills/Python-Master/README.md +0 -11
- package/skills/Python-Master/SKILL.md +0 -37
- package/skills/QueryPulse/skill.md +0 -32
- package/skills/React-Ranger/README.md +0 -17
- package/skills/React-Ranger/SKILL.md +0 -37
- package/skills/ReadMeCraft/skill.md +0 -32
- package/skills/RefactorX/skill.md +0 -32
- package/skills/RenderBoost/skill.md +0 -32
- package/skills/SEOMancer/skill.md +0 -32
- package/skills/ScrapeMaster/skill.md +0 -32
- package/skills/SecretSniffer/skill.md +0 -32
- package/skills/SecureScan/skill.md +0 -32
- package/skills/ServiceSplitter/skill.md +0 -32
- package/skills/SpeedSmith/skill.md +0 -32
- package/skills/StackWise/skill.md +0 -32
- package/skills/TaskOrchestrator/skill.md +0 -32
- package/skills/TestCrafter/skill.md +0 -32
- package/skills/TraceMind/skill.md +0 -32
- package/skills/UISmith/skill.md +0 -32
- /package/{skills/Extension-Extender → extension-extender}/assets/manifest.json +0 -0
- /package/{skills/Extension-Extender → extension-extender}/assets/popup.css +0 -0
- /package/{skills/Extension-Extender → extension-extender}/assets/popup.html +0 -0
- /package/{skills/Extension-Extender → extension-extender}/assets/popup.js +0 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tracemind
|
|
3
|
+
description: Implements distributed tracing, structured logging, and observability using OpenTelemetry, Jaeger/Tempo, and SLO-based alerting. Use when asked to add tracing to a service, implement structured logging, set up correlation IDs, configure OpenTelemetry, analyze stack traces, or build SLO alerts.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# TraceMind
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Implements the three pillars of observability — traces, metrics, and logs — using OpenTelemetry as the vendor-neutral instrumentation layer. Backends: Jaeger or Grafana Tempo for traces, Prometheus + Grafana for metrics, and any JSON-structured log aggregator (Loki, Datadog, Elasticsearch). Produces correlation IDs that stitch traces, logs, and metrics together for root-cause analysis.
|
|
11
|
+
|
|
12
|
+
## Workflow
|
|
13
|
+
|
|
14
|
+
### 1. OpenTelemetry Setup
|
|
15
|
+
|
|
16
|
+
OpenTelemetry is the instrumentation standard. Instrument once, export to any backend.
|
|
17
|
+
|
|
18
|
+
**Python (FastAPI)**:
|
|
19
|
+
```python
|
|
20
|
+
from opentelemetry import trace
|
|
21
|
+
from opentelemetry.sdk.trace import TracerProvider
|
|
22
|
+
from opentelemetry.sdk.trace.export import BatchSpanProcessor
|
|
23
|
+
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
|
|
24
|
+
from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor
|
|
25
|
+
|
|
26
|
+
def setup_tracing(service_name: str, otlp_endpoint: str):
|
|
27
|
+
provider = TracerProvider(resource=Resource.create({SERVICE_NAME: service_name}))
|
|
28
|
+
provider.add_span_processor(BatchSpanProcessor(OTLPSpanExporter(endpoint=otlp_endpoint)))
|
|
29
|
+
trace.set_tracer_provider(provider)
|
|
30
|
+
FastAPIInstrumentor.instrument()
|
|
31
|
+
HTTPXClientInstrumentor.instrument()
|
|
32
|
+
SQLAlchemyInstrumentor.instrument()
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**Node.js**: Load `tracing.ts` before all other imports. Use `NodeSDK` with `getNodeAutoInstrumentations()` and `OTLPTraceExporter`. Configure via `OTEL_EXPORTER_OTLP_ENDPOINT` env var.
|
|
36
|
+
|
|
37
|
+
### 2. Trace Context Propagation
|
|
38
|
+
|
|
39
|
+
Traces must flow across service boundaries using W3C Trace Context (`traceparent` header):
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
traceparent: 00-{trace-id-32hex}-{parent-span-id-16hex}-{flags}
|
|
43
|
+
tracestate: vendor-specific key-value pairs
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Auto-instrumentation handles this for HTTP clients (httpx, axios, requests). For message queues, inject manually:
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
# Inject trace context into Kafka message headers
|
|
50
|
+
from opentelemetry.propagate import inject
|
|
51
|
+
|
|
52
|
+
headers = {}
|
|
53
|
+
inject(headers) # adds 'traceparent' and 'tracestate'
|
|
54
|
+
producer.send('orders', value=payload, headers=list(headers.items()))
|
|
55
|
+
|
|
56
|
+
# Extract in consumer
|
|
57
|
+
from opentelemetry.propagate import extract
|
|
58
|
+
from opentelemetry import trace
|
|
59
|
+
|
|
60
|
+
ctx = extract(dict(message.headers))
|
|
61
|
+
with trace.get_tracer(__name__).start_as_current_span(
|
|
62
|
+
"process-order", context=ctx
|
|
63
|
+
) as span:
|
|
64
|
+
...
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
For async/background workers (Celery, BullMQ): serialize the trace context as a task header and restore it in the worker.
|
|
68
|
+
|
|
69
|
+
### 3. Structured Logging with Correlation IDs
|
|
70
|
+
|
|
71
|
+
All logs must be JSON-structured with trace context embedded. Use a structlog processor to inject `trace_id` and `span_id` from the active OTel span into every log entry. Required fields: `event`, `timestamp` (ISO 8601), `service`, `env`, `trace_id`, `span_id`.
|
|
72
|
+
|
|
73
|
+
**Never log**: passwords, API keys, PII (emails, SSNs) in plaintext. Redact with `***` or hash.
|
|
74
|
+
|
|
75
|
+
### 4. Custom Spans and Attributes
|
|
76
|
+
|
|
77
|
+
Name spans `<domain>.<operation>` (`payment.process`, `db.query`, `cache.get`). Set domain attributes on the span, call `span.record_exception(e)` and `span.set_status(StatusCode.ERROR)` in the except block. Follow OTel Semantic Conventions (`db.system`, `http.method`) for standard attributes; use `<service>.<attribute>` for domain-specific ones.
|
|
78
|
+
|
|
79
|
+
### 5. SLO Definition and Alerting
|
|
80
|
+
|
|
81
|
+
Define SLOs before configuring alerts. SLI = HTTP 2xx / total requests. SLO = 99.9% over 30-day window. Error budget = 43.8 min/month.
|
|
82
|
+
|
|
83
|
+
Key Prometheus alert expressions:
|
|
84
|
+
- Error rate: `sum(rate(http_requests_total{status!~"5.."}[5m])) / sum(rate(http_requests_total[5m])) < 0.999`
|
|
85
|
+
- Latency p99: `histogram_quantile(0.99, ...) > 1.0`
|
|
86
|
+
|
|
87
|
+
**Error budget burn rate** (Google SRE Workbook): fast burn (1h, 14x) = page; slow burn (6h, 6x) = ticket; very slow (3d, 3x) = sprint review.
|
|
88
|
+
|
|
89
|
+
### 6. Grafana Dashboard Structure
|
|
90
|
+
|
|
91
|
+
Use the RED method: Request rate, Error rate, Duration (p50/p95/p99). Include an error budget remaining panel (green > 50%, yellow 10–50%, red < 10%). Link panels directly to Tempo/Jaeger trace queries for the selected time range.
|
|
92
|
+
|
|
93
|
+
### 7. OTel Collector Configuration
|
|
94
|
+
|
|
95
|
+
Route telemetry through an OTel Collector (not directly to backends) for flexibility:
|
|
96
|
+
|
|
97
|
+
```yaml
|
|
98
|
+
# otel-collector-config.yaml
|
|
99
|
+
receivers:
|
|
100
|
+
otlp:
|
|
101
|
+
protocols:
|
|
102
|
+
grpc: { endpoint: "0.0.0.0:4317" }
|
|
103
|
+
http: { endpoint: "0.0.0.0:4318" }
|
|
104
|
+
|
|
105
|
+
processors:
|
|
106
|
+
batch:
|
|
107
|
+
timeout: 5s
|
|
108
|
+
send_batch_size: 1000
|
|
109
|
+
resource:
|
|
110
|
+
attributes:
|
|
111
|
+
- action: insert
|
|
112
|
+
key: deployment.environment
|
|
113
|
+
value: ${ENV}
|
|
114
|
+
|
|
115
|
+
exporters:
|
|
116
|
+
otlp/tempo:
|
|
117
|
+
endpoint: "tempo:4317"
|
|
118
|
+
tls: { insecure: true }
|
|
119
|
+
prometheus:
|
|
120
|
+
endpoint: "0.0.0.0:8889"
|
|
121
|
+
loki:
|
|
122
|
+
endpoint: "http://loki:3100/loki/api/v1/push"
|
|
123
|
+
|
|
124
|
+
service:
|
|
125
|
+
pipelines:
|
|
126
|
+
traces: { receivers: [otlp], processors: [batch], exporters: [otlp/tempo] }
|
|
127
|
+
metrics: { receivers: [otlp], processors: [batch], exporters: [prometheus] }
|
|
128
|
+
logs: { receivers: [otlp], processors: [batch], exporters: [loki] }
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Edge Cases
|
|
132
|
+
|
|
133
|
+
**Sampling strategy:** At > 1000 req/s, use tail-based sampling: always record traces with errors or high latency, sample 1–5% of healthy fast traces. Configure via OTel Collector `tailsampling` processor. Never use head-based sampling alone.
|
|
134
|
+
|
|
135
|
+
**Trace context across async boundaries:** `asyncio.gather()`, `ThreadPoolExecutor`, and message queues do not auto-propagate context. Use `contextvars.copy_context()` when spawning threads. For message queues, inject/extract manually (see Section 2).
|
|
136
|
+
|
|
137
|
+
**Cardinality explosion:** High-cardinality labels (user IDs, full URL paths) cause Prometheus memory exhaustion. Use `http.route` (pattern) not `http.url` (full URL). Audit with `promtool tsdb analyze`.
|
|
138
|
+
|
|
139
|
+
**Clock skew diagnosis:** Spans with impossible durations (negative or longer than the parent) indicate NTP drift or container clock skew. Check `chronyc tracking` on host nodes and verify container time sync. In Kubernetes, pods inherit host clock — a skewed node affects all pods. Use Jaeger's clock skew adjustment or correct the node NTP source.
|
|
140
|
+
|
|
141
|
+
**OTel Collector HA:** Run the Collector as a DaemonSet or sidecar for local buffering. Configure the `batch` processor with `sending_queue` and `retry_on_failure` to buffer spans during backend outages. Add a fallback exporter (e.g., write to file) so telemetry is not lost if the primary backend is down.
|
|
142
|
+
|
|
143
|
+
**PII in span attributes:** Avoid setting user emails, names, or payment data as span attributes — they appear in trace UIs and logs. If unavoidable, use the OTel Collector `transform` processor to redact or hash sensitive attributes before export: `set(attributes["user.email"], "REDACTED") where attributes["user.email"] != nil`.
|
package/UISmith/skill.md
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: uismith
|
|
3
|
+
description: Builds accessible, composable UI components using Atomic Design principles, WCAG AA compliance, design tokens, and CSS Modules or Tailwind CSS. Use when asked to create UI components, audit accessibility, implement ARIA roles, set up a design system, or decompose a UI into reusable components.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# UISmith
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Translates designs into accessible, composable, and maintainable UI components. Every component targets WCAG 2.2 Level AA compliance, uses Atomic Design decomposition, implements correct ARIA roles and keyboard navigation, and is styled with design tokens (CSS custom properties or Tailwind config). No component ships without accessibility attributes and keyboard interaction support.
|
|
11
|
+
|
|
12
|
+
## Workflow
|
|
13
|
+
|
|
14
|
+
### 1. Component Decomposition (Atomic Design)
|
|
15
|
+
|
|
16
|
+
Before coding, classify the component in the Atomic Design hierarchy:
|
|
17
|
+
|
|
18
|
+
| Level | Examples | Key Trait |
|
|
19
|
+
|-------|---------|-----------|
|
|
20
|
+
| **Atom** | Button, Input, Label, Icon, Badge | No children components; single HTML element or small group |
|
|
21
|
+
| **Molecule** | SearchBar (Input + Button), FormField (Label + Input + Error) | Combines 2–4 atoms; one focused function |
|
|
22
|
+
| **Organism** | NavigationBar, DataTable, ProductCard, Modal | Combines molecules/atoms; owns its own state |
|
|
23
|
+
| **Template** | PageLayout, DashboardShell | Layout skeleton; no data, only slots/children |
|
|
24
|
+
| **Page** | DashboardPage, ProfilePage | Template + real data; maps to a route |
|
|
25
|
+
|
|
26
|
+
Decision rule: if you find yourself writing the same markup in 3+ places, extract to the appropriate atom/molecule level.
|
|
27
|
+
|
|
28
|
+
### 2. Accessibility — WCAG 2.2 AA Checklist
|
|
29
|
+
|
|
30
|
+
Apply to every component before marking it complete:
|
|
31
|
+
|
|
32
|
+
**Semantic HTML first**:
|
|
33
|
+
- Use `<button>` for actions (never `<div onClick>`), `<a href>` for navigation, `<input>` for data entry.
|
|
34
|
+
- Use heading hierarchy (`h1` → `h2` → `h3`) that reflects document structure, not visual size.
|
|
35
|
+
- Use landmark elements: `<main>`, `<nav>`, `<aside>`, `<header>`, `<footer>`.
|
|
36
|
+
|
|
37
|
+
**ARIA roles and labels**:
|
|
38
|
+
```html
|
|
39
|
+
<!-- Incorrect: div with no role -->
|
|
40
|
+
<div onClick={handleClose}>X</div>
|
|
41
|
+
|
|
42
|
+
<!-- Correct: semantic button with accessible label -->
|
|
43
|
+
<button type="button" aria-label="Close dialog" onClick={handleClose}>
|
|
44
|
+
<XIcon aria-hidden="true" />
|
|
45
|
+
</button>
|
|
46
|
+
|
|
47
|
+
<!-- Modal dialog -->
|
|
48
|
+
<div
|
|
49
|
+
role="dialog"
|
|
50
|
+
aria-modal="true"
|
|
51
|
+
aria-labelledby="dialog-title"
|
|
52
|
+
aria-describedby="dialog-description"
|
|
53
|
+
>
|
|
54
|
+
<h2 id="dialog-title">Confirm Delete</h2>
|
|
55
|
+
<p id="dialog-description">This action cannot be undone.</p>
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
<!-- Navigation with label to distinguish multiple navs -->
|
|
59
|
+
<nav aria-label="Main navigation">...</nav>
|
|
60
|
+
<nav aria-label="Breadcrumb">...</nav>
|
|
61
|
+
|
|
62
|
+
<!-- Live region for dynamic content -->
|
|
63
|
+
<div aria-live="polite" aria-atomic="true" role="status">
|
|
64
|
+
{statusMessage}
|
|
65
|
+
</div>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Color contrast**: Text must meet 4.5:1 contrast ratio (normal text) or 3:1 (large text ≥ 18pt/14pt bold) against background. Use tooling: `axe-core`, `@radix-ui/colors` (APCA-compliant scale), or Figma's Contrast plugin. Never convey information by color alone — add icon, pattern, or text.
|
|
69
|
+
|
|
70
|
+
**Focus management**:
|
|
71
|
+
- Visible focus indicator: `outline: 2px solid currentColor; outline-offset: 2px` (never `outline: none` without an equally visible custom focus style).
|
|
72
|
+
- Focus trap in modals/drawers: implement with `focus-trap-react` or Radix UI's Dialog primitive.
|
|
73
|
+
- Return focus to trigger element when modal closes.
|
|
74
|
+
|
|
75
|
+
### 3. Keyboard Navigation Patterns
|
|
76
|
+
|
|
77
|
+
Per ARIA Authoring Practices Guide (APG): Button = Enter/Space; Radio group = Arrow keys; Dropdown = Enter opens, Arrow navigates, Escape closes; Dialog = Tab/Shift+Tab within, Escape closes; Tabs = Arrow keys between tabs.
|
|
78
|
+
|
|
79
|
+
**Prefer Radix UI or Headless UI primitives** over hand-rolling keyboard nav — they implement APG patterns correctly. For custom dropdowns, handle `ArrowDown`/`ArrowUp` to move `activeIndex`, `Escape` to close and return focus to the trigger, and `ArrowUp`/`ArrowDown` to prevent page scroll with `e.preventDefault()`.
|
|
80
|
+
|
|
81
|
+
### 4. Design Tokens
|
|
82
|
+
|
|
83
|
+
Define all visual decisions as CSS custom properties — never hardcode values:
|
|
84
|
+
|
|
85
|
+
```css
|
|
86
|
+
:root {
|
|
87
|
+
--color-primary-500: #2563eb; --color-primary-600: #1d4ed8;
|
|
88
|
+
--color-error-500: #dc2626;
|
|
89
|
+
--color-surface-default: #ffffff; --color-text-primary: #0f172a;
|
|
90
|
+
--space-1: 0.25rem; --space-2: 0.5rem; --space-4: 1rem; --space-8: 2rem;
|
|
91
|
+
--font-size-base: 1rem; --line-height-normal: 1.5;
|
|
92
|
+
--radius-md: 0.375rem;
|
|
93
|
+
--shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Tailwind: extend `colors`, `spacing`, and `borderRadius` in `tailwind.config.ts` to match your token scale. Never use magic numbers.
|
|
98
|
+
|
|
99
|
+
### 5. CSS Modules vs. Tailwind
|
|
100
|
+
|
|
101
|
+
**CSS Modules**: choose for strict encapsulation, complex animations, or pseudo-element logic. Reference tokens via `var(--space-2)` in module files.
|
|
102
|
+
|
|
103
|
+
**Tailwind**: choose for rapid iteration, shadcn/ui, or Radix primitives. Use `cn()` to merge variant classes and keep focus-visible styles always present:
|
|
104
|
+
```tsx
|
|
105
|
+
<button className={cn('px-4 py-2 rounded-md focus-visible:outline focus-visible:outline-2',
|
|
106
|
+
variant === 'primary' && 'bg-primary-500 text-white')} {...props} />
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### 6. Component Output Requirements
|
|
110
|
+
|
|
111
|
+
Every component delivered must include:
|
|
112
|
+
|
|
113
|
+
1. **Component file** with TypeScript props interface (no `any`)
|
|
114
|
+
2. **Accessible markup**: correct roles, labels, live regions where needed
|
|
115
|
+
3. **Keyboard interaction**: all interactions operable by keyboard
|
|
116
|
+
4. **Story or usage example** (Storybook story or plain code example)
|
|
117
|
+
5. **Accessibility note**: list of WCAG criteria addressed and any known limitations
|
|
118
|
+
|
|
119
|
+
## Edge Cases
|
|
120
|
+
|
|
121
|
+
**RTL layout support:** Use logical CSS properties (`margin-inline-start` instead of `margin-left`, `padding-inline-end` instead of `padding-right`) so layouts flip automatically when `dir="rtl"` is set on `<html>`. Set `dir="rtl"` at the root for RTL languages. Mirror icons that imply direction (arrows, chevrons) using `transform: scaleX(-1)` under `[dir="rtl"]`. Test with Arabic or Hebrew `lang` attributes.
|
|
122
|
+
|
|
123
|
+
**Windows High Contrast mode:** Use `@media (forced-colors: active)` to adapt components that rely on custom colors, box-shadows, or background images for contrast — these are overridden by the OS. Replace `box-shadow` focus rings with `outline`, use `ButtonText`, `ButtonFace`, and `CanvasText` CSS system color keywords for forced-colors-aware styling. Test in Windows Accessibility → High Contrast Black/White themes.
|
|
124
|
+
|
|
125
|
+
**Touch gesture accessibility (WCAG 2.5.1):** All touch gestures (swipe, pinch, multi-finger) must have a single-pointer alternative (a button, link, or drag handle). Pointer cancellation (WCAG 2.5.2): actions that trigger on `pointerdown` must be reversible on `pointerup`. Provide keyboard equivalents for all custom drag-and-drop interactions.
|
|
126
|
+
|
|
127
|
+
**Dynamic content and screen readers**: Content that updates without a page reload (toasts, form validation errors, loading states) must be announced to screen readers. Use `role="alert"` (assertive, interrupts) for errors, `role="status"` / `aria-live="polite"` for non-urgent updates. Inject the element into the DOM before updating its text content — some screen readers miss updates to pre-existing live regions.
|
|
128
|
+
|
|
129
|
+
**Icon-only buttons without visible labels**: A button containing only an icon must have an `aria-label` describing the action, not the icon. `aria-label="Close"` not `aria-label="X icon"`. The icon itself must have `aria-hidden="true"` to prevent duplicate announcement. If using SVG, add `focusable="false"` to prevent IE11 SVG focus behavior.
|
|
130
|
+
|
|
131
|
+
**Responsive component behavior**: A component that changes its DOM structure at different breakpoints (e.g., a horizontal nav that collapses to a hamburger menu) must maintain accessibility at all breakpoints. The collapsed menu must be announced as expanded/collapsed (`aria-expanded`), and the full nav landmark must remain in the DOM (use CSS to hide, not `display:none` without `aria-hidden`) or the aria-hidden state must be updated when hiding.
|