Token导航 LogoToken导航TokenDH.com
开发敏感数据github未标认证来源可访问许可证需确认审计异常

trafficaltraffical 命令行

Agent Skill

traffical 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

309

周安装

13

GitHub Stars

公开资料未说明

下载量

108
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:traffical(traffical 命令行)
来源仓库:https://github.com/traffical/skills
仓库路径:skills/traffical
安装命令:
npx skills add https://github.com/traffical/skills --skill traffical
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/traffical/skills --skill traffical

简介

用于 GitHub 仓库状态跟踪与协作流程管理,帮助开发者快速掌握项目动态。

  • 可获取 Issue、PR 更新及提交历史,辅助任务分配与进度同步。
  • 通过 npx 命令直接安装并使用,无需复杂配置即可接入现有工作流。
  • 执行时需绑定有效 GitHub token,确保有权限访问目标仓库信息。
  • 注意频繁调用可能受 API 速率限制,建议合理控制查询频率。

SKILL.md

Traffical

Traffical is a parameter-first experimentation and optimization platform. It unifies feature flags, A/B testing, and contextual bandits into a single system. SDKs resolve parameters locally at the edge — no per-request API calls, sub-millisecond latency, works offline.

Mental Model

Traffical is parameter-first. You define parameters with defaults, and Traffical handles the rest.

┌─────────────────────────────────────────────────────────────────────┐
│  Your Code                                                          │
│                                                                     │
│  1. Define parameters with defaults                                 │
│  2. Use the resolved values                                         │
│  3. Track events on conversion                                      │
└─────────────────────────────────────────────────────────────────────┘
                              ▲
                              │  (hidden from you)
                              ▼
┌─────────────────────────────────────────────────────────────────────┐
│  Traffical                                                          │
│                                                                     │
│  • Layers & policies for mutual exclusivity                         │
│  • Bucket assignment & deterministic hashing                        │
│  • Thompson Sampling & contextual bandits                           │
│  • Statistical analysis & optimization                              │
└─────────────────────────────────────────────────────────────────────┘

Key insights:

  1. Parameters, Not Experiments — You define parameters with defaults. Experiments, feature flags, and optimizations are policies that control parameter assignment. Your code doesn't need to know which.
  2. Resolution Is Local — The SDK fetches a config bundle once and caches it. Every resolution call is synchronous from cache — no network latency, no render flicker.
  3. Decisions Are Tracked Automatically — When you call useTraffical() or decide(), a decision event is automatically sent to Traffical (enabled by default via trackDecisions: true). This connects parameter resolution to conversion events for intent-to-treat analysis. No manual setup needed.
  4. Track Events for Learning — Call track() when valuable actions happen (purchase, signup, etc.). Traffical uses this data for adaptive optimization.

When to Use Traffical

ScenarioAction
Adding a new featureWrap in feature flag for gradual rollout
Changing existing UIA/B test against current implementation
Modifying conversion pathsExperiment with success metrics
Updating algorithms/logicTest impact before full rollout
Anything affecting revenueAlways experiment first

Recommended Workflow

Always use the Traffical CLI to manage parameters. The CLI is the primary tool for setting up and syncing configuration. Do not skip it.

  1. Initialize — Run npx @traffical/cli init --api-key <management-key> --framework <name> --yes to set up the project non-interactively (or check for an existing .traffical/ directory). The user must provide a Management Key or Full Access key from the dashboard. Always pass --framework and --yes to avoid interactive prompts.
  2. Define parameters — Add parameters and events to .traffical/config.yaml
  3. Sync — Run npx @traffical/cli push to sync parameters to the Traffical platform
  4. Install SDK — Add the appropriate SDK package to your project
  5. Use in code — Resolve parameters and track events using the SDK
  6. Verify — Run npx @traffical/cli status to confirm everything is in sync

The Traffical CLI

The CLI (@traffical/cli) is how you initialize projects, define parameters, and keep local config in sync with the Traffical platform. You can run it via npx (no global install required):

npx @traffical/cli <command>

Or install globally for shorter commands:

npm install -g @traffical/cli
traffical <command>

Check for existing setup

Look for a .traffical/ directory or traffical.yaml in the project root. If it exists, the project is already initialized — check the config for existing parameters before creating new ones.

Initialize a new project

If no .traffical/ directory exists, initialize Traffical:

