@workingpayload/agent-skills 1.0.0 → 2.0.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.
Files changed (80) hide show
  1. package/APIForge/skill.md +150 -17
  2. package/AccessPlus/skill.md +122 -18
  3. package/AlgoMaster/skill.md +110 -17
  4. package/Architekt AI/skill.md +125 -17
  5. package/AuthCraft/skill.md +129 -17
  6. package/AutoScriptor/skill.md +122 -17
  7. package/BoilerCore/skill.md +121 -17
  8. package/BugHunter Pro/skill.md +118 -17
  9. package/ChangeScribe/skill.md +98 -17
  10. package/CodeSage/skill.md +148 -17
  11. package/CommitCraft/skill.md +97 -16
  12. package/CoverageMax/skill.md +145 -16
  13. package/CronGenius/skill.md +141 -16
  14. package/DataPolish/skill.md +126 -16
  15. package/DataWeaver/skill.md +135 -16
  16. package/DockMaster/skill.md +142 -16
  17. package/DocuGenie/skill.md +122 -16
  18. package/EdgeGuard/skill.md +144 -16
  19. package/EnvWizard/skill.md +140 -16
  20. package/ErrorMedic/skill.md +136 -16
  21. package/FeatureSmith/skill.md +123 -16
  22. package/FlexiLayout/skill.md +128 -16
  23. package/FlowTester/skill.md +138 -16
  24. package/FunctionForge/skill.md +120 -16
  25. package/InputShield/skill.md +128 -16
  26. package/IssueForge/skill.md +132 -16
  27. package/KubeCrafter/skill.md +133 -16
  28. package/LogicLens/skill.md +116 -16
  29. package/MockSmith/skill.md +130 -16
  30. package/ModelSensei/skill.md +122 -16
  31. package/PRMentor/skill.md +103 -32
  32. package/PerfDetective/skill.md +90 -32
  33. package/PipelinePro/skill.md +146 -32
  34. package/PolyglotShift/skill.md +94 -32
  35. package/PromptForge/skill.md +118 -32
  36. package/QueryPulse/skill.md +123 -32
  37. package/README.md +416 -329
  38. package/ReadMeCraft/skill.md +127 -32
  39. package/RefactorX/skill.md +84 -32
  40. package/RenderBoost/skill.md +148 -32
  41. package/SEOMancer/skill.md +140 -16
  42. package/ScrapeMaster/skill.md +157 -32
  43. package/SecretSniffer/skill.md +107 -16
  44. package/SecureScan/skill.md +114 -16
  45. package/ServiceSplitter/skill.md +137 -16
  46. package/SpeedSmith/skill.md +139 -16
  47. package/StackWise/skill.md +139 -16
  48. package/TaskOrchestrator/skill.md +119 -16
  49. package/TestCrafter/skill.md +142 -16
  50. package/TraceMind/skill.md +127 -16
  51. package/UISmith/skill.md +115 -16
  52. package/bin/cli.js +377 -0
  53. package/extension-extender/SKILL.md +122 -0
  54. package/fastapi-furious/SKILL.md +148 -0
  55. package/package.json +41 -28
  56. package/python-master/SKILL.md +108 -0
  57. package/react-ranger/SKILL.md +93 -0
  58. package/scripts/build_index.py +282 -0
  59. package/scripts/doctor.py +541 -0
  60. package/scripts/install.py +397 -0
  61. package/scripts/route.py +348 -0
  62. package/scripts/score.py +355 -0
  63. package/scripts/test_skill.py +473 -0
  64. package/scripts/validate.py +254 -0
  65. package/skills-routing.json +1131 -0
  66. package/skills.json +3261 -0
  67. package/Extension-Extender/SKILL.md +0 -41
  68. package/Extension-Extender/references/ui-guidelines.md +0 -26
  69. package/Fastapi-Furious/README.md +0 -16
  70. package/Fastapi-Furious/SKILL.md +0 -37
  71. package/Python-Master/README.md +0 -11
  72. package/Python-Master/SKILL.md +0 -37
  73. package/React-Ranger/README.md +0 -17
  74. package/React-Ranger/SKILL.md +0 -37
  75. package/cli.js +0 -181
  76. package/parse_skills.py +0 -44
  77. /package/{Extension-Extender → extension-extender}/assets/manifest.json +0 -0
  78. /package/{Extension-Extender → extension-extender}/assets/popup.css +0 -0
  79. /package/{Extension-Extender → extension-extender}/assets/popup.html +0 -0
  80. /package/{Extension-Extender → extension-extender}/assets/popup.js +0 -0
@@ -1,32 +1,135 @@
1
1
  ---
2
2
  name: taskorchestrator
3
- description: Perfects tasks related to managing asynchronous task queues, worker pools, and orchestrating complex distributed workflows. Use when a user asks to handle agent or requires assistance with task planning..
3
+ description: Designs and implements asynchronous task queues, distributed workflows, and worker orchestration systems. Use when asked to build job queues, implement background workers, design saga workflows, handle retry logic, or configure dead-letter queues with Celery, BullMQ, or Temporal.
4
4
  ---
5
5
 
6
6
  # TaskOrchestrator
7
7
 
8
8
  ## Overview
9
9
 
10
- The TaskOrchestrator skill specializes in managing asynchronous task queues, worker pools, and orchestrating complex distributed workflows. It is designed to be the perfect, flawless assistant for agent, providing robust, industry-standard solutions.
10
+ Designs production-grade task orchestration systems using Celery (Python), BullMQ (Node.js), or Temporal (polyglot). Covers queue topology, worker concurrency, retry strategies with exponential backoff, dead-letter queues, idempotency, saga orchestration, and backpressure. Every design decision is justified against the specific failure mode it addresses.
11
11
 
12
12
  ## Workflow
13
13
 
14
- When asked to work on agent or related tasks, follow these steps:
14
+ ### 1. Tool Selection
15
15
 
16
- ### 1. Analysis & Pre-flight
17
- - Analyze the user's request thoroughly.
18
- - Identify the core requirements for managing asynchronous task queues, worker pools, and orchestrating complex distributed workflows.
19
- - Ensure all context and preconditions are understood.
16
+ Choose the orchestration tool based on the workload profile:
20
17
 
21
- ### 2. Execution & Implementation
22
- - Apply the core logic of TaskOrchestrator perfectly.
23
- - Prioritize clean architecture, high efficiency, and robust error handling.
24
- - Strive for a flawless, comprehensive solution that directly addresses the user's needs.
18
+ | Tool | Language | Best For | Avoid When |
19
+ |------|----------|----------|------------|
20
+ | **Celery** | Python | High-throughput task queues, ML pipelines, Django/Flask integration | Long-running workflows with complex state; use Temporal instead |
21
+ | **BullMQ** | Node.js/TypeScript | Job queues with Redis backend, UI dashboard (Bull Board), rate limiting | Large Python teams; missing native workflow orchestration |
22
+ | **Temporal** | Python/Go/Java/TS | Long-running workflows, saga orchestration, durable execution with replay | Simple fire-and-forget tasks; adds operational overhead |
23
+ | **Celery + Kombu** | Python | When broker flexibility needed (RabbitMQ, SQS, Redis) | |
24
+ | **AWS SQS + Lambda** | Any | Serverless, event-driven, AWS-native; no infra to manage | Tasks > 15 min, complex orchestration logic |
25
+ | **Inngest / Trigger.dev** | TypeScript | Serverless-first Node.js workflows with built-in retries | Non-TypeScript stacks |
25
26
 
26
- ### 3. Validation & Polish
27
- - Review the generated output against industry best practices for agent.
28
- - Ensure the result perfectly resolves the user's request without omissions.
27
+ ### 2. Queue Topology Design
29
28
 
30
- ## Resources
29
+ Design queues before writing code:
31
30
 
