workflow-management
БесплатноБез исполняемых скриптовНе проверенCreate, debug, or modify Vercel WDK workflows for data updates and social media posting in the web application. Use when adding new automated jobs, fixing…
от motormetrics★ 22 звезды на GitHubОб этом скилле
Workflow Management Skill
This skill helps you work with Vercel WDK (Workflow Development Kit) workflows in apps/web/src/workflows/.
When to Use This Skill
- Adding new scheduled workflows for data fetching
- Debugging workflow execution errors
- Modifying existing workflow schedules or logic
- Integrating new data sources into the update pipeline
- Adding new social media posting workflows
Workflow Architecture
The project uses Vercel WDK workflows with the following structure:
apps/web/src/workflows/
├── cars.ts # Car registration data workflow
├── coe.ts # COE bidding data workflow
├── deregistrations.ts # Deregistration data workflow
├── regenerate-post.ts # Blog post regeneration workflow
└── shared.ts # Shared workflow steps (social media, cache)
Key Patterns
1. Workflow Definition
Workflows are defined using Vercel WDK directives:
import { fetch } from "workflow";
export async function carsWorkflow(payload: CarsWorkflowPayload) {
"use workflow";
// Enable WDK's durable fetch for AI SDK
globalThis.fetch = fetch;
// Step 1: Process data
const result = await processCarsData();
// Step 2: Revalidate cache
await revalidateCarsCache(month, year);
// Step 3: Generate blog post
const post = await generateCarsPost(data, month);
return { postId: post.postId };
}
async function processCarsData(): Promise<UpdaterResult> {
"use step";
// Processing logic - each step is durable and can retry
return await updateCars();
}
2. Scheduling Workflows
Workflows are triggered via Vercel Cron schedules configured in apps/web/vercel.json:
{
"crons": [
{ "path": "/api/workflows/cars", "schedule": "0 10 * * *" },
{ "path": "/api/workflows/coe", "schedule": "0 10 * * *" },
{ "path": "/api/workflows/deregistrations", "schedule": "0 10 * * *" }
]
}
3. API Route Integration
API routes trigger workflows using WDK's start() function:
import { start } from "workflow/api";
import { carsWorkflow } from "@web/workflows/cars";
export async function POST(request: Request) {
const payload = await request.json();
const run = await start(carsWorkflow, [payload]);
return Response.json({ message: "Workflow started", runId: run.runId });
}
4. Shared Steps
Common operations are extracted to shared.ts:
export async function publishToSocialMedia(title: string, link: string) {
"use step";
await socialMediaManager.publishToAll({ message: `📰 ${title}`, link });
}
export async function revalidatePostsCache() {
"use step";
revalidateTag("posts:list", "max");
}
5. Error Handling
Steps automatically retry on failure. For custom error handling:
async function processData() {
"use step";
try {
const result = await updateData();
return result;
} catch (error) {
console.error("Step failed:", error);
throw error; // Re-throw for automatic retry
}
}
Common Tasks
Adding a New Workflow
- Create workflow file in
apps/web/src/workflows/ - Define workflow function with
"use workflow"directive - Break logic into steps using
"use step"directive - Create API route in
apps/web/src/app/api/workflows/ - Add Vercel Cron schedule if needed in
vercel.json - Add tests for workflow logic
Debugging Workflow Failures
- Check Vercel dashboard for workflow execution logs
- Review function logs in Vercel
- Verify environment variables are set correctly
- Test workflow locally using development server
- Check database connectivity and Redis availability
Modifying Existing Workflows
- Read existing workflow implementation
- Identify which step needs modification
- Update step logic while maintaining error handling
- Test changes locally
- Deploy and monitor execution
Environment Variables
Workflows typically need:
DATABASE_URL- PostgreSQL connectionUPSTASH_REDIS_REST_URL/UPSTASH_REDIS_REST_TOKEN- Redis- Service-specific tokens (Discord webhook, Twitter API, etc.)
Testing Workflows
Run workflow tests:
pnpm -F @sgcarstrends/web test -- src/workflows
Test individual workflow locally:
# Start dev server
pnpm dev
# Trigger workflow via HTTP
curl -X POST http://localhost:3000/api/workflows/cars
References
- Vercel WDK Documentation: https://vercel.com/docs/workflow-kit
- Related files:
apps/web/src/app/api/workflows/- Workflow route handlersapps/web/src/config/platforms.ts- Social media configurationapps/web/vercel.json- Vercel Cron schedulesapps/web/AGENTS.md- Web application documentation
Best Practices
- Idempotency: Ensure workflows can safely retry without duplicating data
- Step Granularity: Break workflows into small, focused steps with
"use step" - Durable Fetch: Set
globalThis.fetch = fetchfor AI SDK calls - Logging: Add comprehensive
Установить workflow-management в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadEditWriteBashGrepGlobFAQ
Что делает скилл workflow-management?
Create, debug, or modify Vercel WDK workflows for data updates and social media posting in the web application. Use when adding new automated jobs, fixing workflow errors, or updating scheduling logic.
Как установить скилл workflow-management?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл workflow-management запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic