Communitygithub.com

后端权威运行时重构技能

重构应用,使后端拥有运行时真相,UI 仅投射快照。当工具之间出现权限分裂时,使用此技能。不适用于纯 UI 美化工作或在消除分裂之前添加新功能。

后端权威运行时重构技能 是什么?

该技能专注于解决后端与前端之间出现“权限分裂”的架构问题——即 UI 能够独立合成或缓存运行时状态(如执行图、节点类型、阶段状态或 provider 层级),而后端并不知情。它提供了一套系统化的重构方法,首先需要盘点所有 UI 发明运行时真相的地方,然后将用户交互严格划分为命令、查询和事件三类,并冻结接口契约。接着,通过将运行时所有权(如图结构、执行阶段、provider 归一化)迁移到后端,并将 UI 降级为后端快照的纯投射端,从而消除分裂。该技能支持所有需要后端权威的软件平台,尤其是那些具有复杂工作流编辑器、审批流或多层运行时映射的工具(如 Tauri 应用)。它不适用于纯粹的后端性能优化(当架构已有一个真相源时),也不适用于在修复分裂之前添加新业务功能。最终目标是实现:重新启动或重新连接后,UI 仅凭后端快照和事件重放即可重建完全相同的可见状态,从而确保执行可审计、可重放且对前端缓存不可知。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/curiositech/windags-skills/tree/HEAD/skills/backend-authoritative-runtime-refactor

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

后端权威运行时重构

仅当你能准确说明执行真相位于何处以及 UI 如何读取它时,才进行重构。

何时使用

  • UI 合成后端不理解的关系图、阶段或 provider 选择。
  • 重新启动或重新连接会改变可见运行时状态,因为前端缓存了权限。
  • 新旧模式、启动器格式或节点类型在活跃的创作路径中并存。
  • 审批、审查或下游执行依赖于仅前端重建。

不适用于

  • 纯视觉清理且运行时所有权无变化。
  • 后端契约已经是权威的独立组件重构。
  • 在删除权限分裂的接缝之前,交付新的业务功能。
  • 架构已有一个真相源的纯后端性能优化。

决策点

flowchart TD
  A[工作流重构请求] --> B{UI 是否仍能发明运行时真相?}
  B -->|否| C[使用更狭窄的领域或 UI 技能]
  B -->|是| D[盘点命令、查询和事件的接缝]
  D --> E{是否每个用户操作都能映射到命令、查询或事件?}
  E -->|否| F[在特性开发前冻结契约]
  E -->|是| G[将投射状态与后端拥有状态分离]
  G --> H{是否还有遗留兼容路径活跃?}
  H -->|是| I[将它们移到迁移边缘或删除]
  H -->|否| J[添加评估器、重放安全启动查询和事件订阅]
  I --> J
  J --> K[验证重连、审批和下游就绪状态]

请首先使用此路由模型:

  • 如果 UI 不能描述为 命令 -> 后端转移 -> 查询或事件投射,则接缝仍然是错误的。
  • 如果“临时兼容”路径位于热点路径中,将其视为重构债务,而非特性。
  • 如果重新启动或重新连接无法仅从后端真相重建可见状态,则重构尚未完成。

工作方法

1. 盘点分裂的“双脑”

找出所有 UI 执行以下操作的地方:

  • 生成或变更执行真相
  • 发明后端不知道的阶段
  • 在活跃代码路径中模拟执行
  • 在同一创作路径中保留新旧模式
  • 混合抽象路由层级和精确 provider ID

2. 冻结契约

仅定义三类:

  • 命令:启动、停止、批准、恢复、变更
  • 查询:启动状态、审查负载、执行快照、provider 健康
  • 事件:权威转移、评估器判定、门状态、重放标记

如果 UI 操作不能表示为其中之一,则架构仍然模糊不清。

3. 规范化状态所有权

将存储分离为:

  • 契约输入状态
  • 后端快照投射状态
  • UI 布局状态

不要让任何存储同时拥有运行时真相和布局关注点。

4. 删除活跃的兼容接缝

优先删除,而非“暂时支持两者”。

典型删除项:

  • 活跃创作中的单数和复数模式兼容性
  • 活跃桌面运行时中的浏览器或演示模拟
  • 主路径中的弃用节点类型
  • 重复的审查摘要
  • 多种启动器或导入格式

5. 在信任重构之前添加评估器

每个实现节点应有:

  • 本地输出评估器,用于正确性
  • 下游就绪评估器,用于契约安全性
  • 重新启动或重新连接路径,从后端真相而非前端猜测中恢复

失败模式

伪装成权威的投射

症状:UI 看起来“只读”,但悄悄地在本地组合阶段、关系图或 provider 真相。

修复:将该逻辑移到后端命令或查询中,并将前端视为投射器。

兼容接缝钙化

症状:“暂时支持两者”在热点路径中停留数周,最终成为实际架构。

修复:将兼容性推至单向迁移边缘,并明确删除日期,或立即删除。

不可检查的审批

症状:人类可以批准他们无法检查的工作,因为审查负载是部分或前端合成的。

修复:后端必须发出精确的审查负载;UI 仅渲染它。

对重放敌意的启动

症状:重新启动应用会改变可见状态或丢失门位置,因为前端缓存了权限。

修复:启动必须是对后端真相的查询加上事件重放,而不是存储重建。

识别语

如果重新启动应用在没有任何新后端事件的情况下改变了可见运行时状态,则权限仍然是分裂的。

工作示例

具有前端拥有的阶段逻辑的 Tauri 工作流编辑器

问题:

  • React 存储创作了关系图、推断阶段状态和归一化 provider 层级。
  • 后端执行使用不同的契约,因此审查和重启流程发生漂移。

重构路径:

  1. 盘点每个 UI 发明执行真相的地方。
  2. 将运行时交互压缩为命令、查询和事件。
  3. 将 provider 归一层级和阶段转换移至后端命令之后。
  4. 从活跃创作路径中删除启动器格式联合体。
  5. 添加评估器门,使下游工作仅从后端验证的输出继续进行。

成功条件:

  • 重新启动时,UI 从后端快照加上事件重建相同的可见状态。
  • 审批屏幕渲染后端发出的审查负载,而非 React 重组。

分支指导

在工作能清晰分离时进行分支:

  • 契约分支:盘点权限分裂接缝,并定义命令、查询和事件。
  • 删除分支:移除兼容层、弃用节点类型和启动器格式联合体。
  • 验证分支:添加评估器门、重放测试以及重新启动或重连覆盖。

保持最终所有权决策在父分支中,以便一个角色决定后端真正拥有什么。

质量门禁

  • UI 无法在本地伪造关系图、阶段、provider 或门真相。
  • 每个用户操作都映射到命令、查询或事件。
  • 运行时状态仅凭后端真相即可在重新启动和重连后存活。
  • 审查和审批负载由后端发出并由 UI 渲染。
  • 兼容逻辑仅存在于迁移边缘,不在活跃路径中。
  • 下游执行在上游契约失败时停止。
  • 准确的 provider ID 和模型选择在契约边界可见。
  • 测试覆盖重新启动、重连、审批和评估器失败路径。

参考地图

  • references/architecture-patterns.md — 后端拥有的工作流契约模式和状态所有权分裂。
  • references/windags-lessons.md — 来自真实权限分裂运行时迁移的具体经验教训。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

curiositech/windags-skills

Expert in 2000s-era music visualization (Milkdrop, AVS, Geiss) and modern WebGL implementations. Specializes in Butterchurn integration, Web Audio API AnalyserNode FFT data, GLSL shaders for audio-reactive visuals, and psychedelic generative art. Activate on "Milkdrop", "music visualization", "WebGL visualizer", "Butterchurn", "audio reactive", "FFT visualization", "spectrum analyzer". NOT for simple bar charts/waveforms (use basic canvas), video editing, or non-audio visuals.

curiositech/windags-skills

Expert legal research agent for finding and scraping expungement data state by state. Knows authoritative sources, URL patterns, Firecrawl configuration, and 2026 legal landscape.

curiositech/windags-skills

Expert in 3D computer vision labeling tools, workflows, and AI-assisted annotation for LiDAR, point clouds, and sensor fusion. Covers SAM4D/Point-SAM, human-in-the-loop architectures, and vertical-specific training strategies. Activate on '3D labeling', 'point cloud annotation', 'LiDAR labeling', 'SAM 3D', 'SAM4D', 'sensor fusion annotation', '3D bounding box', 'semantic segmentation point cloud'. NOT for 2D image labeling (use clip-aware-embeddings), general ML training (use ml-engineer), video annotation without 3D (use computer-vision-pipeline), or VLM prompt engineering (use prompt-engineer).

curiositech/windags-skills

Implement WCAG 2.2 AA/AAA compliance with automated testing, keyboard navigation, screen reader support, and focus management. Activate on: accessibility audit, WCAG compliance, keyboard navigation, screen reader, aria attributes, axe-core, focus trap. NOT for: design-level accessibility review (use design-accessibility-auditor), color contrast only (use css-in-js-architect).

curiositech/windags-skills

Time-blind friendly planning, executive function support, and daily structure for ADHD brains. Specializes in realistic time estimation, dopamine-aware task design, and building systems that actually work for neurodivergent minds.

curiositech/windags-skills

Designs digital experiences for ADHD brains using neuroscience research and UX principles. Expert in reducing cognitive load, time blindness solutions, dopamine-driven engagement, and compassionate design patterns. Activate on 'ADHD design', 'cognitive load', 'accessibility', 'neurodivergent UX', 'time blindness', 'dopamine-driven', 'executive function'. NOT for general accessibility (WCAG only), neurotypical UX design, or simple UI styling without ADHD context.

curiositech/windags-skills

>- Apply crisis decision-making research to agent routing, uncertainty triage, and coordination failure analysis in time-pressured systems. Use when diagnosing handoff failures, analytical paralysis, or expert judgment under incomplete information. NOT for routine coding, simple CRUD design, or static single-agent tasks with complete information.

curiositech/windags-skills

Extend and modify the admin dashboard, developer portal, and operations console. Use when adding new admin tabs, metrics, monitoring features, or internal tools. Activates for dashboard development, analytics, user management, and internal tooling.

curiositech/windags-skills

Conversation patterns and interaction protocols for multi-agent systems. Covers request/response, pub/sub, blackboard, delegation chains, debate, critique, consensus, fan-out/fan-in, supervisor-worker, and peer negotiation. Deep analysis of AutoGen conversation patterns, CrewAI delegation, LangGraph state passing, and FIPA-ACL performatives. Teaches how to design what agents say to each other and in what order. Activate on: "agent conversation", "agent protocol", "multi-agent debate", "agent delegation", "supervisor worker pattern", "agent voting", "consensus protocol", "fan-out fan-in", "agent negotiation", "blackboard pattern", "agent dialogue", "conversation topology", "agent handoff". NOT for: wire format or serialization (use agent-interchange-formats), orchestration infrastructure (use agentic-infrastructure-2026), single agent behavior (use agentic-patterns).

curiositech/windags-skills

Meta-agent for creating new custom agents, skills, and MCP integrations. Expert in agent design, MCP development, skill architecture, and rapid prototyping. Activate on 'create agent', 'new skill', 'MCP server', 'custom tool', 'agent design'. NOT for using existing agents (invoke them directly), general coding (use language-specific skills), or infrastructure setup (use deployment-engineer).

curiositech/windags-skills

AI-powered calendar management and agent-based scheduling coordination. Covers calendar APIs (Google Calendar, CalDAV/iCal), AI scheduling assistants (Reclaim, Clockwise, Motion, Cal.com), building custom calendar agents with MCP, multi-calendar merging, timezone management, focus block protection, meeting fatigue detection, and agent-to-agent meeting negotiation protocols. Activate on: "calendar agent", "AI scheduling", "calendar coordination", "meeting scheduling", "calendar API", "focus time protection", "calendar optimization", "Google Calendar MCP", "Reclaim", "Clockwise", "Motion", "Cal.com", "smart scheduling", "calendar-aware agent", "timezone scheduling", "agent negotiation meetings". NOT for: manual calendar UI component design (use form-validation-architect), project management scheduling or Gantt charts (use project-management-guru-adhd), general time-tracking or pomodoro apps (use adhd-daily-planner for time-awareness), building the agent itself from scratch (use agent-creator).