Important: The --api-key flag requires a real Management Key or Full Access key. Never fabricate or guess API keys. If no key is available in environment variables (TRAFFICAL_API_KEY) or ~/.trafficalrc, ask the user to provide one from https://app.traffical.io/settings/api-keys.
# Basic init (will auto-detect framework and prompt if needed):
npx @traffical/cli init --api-key <management-key>

# Fully non-interactive init (recommended for AI agents and CI/CD):
npx @traffical/cli init --api-key <management-key> --framework react --yes

Available flags for init:

FlagDescription
--api-key <key>Management or Full Access key (falls back to TRAFFICAL_API_KEY env var or ~/.trafficalrc)
--framework <name>Skip framework detection. Values: react, nextjs, svelte, sveltekit, vue, nuxt, node
--project <id>Use a specific project (skips project selection prompt, useful with org-scoped keys)
-y, --yesAuto-accept all detected defaults — no interactive prompts
--no-sdk-keySkip automatic SDK key creation
For AI agents: Always pass --framework and --yes to avoid interactive prompts that will hang in non-TTY environments.

This creates:

.traffical/
├── config.yaml      # Parameter and event definitions (committed)
├── .env             # TRAFFICAL_API_KEY=... (gitignored, auto-generated SDK key)
├── .gitignore       # Ensures .env is never committed
├── AGENTS.md        # AI agent integration guide (project-specific)
└── TEMPLATES.md     # Framework-specific code templates

The CLI auto-detects your framework (React, Next.js, Svelte, SvelteKit, Vue, Nuxt, Node.js) and generates appropriate templates. Existing synced parameters and events are imported into config.yaml automatically.

After init, add TRAFFICAL_API_KEY from .traffical/.env to your project's .env or hosting environment for runtime SDK use. The auto-generated key has sdk:read and sdk:write scopes — just enough for parameter resolution and event tracking.

Managing parameters with the CLI

After initialization, use the CLI to keep local config and the Traffical platform in sync:

# After adding or modifying parameters in config.yaml — push to platform
npx @traffical/cli push

# Before writing code — check what parameters exist and their sync status
npx @traffical/cli status

# Pull latest parameters from the platform into local config
npx @traffical/cli pull

# Bidirectional sync (local wins for conflicts)
npx @traffical/cli sync

# Import specific parameters from the dashboard (supports wildcards)
npx @traffical/cli import "ui.*"

# Validate config without pushing (dry run)
npx @traffical/cli push --dry-run

Always run npx @traffical/cli push after modifying .traffical/config.yaml. This syncs your changes to the platform and prevents drift.

Authentication

Traffical uses different API key types for different purposes:

Key TypePrefixPurposeScopes
SDK Keytraffical_sk_*Runtime SDKs — fetch config, send eventssdk:read, sdk:write
Management Keytraffical_sk_*CLI, CI/CD — create/modify entities, push/pull/syncmgmt:read, mgmt:write
Full Access Keytraffical_sk_*Administrative — all operationssdk:*, mgmt:*, admin

How init handles keys

  1. You provide a Management Key (or Full Access key) via --api-key or ~/.trafficalrc
  2. The CLI authenticates and selects org/project
  3. The CLI auto-creates a project-scoped SDK key via the API and saves it to .traffical/.env
  4. The .traffical/.gitignore is created/updated to ensure .env is never committed

This means:

  • The Management Key stays in ~/.trafficalrc (for CLI operations like push/pull/sync)
  • The SDK Key goes into .traffical/.env (for runtime use in your app)
  • Only the least-privileged key (SDK) is used at runtime — no risk of leaking management access

SDK key location

The SDK key auto-generated by init is stored in:

.traffical/.env
# Contains: TRAFFICAL_API_KEY=traffical_sk_...

Copy this value to your project's .env or hosting environment variables for your SDK to use at runtime.

SDK configuration values

After traffical init, the .traffical/config.yaml contains project.id and project.orgId. Use these values (along with an env like "production") when initializing the SDK. The SDK key is in .traffical/.env as TRAFFICAL_API_KEY.

Install an SDK

PackageUse case
@traffical/reactReact and Next.js apps
@traffical/svelteSvelte and SvelteKit apps
@traffical/nodeServer-side Node.js (Express, Fastify, etc.)
@traffical/js-clientAny browser environment
# Pick the one matching your framework
npm install @traffical/react
# or
npm install @traffical/svelte
# or
npm install @traffical/node

