@vesviet/agent-skills 5.6.0 → 5.6.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 (113) hide show
  1. package/INDEX.md +1 -1
  2. package/README.md +1 -1
  3. package/VERSION +1 -1
  4. package/adapters/antigravity/a2a-config.template.yaml +1 -1
  5. package/adapters/antigravity/role-skill-index.json +1 -1
  6. package/adapters/claude/CLAUDE_ADAPTER.md +1 -1
  7. package/adapters/cursor/README.md +185 -185
  8. package/bin/agent-skills.mjs +17 -14
  9. package/core/contracts/schemas/api-contract-spec.json +191 -191
  10. package/core/contracts/schemas/feature-ticket.json +1293 -1293
  11. package/core/contracts/schemas/pull-request-spec.json +338 -338
  12. package/core/contracts/schemas/references/detailed/01-solution-and-governance.md +19 -19
  13. package/core/contracts/schemas/references/detailed/02-engineering-delivery.md +93 -93
  14. package/core/contracts/schemas/references/detailed/04-finance-accounting-and-compliance.md +54 -54
  15. package/core/contracts/schemas/references/detailed/05-design-and-content.md +92 -92
  16. package/core/contracts/schemas/references/detailed/06-seo-and-publishing.md +48 -48
  17. package/core/contracts/schemas/references/detailed/07-a2a-protocol.md +85 -85
  18. package/core/contracts/schemas/test-report.json +530 -530
  19. package/core/roles/references/business-analyst-responsibilities.md +207 -207
  20. package/core/roles/references/frontend-developer-responsibilities.md +275 -275
  21. package/core/roles/system-engineer.md +465 -465
  22. package/core/skills/agent/agent-memory-compaction/references/anchored-schema-and-compaction-algorithms.md +141 -141
  23. package/core/skills/backend/build-mcp-server/SKILL.md +100 -100
  24. package/core/skills/backend/implement-structured-outputs/SKILL.md +94 -94
  25. package/core/skills/business/elicit-requirements/SKILL.md +102 -102
  26. package/core/skills/business/elicit-requirements/references/elicitation-techniques-and-babok-criteria.md +60 -60
  27. package/core/skills/business/trace-requirements-impact/SKILL.md +97 -97
  28. package/core/skills/business/trace-requirements-impact/references/rtm-graph-and-prioritization-models.md +109 -109
  29. package/core/skills/business/write-use-cases/SKILL.md +106 -106
  30. package/core/skills/business/write-use-cases/references/cockburn-scoping-and-13-field-template.md +135 -135
  31. package/core/skills/document/pptx/scripts/add_slide.py +0 -0
  32. package/core/skills/document/pptx/scripts/clean.py +0 -0
  33. package/core/skills/document/pptx/scripts/thumbnail.py +0 -0
  34. package/core/skills/document/xlsx/scripts/recalc.py +0 -0
  35. package/core/skills/documentation/write-documentation/SKILL.md +143 -143
  36. package/core/skills/documentation/write-tech-radar/SKILL.md +149 -149
  37. package/core/skills/foundation/accessibility-review/SKILL.md +160 -160
  38. package/core/skills/foundation/release-notes/SKILL.md +192 -192
  39. package/core/skills/foundation/webapp-server-runner/scripts/with_server.py +0 -0
  40. package/core/skills/foundation/write-product-brief/SKILL.md +160 -160
  41. package/core/skills/platform/cloudflare-email-service/SKILL.md +166 -166
  42. package/core/skills/platform/cloudflare-email-service/references/routing.md +199 -199
  43. package/core/skills/platform/debug-workers-edge/SKILL.md +111 -111
  44. package/core/skills/platform/sandbox-sdk/SKILL.md +183 -183
  45. package/core/skills/platform/setup-gpu-finops/SKILL.md +107 -107
  46. package/core/skills/platform/setup-llm-gateway/SKILL.md +108 -108
  47. package/core/skills/platform/turnstile-spin/SKILL.md +118 -118
  48. package/core/skills/platform/turnstile-spin/scripts/auth-probe.sh +0 -0
  49. package/core/skills/platform/turnstile-spin/scripts/fetch-secret.sh +0 -0
  50. package/core/skills/platform/turnstile-spin/scripts/persist-skill.sh +0 -0
  51. package/core/skills/platform/turnstile-spin/scripts/validate.sh +0 -0
  52. package/core/skills/platform/turnstile-spin/scripts/widget-create.sh +0 -0
  53. package/core/skills/platform/turnstile-spin/scripts/worker-deploy.sh +0 -0
  54. package/core/skills/platform/turnstile-spin/templates/worker/src/index.ts +199 -199
  55. package/core/skills/platform/turnstile-spin/templates/worker/wrangler.toml +31 -31
  56. package/core/skills/platform/web-perf/SKILL.md +151 -151
  57. package/core/skills/platform/workers-best-practices/references/rules.md +463 -463
  58. package/core/skills/product/build-story-map/SKILL.md +104 -104
  59. package/core/skills/product/build-story-map/references/story-mapping-and-cpm-scheduling.md +101 -101
  60. package/core/skills/product/define-product-strategy/SKILL.md +105 -105
  61. package/core/skills/product/define-product-strategy/references/strategy-frameworks-and-pr-faq.md +142 -142
  62. package/core/skills/product/model-saas-metrics/SKILL.md +104 -104
  63. package/core/skills/product/model-saas-metrics/references/saas-unit-economics-and-pricing.md +110 -110
  64. package/core/skills/product/prioritize-roadmap/SKILL.md +106 -106
  65. package/core/skills/product/prioritize-roadmap/references/prioritization-scoring-and-kill-criteria.md +105 -105
  66. package/core/skills/repo-ops/commit-code/SKILL.md +190 -190
  67. package/core/skills/repo-ops/commit-code/references/multi-repo-and-deployment.md +21 -21
  68. package/core/skills/repo-ops/navigate-service/SKILL.md +199 -199
  69. package/core/skills/repo-ops/review-code/references/process-and-format.md +100 -100
  70. package/core/skills/repo-ops/review-service/SKILL.md +186 -186
  71. package/core/skills/repo-ops/troubleshoot-service/SKILL.md +127 -127
  72. package/core/skills/repo-ops/troubleshoot-service/references/failure-modes-and-security.md +22 -22
  73. package/core/skills/repo-ops/troubleshoot-service/references/suggested-process.md +110 -110
  74. package/core/skills/security-data/security-audit/SKILL.md +119 -119
  75. package/core/workflows/add-new-feature.md +212 -212
  76. package/core/workflows/agent-a2a-delegation.md +142 -142
  77. package/core/workflows/bug-fix.md +147 -147
  78. package/core/workflows/build-deploy.md +208 -208
  79. package/core/workflows/code-review.md +137 -137
  80. package/core/workflows/dependency-upgrade.md +193 -193
  81. package/core/workflows/feature-delivery.md +149 -149
  82. package/core/workflows/hotfix-production.md +172 -172
  83. package/core/workflows/qa-validation.md +231 -231
  84. package/core/workflows/refactoring.md +154 -154
  85. package/core/workflows/revert-deployment.md +147 -147
  86. package/core/workflows/security-incident-response.md +191 -191
  87. package/core/workflows/seo-content-lifecycle.md +91 -91
  88. package/core/workflows/service-review-release.md +223 -223
  89. package/core/workflows/setup-new-service.md +214 -214
  90. package/core/workflows/tech-repo-review.md +245 -245
  91. package/core/workflows/troubleshooting.md +241 -241
  92. package/overlays/astro-cloudflare/README.md +93 -93
  93. package/overlays/data-analyst-stack/README.md +109 -109
  94. package/overlays/data-analyst-stack/rules/metric-dashboard-templates.md +135 -135
  95. package/overlays/data-analyst-stack/rules/stack-conventions.md +80 -80
  96. package/overlays/ecommerce-microservices/README.md +65 -65
  97. package/overlays/go-microservices/README.md +78 -78
  98. package/overlays/go-microservices/rules/go-conventions.md +223 -223
  99. package/overlays/laravel-filament/README.md +90 -90
  100. package/overlays/laravel-filament/rules/laravel-conventions.md +220 -220
  101. package/overlays/laravel-filament/skills/develop-laravel-feature/SKILL.md +141 -141
  102. package/overlays/laravel-filament/workflows/deploy-laravel.md +133 -133
  103. package/overlays/obj-configurator/rules/obj-project-rules.md +111 -111
  104. package/overlays/obj-configurator/skills/develop-obj-feature/SKILL.md +71 -71
  105. package/overlays/r3f-stack/README.md +89 -89
  106. package/overlays/r3f-stack/rules/stub.md +43 -43
  107. package/overlays/r3f-stack/skills/debug-3d-scene/SKILL.md +166 -166
  108. package/overlays/r3f-stack/skills/integrate-r3f-three-legacy/SKILL.md +159 -159
  109. package/overlays/r3f-stack/skills/optimize-3d-assets/SKILL.md +128 -128
  110. package/overlays/seo-publishing/rules/site-mix-and-cannibalization.md +52 -52
  111. package/overlays/ui-design-system/rules/handoff-conventions.md +73 -73
  112. package/package.json +2 -2
  113. package/core/README.md +0 -53
@@ -1,108 +1,108 @@
1
- ---
2
- name: setup-llm-gateway
3
- description: Configure a centralized LLM proxy gateway for token routing, budgeting, and failover. Use when deploying multi-model routing, enforcing token rate limits, managing provider credentials, or centralizing AI observability.
4
- allowed-tools: [read_file, write_file, edit_file, create_file, search_code, run_tests, run_linter, run_build, execute_command]
5
- ---
6
-
7
- # Setup LLM Gateway
8
-
9
- Use this skill to implement an AI infrastructure gateway (e.g., LiteLLM, Portkey) that sits between internal applications and external LLM providers (OpenAI, Anthropic, Gemini).
10
-
11
- ## Core Rules
12
-
13
- - **Centralized Choke Point**: All LLM traffic MUST route through the gateway. Direct calls to provider APIs using raw keys are prohibited.
14
- - **Failover Routing**: Configure multi-provider fallback logic (e.g., primary: Claude 3.5 Sonnet → secondary: GPT-4o → fallback: Llama 3) to guarantee inference uptime.
15
- - **Cost Attribution**: Enforce mandatory metadata tags (e.g., `team_id`, `project_id`) on all requests to track token budgets accurately.
16
- - **Rate Limiting**: Apply token and request rate limits per user/tenant to prevent abusive spikes or accidental infinite loops from autonomous agents.
17
- - **Credential Vaulting**: Secure provider master API keys in a dedicated secrets manager; never expose upstream keys to client applications.
18
- - **LLM-SLO-TARGETS**: Define measurable SLOs for each virtual model tier: TTFT (Time-to-First-Token) p95 < 800ms for interactive, < 3s for batch; TBT (Time-Between-Tokens) p95 < 25ms; alert on SLO breaches per model, not globally.
19
- - **PROMPTOPS-TOKEN-BUDGET**: Track token usage per `(team_id, model, prompt_template_version)` tuple — prompt template version changes must be reflected in metadata tagging so cost attribution remains accurate after prompt engineering changes.
20
- - **AGENTIC-CIRCUIT-BREAKER**: Configure a hard circuit breaker (max total tokens per agent invocation session) to prevent autonomous agent loops from exhausting daily budgets — set per-session token cap ≤ 10% of daily budget.
21
-
22
- ## Suggested Process
23
-
24
- ### 1. Select Gateway Architecture & Engine
25
-
26
- Evaluate and select the LLM gateway engine based on technical requirements:
27
- - LiteLLM Proxy for Python/Kubernetes native environments supporting 100+ LLM providers.
28
- - Portkey or Cloudflare AI Gateway for edge-deployed, managed caching and routing pipelines.
29
- - Verify support for streaming responses, function/tool calling passthrough, and structured JSON output constraints.
30
-
31
- ### 2. Deploy Gateway Infrastructure & Vault Credentials
32
-
33
- Provision the gateway runtime:
34
- - Deploy the gateway service as a high-availability deployment behind a load balancer.
35
- - Store upstream provider API keys (OpenAI, Anthropic, Google Vertex AI) in AWS Secrets Manager or HashiCorp Vault.
36
- - Configure internal API key generation for downstream applications with role-based permissions and spending limits.
37
-
38
- ### 3. Configure Model Routing Matrix & Failover Fallbacks
39
-
40
- Define routing rules and resilience strategies:
41
- - Define virtual model aliases (e.g., `fast-model`, `reasoning-model`) mapping to concrete upstream endpoints.
42
- - Configure automated failover fallbacks triggered by HTTP 429 (rate limits), 5xx server errors, or timeout thresholds.
43
- - Set up latency-based and cost-optimized routing rules where appropriate.
44
-
45
- ### 4. Enforce Token Budgets, Rate Limits & Metadata Tagging
46
-
47
- Implement traffic controls and governance:
48
- - Require client requests to include metadata headers (`x-team-id`, `x-project-id`, `x-user-id`).
49
- - Configure token-bucket rate limits (requests per minute and tokens per minute) per client key.
50
- - Set hard monthly budget caps per project with automated request rejection when budgets are exhausted.
51
-
52
- ### 5. Instrument Observability & Tracing
53
-
54
- Use skill: `add-telemetry-instrumentation`
55
- - Configure OpenTelemetry trace export following OpenTelemetry GenAI semantic conventions (`gen_ai.system`, `gen_ai.request.model`, `gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens`).
56
- - Forward gateway access logs to centralized logging backends.
57
- - Set up monitoring dashboards for token consumption, latency percentiles (p50, p95, p99), and provider error rates.
58
-
59
- ### 6. Validate Routing, Failover & Load Resilience
60
-
61
- Use skill: `troubleshoot-service`
62
- - Execute end-to-end integration tests routing test prompts across all configured virtual models.
63
- - Simulate provider outages by injecting HTTP 500/429 responses and assert that fallback models respond without client disruption.
64
- - Verify that rate limiting correctly throttles traffic when request ceilings are exceeded.
65
-
66
- ## Output Contracts
67
-
68
- When this skill is invoked as part of a coordinated multi-role delivery, emit:
69
-
70
- - **`contracts/schemas/deployment-plan.json`** — Required fields: `infrastructure_changes[]`, `config_updates[]`, and `validation_run` output proving the gateway successfully routes a test request and triggers a failover correctly.
71
-
72
- ## Failure Modes
73
-
74
- - **Direct provider call**: an application calls OpenAI/Anthropic directly with a raw key, bypassing the gateway. Mitigation: enforce gateway-only routing via egress policy; reject direct provider URLs in the app's outbound allowlist.
75
- - **Provider key leaked**: an upstream provider API key is committed to the repo or exposed in client config. Mitigation: vault upstream keys in AWS Secrets Manager or HashiCorp Vault; never expose to client apps.
76
- - **Failover not tested**: a failover path is configured but never exercised. Mitigation: inject 500/429 in integration tests; assert fallback model responds without client disruption.
77
- - **Missing cost metadata**: a request arrives without `x-team-id`, `x-project-id`, `x-user-id`. Mitigation: reject requests missing cost metadata; enforce at the gateway.
78
- - **Token budget unmonitored**: monthly budgets are configured but no alert fires when exhausted. Mitigation: wire budget exhaustion to a 429 response; alert on > 80% consumption.
79
- - **Agent loop exhausts budget**: an autonomous agent loops and consumes the daily token budget. Mitigation: enforce the per-session circuit breaker (≤ 10% of daily budget); raise `budget_exhausted` on breach.
80
- - **Prompt version drift**: prompt template version changes are not reflected in the cost tuple. Mitigation: include `prompt_template_version` in the metadata tag; re-attribute cost after every prompt change.
81
-
82
- ## Security Guardrails (OWASP ASI)
83
-
84
- - **ASI03 Identity & Privilege Abuse**: every client must authenticate to the gateway with a scoped key; reject anonymous or unscoped requests.
85
- - **ASI04 Supply Chain**: gateway engine, provider SDKs, and OTel collector must be schema-validated against the expected manifest; treat unknown versions as untrusted.
86
- - **ASI05 RCE Guard**: never construct virtual model aliases, routing rules, or function-call payloads from external content without strict schema validation.
87
- - **ASI07 Inter-Agent Communication**: the deployment plan is consumed by DevOps and SRE roles; emit a structured contract so each role can validate the rollout.
88
- - **ASI09 Human-Agent Trust Exploitation**: do not present the gateway as "failover-ready" without a test run; surface the actual failover coverage honestly.
89
-
90
- ## Checklist
91
-
92
- - [ ] LLM gateway service deployed in high-availability configuration.
93
- - [ ] Upstream provider API keys vaulted in secrets management.
94
- - [ ] Virtual model aliases and multi-provider failover routing configured.
95
- - [ ] Client authentication, rate limits, and token budgets enforced per tenant.
96
- - [ ] Mandatory cost attribution metadata tagging validated on incoming requests.
97
- - [ ] OpenTelemetry GenAI semantic tracing and latency metrics enabled.
98
- - [ ] Failover and throttling behaviors verified via integration tests.
99
- - [ ] `deployment-plan.json` emitted.
100
-
101
- ## Related Skills
102
-
103
- - **agent-model-routing**: Select cost-effective models dynamically before dispatching to the gateway
104
- - **setup-gpu-finops**: Track token spend and GPU compute costs across infrastructure layers
105
- - **implement-structured-outputs**: Ensure gateway preserves JSON Schema constrained decoding across routed models
106
- - **add-telemetry-instrumentation**: Wire OpenTelemetry GenAI semantic conventions and trace propagation
107
- - **manage-secrets**: Securely store and rotate provider API keys and gateway authentication tokens
108
- - **system-design**: Architect high-availability LLM proxy clusters and failover topologies
1
+ ---
2
+ name: setup-llm-gateway
3
+ description: Configure a centralized LLM proxy gateway for token routing, budgeting, and failover. Use when deploying multi-model routing, enforcing token rate limits, managing provider credentials, or centralizing AI observability.
4
+ allowed-tools: [read_file, write_file, edit_file, create_file, search_code, run_tests, run_linter, run_build, execute_command]
5
+ ---
6
+
7
+ # Setup LLM Gateway
8
+
9
+ Use this skill to implement an AI infrastructure gateway (e.g., LiteLLM, Portkey) that sits between internal applications and external LLM providers (OpenAI, Anthropic, Gemini).
10
+
11
+ ## Core Rules
12
+
13
+ - **Centralized Choke Point**: All LLM traffic MUST route through the gateway. Direct calls to provider APIs using raw keys are prohibited.
14
+ - **Failover Routing**: Configure multi-provider fallback logic (e.g., primary: Claude 3.5 Sonnet → secondary: GPT-4o → fallback: Llama 3) to guarantee inference uptime.
15
+ - **Cost Attribution**: Enforce mandatory metadata tags (e.g., `team_id`, `project_id`) on all requests to track token budgets accurately.
16
+ - **Rate Limiting**: Apply token and request rate limits per user/tenant to prevent abusive spikes or accidental infinite loops from autonomous agents.
17
+ - **Credential Vaulting**: Secure provider master API keys in a dedicated secrets manager; never expose upstream keys to client applications.
18
+ - **LLM-SLO-TARGETS**: Define measurable SLOs for each virtual model tier: TTFT (Time-to-First-Token) p95 < 800ms for interactive, < 3s for batch; TBT (Time-Between-Tokens) p95 < 25ms; alert on SLO breaches per model, not globally.
19
+ - **PROMPTOPS-TOKEN-BUDGET**: Track token usage per `(team_id, model, prompt_template_version)` tuple — prompt template version changes must be reflected in metadata tagging so cost attribution remains accurate after prompt engineering changes.
20
+ - **AGENTIC-CIRCUIT-BREAKER**: Configure a hard circuit breaker (max total tokens per agent invocation session) to prevent autonomous agent loops from exhausting daily budgets — set per-session token cap ≤ 10% of daily budget.
21
+
22
+ ## Suggested Process
23
+
24
+ ### 1. Select Gateway Architecture & Engine
25
+
26
+ Evaluate and select the LLM gateway engine based on technical requirements:
27
+ - LiteLLM Proxy for Python/Kubernetes native environments supporting 100+ LLM providers.
28
+ - Portkey or Cloudflare AI Gateway for edge-deployed, managed caching and routing pipelines.
29
+ - Verify support for streaming responses, function/tool calling passthrough, and structured JSON output constraints.
30
+
31
+ ### 2. Deploy Gateway Infrastructure & Vault Credentials
32
+
33
+ Provision the gateway runtime:
34
+ - Deploy the gateway service as a high-availability deployment behind a load balancer.
35
+ - Store upstream provider API keys (OpenAI, Anthropic, Google Vertex AI) in AWS Secrets Manager or HashiCorp Vault.
36
+ - Configure internal API key generation for downstream applications with role-based permissions and spending limits.
37
+
38
+ ### 3. Configure Model Routing Matrix & Failover Fallbacks
39
+
40
+ Define routing rules and resilience strategies:
41
+ - Define virtual model aliases (e.g., `fast-model`, `reasoning-model`) mapping to concrete upstream endpoints.
42
+ - Configure automated failover fallbacks triggered by HTTP 429 (rate limits), 5xx server errors, or timeout thresholds.
43
+ - Set up latency-based and cost-optimized routing rules where appropriate.
44
+
45
+ ### 4. Enforce Token Budgets, Rate Limits & Metadata Tagging
46
+
47
+ Implement traffic controls and governance:
48
+ - Require client requests to include metadata headers (`x-team-id`, `x-project-id`, `x-user-id`).
49
+ - Configure token-bucket rate limits (requests per minute and tokens per minute) per client key.
50
+ - Set hard monthly budget caps per project with automated request rejection when budgets are exhausted.
51
+
52
+ ### 5. Instrument Observability & Tracing
53
+
54
+ Use skill: `add-telemetry-instrumentation`
55
+ - Configure OpenTelemetry trace export following OpenTelemetry GenAI semantic conventions (`gen_ai.system`, `gen_ai.request.model`, `gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens`).
56
+ - Forward gateway access logs to centralized logging backends.
57
+ - Set up monitoring dashboards for token consumption, latency percentiles (p50, p95, p99), and provider error rates.
58
+
59
+ ### 6. Validate Routing, Failover & Load Resilience
60
+
61
+ Use skill: `troubleshoot-service`
62
+ - Execute end-to-end integration tests routing test prompts across all configured virtual models.
63
+ - Simulate provider outages by injecting HTTP 500/429 responses and assert that fallback models respond without client disruption.
64
+ - Verify that rate limiting correctly throttles traffic when request ceilings are exceeded.
65
+
66
+ ## Output Contracts
67
+
68
+ When this skill is invoked as part of a coordinated multi-role delivery, emit:
69
+
70
+ - **`contracts/schemas/deployment-plan.json`** — Required fields: `infrastructure_changes[]`, `config_updates[]`, and `validation_run` output proving the gateway successfully routes a test request and triggers a failover correctly.
71
+
72
+ ## Failure Modes
73
+
74
+ - **Direct provider call**: an application calls OpenAI/Anthropic directly with a raw key, bypassing the gateway. Mitigation: enforce gateway-only routing via egress policy; reject direct provider URLs in the app's outbound allowlist.
75
+ - **Provider key leaked**: an upstream provider API key is committed to the repo or exposed in client config. Mitigation: vault upstream keys in AWS Secrets Manager or HashiCorp Vault; never expose to client apps.
76
+ - **Failover not tested**: a failover path is configured but never exercised. Mitigation: inject 500/429 in integration tests; assert fallback model responds without client disruption.
77
+ - **Missing cost metadata**: a request arrives without `x-team-id`, `x-project-id`, `x-user-id`. Mitigation: reject requests missing cost metadata; enforce at the gateway.
78
+ - **Token budget unmonitored**: monthly budgets are configured but no alert fires when exhausted. Mitigation: wire budget exhaustion to a 429 response; alert on > 80% consumption.
79
+ - **Agent loop exhausts budget**: an autonomous agent loops and consumes the daily token budget. Mitigation: enforce the per-session circuit breaker (≤ 10% of daily budget); raise `budget_exhausted` on breach.
80
+ - **Prompt version drift**: prompt template version changes are not reflected in the cost tuple. Mitigation: include `prompt_template_version` in the metadata tag; re-attribute cost after every prompt change.
81
+
82
+ ## Security Guardrails (OWASP ASI)
83
+
84
+ - **ASI03 Identity & Privilege Abuse**: every client must authenticate to the gateway with a scoped key; reject anonymous or unscoped requests.
85
+ - **ASI04 Supply Chain**: gateway engine, provider SDKs, and OTel collector must be schema-validated against the expected manifest; treat unknown versions as untrusted.
86
+ - **ASI05 RCE Guard**: never construct virtual model aliases, routing rules, or function-call payloads from external content without strict schema validation.
87
+ - **ASI07 Inter-Agent Communication**: the deployment plan is consumed by DevOps and SRE roles; emit a structured contract so each role can validate the rollout.
88
+ - **ASI09 Human-Agent Trust Exploitation**: do not present the gateway as "failover-ready" without a test run; surface the actual failover coverage honestly.
89
+
90
+ ## Checklist
91
+
92
+ - [ ] LLM gateway service deployed in high-availability configuration.
93
+ - [ ] Upstream provider API keys vaulted in secrets management.
94
+ - [ ] Virtual model aliases and multi-provider failover routing configured.
95
+ - [ ] Client authentication, rate limits, and token budgets enforced per tenant.
96
+ - [ ] Mandatory cost attribution metadata tagging validated on incoming requests.
97
+ - [ ] OpenTelemetry GenAI semantic tracing and latency metrics enabled.
98
+ - [ ] Failover and throttling behaviors verified via integration tests.
99
+ - [ ] `deployment-plan.json` emitted.
100
+
101
+ ## Related Skills
102
+
103
+ - **agent-model-routing**: Select cost-effective models dynamically before dispatching to the gateway
104
+ - **setup-gpu-finops**: Track token spend and GPU compute costs across infrastructure layers
105
+ - **implement-structured-outputs**: Ensure gateway preserves JSON Schema constrained decoding across routed models
106
+ - **add-telemetry-instrumentation**: Wire OpenTelemetry GenAI semantic conventions and trace propagation
107
+ - **manage-secrets**: Securely store and rotate provider API keys and gateway authentication tokens
108
+ - **system-design**: Architect high-availability LLM proxy clusters and failover topologies
@@ -1,118 +1,118 @@
1
- ---
2
- name: turnstile-spin
3
- description: Implements end-to-end Cloudflare Turnstile CAPTCHA protection — widget creation, managed siteverify Worker deployment, and frontend integration — turning a "set up Turnstile" request into a validated, working integration. Use when adding bot protection to forms or gated flows in vanilla HTML, Next.js, Astro, SvelteKit, or Hugo projects.
4
- allowed-tools: [read_file, write_file, edit_file, create_file, search_code, run_tests, run_linter, run_build, wrangler_deploy, execute_command]
5
- ---
6
-
7
- # Turnstile Spin
8
-
9
- Turns the prompt "set up Turnstile" into a working end-to-end integration: a widget, a deployed managed siteverify Worker, frontend snippets at every chosen insertion point, and a real validation pass before reporting success.
10
-
11
- You are the agent. Run the wizard below by invoking the scripts under `scripts/` and branching on their JSON output. The scripts hold the deterministic logic (API calls, retry/error handling); your job is orchestration, codebase reading, confirmation, and the frontend edits.
12
-
13
- Canonical instructions live at [`developers.cloudflare.com/turnstile/spin`](https://developers.cloudflare.com/turnstile/spin/). If the docs page and this file disagree, trust the docs page.
14
-
15
- ## When to Use
16
-
17
- - adding bot protection to a form or gated flow (login, signup, checkout)
18
- - integrating Turnstile into vanilla HTML, Next.js, Astro, SvelteKit, or Hugo
19
- - deploying a managed `siteverify` Worker and wiring server-side validation
20
- - choosing the least-intrusive widget mode for a given risk level
21
- - re-triggering the widget on token expiry or backend validation failure
22
-
23
- ## Core Rules
24
- - Do NOT write the Turnstile secret to disk. Only pass it via stdin to `wrangler secret put`.
25
- - Do NOT skip validation (Step 11).
26
- - Do NOT overwrite files without showing a diff.
27
- - Do NOT deploy a Worker to a different account than the widget was created in.
28
- - Do NOT call siteverify from the browser. Always: browser -> user's Worker -> siteverify.
29
- - Always choose the least-invasive widget mode (`non-interactive` or `invisible`) that maintains security requirements, falling back to `managed` for critical checkpoints.
30
- - Ensure that tokens are never reused; they are single-use and expire within 300 seconds. Re-trigger the Turnstile widget on any failed form submission.
31
- - **WIDGET-MODE-SELECTION**: `managed` for login/checkout/password-reset (shows interactive challenge if suspicious); `non-interactive` for medium-risk (browser telemetry only, may fail in privacy-hardened browsers); `invisible` for low-risk only (highest false-positive risk).
32
- - **TOKEN-REUSE-PREVENTION**: On backend validation failure, frontend MUST call `turnstile.reset(widgetId)` — do NOT show a generic error; user must complete a fresh challenge.
33
- - **CSP-TURNSTILE-DOMAINS**: Add Cloudflare Turnstile script domains to the site's Content Security Policy (`script-src` and `frame-src`) before deployment — missing CSP entries silently block the widget.
34
-
35
- ## Retrieval Sources
36
-
37
- | Source | How to retrieve | Use for |
38
- |--------|----------------|---------|
39
- | Turnstile docs | `https://developers.cloudflare.com/turnstile/` | Core API reference, script widget parameters |
40
-
41
- ## Suggested Process
42
- 1. Check credentials and account ID by running the auth-probe script.
43
- 2. Probe active domain settings, scans codebase layout, and present insertion plans.
44
- 3. Call api.cloudflare.com client endpoints to build the CAPTCHA widget.
45
- 4. Deploy siteverify Workers templates with wrangler.
46
- 5. Apply frontend changes and check responses via validate tool scripts.
47
- 6. Guide the integration by choosing the right widget mode and setting up token expiration handling.
48
- 7. Implement frontend listeners to reset and re-render the Turnstile widget upon backend validation failure or token expiry.
49
-
50
- ### Widget Modes, Token Handling, and Verification
51
-
52
- #### Widget Modes Selection
53
-
54
- Widget mode details (`managed`, `non-interactive`, `invisible`) and the
55
- rule-of-thumb for choosing the least-intrusive mode that satisfies the
56
- security threat model are documented in
57
- [`references/code-patterns.md`](references/code-patterns.md#widget-modes-reference).
58
- Framework-specific integration patterns (Astro, Hugo, Next.js app/pages,
59
- SvelteKit, vanilla HTML) live under `references/`.
60
-
61
- #### Token Expiry & Reuse Prevention
62
-
63
- Turnstile validation tokens are single-use to prevent replay attacks and
64
- remain valid for exactly 300 seconds (5 minutes). If validation fails on the
65
- backend, the token becomes spent. The frontend must immediately reset the
66
- widget instance rather than showing a generic submission failure. The full
67
- frontend reset pattern and the siteverify Worker template live in
68
- [`references/code-patterns.md`](references/code-patterns.md).
69
-
70
- #### Backend verify Worker Endpoint Pattern
71
-
72
- Always verify the client token server-side via a secure endpoint. Never
73
- invoke siteverify directly from the web client. The siteverify Worker
74
- implementation is in
75
- [`references/code-patterns.md`](references/code-patterns.md#backend-siteverify-worker-implementation).
76
-
77
- ## Checklist
78
- - [ ] Account and API auth are verified.
79
- - [ ] Target domain is registered for widget.
80
- - [ ] Widget is created via Turnstile API.
81
- - [ ] siteverify Worker is deployed.
82
- - [ ] Frontend form submission gates on widget success.
83
- - [ ] Widget mode (`managed`, `non-interactive`, or `invisible`) is explicitly selected based on use case constraints.
84
- - [ ] Token reuse is prevented by resetting the widget via `turnstile.reset()` on submission failure.
85
- - [ ] Token expiry (300-second window) is handled gracefully with automatic widget re-triggering.
86
-
87
- ## Output Contracts
88
-
89
- When this skill is invoked as part of a coordinated multi-role delivery, emit:
90
-
91
- - **contracts/schemas/deployment-plan.json** — Required fields: infrastructure_changes[], config_updates[], and
92
- alidation_run. Set produced_by_role to the emitting developer role.
93
-
94
- Skip emission for solo refactor work where no downstream handoff is expected.
95
-
96
- ## Failure Modes
97
-
98
- - **Secret on disk**: the Turnstile secret is written to a file or committed. Mitigation: only pass the secret via stdin to `wrangler secret put`; never write it to disk.
99
- - **Validation skipped**: a form submits without siteverify server-side check. Mitigation: require server-side validation; treat browser-side checks as untrusted.
100
- - **Cross-account deploy**: a siteverify Worker is deployed to a different Cloudflare account than the widget. Mitigation: verify the active account before deploy; reject cross-account deploys.
101
- - **Siteverify called from browser**: the browser calls siteverify directly. Mitigation: always route browser → user's Worker → siteverify; reject client-side siteverify calls.
102
- - **Token reuse**: a failed submit does not reset the widget, allowing the same token to be retried. Mitigation: call `turnstile.reset(widgetId)` on backend validation failure; require a fresh challenge.
103
- - **CSP missing**: the widget does not load because the site CSP blocks the Turnstile script. Mitigation: add `challenges.cloudflare.com` to `script-src` and `frame-src` before deploy.
104
- - **Token expired**: a token is older than 300 seconds. Mitigation: re-trigger the widget automatically on token expiry; do not retry the same token.
105
- - **Wrong widget mode**: a low-risk checkpoint uses `invisible` for a high-risk flow. Mitigation: use `managed` for login/checkout/password-reset; reserve `invisible` for low-risk only.
106
- - **Diff not shown**: a frontend file is overwritten without showing a diff. Mitigation: always show a diff before writing; never overwrite silently.
107
-
108
- ## Security Guardrails (OWASP ASI)
109
-
110
- - **ASI01 Goal Hijack**: a malicious frontend could try to bypass the widget by skipping the `cf_token` field. Mitigation: server-side validation must reject any request without a verified token.
111
- - **ASI03 Identity & Privilege Abuse**: the Turnstile secret must never reach the browser; load it only into the siteverify Worker via `wrangler secret put`.
112
- - **ASI04 Supply Chain**: the Turnstile widget script URL and the siteverify endpoint must be the canonical Cloudflare domains; reject third-party script sources.
113
- - **ASI05 RCE Guard**: never construct siteverify payloads, widget configs, or token-handling logic from external content without strict schema validation.
114
- - **ASI07 Inter-Agent Communication**: the deployment plan is consumed by Cloudflare Engineer and DevOps; emit a structured contract so each role can validate the rollout.
115
-
116
- ## Related Skills
117
- - **wrangler**: Manage deployment environments and bindings.
118
- - **debug-workers-edge**: Troubleshoot execution at the edge.
1
+ ---
2
+ name: turnstile-spin
3
+ description: Implements end-to-end Cloudflare Turnstile CAPTCHA protection — widget creation, managed siteverify Worker deployment, and frontend integration — turning a "set up Turnstile" request into a validated, working integration. Use when adding bot protection to forms or gated flows in vanilla HTML, Next.js, Astro, SvelteKit, or Hugo projects.
4
+ allowed-tools: [read_file, write_file, edit_file, create_file, search_code, run_tests, run_linter, run_build, wrangler_deploy, execute_command]
5
+ ---
6
+
7
+ # Turnstile Spin
8
+
9
+ Turns the prompt "set up Turnstile" into a working end-to-end integration: a widget, a deployed managed siteverify Worker, frontend snippets at every chosen insertion point, and a real validation pass before reporting success.
10
+
11
+ You are the agent. Run the wizard below by invoking the scripts under `scripts/` and branching on their JSON output. The scripts hold the deterministic logic (API calls, retry/error handling); your job is orchestration, codebase reading, confirmation, and the frontend edits.
12
+
13
+ Canonical instructions live at [`developers.cloudflare.com/turnstile/spin`](https://developers.cloudflare.com/turnstile/spin/). If the docs page and this file disagree, trust the docs page.
14
+
15
+ ## When to Use
16
+
17
+ - adding bot protection to a form or gated flow (login, signup, checkout)
18
+ - integrating Turnstile into vanilla HTML, Next.js, Astro, SvelteKit, or Hugo
19
+ - deploying a managed `siteverify` Worker and wiring server-side validation
20
+ - choosing the least-intrusive widget mode for a given risk level
21
+ - re-triggering the widget on token expiry or backend validation failure
22
+
23
+ ## Core Rules
24
+ - Do NOT write the Turnstile secret to disk. Only pass it via stdin to `wrangler secret put`.
25
+ - Do NOT skip validation (Step 11).
26
+ - Do NOT overwrite files without showing a diff.
27
+ - Do NOT deploy a Worker to a different account than the widget was created in.
28
+ - Do NOT call siteverify from the browser. Always: browser -> user's Worker -> siteverify.
29
+ - Always choose the least-invasive widget mode (`non-interactive` or `invisible`) that maintains security requirements, falling back to `managed` for critical checkpoints.
30
+ - Ensure that tokens are never reused; they are single-use and expire within 300 seconds. Re-trigger the Turnstile widget on any failed form submission.
31
+ - **WIDGET-MODE-SELECTION**: `managed` for login/checkout/password-reset (shows interactive challenge if suspicious); `non-interactive` for medium-risk (browser telemetry only, may fail in privacy-hardened browsers); `invisible` for low-risk only (highest false-positive risk).
32
+ - **TOKEN-REUSE-PREVENTION**: On backend validation failure, frontend MUST call `turnstile.reset(widgetId)` — do NOT show a generic error; user must complete a fresh challenge.
33
+ - **CSP-TURNSTILE-DOMAINS**: Add Cloudflare Turnstile script domains to the site's Content Security Policy (`script-src` and `frame-src`) before deployment — missing CSP entries silently block the widget.
34
+
35
+ ## Retrieval Sources
36
+
37
+ | Source | How to retrieve | Use for |
38
+ |--------|----------------|---------|
39
+ | Turnstile docs | `https://developers.cloudflare.com/turnstile/` | Core API reference, script widget parameters |
40
+
41
+ ## Suggested Process
42
+ 1. Check credentials and account ID by running the auth-probe script.
43
+ 2. Probe active domain settings, scans codebase layout, and present insertion plans.
44
+ 3. Call api.cloudflare.com client endpoints to build the CAPTCHA widget.
45
+ 4. Deploy siteverify Workers templates with wrangler.
46
+ 5. Apply frontend changes and check responses via validate tool scripts.
47
+ 6. Guide the integration by choosing the right widget mode and setting up token expiration handling.
48
+ 7. Implement frontend listeners to reset and re-render the Turnstile widget upon backend validation failure or token expiry.
49
+
50
+ ### Widget Modes, Token Handling, and Verification
51
+
52
+ #### Widget Modes Selection
53
+
54
+ Widget mode details (`managed`, `non-interactive`, `invisible`) and the
55
+ rule-of-thumb for choosing the least-intrusive mode that satisfies the
56
+ security threat model are documented in
57
+ [`references/code-patterns.md`](references/code-patterns.md#widget-modes-reference).
58
+ Framework-specific integration patterns (Astro, Hugo, Next.js app/pages,
59
+ SvelteKit, vanilla HTML) live under `references/`.
60
+
61
+ #### Token Expiry & Reuse Prevention
62
+
63
+ Turnstile validation tokens are single-use to prevent replay attacks and
64
+ remain valid for exactly 300 seconds (5 minutes). If validation fails on the
65
+ backend, the token becomes spent. The frontend must immediately reset the
66
+ widget instance rather than showing a generic submission failure. The full
67
+ frontend reset pattern and the siteverify Worker template live in
68
+ [`references/code-patterns.md`](references/code-patterns.md).
69
+
70
+ #### Backend verify Worker Endpoint Pattern
71
+
72
+ Always verify the client token server-side via a secure endpoint. Never
73
+ invoke siteverify directly from the web client. The siteverify Worker
74
+ implementation is in
75
+ [`references/code-patterns.md`](references/code-patterns.md#backend-siteverify-worker-implementation).
76
+
77
+ ## Checklist
78
+ - [ ] Account and API auth are verified.
79
+ - [ ] Target domain is registered for widget.
80
+ - [ ] Widget is created via Turnstile API.
81
+ - [ ] siteverify Worker is deployed.
82
+ - [ ] Frontend form submission gates on widget success.
83
+ - [ ] Widget mode (`managed`, `non-interactive`, or `invisible`) is explicitly selected based on use case constraints.
84
+ - [ ] Token reuse is prevented by resetting the widget via `turnstile.reset()` on submission failure.
85
+ - [ ] Token expiry (300-second window) is handled gracefully with automatic widget re-triggering.
86
+
87
+ ## Output Contracts
88
+
89
+ When this skill is invoked as part of a coordinated multi-role delivery, emit:
90
+
91
+ - **contracts/schemas/deployment-plan.json** — Required fields: infrastructure_changes[], config_updates[], and
92
+ alidation_run. Set produced_by_role to the emitting developer role.
93
+
94
+ Skip emission for solo refactor work where no downstream handoff is expected.
95
+
96
+ ## Failure Modes
97
+
98
+ - **Secret on disk**: the Turnstile secret is written to a file or committed. Mitigation: only pass the secret via stdin to `wrangler secret put`; never write it to disk.
99
+ - **Validation skipped**: a form submits without siteverify server-side check. Mitigation: require server-side validation; treat browser-side checks as untrusted.
100
+ - **Cross-account deploy**: a siteverify Worker is deployed to a different Cloudflare account than the widget. Mitigation: verify the active account before deploy; reject cross-account deploys.
101
+ - **Siteverify called from browser**: the browser calls siteverify directly. Mitigation: always route browser → user's Worker → siteverify; reject client-side siteverify calls.
102
+ - **Token reuse**: a failed submit does not reset the widget, allowing the same token to be retried. Mitigation: call `turnstile.reset(widgetId)` on backend validation failure; require a fresh challenge.
103
+ - **CSP missing**: the widget does not load because the site CSP blocks the Turnstile script. Mitigation: add `challenges.cloudflare.com` to `script-src` and `frame-src` before deploy.
104
+ - **Token expired**: a token is older than 300 seconds. Mitigation: re-trigger the widget automatically on token expiry; do not retry the same token.
105
+ - **Wrong widget mode**: a low-risk checkpoint uses `invisible` for a high-risk flow. Mitigation: use `managed` for login/checkout/password-reset; reserve `invisible` for low-risk only.
106
+ - **Diff not shown**: a frontend file is overwritten without showing a diff. Mitigation: always show a diff before writing; never overwrite silently.
107
+
108
+ ## Security Guardrails (OWASP ASI)
109
+
110
+ - **ASI01 Goal Hijack**: a malicious frontend could try to bypass the widget by skipping the `cf_token` field. Mitigation: server-side validation must reject any request without a verified token.
111
+ - **ASI03 Identity & Privilege Abuse**: the Turnstile secret must never reach the browser; load it only into the siteverify Worker via `wrangler secret put`.
112
+ - **ASI04 Supply Chain**: the Turnstile widget script URL and the siteverify endpoint must be the canonical Cloudflare domains; reject third-party script sources.
113
+ - **ASI05 RCE Guard**: never construct siteverify payloads, widget configs, or token-handling logic from external content without strict schema validation.
114
+ - **ASI07 Inter-Agent Communication**: the deployment plan is consumed by Cloudflare Engineer and DevOps; emit a structured contract so each role can validate the rollout.
115
+
116
+ ## Related Skills
117
+ - **wrangler**: Manage deployment environments and bindings.
118
+ - **debug-workers-edge**: Troubleshoot execution at the edge.