curiositech/windags-skills

Build and adopt production AI agent infrastructure in 2026. Covers framework selection (LangGraph, CrewAI, AutoGen, MCP), orchestration patterns, evaluation, observability, memory systems, and tool use. Also covers the SOCIAL dimension: how to sell agent infrastructure internally, change management, measuring ROI, building trust in autonomous systems, and scaling adoption across teams. Activate on: "agent infrastructure", "agent framework comparison", "which agent framework", "sell AI tools internally", "agent adoption", "agent observability", "agent evaluation", "MCP architecture", "agentic mesh", "enterprise AI agents", "AI change management", "agent ROI". NOT for: building specific agents (use ai-engineer), designing agent behavior patterns (use agentic-patterns), prompt tuning (use prompt-engineer).

curiositech/windags-skills

Fundamental patterns for effective agentic behavior. Teaches decomposition, tool orchestration, error recovery, context management, quality self-assessment, and knowing when to stop. Model-agnostic principles that make any agent more effective regardless of domain. Activate on: "how should I structure this agent", "agentic workflow", "agent patterns", "multi-step task", "tool orchestration", "/agentic-patterns", "decompose this", "agent best practices", "chain of actions", "when should the agent stop", "agent loop design". NOT for: creating agent infrastructure (use agent-creator), building DAGs (use windags-architect), specific tool implementation.

curiositech/windags-skills

Automated discovery and matching of agent skills for dynamic task routing and capability assessment

curiositech/windags-skills

Cryptographic security for agentic systems — zero-trust agent networking, signed message envelopes (JWS/JWE), capability-based security (ocaps), Merkle tree audit trails, WASM sandboxing, and formal verification. Covers CLI dev tool security, mTLS between agents, permission boundaries (least privilege for AI agents), and supply chain security for skills/plugins. Activate on: "agent security", "zero trust agents", "secure agent communication", "capability-based security", "ocap", "signed messages between agents", "agent audit trail", "sandbox agent execution", "agent permissions", "mTLS agents", "cryptographic verification", "agent supply chain", "OWASP agentic", "prove agent did X", "tamper-proof agent logs". NOT for: application-level SAST scanning (use security-auditor), network firewall rules (use infrastructure), SOC2/HIPAA compliance (organizational), or prompt injection defense (use prompt-engineer).

curiositech/windags-skills

Data structures and serialization formats for agent-to-agent communication. Covers message envelopes, structured output schemas, capability declarations, task handoff payloads, error/retry signaling, and context windows as data structures. Deep comparison of A2A protocol, MCP, OpenAI function calling, and LangChain message types. Teaches when to use rigid schemas vs free-form with validation, typed vs untyped, streaming vs batch. Activate on: "agent message format", "agent communication schema", "agent-to-agent protocol", "A2A protocol", "MCP message format", "structured output for agents", "agent interop", "interchange format", "agent serialization", "task handoff format", "capability declaration". NOT for: what agents say to each other (use agent-conversation-protocols), orchestration topology (use multi-agent-coordination), building agent infrastructure (use agentic-infrastructure-2026).

curiositech/windags-skills

Logic-based agent programming language implementing BDI architecture for practical autonomous agent development

curiositech/windags-skills

>- Design AgentSpeak(L)-style BDI agents with context-guarded plans, selection functions, and intention stacks. Use for interruptible autonomy, agent policy, and multi-agent orchestration in dynamic environments. NOT for simple rule engines, static planners, or centralized workflows.

curiositech/windags-skills

Foundational concurrent computation model where actors communicate exclusively through asynchronous message passing

curiositech/windags-skills

license: Apache-2.0 NOT for unrelated tasks outside this domain.

相关技能