32
- - **`references/best-practices.md`**: Core principles for agent.
31
+ ```
32
+ Priority queues: critical > high > default > low
33
+ - critical: payment processing, auth tokens
34
+ - high: user-triggered actions (export, import)
35
+ - default: background enrichment, notifications
36
+ - low: analytics, cleanup, maintenance tasks
37
+
38
+ Dead-letter queues: every queue has a corresponding DLQ
39
+ - orders.queue → orders.dlq
40
+ - emails.queue → emails.dlq
41
+ ```
42
+
43
+ **Celery:** Use `task_routes` to map task name patterns to queue names. Set `x-max-priority: 10` on the critical queue.
44
+
45
+ **BullMQ:**
46
+ ```typescript
47
+ const paymentQueue = new Queue('payments', {
48
+ connection: redis,
49
+ defaultJobOptions: { attempts: 5, backoff: { type: 'exponential', delay: 2000 },
50
+ removeOnComplete: { count: 1000 }, removeOnFail: { count: 5000 } }
51
+ });
52
+ ```
53
+
54
+ ### 3. Retry Strategy with Exponential Backoff
55
+
56
+ Use `retry_delay = min(base * 2^attempt + jitter, max_delay)`. Never fixed-interval retries.
57
+
58
+ **Celery:** `@celery_app.task(retry_backoff=True, retry_backoff_max=600, retry_jitter=True, max_retries=5)`. Raise `self.reject(requeue=False)` for permanent errors (invalid card, validation failure).
59
+
60
+ **Temporal:** Configure `RetryPolicy(initial_interval=2s, backoff_coefficient=2.0, maximum_attempts=5, non_retryable_error_types=["PermanentPaymentError"])` on `execute_activity`.
61
+
62
+ Distinguish retryable (network, 429, 5xx) from non-retryable (validation, 4xx, business rule violations).
63
+
64
+ ### 4. Idempotency Keys
65
+
66
+ Every task that produces side effects must be idempotent:
67
+
68
+ ```python
69
+ # Pattern: idempotency key stored in DB with unique constraint
70
+ def send_email_idempotent(email_id: str, recipient: str, subject: str):
71
+ idempotency_key = f"email:{email_id}:{recipient}"
72
+
73
+ with db.transaction():
74
+ # Attempt insert; if it already exists, this email was already sent
75
+ try:
76
+ db.execute(
77
+ "INSERT INTO processed_tasks (idempotency_key, processed_at) VALUES (?, NOW())",
78
+ (idempotency_key,)
79
+ )
80
+ except UniqueConstraintError:
81
+ logger.info(f"Task already processed: {idempotency_key}")
82
+ return # idempotent no-op
83
+
84
+ # Only runs if insert succeeded (first time)
85
+ email_service.send(recipient, subject)
86
+ ```
87
+
88
+ Use UUID v4 or content-based hash as idempotency key. Store in Redis with TTL for short-lived tasks, or in a DB table for audit trail requirements.
89
+
90
+ ### 5. Dead-Letter Queue Handling
91
+
92
+ DLQs catch tasks that exhausted all retries. Never leave DLQs unmonitored:
93
+ 1. **Alert**: when DLQ depth > threshold (e.g., > 10 messages in `payments.dlq`).
94
+ 2. **Inspect**: Log task ID, queue, attempt count, last error, timestamp when routing to DLQ.
95
+ 3. **Reprocess**: fix root cause first, then replay via `queue.retryJobs()` (BullMQ) or re-queue (Celery).
96
+ 4. **Retention**: Keep DLQ messages 14 days minimum.
97
+
98
+ ```python
99
+ # Celery dead-letter with RabbitMQ
100
+ Queue('default', queue_arguments={
101
+ 'x-dead-letter-exchange': 'dlx',
102
+ 'x-dead-letter-routing-key': 'default.dlq',
103
+ })
104
+ ```
105
+
106
+ ### 6. Backpressure
107
+
108
+ - **Celery**: `worker_prefetch_multiplier=1` prevents pre-fetching excess tasks. `task_acks_late=True` prevents loss on worker crash.
109
+ - **BullMQ**: Set `concurrency` and `limiter: { max: 100, duration: 60000 }` on the Worker.
110
+ - **Temporal**: `WorkerOptions.max_concurrent_activity_task_executions` limits parallelism. Use `workflow.pause()` if the downstream is unhealthy.
111
+
112
+ ### 7. Monitoring and Observability
113
+
114
+ Key metrics per queue: task throughput (tasks/sec), queue depth (lag > 5 min = alert for high-priority), error rate (> 1% = alert on critical queues), worker saturation.
115
+
116
+ ```python
117
+ @task_failure.connect
118
+ def on_task_failure(task_id, exception, sender, **kwargs):
119
+ metrics.increment('celery.task.failure', tags=[f'task:{sender.name}'])
120
+ logger.error("Task failed", extra={"task_id": task_id, "error": str(exception)})
121
+ ```
122
+
123
+ Use **Flower** (Celery) or **Bull Board** (BullMQ) for dashboards. Temporal Cloud provides built-in workflow visibility.
124
+
125
+ ## Additional Patterns
126
+
127
+ **Temporal determinism requirement:** Temporal workflows are replayed from event history to resume after crashes. This means workflow code must be fully deterministic: never call `datetime.now()`, `random.random()`, `uuid4()`, or any I/O (DB, HTTP, filesystem) directly in the workflow body. All non-deterministic operations must be placed in activities. Use `workflow.now()` for current time and `workflow.uuid4()` for IDs inside workflows.
128
+
129
+ ## Edge Cases
130
+
131
+ **Long-running tasks and worker restarts**: For tasks that run > 5 minutes, use Temporal's durable execution (workflows survive worker restarts via event sourcing replay) or implement a heartbeat mechanism in Celery (`self.update_state(state='PROGRESS')` + monitor for stale heartbeats). Never run long tasks in a queue designed for fast tasks — separate pools.
132
+
133
+ **Task deduplication**: Prevent the same logical task from being enqueued twice (e.g., double-click on "Export" button). Implement deduplication at enqueue time: check for an in-progress job with the same key before adding to the queue. BullMQ supports `jobId` deduplication natively. For Celery, use Redis `SET NX` with TTL as a distributed lock before calling `.apply_async()`.
134
+
135
+ **Poison pill messages**: A malformed message that always causes a task to crash will cycle through retries and fill the DLQ. Detect by inspecting DLQ for repeated task signatures. Add a payload validation step at the start of every task handler that raises a non-retryable exception on schema validation failure — this routes malformed messages to DLQ immediately without wasting retry attempts.
@@ -1,32 +1,158 @@
1
1
  ---