SDK Usage

React / Next.js

Provider setup (wrap your app once):

import { TrafficalProvider } from "@traffical/react";

function App() {
  return (
    <TrafficalProvider
      config={{
        orgId: "org_xxx",
        projectId: "proj_xxx",
        env: "production",
        apiKey: "pk_live_your_public_key",
      }}
      // Optional: provide unitKeyFn for logged-in users
      // unitKeyFn: () => currentUser.id,
    >
      <MyApp />
    </TrafficalProvider>
  );
}

Use in components:

import { useTraffical } from "@traffical/react";

function CheckoutButton() {
  const { params, track } = useTraffical({
    defaults: {
      "checkout.button.color": "#1E6EFB",
      "checkout.button.label": "Buy now",
    },
  });

  return (
    <button
      style={{ backgroundColor: params["checkout.button.color"] }}
      onClick={() => track("checkout_click")}
    >
      {params["checkout.button.label"]}
    </button>
  );
}

Svelte / SvelteKit

Layout setup:

<!-- src/routes/+layout.svelte -->
<script>
  import { setTrafficalContext } from "@traffical/svelte";

  setTrafficalContext({
    orgId: "org_xxx",
    projectId: "proj_xxx",
    env: "production",
    apiKey: "pk_live_your_public_key",
    context: { userId: data.user?.id ?? "anonymous" },
  });
</script>

<slot />

Use in components (params and track are Svelte stores — use $ prefix):

<script>
  import { getTraffical } from "@traffical/svelte";

  const { params, track } = getTraffical({
    defaults: {
      "checkout.button.color": "#1E6EFB",
      "checkout.button.label": "Buy now",
    },
  });
</script>

<button
  style="background-color: {$params['checkout.button.color']}"
  on:click={() => $track("checkout_click")}
>
  {$params["checkout.button.label"]}
</button>

Node.js (Server-side)

import { createTrafficalClient } from "@traffical/node";

const traffical = await createTrafficalClient({
  orgId: "org_xxx",        // from .traffical/config.yaml
  projectId: "proj_xxx",   // from .traffical/config.yaml
  env: "production",
  apiKey: process.env.TRAFFICAL_API_KEY!,  // from .traffical/.env
});

// Resolve parameters (synchronous, from cached bundle)
const params = traffical.getParams({
  context: { userId: "user_789", locale: "en-US" },
  defaults: {
    "checkout.button.color": "#1E6EFB",
    "pricing.discount_pct": 0,
  },
});

// Track events (value goes in properties, unitKey in options)
traffical.track("purchase", { value: 49.99 }, { unitKey: "user_789" });

Node.js (CLI / Scripts)

For non-web contexts like CLI tools, batch jobs, or scripts, you can use @traffical/node without a web server. Use a machine or job identifier instead of a user ID:

import { createTrafficalClient } from "@traffical/node";

const traffical = await createTrafficalClient({
  orgId: "org_xxx",        // from .traffical/config.yaml
  projectId: "proj_xxx",   // from .traffical/config.yaml
  env: "production",
  apiKey: process.env.TRAFFICAL_API_KEY!,
});

const params = traffical.getParams({
  context: { unitKey: "batch-job" },
  defaults: {
    "feature.new_algorithm": false,
    "processing.batch_size": 100,
  },
});

if (params["feature.new_algorithm"]) {
  // Use new algorithm
}

track() API

The track() signature differs between client-side and server-side SDKs:

  • React/Svelte (client-side): track(event, properties?) — The decisionId and unitKey are automatically bound from the provider context. Just call track("purchase", {value: 49.99}).
  • Node.js (server-side): track(event, properties?, options?) — You must provide unitKey in the third argument: traffical.track("purchase", {value: 49.99}, {unitKey: userId}). Optionally pass decisionId for explicit attribution.

Config-as-Code

Parameters and events are defined in .traffical/config.yaml (or traffical.yaml). This file is the source of truth — version-control it alongside your code.

version: "1.0"
project:
  id: proj_xxx
  orgId: org_xxx

parameters:
  checkout.button.color:
    type: string
    default: "#1E6EFB"
    description: Primary CTA button color

  checkout.show_trust_badges:
    type: boolean
    default: false

  pricing.discount_pct:
    type: number
    default: 0

