contextos-agents 2.1.0 → 2.1.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.
Files changed (191) hide show
  1. package/.agents/adapters/aider/export.js +2 -2
  2. package/.agents/adapters/claude/export.js +53 -2
  3. package/.agents/adapters/drift-detector.js +6 -3
  4. package/.agents/adapters/pure-compiler.js +18 -6
  5. package/.agents/ctx.js +4 -4
  6. package/.agents/plugins.js +100 -4
  7. package/.agents/profiles.js +32 -11
  8. package/README.md +2 -2
  9. package/bin/commands/hook.js +50 -12
  10. package/bin/commands/scan.js +10 -3
  11. package/bin/index.js +8 -2
  12. package/bin/lib/git-snapshot.js +70 -43
  13. package/bin/lib/scan.js +108 -27
  14. package/catalog/skills/adapters/EXAMPLES.md +19 -0
  15. package/catalog/skills/adapters/SKILL.md +101 -0
  16. package/catalog/skills/adapters/TROUBLESHOOTING.md +7 -0
  17. package/catalog/skills/adapters/VALIDATION.json +12 -0
  18. package/catalog/skills/adapters/skill.yaml +13 -0
  19. package/catalog/skills/api-design/EXAMPLES.md +91 -0
  20. package/catalog/skills/api-design/SKILL.md +63 -0
  21. package/catalog/skills/api-design/TROUBLESHOOTING.md +54 -0
  22. package/catalog/skills/api-design/VALIDATION.json +11 -0
  23. package/catalog/skills/api-design/skill.yaml +14 -0
  24. package/catalog/skills/architecture-diagrams/SKILL.md +108 -0
  25. package/catalog/skills/architecture-diagrams/VALIDATION.json +12 -0
  26. package/catalog/skills/architecture-diagrams/skill.yaml +9 -0
  27. package/catalog/skills/brutalist-design/EXAMPLES.md +59 -0
  28. package/catalog/skills/brutalist-design/SKILL.md +150 -0
  29. package/catalog/skills/brutalist-design/VALIDATION.json +12 -0
  30. package/catalog/skills/brutalist-design/skill.yaml +10 -0
  31. package/catalog/skills/ci-cd/EXAMPLES.md +79 -0
  32. package/catalog/skills/ci-cd/SKILL.md +69 -0
  33. package/catalog/skills/ci-cd/TROUBLESHOOTING.md +52 -0
  34. package/catalog/skills/ci-cd/VALIDATION.json +11 -0
  35. package/catalog/skills/ci-cd/skill.yaml +13 -0
  36. package/catalog/skills/database/EXAMPLES.md +74 -0
  37. package/catalog/skills/database/SKILL.md +101 -0
  38. package/catalog/skills/database/TROUBLESHOOTING.md +18 -0
  39. package/catalog/skills/database/VALIDATION.json +11 -0
  40. package/catalog/skills/database/skill.yaml +14 -0
  41. package/catalog/skills/ddd/EXAMPLES.md +42 -0
  42. package/catalog/skills/ddd/SKILL.md +247 -0
  43. package/catalog/skills/ddd/TROUBLESHOOTING.md +19 -0
  44. package/catalog/skills/ddd/VALIDATION.json +12 -0
  45. package/catalog/skills/ddd/skill.yaml +14 -0
  46. package/catalog/skills/decisions/EXAMPLES.md +35 -0
  47. package/catalog/skills/decisions/SKILL.md +90 -0
  48. package/catalog/skills/decisions/TROUBLESHOOTING.md +13 -0
  49. package/catalog/skills/decisions/VALIDATION.json +12 -0
  50. package/catalog/skills/decisions/skill.yaml +13 -0
  51. package/catalog/skills/docker/EXAMPLES.md +56 -0
  52. package/catalog/skills/docker/SKILL.md +169 -0
  53. package/catalog/skills/docker/TROUBLESHOOTING.md +18 -0
  54. package/catalog/skills/docker/VALIDATION.json +11 -0
  55. package/catalog/skills/docker/skill.yaml +13 -0
  56. package/catalog/skills/fastapi/EXAMPLES.md +36 -0
  57. package/catalog/skills/fastapi/SKILL.md +171 -0
  58. package/catalog/skills/fastapi/TROUBLESHOOTING.md +19 -0
  59. package/catalog/skills/fastapi/VALIDATION.json +12 -0
  60. package/catalog/skills/fastapi/skill.yaml +14 -0
  61. package/catalog/skills/generators/EXAMPLES.md +19 -0
  62. package/catalog/skills/generators/SKILL.md +110 -0
  63. package/catalog/skills/generators/TROUBLESHOOTING.md +7 -0
  64. package/catalog/skills/generators/VALIDATION.json +12 -0
  65. package/catalog/skills/generators/skill.yaml +22 -0
  66. package/catalog/skills/generators/templates/API.md +77 -0
  67. package/catalog/skills/generators/templates/ARCHITECTURE.md +70 -0
  68. package/catalog/skills/generators/templates/DATABASE.md +42 -0
  69. package/catalog/skills/generators/templates/DECISION.md +46 -0
  70. package/catalog/skills/generators/templates/PRD.md +67 -0
  71. package/catalog/skills/generators/templates/PROJECT_GRAPH.md +56 -0
  72. package/catalog/skills/generators/templates/ROADMAP.md +51 -0
  73. package/catalog/skills/generators/templates/TASKS.md +43 -0
  74. package/catalog/skills/generators/templates/UI.md +73 -0
  75. package/catalog/skills/graphify/EXAMPLES.md +73 -0
  76. package/catalog/skills/graphify/SKILL.md +130 -0
  77. package/catalog/skills/graphify/VALIDATION.json +12 -0
  78. package/catalog/skills/graphify/skill.yaml +13 -0
  79. package/catalog/skills/impeccable-design/EXAMPLES.md +26 -0
  80. package/catalog/skills/impeccable-design/SKILL.md +201 -0
  81. package/catalog/skills/impeccable-design/TROUBLESHOOTING.md +19 -0
  82. package/catalog/skills/impeccable-design/VALIDATION.json +12 -0
  83. package/catalog/skills/impeccable-design/skill.yaml +15 -0
  84. package/catalog/skills/interview-me/SKILL.md +97 -0
  85. package/catalog/skills/interview-me/VALIDATION.json +12 -0
  86. package/catalog/skills/interview-me/skill.yaml +9 -0
  87. package/catalog/skills/microservices/EXAMPLES.md +38 -0
  88. package/catalog/skills/microservices/SKILL.md +164 -0
  89. package/catalog/skills/microservices/TROUBLESHOOTING.md +19 -0
  90. package/catalog/skills/microservices/VALIDATION.json +12 -0
  91. package/catalog/skills/microservices/skill.yaml +14 -0
  92. package/catalog/skills/minimalist-design/EXAMPLES.md +58 -0
  93. package/catalog/skills/minimalist-design/SKILL.md +113 -0
  94. package/catalog/skills/minimalist-design/VALIDATION.json +12 -0
  95. package/catalog/skills/minimalist-design/skill.yaml +10 -0
  96. package/catalog/skills/nestjs/EXAMPLES.md +40 -0
  97. package/catalog/skills/nestjs/SKILL.md +139 -0
  98. package/catalog/skills/nestjs/TROUBLESHOOTING.md +19 -0
  99. package/catalog/skills/nestjs/VALIDATION.json +12 -0
  100. package/catalog/skills/nestjs/skill.yaml +14 -0
  101. package/catalog/skills/nextjs/EXAMPLES.md +40 -0
  102. package/catalog/skills/nextjs/SKILL.md +163 -0
  103. package/catalog/skills/nextjs/TROUBLESHOOTING.md +19 -0
  104. package/catalog/skills/nextjs/VALIDATION.json +12 -0
  105. package/catalog/skills/nextjs/skill.yaml +14 -0
  106. package/catalog/skills/node/EXAMPLES.md +80 -0
  107. package/catalog/skills/node/SKILL.md +128 -0
  108. package/catalog/skills/node/TROUBLESHOOTING.md +19 -0
  109. package/catalog/skills/node/VALIDATION.json +12 -0
  110. package/catalog/skills/node/skill.yaml +14 -0
  111. package/catalog/skills/performance/EXAMPLES.md +30 -0
  112. package/catalog/skills/performance/SKILL.md +75 -0
  113. package/catalog/skills/performance/TROUBLESHOOTING.md +19 -0
  114. package/catalog/skills/performance/VALIDATION.json +12 -0
  115. package/catalog/skills/performance/skill.yaml +14 -0
  116. package/catalog/skills/react/EXAMPLES.md +79 -0
  117. package/catalog/skills/react/SKILL.md +132 -0
  118. package/catalog/skills/react/TROUBLESHOOTING.md +19 -0
  119. package/catalog/skills/react/VALIDATION.json +12 -0
  120. package/catalog/skills/react/skill.yaml +14 -0
  121. package/catalog/skills/react-best-practices/SKILL.md +158 -0
  122. package/catalog/skills/react-best-practices/VALIDATION.json +12 -0
  123. package/catalog/skills/react-best-practices/skill.yaml +13 -0
  124. package/catalog/skills/redesign-audit/SKILL.md +117 -0
  125. package/catalog/skills/redesign-audit/VALIDATION.json +12 -0
  126. package/catalog/skills/redesign-audit/skill.yaml +9 -0
  127. package/catalog/skills/security-audit/EXAMPLES.md +79 -0
  128. package/catalog/skills/security-audit/SKILL.md +91 -0
  129. package/catalog/skills/security-audit/TROUBLESHOOTING.md +46 -0
  130. package/catalog/skills/security-audit/VALIDATION.json +11 -0
  131. package/catalog/skills/security-audit/skill.yaml +14 -0
  132. package/catalog/skills/soft-design/EXAMPLES.md +51 -0
  133. package/catalog/skills/soft-design/SKILL.md +108 -0
  134. package/catalog/skills/soft-design/VALIDATION.json +12 -0
  135. package/catalog/skills/soft-design/skill.yaml +10 -0
  136. package/catalog/skills/state-management/EXAMPLES.md +56 -0
  137. package/catalog/skills/state-management/SKILL.md +168 -0
  138. package/catalog/skills/state-management/TROUBLESHOOTING.md +18 -0
  139. package/catalog/skills/state-management/VALIDATION.json +11 -0
  140. package/catalog/skills/state-management/skill.yaml +14 -0
  141. package/catalog/skills/subagent-orchestrator/SKILL.md +117 -0
  142. package/catalog/skills/subagent-orchestrator/VALIDATION.json +12 -0
  143. package/catalog/skills/subagent-orchestrator/skill.yaml +9 -0
  144. package/catalog/skills/system-design/EXAMPLES.md +75 -0
  145. package/catalog/skills/system-design/SKILL.md +419 -0
  146. package/catalog/skills/system-design/TROUBLESHOOTING.md +19 -0
  147. package/catalog/skills/system-design/VALIDATION.json +12 -0
  148. package/catalog/skills/system-design/skill.yaml +14 -0
  149. package/catalog/skills/terraform/EXAMPLES.md +74 -0
  150. package/catalog/skills/terraform/SKILL.md +55 -0
  151. package/catalog/skills/terraform/TROUBLESHOOTING.md +53 -0
  152. package/catalog/skills/terraform/VALIDATION.json +11 -0
  153. package/catalog/skills/terraform/skill.yaml +14 -0
  154. package/catalog/skills/testing/EXAMPLES.md +122 -0
  155. package/catalog/skills/testing/SKILL.md +70 -0
  156. package/catalog/skills/testing/TROUBLESHOOTING.md +18 -0
  157. package/catalog/skills/testing/VALIDATION.json +11 -0
  158. package/catalog/skills/testing/skill.yaml +14 -0
  159. package/catalog/skills/typescript/EXAMPLES.md +64 -0
  160. package/catalog/skills/typescript/SKILL.md +112 -0
  161. package/catalog/skills/typescript/TROUBLESHOOTING.md +19 -0
  162. package/catalog/skills/typescript/VALIDATION.json +12 -0
  163. package/catalog/skills/typescript/skill.yaml +14 -0
  164. package/catalog/skills/ui-design/EXAMPLES.md +21 -0
  165. package/catalog/skills/ui-design/SKILL.md +124 -0
  166. package/catalog/skills/ui-design/TROUBLESHOOTING.md +19 -0
  167. package/catalog/skills/ui-design/VALIDATION.json +12 -0
  168. package/catalog/skills/ui-design/skill.yaml +16 -0
  169. package/catalog/skills/ui-ux-pro/EXAMPLES.md +62 -0
  170. package/catalog/skills/ui-ux-pro/SKILL.md +418 -0
  171. package/catalog/skills/ui-ux-pro/TROUBLESHOOTING.md +19 -0
  172. package/catalog/skills/ui-ux-pro/VALIDATION.json +12 -0
  173. package/catalog/skills/ui-ux-pro/skill.yaml +14 -0
  174. package/catalog/skills/ux-design/EXAMPLES.md +36 -0
  175. package/catalog/skills/ux-design/SKILL.md +116 -0
  176. package/catalog/skills/ux-design/TROUBLESHOOTING.md +19 -0
  177. package/catalog/skills/ux-design/VALIDATION.json +12 -0
  178. package/catalog/skills/ux-design/skill.yaml +16 -0
  179. package/catalog/skills/vercel-optimize/SKILL.md +83 -0
  180. package/catalog/skills/vercel-optimize/VALIDATION.json +12 -0
  181. package/catalog/skills/vercel-optimize/scripts/collect-signals.mjs +131 -0
  182. package/catalog/skills/vercel-optimize/scripts/gate-investigations.mjs +142 -0
  183. package/catalog/skills/vercel-optimize/scripts/merge-signals.mjs +143 -0
  184. package/catalog/skills/vercel-optimize/scripts/scan-codebase.mjs +174 -0
  185. package/catalog/skills/vercel-optimize/skill.yaml +15 -0
  186. package/catalog/skills/web-accessibility/EXAMPLES.md +39 -0
  187. package/catalog/skills/web-accessibility/SKILL.md +151 -0
  188. package/catalog/skills/web-accessibility/TROUBLESHOOTING.md +19 -0
  189. package/catalog/skills/web-accessibility/VALIDATION.json +12 -0
  190. package/catalog/skills/web-accessibility/skill.yaml +14 -0
  191. package/package.json +3 -2
@@ -0,0 +1,91 @@
1
+ ---
2
+ name: security-audit
3
+ description: Security guidance and vulnerability review for codebases, APIs, and services. Orchestrates adversarial hunting and independent verification with sandbox write isolation and evidence ledgers.
4
+ ---
5
+
6
+ # Security Audit
7
+
8
+ Find vulnerabilities that violate a real trust boundary, then give owners source evidence, safe reproduction, priority, and the smallest effective fix. This is a defensive, source-first workflow inspired by Cloudflare's security audit architecture.
9
+
10
+ ## Operating Modes
11
+
12
+ This skill operates in two distinct modes:
13
+
14
+ - **Guidance Mode**: For security questions, focused reviews, threat modeling, or triage of specific components, use only the relevant parts of this skill. Do not automatically create audit directories or write audit artifacts.
15
+ - **Full Audit Mode**: Use the complete workflow when explicitly requested to audit, pen-test, or perform an end-to-end security review of a repository. Run all phases and generate structured artifacts.
16
+
17
+ ## Adversarial Multi-Agent Audit Protocol
18
+
19
+ A core invariant of rigorous security auditing is adversarial verification:
20
+
21
+ 1. **Separation of Hunter and Verifier**:
22
+ - The agent that discovers a candidate vulnerability (**Hunter**) must never be the same agent that validates it.
23
+ - The verifying agent (**Verifier**) starts with a fresh context and explicitly attempts to disprove each finding.
24
+ 2. **Evidence-Based Standard**:
25
+ - A candidate vulnerability is confirmed only if it has a complete source trace from untrusted input to a sensitive sink, along with a bounded, observable defect.
26
+ - If an issue cannot be definitively reproduced or disproven locally, mark it as `needs_validation` rather than creating speculative findings.
27
+
28
+ ```
29
+ ┌─────────────────────────────────────────────────────────────┐
30
+ │ SECURITY AUDIT PIPELINE │
31
+ │ │
32
+ │ Phase 1: Reconnaissance (Map trust boundaries & inputs) │
33
+ │ ↓ │
34
+ │ Phase 2: Coverage Hunting (Hunter agents search surfaces) │
35
+ │ ↓ │
36
+ │ Phase 3: Candidate Validation (Verifier agents disprove) │
37
+ │ ↓ │
38
+ │ Phase 4: Structured Output (findings.json & ledger) │
39
+ │ ↓ │
40
+ │ Phase 5: Record Verification (Final attestation review) │
41
+ │ ↓ │
42
+ │ Phase 6: Target-Neutral Reporting (REPORT.md) │
43
+ └─────────────────────────────────────────────────────────────┘
44
+ ```
45
+
46
+ ## Universal Execution Safety & Sandbox Write Isolation
47
+
48
+ Target repositories must be audited without risking supply-chain compromise or data exfiltration:
49
+
50
+ - **Read-Only Target Code**: Source inspection is read-only. Target code must never be executed with write access to its own repository.
51
+ - **Dedicated Scratch Root**: All target-controlled builds, tests, or reproduction scripts execute inside an isolated sandbox writing strictly to `scratch/`.
52
+ - **Zero External Network**: Sandboxed processes must have no outbound internet access. Use isolated loopback namespaces if local client/server communication is needed.
53
+ - **Sanitized Environment**: Clear credentials, SSH keys, cloud tokens, and parent process environments before spawning reproduction commands.
54
+ - **Promotion to Artifacts**: Only trusted parent-side code may inspect and promote non-secret results from `scratch/` to retained `artifacts/`.
55
+
56
+ ## Audit Artifacts & Findings Schema
57
+
58
+ Full audits produce machine-readable and human-readable artifacts:
59
+
60
+ ### findings.json
61
+ ```json
62
+ {
63
+ "audit_version": "1.0.0",
64
+ "target_repository": "example-repo",
65
+ "commit_hash": "a1b2c3d",
66
+ "findings": [
67
+ {
68
+ "id": "SEC-001",
69
+ "title": "Path Traversal in File Download Handler",
70
+ "severity": "HIGH",
71
+ "cwe": "CWE-22",
72
+ "source_trace": {
73
+ "source_file": "src/controllers/download.ts",
74
+ "source_line": 42,
75
+ "entry_point": "req.query.filename",
76
+ "sink_file": "src/services/storage.ts",
77
+ "sink_line": 88,
78
+ "sink_function": "fs.promises.readFile"
79
+ },
80
+ "verification_status": "CONFIRMED",
81
+ "verifier_notes": "Reproduction script proved escape from base directory using %2e%2e%2f traversal.",
82
+ "remediation": "Apply path.normalize and verify path.resolve starts with the designated root directory."
83
+ }
84
+ ]
85
+ }
86
+ ```
87
+
88
+ ### Required Reports
89
+ - `REPORT.md`: Executive summary, risk score, vulnerability distribution, and remediation priorities.
90
+ - `FINDINGS-DETAIL.md`: Detailed technical breakdown of each confirmed finding with step-by-step reproduction and surgical diff recommendations.
91
+ - `NEEDS-VALIDATION.md`: Potential leads that could not be conclusively verified without live cloud infrastructure or out-of-scope permissions.
@@ -0,0 +1,46 @@
1
+ # Security Audit - Troubleshooting & Common Edge Cases
2
+
3
+ ## Common Diagnostic Scenarios
4
+
5
+ ### 1. Hunter Agent Generates Speculative or Untraceable Findings
6
+
7
+ - **Symptom**: Candidate vulnerability report contains vague descriptions like "Potential SQL injection in database layer" without line numbers, parameters, or affected sinks.
8
+ - **Root Cause**: The Hunter agent skipped Step 1 (Reconnaissance) and performed heuristic keyword matching instead of taint tracking.
9
+ - **Fix Protocol**:
10
+ 1. Reject candidate immediately: mark status as `INVALID_SPECULATION`.
11
+ 2. Mandate the 3-point trace requirement:
12
+ - Entry Point (HTTP param, header, body field, CLI flag).
13
+ - Intermediate Propagation (functions, transforms, assignments).
14
+ - Sensitive Sink (database query, filesystem access, shell execution, reflection).
15
+ 3. If any of the three points is missing, the candidate cannot be submitted to the Verifier.
16
+
17
+ ---
18
+
19
+ ### 2. Sandbox File Promotion Failure (`scratch/` to `artifacts/`)
20
+
21
+ - **Symptom**: Parent process fails to copy verified findings or test outputs from `scratch/` to `artifacts/`, throwing an access violation or promotion blocker.
22
+ - **Root Cause**: Target-controlled code created symlinks, hardlinks, or unescaped nested paths attempting to escape the assigned scratch root.
23
+ - **Fix Protocol**:
24
+ 1. Never perform recursive copy or glob promotion across boundaries.
25
+ 2. Walk paths with `no-follow` directory descriptors.
26
+ 3. Verify that the leaf is a regular file with link count exactly 1 and size within the byte allowance.
27
+ 4. Discard any entry violating promotion bounds and log `PROMOTION_SECURITY_REJECT`.
28
+
29
+ ---
30
+
31
+ ### 3. Loopback Port Collisions During Local Reproduction
32
+
33
+ - **Symptom**: Standalone verification script fails with `EADDRINUSE: address already in use 127.0.0.1:3000`.
34
+ - **Root Cause**: Fixed port numbers in reproduction tests collide with existing developer processes.
35
+ - **Fix Protocol**:
36
+ - Always bind reproduction servers to port `0` (`server.listen(0)`), allowing the OS to allocate an ephemeral free port.
37
+ - Read `server.address().port` dynamically in test fixtures.
38
+
39
+ ---
40
+
41
+ ### 4. False Positives Due to Upstream Middleware Sanitization
42
+
43
+ - **Symptom**: Hunter flags `req.query.path` passed to `res.sendFile`, but global Express middleware already calls `path.normalize` and rejects relative traversals.
44
+ - **Root Cause**: Single-file inspection without analyzing the global middleware chain.
45
+ - **Fix Protocol**:
46
+ - The Verifier agent must inspect the application entrypoint (`app.ts`, `server.ts`, router configuration) to verify active global filters before concluding the audit verdict.
@@ -0,0 +1,11 @@
1
+ {
2
+ "skill": "security-audit",
3
+ "version": "1.0.0",
4
+ "checks": [
5
+ "Hunter and verifier roles are strictly separated",
6
+ "Evidence-based verification requires complete source trace",
7
+ "Target code is executed in read-only sandbox writing only to scratch/",
8
+ "Findings are documented in structured findings.json format",
9
+ "Remediations adhere to surgical blast radius containment"
10
+ ]
11
+ }
@@ -0,0 +1,14 @@
1
+ schemaVersion: 2
2
+ name: security-audit
3
+ description: Adversarial multi-agent security audit framework inspired by Cloudflare. Employs independent hunter and verifier roles, OS sandbox write isolation, and evidence-backed vulnerability verification.
4
+ version: 1.0.0
5
+ category: engineering
6
+ type: instruction-only
7
+ requires:
8
+ - engineering-workflow
9
+ - security
10
+ resources:
11
+ - EXAMPLES.md
12
+ - SKILL.md
13
+ - TROUBLESHOOTING.md
14
+ - VALIDATION.json
@@ -0,0 +1,51 @@
1
+ # Soft Design - Component & Layout Examples
2
+
3
+ ## Example 1: Glassmorphic Elevated Panel
4
+
5
+ ```tsx
6
+ import React from 'react';
7
+
8
+ interface SoftPanelProps {
9
+ title: string;
10
+ category: string;
11
+ children: React.ReactNode;
12
+ }
13
+
14
+ export function SoftElevatedPanel({ title, category, children }: SoftPanelProps) {
15
+ return (
16
+ <div className="relative overflow-hidden rounded-3xl border border-white/40 bg-white/60 p-8 shadow-[0_20px_50px_rgba(8,_112,_184,_0.07)] backdrop-blur-xl transition-all duration-300 hover:shadow-[0_30px_60px_rgba(8,_112,_184,_0.12)]">
17
+ {/* Subtle ambient light gradient */}
18
+ <div className="pointer-events-none absolute -right-20 -top-20 h-56 w-56 rounded-full bg-gradient-to-br from-indigo-200/50 to-pink-200/30 blur-2xl" />
19
+
20
+ <div className="relative z-10">
21
+ <span className="inline-block rounded-full bg-indigo-50/80 px-3 py-1 text-xs font-medium text-indigo-600 backdrop-blur-sm">
22
+ {category}
23
+ </span>
24
+ <h2 className="mt-4 text-2xl font-normal tracking-tight text-slate-800">
25
+ {title}
26
+ </h2>
27
+ <div className="mt-6 text-slate-600 leading-relaxed">
28
+ {children}
29
+ </div>
30
+ </div>
31
+ </div>
32
+ );
33
+ }
34
+ ```
35
+
36
+ ---
37
+
38
+ ## Example 2: Soft Tactile Pill Button
39
+
40
+ ```tsx
41
+ export function SoftPillButton({ label, onClick }: { label: string; onClick: () => void }) {
42
+ return (
43
+ <button
44
+ onClick={onClick}
45
+ className="rounded-full bg-gradient-to-b from-indigo-500 to-indigo-600 px-6 py-3 text-sm font-medium text-white shadow-[0_10px_20px_-5px_rgba(79,_70,_229,_0.3)] transition-all duration-200 hover:scale-[1.02] hover:shadow-[0_15px_25px_-5px_rgba(79,_70,_229,_0.4)] active:scale-[0.98]"
46
+ >
47
+ {label}
48
+ </button>
49
+ );
50
+ }
51
+ ```
@@ -0,0 +1,108 @@
1
+ ---
2
+ name: high-end-visual-design
3
+ description: Teaches the AI to design like a high-end agency. Defines the exact fonts, spacing, shadows, card structures, and animations that make a website feel expensive. Blocks all the common defaults that make AI designs look cheap or generic.
4
+ ---
5
+
6
+ # Agent Skill: Principal UI/UX Architect & Motion Choreographer (Awwwards-Tier)
7
+
8
+ ## Overview
9
+
10
+ Engineers high-end, agency-level digital experiences characterized by tactile haptic depth, cinematic spatial rhythm, obsessive micro-interactions, and fluid spring physics. Rejects generic commodity SaaS templates in favor of bespoke layout archetypes, nested double-bezel enclosures, and purposeful motion dynamics.
11
+
12
+ ## When to Use
13
+
14
+ - When tasked with creating luxury, premium, Awwwards-tier landing pages, portfolio showpieces, or editorial SaaS interfaces.
15
+ - When explicitly prompted for "soft UI", "expensive design", "Apple-level polish", or "calm aesthetics".
16
+ - When standard component libraries feel too clinical or generic.
17
+
18
+ ## Rules & Patterns
19
+
20
+ ### 1. Absolute Zero Directive (Strict Anti-Patterns)
21
+
22
+ - **Banned Fonts:** Inter, Roboto, Arial, Open Sans, Helvetica. (Use `Geist`, `Clash Display`, `PP Editorial New`, or `Plus Jakarta Sans`).
23
+ - **Banned Icons:** Thick-stroked Lucide, FontAwesome, or Material Icons. Use ultra-light, precise line icons (Phosphor Light, Remix Line).
24
+ - **Banned Borders & Shadows:** Generic 1px solid gray borders. Harsh dark drop shadows (`rgba(0,0,0,0.3)`).
25
+ - **Banned Layouts:** Edge-to-edge sticky navbars glued to the top. Symmetrical 3-column Bootstrap-style grids without massive whitespace.
26
+ - **Banned Motion:** Standard `linear` or `ease-in-out` transitions. Instant state changes without interpolation.
27
+
28
+ ### 2. The Creative Variance Engine
29
+
30
+ Before writing code, consciously pick ONE combination:
31
+
32
+ #### Vibe & Texture Archetypes
33
+
34
+ 1. **Ethereal Glass (SaaS / AI / Tech):** Deep OLED black (`#050505`), subtle radial mesh gradients, vantablack cards with `backdrop-blur-2xl` and white/10 hairlines.
35
+ 2. **Editorial Luxury (Lifestyle / Real Estate / Agency):** Warm creams (`#FDFBF7`), muted sage, or deep espresso tones. Variable serif headings with subtle CSS noise overlay (`opacity-[0.03]`).
36
+ 3. **Soft Structuralism (Consumer / Health / Portfolio):** Silver-grey or pure white backgrounds, bold grotesk typography, airy floating components with ultra-diffuse ambient shadows.
37
+
38
+ #### Layout Archetypes
39
+
40
+ 1. **The Asymmetrical Bento:** Masonry CSS Grid of varying card spans. (Collapses to single-column `grid-cols-1 gap-6` on mobile).
41
+ 2. **The Z-Axis Cascade:** Stacked cards with varying depth of field and subtle `-2deg` or `3deg` rotations. (Rotations removed on mobile).
42
+ 3. **The Editorial Split:** Massive typography on the left half (`w-1/2`), with horizontal interactive card ribbons on the right.
43
+
44
+ ### 3. Haptic Micro-Aesthetics
45
+
46
+ - **The Double-Bezel (Doppelrand):**
47
+ - **Outer Shell:** Wrapper `div` with subtle background (`bg-black/5` or `bg-white/5`), hairline border (`border border-white/10`), padding (`p-2`), and large outer radius (`rounded-[2rem]`).
48
+ - **Inner Core:** Nested card inside shell with distinct background, inner highlight (`shadow-[inset_0_1px_1px_rgba(255,255,255,0.15)]`), and mathematically concentric smaller radius (`rounded-[calc(2rem-0.5rem)]`).
49
+ - **Button-in-Button Trailing Icon:** Pill-shaped primary buttons (`rounded-full px-6 py-3`) with trailing arrows nested inside their own dedicated circular badge (`w-8 h-8 rounded-full bg-black/5 flex items-center justify-center`).
50
+ - **Macro-Whitespace:** Minimum `py-24` to `py-40` for section padding.
51
+
52
+ ### 4. Motion Choreography & Performance Guardrails
53
+
54
+ - **Custom Physics:** All transitions use custom cubic-beziers: `transition-all duration-700 ease-[cubic-bezier(0.32,0.72,0,1)]`.
55
+ - **GPU-Safe Animation:** Animate exclusively via `transform` and `opacity`. Never animate `top`, `left`, `width`, or `height`.
56
+ - **Blur Discipline:** Restrict `backdrop-blur` to fixed or sticky elements (navbars, modals). Never apply to scrolling containers.
57
+
58
+ ## Code Examples
59
+
60
+ ```tsx
61
+ export function DoubleBezelCard({ title, subtitle, tag }: { title: string; subtitle: string; tag: string }) {
62
+ return (
63
+ // Outer Shell
64
+ <div className="p-2 rounded-[2rem] bg-black/5 dark:bg-white/5 border border-black/10 dark:border-white/10 transition-all duration-700 ease-[cubic-bezier(0.32,0.72,0,1)] hover:shadow-2xl">
65
+ // Inner Core
66
+ <div className="p-8 rounded-[calc(2rem-0.5rem)] bg-[#FFFFFF] dark:bg-[#0E0E0E] shadow-[inset_0_1px_1px_rgba(255,255,255,0.15)] flex flex-col justify-between min-h-[320px]">
67
+ <div>
68
+ <span className="inline-block px-3 py-1 rounded-full text-[10px] uppercase tracking-[0.2em] font-medium bg-black/5 dark:bg-white/10 text-neutral-600 dark:text-neutral-400 mb-4">
69
+ {tag}
70
+ </span>
71
+ <h3 className="text-2xl font-bold tracking-tight text-neutral-900 dark:text-white mb-2">{title}</h3>
72
+ <p className="text-sm text-neutral-500 dark:text-neutral-400 leading-relaxed">{subtitle}</p>
73
+ </div>
74
+ <button
75
+ type="button"
76
+ className="group mt-6 inline-flex items-center justify-between pl-6 pr-2 py-2 rounded-full bg-neutral-900 dark:bg-white text-white dark:text-neutral-950 font-medium text-sm active:scale-[0.98] transition-all duration-300"
77
+ >
78
+ <span>Explore Experience</span>
79
+ <span className="w-8 h-8 rounded-full bg-white/10 dark:bg-black/10 flex items-center justify-center transition-transform duration-300 group-hover:translate-x-0.5 group-hover:-translate-y-0.5">
80
+ ↗
81
+ </span>
82
+ </button>
83
+ </div>
84
+ </div>
85
+ );
86
+ }
87
+ ```
88
+
89
+ ## Validation Checklist
90
+
91
+ - [ ] All major cards and interactive modules use the Double-Bezel concentric architecture.
92
+ - [ ] Primary buttons feature the nested button-in-button trailing icon pattern.
93
+ - [ ] Section vertical padding is at minimum `py-24`.
94
+ - [ ] Transitions use spring or custom cubic-bezier curves (no default linear transitions).
95
+ - [ ] Layout collapses gracefully to single-column on mobile viewports (<768px).
96
+ - [ ] Animations use only `transform` and `opacity`.
97
+
98
+ ## Common Mistakes
99
+
100
+ - Using standard `shadow-md` or harsh dark drop shadows instead of soft ambient shadows.
101
+ - Failing to recalculate concentric inner border-radii (`calc(outer - padding)`).
102
+ - Applying `backdrop-blur` on large scrolling sections, triggering GPU repaints.
103
+ - Sticking to generic 3-column Bootstrap grids.
104
+
105
+ ## Integration Notes
106
+
107
+ - Complements `impeccable-design` for QA and anti-pattern enforcement.
108
+ - Pairs with `ui-ux-pro` for color palette harmony and accessibility compliance.
@@ -0,0 +1,12 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "rules_followed": {
6
+ "type": "boolean"
7
+ }
8
+ },
9
+ "required": [
10
+ "rules_followed"
11
+ ]
12
+ }
@@ -0,0 +1,10 @@
1
+ schemaVersion: 2
2
+ name: soft-design
3
+ category: design
4
+ type: instruction-only
5
+ description: High-end agency-grade UI architecture, haptic micro-aesthetics, and fluid spring motion choreography.
6
+ version: 1.0.0
7
+ resources:
8
+ - EXAMPLES.md
9
+ - SKILL.md
10
+ - VALIDATION.json
@@ -0,0 +1,56 @@
1
+ # State Management Examples - Anti-patterns vs ContextOS Standard
2
+
3
+ ## Example 1: Selecting State from Zustand
4
+
5
+ ### Anti-pattern: Anti-pattern (Subscribing to full store causes unnecessary renders)
6
+
7
+ ```typescript
8
+ // BAD: component re-renders whenever ANY property in the store changes!
9
+ function CartBadge() {
10
+ const store = useCartStore(); // subscribes to entire object!
11
+ return <span>{store.items.length}</span>;
12
+ }
13
+ ```
14
+
15
+ ### Best practice: ContextOS Standard (Atomic granular selector)
16
+
17
+ ```typescript
18
+ // GOOD: component ONLY re-renders when itemCount changes
19
+ function CartBadge() {
20
+ const itemCount = useCartStore((state) => state.items.length);
21
+ return <span>{itemCount}</span>;
22
+ }
23
+ ```
24
+
25
+ ---
26
+
27
+ ## Example 2: Server State Invalidation
28
+
29
+ ### Anti-pattern: Anti-pattern (Manually syncing server data into global state with useEffect)
30
+
31
+ ```typescript
32
+ // BAD: manual sync, race conditions, stale cache bugs
33
+ function UserProfile({ userId }) {
34
+ const { setUser } = useUserStore();
35
+ useEffect(() => {
36
+ fetch(`/api/users/${userId}`).then(res => res.json()).then(setUser);
37
+ }, [userId]);
38
+ }
39
+ ```
40
+
41
+ ### Best practice: ContextOS Standard (Declarative TanStack Query caching)
42
+
43
+ ```typescript
44
+ // GOOD: automatic caching, deduplication, background revalidation
45
+ function UserProfile({ userId }: { userId: string }) {
46
+ const { data: user, isLoading, error } = useQuery({
47
+ queryKey: ['users', userId],
48
+ queryFn: () => fetchUserById(userId),
49
+ staleTime: 1000 * 60 * 5, // 5 minutes fresh
50
+ });
51
+
52
+ if (isLoading) return <SkeletonLoader />;
53
+ if (error) return <ErrorMessage error={error} />;
54
+ return <UserDetails user={user} />;
55
+ }
56
+ ```
@@ -0,0 +1,168 @@
1
+ ---
2
+ name: state-management
3
+ description: Client and server state management standards using Zustand and TanStack Query. Enforces minimal global state, optimistic updates, and clean query invalidation.
4
+ ---
5
+
6
+ # State Management
7
+
8
+ ## Overview
9
+
10
+ Global client state and asynchronous server state architecture in modern React and Next.js applications using Zustand and TanStack Query v5.
11
+
12
+ ## When to Use
13
+
14
+ Activate when managing asynchronous server data fetching, HTTP caching, optimistic UI updates, or global synchronous client UI state (modals, active filters, multi-step wizards, theme overrides).
15
+
16
+ ## Rules & Patterns
17
+
18
+ ### The Rule of Two States
19
+
20
+ 1. **SERVER STATE (Async)**: Managed exclusively by TanStack Query (`useQuery`, `useMutation`). Handles HTTP caching, stale-while-revalidate, deduplication, background refetching, pagination, and query invalidation.
21
+ 2. **CLIENT STATE (Sync)**: Managed by Zustand. Handles transient UI state: modal visibility, sidebar collapsed state, active filter values, wizard steps, and offline draft buffers.
22
+
23
+ ### Negative Constraints (What NOT to Do)
24
+
25
+ 1. **NEVER store server-fetched entity data in Zustand or Redux**: Store ONLY client-local UI state in Zustand. All API responses, lists, and entity records belong in TanStack Query.
26
+ 2. **NEVER duplicate derived state**: Compute values inline or via `useMemo` from existing state instead of storing redundant state variables.
27
+ 3. **NEVER subscribe to entire store objects in components**: Always use atomic selector functions (e.g. `useStore(state => state.isOpen)`) or `useShallow` to prevent unnecessary component re-renders.
28
+ 4. **NEVER mutate state directly**: Always return new immutable state objects in Zustand setters.
29
+ 5. **NEVER ignore optimistic rollback on mutation failure**: When implementing optimistic UI, always capture `previousData` in `onMutate` and restore it in `onError`.
30
+ 6. **NEVER use ad-hoc array strings for query keys**: Always define and use a centralized Query Key Factory to guarantee consistent cache invalidation.
31
+
32
+ ---
33
+
34
+ ### Pattern 1: Zustand Slices Architecture
35
+
36
+ Split large global stores into focused, typed slices that compose into a single unified hook:
37
+
38
+ ```typescript
39
+ import { create, StateCreator } from 'zustand';
40
+ import { devtools } from 'zustand/middleware';
41
+
42
+ interface UiSlice {
43
+ isSidebarOpen: boolean;
44
+ activeModal: string | null;
45
+ toggleSidebar: () => void;
46
+ openModal: (modalId: string) => void;
47
+ closeModal: () => void;
48
+ }
49
+
50
+ const createUiSlice: StateCreator<UiSlice> = (set) => ({
51
+ isSidebarOpen: true,
52
+ activeModal: null,
53
+ toggleSidebar: () => set((state) => ({ isSidebarOpen: !state.isSidebarOpen })),
54
+ openModal: (modalId) => set({ activeModal: modalId }),
55
+ closeModal: () => set({ activeModal: null }),
56
+ });
57
+
58
+ export const useAppStore = create<UiSlice>()(
59
+ devtools((...args) => ({
60
+ ...createUiSlice(...args),
61
+ }))
62
+ );
63
+ ```
64
+
65
+ ---
66
+
67
+ ### Pattern 2: Atomic Selectors & Re-render Prevention
68
+
69
+ Always pass specific selector functions to extract only the state your component needs:
70
+
71
+ ```typescript
72
+ // [BAD] Subscribes to the entire store; re-renders on ANY store change
73
+ const { isSidebarOpen, activeModal } = useAppStore();
74
+
75
+ // [GOOD] Subscribes only to isSidebarOpen; re-renders ONLY when it changes
76
+ const isSidebarOpen = useAppStore((state) => state.isSidebarOpen);
77
+
78
+ // [GOOD] Multiple values extracted without extra re-renders using useShallow
79
+ import { useShallow } from 'zustand/react/shallow';
80
+
81
+ const { isSidebarOpen, activeModal } = useAppStore(
82
+ useShallow((state) => ({
83
+ isSidebarOpen: state.isSidebarOpen,
84
+ activeModal: state.activeModal,
85
+ }))
86
+ );
87
+ ```
88
+
89
+ ---
90
+
91
+ ### Pattern 3: TanStack Query Key Factory Standard
92
+
93
+ Maintain a structured hierarchy of query keys for predictable invalidation:
94
+
95
+ ```typescript
96
+ export const projectKeys = {
97
+ all: ['projects'] as const,
98
+ lists: () => [...projectKeys.all, 'list'] as const,
99
+ list: (filters: ProjectFilters) => [...projectKeys.lists(), filters] as const,
100
+ details: () => [...projectKeys.all, 'detail'] as const,
101
+ detail: (id: string) => [...projectKeys.details(), id] as const,
102
+ };
103
+ ```
104
+
105
+ ---
106
+
107
+ ### Pattern 4: Optimistic Mutation with Rollback
108
+
109
+ Safely update UI instantly and roll back on network or server error:
110
+
111
+ ```typescript
112
+ import { useMutation, useQueryClient } from '@tanstack/react-query';
113
+ import { projectKeys } from './query-keys';
114
+
115
+ export function useUpdateProject() {
116
+ const queryClient = useQueryClient();
117
+
118
+ return useMutation({
119
+ mutationFn: (updated: { id: string; name: string }) => api.patch(`/projects/${updated.id}`, updated),
120
+ onMutate: async (newProject) => {
121
+ // 1. Cancel outgoing queries to avoid overwriting optimistic update
122
+ await queryClient.cancelQueries({ queryKey: projectKeys.detail(newProject.id) });
123
+
124
+ // 2. Snapshot the previous value
125
+ const previousProject = queryClient.getQueryData(projectKeys.detail(newProject.id));
126
+
127
+ // 3. Optimistically update the cache
128
+ queryClient.setQueryData(projectKeys.detail(newProject.id), (old: any) => ({
129
+ ...old,
130
+ ...newProject,
131
+ }));
132
+
133
+ // 4. Return context with snapshot for rollback
134
+ return { previousProject, projectId: newProject.id };
135
+ },
136
+ onError: (err, newProject, context) => {
137
+ // 5. Rollback to snapshot on failure
138
+ if (context?.previousProject) {
139
+ queryClient.setQueryData(projectKeys.detail(context.projectId), context.previousProject);
140
+ }
141
+ },
142
+ onSettled: (data, err, variables) => {
143
+ // 6. Always re-sync with server after error or success
144
+ queryClient.invalidateQueries({ queryKey: projectKeys.detail(variables.id) });
145
+ },
146
+ });
147
+ }
148
+ ```
149
+
150
+ ---
151
+
152
+ ## Validation Checklist
153
+
154
+ - [ ] Clear separation: Server state in TanStack Query, client UI state in Zustand.
155
+ - [ ] Atomic selectors or `useShallow` used on all store consumers.
156
+ - [ ] Centralized Query Key Factory used for all `queryKey` definitions.
157
+ - [ ] Optimistic mutations implement `onMutate`, `onError` rollback, and `onSettled` invalidation.
158
+ - [ ] Zero duplicated or redundant derived state stored in global stores.
159
+
160
+ ## Common Mistakes
161
+
162
+ - **Storing API collections in Zustand**: Results in stale data and duplicate caching layers. Use TanStack Query.
163
+ - **Missing query cancellation in onMutate**: Causes race conditions between ongoing fetches and optimistic updates.
164
+ - **Forgetting atomic selectors**: Causes every component reading one store value to re-render when an unrelated value changes.
165
+
166
+ ## Integration Notes
167
+
168
+ Interacts with `react`, `nextjs`, and `typescript`.
@@ -0,0 +1,18 @@
1
+ # State Management Troubleshooting Guide
2
+
3
+ ## Common Issues & Fixes
4
+
5
+ ### 1. Infinite re-renders when calling `useStore` with an inline object selector
6
+
7
+ - **Cause**: Returning a new object reference from a selector without a custom equality check.
8
+ - **Fix**: Use `useShallow` from `zustand/react/shallow` or select scalar values directly.
9
+
10
+ ### 2. Stale data shown after mutation
11
+
12
+ - **Cause**: Missing `queryClient.invalidateQueries` in `onSettled` or `onSuccess`.
13
+ - **Fix**: Always invalidate the relevant query keys on mutation completion to trigger background refetch.
14
+
15
+ ### 3. Server-Side Rendering (SSR) Hydration Mismatch in Next.js
16
+
17
+ - **Cause**: Reading localStorage-persisted Zustand store directly during initial SSR render.
18
+ - **Fix**: Use a custom `useHydratedStore` hook or render persisted components only after client mount.
@@ -0,0 +1,11 @@
1
+ {
2
+ "skill": "state-management",
3
+ "version": "1.0.0",
4
+ "checks": [
5
+ "Strict separation between Server and Client state",
6
+ "No server API responses cached in Zustand",
7
+ "Granular atomic selectors used for component subscriptions",
8
+ "Optimistic mutations include rollback handler",
9
+ "Zero duplicated derived state"
10
+ ]
11
+ }
@@ -0,0 +1,14 @@
1
+ schemaVersion: 2
2
+ name: state-management
3
+ description: Client and server state management standards using Zustand and TanStack Query. Enforces minimal global state, optimistic updates, and clean query invalidation.
4
+ version: 1.0.0
5
+ category: frontend
6
+ type: instruction-only
7
+ requires:
8
+ - react
9
+ - typescript
10
+ resources:
11
+ - EXAMPLES.md
12
+ - SKILL.md
13
+ - TROUBLESHOOTING.md
14
+ - VALIDATION.json