2
2
  name: testcrafter
3
- description: Perfects tasks related to writing unit and integration tests using modern testing frameworks, ensuring test reliability and speed. Use when a user asks to handle testing or requires assistance with creates unit tests..
3
+ description: Writes unit and integration tests using Jest, Vitest, Pytest, or JUnit following the AAA pattern and test pyramid principles. Use when asked to write tests, improve test coverage, set up a testing strategy, configure CI test gates, or decide between mocking vs. real implementations.
4
4
  ---
5
5
 
6
6
  # TestCrafter
7
7
 
8
8
  ## Overview
9
9
 
10
- The TestCrafter skill specializes in writing unit and integration tests using modern testing frameworks, ensuring test reliability and speed. It is designed to be the perfect, flawless assistant for testing, providing robust, industry-standard solutions.
10
+ Produces high-quality, maintainable tests following the AAA (Arrange-Act-Assert) pattern, test pyramid principles, and clear naming conventions. Framework-specific guidance for Jest/Vitest (JavaScript/TypeScript), Pytest (Python), and JUnit 5 (Java). Targets 80% line coverage as a floor, with emphasis on testing behavior over implementation.
11
11
 
12
12
  ## Workflow
13
13
 
14
- When asked to work on testing or related tasks, follow these steps:
14
+ ### 1. Test Pyramid Strategy
15
15
 
16
- ### 1. Analysis & Pre-flight
17
- - Analyze the user's request thoroughly.
18
- - Identify the core requirements for writing unit and integration tests using modern testing frameworks, ensuring test reliability and speed.
19
- - Ensure all context and preconditions are understood.
16
+ Before writing tests, identify the appropriate layer:
20
17
 
21
- ### 2. Execution & Implementation
22
- - Apply the core logic of TestCrafter perfectly.
23
- - Prioritize clean architecture, high efficiency, and robust error handling.
24
- - Strive for a flawless, comprehensive solution that directly addresses the user's needs.
18
+ ```
19
+ /\
20
+ /E2E\ ~5% — Playwright/Cypress/Selenium; slow, costly, high confidence
21
+ /------\
22
+ /Integr. \ ~20% — DB, HTTP, message queue integration; real dependencies
23
+ /----------\
24
+ / Unit Tests \ ~75% — Pure logic, isolated, fast (< 10ms each)
25
+ /--------------\
26
+ ```
25
27
 
26
- ### 3. Validation & Polish
27
- - Review the generated output against industry best practices for testing.
28
- - Ensure the result perfectly resolves the user's request without omissions.
28
+ **Unit tests**: Test one function/class in isolation. Mock all external dependencies (DB, HTTP, filesystem, time). Goal: < 10ms per test, no I/O.
29
29
 
30
- ## Resources
30
+ **Integration tests**: Test the interaction between components (e.g., repository + real DB, HTTP handler + real router). Use test containers (Testcontainers library) or an in-memory DB (SQLite for PostgreSQL compatibility testing, `mongomock` for MongoDB).
31
31
 
32
- - **`references/best-practices.md`**: Core principles for testing.
32
+ **E2E tests**: Test the full user journey through the real UI. Reserve for critical paths only (login, checkout, core workflow). Do not write E2E tests for every feature.
33
+
34
+ ### 2. Naming Convention
35
+
36
+ Use the **"should [expected behavior] when [condition]"** pattern:
37
+
38
+ ```javascript
39
+ // Good
40
+ describe('UserService', () => {
41
+ describe('createUser', () => {
42
+ it('should return the created user with an assigned ID when valid data is provided')
43
+ it('should throw ValidationError when email is already taken')
44
+ it('should hash the password before persisting to the database')
45
+ })
46
+ })
47
+ ```
48
+
49
+ ```python
50
+ # Pytest: use descriptive function names
51
+ def test_create_user_returns_user_with_id_when_valid_data():
52
+ def test_create_user_raises_validation_error_when_email_taken():
53
+ def test_create_user_hashes_password_before_persisting():
54
+ ```
55
+
56
+ Avoid: `test1`, `testHappyPath`, `test_create_user_works`. The test name should be self-documenting enough to diagnose a failure without reading the test body.
57
+
58
+ ### 3. AAA Pattern Implementation
59
+
60
+ Every test has exactly three sections: Arrange, Act, Assert.
61
+
62
+ **Jest/Vitest (TypeScript)** — mock the repo, call the service, assert the result:
63
+ ```typescript
64
+ it('should return created user with ID when valid data is provided', async () => {
65
+ // Arrange
66
+ mockUserRepo.findByEmail.mockResolvedValue(null);
67
+ mockUserRepo.save.mockResolvedValue({ id: 'uuid-123', email: 'user@example.com' });
68
+ // Act
69
+ const result = await userService.createUser({ email: 'user@example.com', password: 'secret' });
70
+ // Assert
71
+ expect(result.id).toBe('uuid-123');
72
+ expect(mockUserRepo.save).toHaveBeenCalledOnce();
73
+ });
74
+ ```
75
+
76
+ **Pytest**:
77
+ ```python
78
+ def test_returns_user_with_id_when_valid_data(self):
79
+ self.mock_repo.find_by_email.return_value = None
80
+ self.mock_repo.save.return_value = {"id": "uuid-123", "email": "u@example.com"}
81
+ result = self.service.create_user(email="u@example.com", password="secret")
82
+ assert result["id"] == "uuid-123"
83
+ self.mock_repo.save.assert_called_once()
84
+
85
+ def test_raises_validation_error_when_email_taken(self):
86
+ self.mock_repo.find_by_email.return_value = {"id": "existing"}
87
+ with pytest.raises(ValidationError, match="Email already in use"):
88
+ self.service.create_user(email="u@example.com", password="secret")
89
+ ```
90
+
91
+ ### 4. Mock vs. Real Dependencies
92
+
93
+ **Mock** when the dependency has slow I/O, non-deterministic behavior, or you need to force specific error paths. Always mock in unit tests.
94
+
95
+ **Use real implementations** when testing the integration itself (repository + DB). Use Testcontainers (`PostgreSqlContainer`, `@testcontainers/postgresql`) for integration tests — spin up a real DB in `beforeAll`, run migrations, then tear down in `afterAll`.
96
+
97
+ **Avoid partial mocks** — they couple tests to implementation and hide bugs.
98
+
99
+ ### 5. Framework-Specific Configuration
100
+
101
+ **Vitest** (`vitest.config.ts`):
102
+ ```typescript
103
+ export default defineConfig({
104
+ test: {
105
+ globals: true, environment: 'node',
106
+ coverage: {
107
+ provider: 'v8', reporter: ['text', 'lcov'],
108
+ thresholds: { lines: 80, functions: 80, branches: 75 },
109
+ exclude: ['**/*.config.*', '**/migrations/**'],
110
+ },
111
+ },
112
+ });
113
+ ```
114
+
115
+ **Pytest** (`pyproject.toml`):
116
+ ```toml
117
+ [tool.pytest.ini_options]
118
+ addopts = "--cov=app --cov-report=term-missing --cov-fail-under=80"
119
+ ```
120
+
121
+ **JUnit 5**: configure Jacoco with `<minimum>0.80</minimum>` on `LINE` counter.
122
+
123
+ ### 6. Coverage Strategy
124
+
125
+ 80% line coverage is a floor. Priorities: (1) 100% on domain logic and calculation functions; (2) every `catch` block and error path; (3) boundary conditions (empty, null, min/max). Exclude `toString()`, getters/setters, and generated code. Use `vitest --coverage` for branch coverage; `--cov-report=term-missing` in Pytest.
126
+
127
+ ### 7. CI Integration
128
+
129
+ ```yaml
130
+ - name: Run tests with coverage
131
+ run: npx vitest run --coverage
132
+ - name: Upload coverage
133
+ uses: codecov/codecov-action@v4
134
+ with: { token: "${{ secrets.CODECOV_TOKEN }}", fail_ci_if_error: true }
135
+ ```
136
+
137
+ Block PRs on test failures and coverage drops > 2% from main baseline.
138
+
139
+ ## Additional Patterns
140
+
141
+ **WebSocket testing:** Mock the `WebSocket` constructor in unit tests to avoid real connections:
142
+ ```typescript
143
+ const mockWs = { send: vi.fn(), close: vi.fn(), onmessage: null, onopen: null };
144
+ vi.stubGlobal('WebSocket', vi.fn(() => mockWs));
145
+ // Simulate incoming message
146
+ mockWs.onmessage?.({ data: JSON.stringify({ type: 'update', payload: 42 }) });
147
+ ```
148
+ For integration tests, use a real `ws` server spun up in `beforeAll` on a random port.
149
+
150
+ **Large parameterized test performance:** When `pytest.mark.parametrize` produces thousands of cases (e.g., fuzzing inputs), test runs can take minutes. Apply stratified sampling: group inputs by equivalence class and pick one representative per class. For CI speed, split the full suite across workers with `pytest-xdist` (`pytest -n auto`), and run the full set only on main branch merges.
151
+
152
+ ## Edge Cases
153
+
154
+ **Testing async code and timers**: Use `vi.useFakeTimers()` (Vitest) or `pytest-asyncio` + `asyncio.sleep` mocking to control time in tests. Never use `setTimeout(fn, 0)` or `asyncio.sleep(0.1)` in tests — they create flaky tests dependent on real time. Use `vi.advanceTimersByTime(5000)` to simulate time passage deterministically.
155
+
156
+ **Testing code with global state / singletons**: Reset global state in `beforeEach`/`afterEach`. For module-level singletons in Node.js, use `vi.resetModules()` to get a fresh module instance per test. For Python, use `importlib.reload()` or redesign the singleton to accept injected dependencies (constructor injection is inherently more testable).
157
+
158
+ **Snapshot tests**: Use Jest/Vitest snapshot tests sparingly — only for stable serialized output (serialized ASTs, rendered static HTML). Never snapshot for UI components that change frequently; use explicit assertions instead. Stale snapshots silently pass until someone runs `--updateSnapshot`, masking regressions. If a snapshot test fails unexpectedly, treat it as a regression, not an automatic update.
@@ -1,32 +1,143 @@
1
1
  ---
2
2
  name: tracemind
3
- description: Perfects tasks related to implementing distributed tracing, structured logging, and observability tools to monitor system health. Use when a user asks to handle debug, logs or requires assistance with analyzes stack traces..
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
4
  ---
5
5
 
6
6
  # TraceMind
7
7
 
8
8
  ## Overview
9
9
 
10
- The TraceMind skill specializes in implementing distributed tracing, structured logging, and observability tools to monitor system health. It is designed to be the perfect, flawless assistant for debug, logs, providing robust, industry-standard solutions.
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
11
 
12
12
  ## Workflow
13
13
 
14
- When asked to work on debug, logs or related tasks, follow these steps:
14
+ ### 1. OpenTelemetry Setup
15
15
 
16
- ### 1. Analysis & Pre-flight
17
- - Analyze the user's request thoroughly.
18
- - Identify the core requirements for implementing distributed tracing, structured logging, and observability tools to monitor system health.
19
- - Ensure all context and preconditions are understood.
16
+ OpenTelemetry is the instrumentation standard. Instrument once, export to any backend.
20
17
 
21
- ### 2. Execution & Implementation
22
- - Apply the core logic of TraceMind perfectly.
23
- - Prioritize clean architecture, high efficiency, and robust error handling.
24
- - Strive for a flawless, comprehensive solution that directly addresses the user's needs.
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
25
 
26
- ### 3. Validation & Polish
27
- - Review the generated output against industry best practices for debug, logs.
28
- - Ensure the result perfectly resolves the user's request without omissions.
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
+ ```
29
34
 
30
- ## Resources
35
+ **Node.js**: Load `tracing.ts` before all other imports. Use `NodeSDK` with `getNodeAutoInstrumentations()` and `OTLPTraceExporter`. Configure via `OTEL_EXPORTER_OTLP_ENDPOINT` env var.
31
36
 
32
- - **`references/best-practices.md`**: Core principles for debug, logs.
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 CHANGED
@@ -1,32 +1,131 @@
1
1
  ---
2
2
  name: uismith
3
- description: Perfects tasks related to translating design mockups into pixel-perfect, accessible, and interactive frontend components. Use when a user asks to handle frontend or requires assistance with ui components..
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
4
  ---
5
5
 
6
6
  # UISmith
7
7
 
8
8
  ## Overview
9
9
 
10
- The UISmith skill specializes in translating design mockups into pixel-perfect, accessible, and interactive frontend components. It is designed to be the perfect, flawless assistant for frontend, providing robust, industry-standard solutions.
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
11
 
12
12
  ## Workflow
13
13
 
14
- When asked to work on frontend or related tasks, follow these steps:
14
+ ### 1. Component Decomposition (Atomic Design)
15
15
 
16
- ### 1. Analysis & Pre-flight
17
- - Analyze the user's request thoroughly.
18
- - Identify the core requirements for translating design mockups into pixel-perfect, accessible, and interactive frontend components.
19
- - Ensure all context and preconditions are understood.
16
+ Before coding, classify the component in the Atomic Design hierarchy:
20
17
 
21
- ### 2. Execution & Implementation
22
- - Apply the core logic of UISmith perfectly.
23
- - Prioritize clean architecture, high efficiency, and robust error handling.
24
- - Strive for a flawless, comprehensive solution that directly addresses the user's needs.
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
25
 
26
- ### 3. Validation & Polish
27
- - Review the generated output against industry best practices for frontend.
28
- - Ensure the result perfectly resolves the user's request without omissions.
26
+ Decision rule: if you find yourself writing the same markup in 3+ places, extract to the appropriate atom/molecule level.
29
27
 
30
- ## Resources
28
+ ### 2. Accessibility — WCAG 2.2 AA Checklist
31
29
 
32
- - **`references/best-practices.md`**: Core principles for frontend.
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.