events:
  purchase:
    valueType: currency
    unit: USD
    description: User completes a purchase

  add_to_cart:
    valueType: count
    description: User adds item to cart

Parameter types

TypeUse case
stringColors, labels, URLs, template names
numberPrices, percentages, thresholds, timeouts
booleanFeature flags, simple toggles
jsonStructured config (multiple related settings)

Event value types

Value TypeUse case
currencyMonetary values (revenue, order value)
countNumeric counts (clicks, items, views)
ratePercentages or ratios
booleanBinary events (happened or not)

Adding events to config.yaml

Define events in the events: block of .traffical/config.yaml:

events:
  purchase:
    valueType: currency
    unit: USD
    description: User completes a purchase

  signup:
    valueType: boolean
    description: User creates an account

  page_view:
    valueType: count
    description: User views a page

Each event has:

  • valueType (required): currency, count, rate, or boolean
  • unit (optional): unit label for currency events (e.g., USD, EUR)
  • description (optional but recommended): human-readable explanation

After adding events, run npx @traffical/cli push to sync them to the platform.

Events discovered at runtime (via track() calls) will appear in the dashboard even without config definitions, but defining them in config gives you descriptions, value types, and keeps the config file as the source of truth.

Namespaces

Namespaces are optional organizational groupings for parameters. They help organize parameters in the dashboard but do not affect how you use them in code.

parameters:
  bookmarks.max_stored:
    type: number
    default: 100
    namespace: bookmarks   # optional organizational grouping
    description: Maximum bookmarks per user
  • The "main" namespace is the default and is omitted from config
  • When parameters are imported from the dashboard (via npx @traffical/cli pull or during init), they may include namespace: <name> — this is normal
  • Namespace is independent of dot-notation naming (e.g., bookmarks.max_stored can be in namespace bookmarks, but this is a convention, not enforced)
  • You do not need to specify a namespace when creating new parameters — they will use the default namespace

Parameter Naming Conventions

Use dot notation: category.subcategory.name

CategoryExamplesUse case
feature.*feature.new_checkout, feature.dark_modeFeature flags (boolean)
ui.*ui.cta.text, ui.hero.variantVisual variations
pricing.*pricing.discount, pricing.tier_multiplierPricing experiments
copy.*copy.headline, copy.cta_textCopywriting tests
experiment.*experiment.checkout.variantExplicit variant names

Best Practices

  1. Always use the CLI — Run npx @traffical/cli push after editing config. Run npx @traffical/cli status to check sync state. Never skip the CLI — it is the bridge between your config files and the Traffical platform.
  2. Check existing parameters first — Look in .traffical/config.yaml (or traffical.yaml) before creating new ones. Run npx @traffical/cli status to see what's already defined. Reuse existing parameters where possible.
  3. Define parameters in config, then push — Add new parameters to .traffical/config.yaml and run npx @traffical/cli push to sync them. This keeps the config file as the source of truth and prevents drift with the dashboard.
  4. Always provide in-code defaults — Defaults appear in two places: in config.yaml (the source of truth for the dashboard and experiment setup) and in your getParams()/useTraffical() calls (the offline fallback). In-code defaults are what the SDK returns when the config bundle hasn't loaded yet or is unreachable. The bundle's resolved value always takes precedence when available.
  5. Track events at conversion points — Call track() on purchases, signups, and other valuable actions. This enables adaptive optimization.
  6. Group related parameters — Keep correlated params in one useTraffical() / getTraffical() / getParams() call for proper attribution.
  7. Use meaningful param names — Follow dot notation: category.subcategory.name. Be descriptive.

What You Don't Need to Know

These are internal concepts handled by Traffical automatically:

  • Layers, policies, allocations — Experiment infrastructure is managed in the dashboard
  • Bucket assignment and hashing — Deterministic user assignment happens automatically
  • Whether an A/B test vs. optimization is running — Your code is the same either way
  • Statistical significance calculations — Traffical handles analysis in the background
  • Decision deduplication — Multiple resolution calls are handled efficiently

Just parametrize your app, track conversions, and let Traffical handle the rest.

Documentation

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

31.95%
按下载量换算35

Claude

29.69%
按下载量换算32

Cursor

20.61%
按下载量换算22

Gemini CLI

9.2%
按下载量换算10

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

未通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills