Token导航 LogoToken导航TokenDH.com
研究检索执行命令github未标认证来源可访问许可证需确认审计通过

before-after之前 之后

Agent Skill

before-after 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

367

周安装

15

GitHub Stars

47

下载量

118
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/cosmix/loom --skill before-after

简介

验证之前/之后证明您的阶段更改了系统:

  • 新功能:失败之前 → 成功之后
  • 错误修复:成功之前(存在错误)→ 失败之后(错误消失)
  • 行为变化:之前显示旧行为→之后显示新行为
  • 使用 before_stage
  • / 后阶段
  • 对于明确的自动增量证明,真相
  • 捕获后状态,接线
  • 证明集成和工件
  • 证明文件存在。
  • 始终思考:“我可以用什么来衡量来证明这个阶段产生了影响?”
  • 每周安装量
  • 15
  • 存储库
  • 科斯米克斯/织布机
  • GitHub 之星
  • 47
  • 第一次看到
  • 2026 年 2 月 27 日
  • 安全审计
  • Gen Agent Trust Hub 通行证
  • 套接字通行证
  • 斯尼克通行证

SKILL.md

Before/After Verification Skill

Overview

Before/after verification is a technique for proving that a stage actually changed system behavior. Instead of just checking that the final state is valid, you capture what was true BEFORE implementation and what should be true AFTER implementation. The pair proves your stage caused the change.

This matters because without before/after thinking, you can't distinguish:

  • "The feature already worked" from "My stage made it work"
  • "The bug was already fixed" from "My fix resolved it"
  • "The endpoint existed" from "I created the endpoint"

The Delta-Proof Concept

A delta-proof is verification that proves a state transition occurred.

The Pattern

  1. Before State: Capture system behavior BEFORE implementation

- For new features: Expected to FAIL (feature doesn't exist yet) - For bug fixes: Expected to SUCCEED (bug reproducer demonstrates the problem)

  1. After State: Capture system behavior AFTER implementation

- For new features: Expected to SUCCEED (feature now exists) - For bug fixes: Expected to FAIL (bug reproducer no longer triggers the bug)

  1. The Pair: Together, before + after prove the implementation caused the change

Why This Matters

Without delta-proof thinking, verification can be misleading:

Bad Example:

# Stage: Add user authentication
truths:
  - "cargo test"  # All tests pass

Problem: Tests might have passed before this stage. This doesn't prove authentication was added.

Good Example:

# Stage: Add user authentication
description: |
  Implement JWT-based user authentication.

  BEFORE: curl -f localhost:8080/api/protected returns 200 (no auth required)
  AFTER: curl -f localhost:8080/api/protected returns 401 (auth now required)
  AFTER: curl -f -H "Authorization: Bearer <token>" localhost:8080/api/protected returns 200

truths:
  - "curl -sf localhost:8080/api/protected | grep -q 401"
  - "curl -sf -H 'Authorization: Bearer fake' localhost:8080/api/protected && exit 1 || exit 0"

wiring:
  - source: "src/middleware/auth.rs"
    pattern: "pub fn require_auth"
    description: "Authentication middleware registered"

This proves authentication was ADDED by this stage (not already present).

When to Use Before/After Thinking

Use delta-proof verification when:

  1. Adding new features — Prove the feature didn't exist before
  2. Fixing bugs — Prove the bug existed before and is gone after
  3. Changing behavior — Prove old behavior is replaced by new behavior
  4. Creating endpoints/commands — Prove they're newly available
  5. Refactoring with behavior change — Prove the behavior actually changed

Do NOT use when:

  • Verification is straightforward (just checking files exist)
  • The stage is knowledge-only (no implementation)
  • You're just checking code quality (linting, formatting)

Templates for Common Scenarios

Scenario 1: New CLI Command

When adding a new CLI command, prove it didn't exist before.

Before State: Command doesn't exist (help fails or command not found) After State: Command exists (help succeeds, basic invocation works)

- id: add-verify-command
  name: "Add loom check command"
  stage_type: standard
  working_dir: "loom"
  description: |
    Implement the `loom check <stage-id>` CLI command.

    DELTA PROOF:
    - BEFORE: `loom check --help` fails (command not registered)
    - AFTER: `loom check --help` succeeds
    - AFTER: `loom check test-stage` runs verification logic

  truths:
    - "loom check --help"
    - "loom check nonexistent-stage 2>&1 | grep -q 'Stage not found'"

  wiring:
    - source: "src/main.rs"
      pattern: "verify"
      description: "Verify command registered in CLI"
    - source: "src/commands/verify.rs"
      pattern: "pub fn execute"
      description: "Verify command implementation exists"

  artifacts:
    - "src/commands/verify.rs"

Scenario 2: New API Endpoint

When adding an API endpoint, prove it returns 404 before and data after.

Before State: Endpoint returns 404 (not registered) After State: Endpoint returns expected status/data

- id: add-status-endpoint
  name: "Add /api/status endpoint"
  stage_type: standard
  working_dir: "."
  description: |
    Implement GET /api/status endpoint returning system health.

    DELTA PROOF:
    - BEFORE: curl localhost:8080/api/status returns 404
    - AFTER: curl localhost:8080/api/status returns 200 with JSON health data

  truths:
    - "curl -sf localhost:8080/api/status | jq -e '.healthy'"
    - "curl -sf -o /dev/null -w '%{http_code}' localhost:8080/api/status | grep -q 200"

  wiring:
    - source: "src/routes/mod.rs"
      pattern: "/api/status"
      description: "Status endpoint registered in router"
    - source: "src/handlers/status.rs"
      pattern: "pub async fn status_handler"
      description: "Status handler implementation"

  artifacts:
    - "src/handlers/status.rs"

Scenario 3: New Module/Library

When adding a new module, prove imports fail before and succeed after.

Before State: Import/use fails (module doesn't exist) After State: Import/use succeeds

- id: add-retry-module
  name: "Add retry module"
  stage_type: standard
  working_dir: "loom"
  description: |
    Create retry module with exponential backoff.

    DELTA PROOF:
    - BEFORE: `use crate::retry::RetryPolicy;` would fail (module doesn't exist)
    - AFTER: Module compiles, exports are available

  truths:
    - "cargo check"
    - "cargo test --lib retry"

  wiring:
    - source: "src/lib.rs"
      pattern: "pub mod retry"
      description: "Retry module exported from lib.rs"
    - source: "src/orchestrator/core/orchestrator.rs"
      pattern: "use crate::retry"
      description: "Retry module imported in orchestrator"

  artifacts:
    - "src/retry.rs"
    - "tests/retry_tests.rs"

Scenario 4: Bug Fix (COUNTERINTUITIVE)

When fixing a bug, prove the bug reproducer SUCCEEDS before (bug exists) and FAILS after (bug fixed).

Before State: Bug reproducer succeeds (demonstrates the bug) After State: Bug reproducer fails (bug no longer triggers)

This is counterintuitive but correct: the reproducer "working" means the bug is present.

- id: fix-crash-on-empty-plan
  name: "Fix crash when plan has no stages"
  stage_type: standard
  working_dir: "loom"
  description: |
    Fix crash when initializing empty plan.

    DELTA PROOF (NOTE: Before/after are inverted for bugs):
    - BEFORE: Empty plan causes panic (bug reproducer succeeds at finding the bug)
    - AFTER: Empty plan returns error gracefully (bug reproducer fails to find the bug)

    Verification approach:
    1. Create test case that reproduces the crash
    2. Test should PASS after fix (catches the crash gracefully)
    3. The bug is proven fixed when the panic no longer occurs

  truths:
    - "cargo test test_empty_plan_no_crash"
    - "cargo test --lib plan::parser"

  wiring:
    - source: "src/plan/parser.rs"
      pattern: "if stages.is_empty()"
      description: "Empty stage list check added"
    - source: "src/plan/parser.rs"
      pattern: 'Err.*"Plan must contain at least one stage"'
      description: "Error returned instead of panic"

  artifacts:
    - "tests/empty_plan_tests.rs"

Important: For bug fixes, the test SHOULD FAIL before the fix (reproducing the bug) and PASS after the fix. The wiring verification proves the defensive code was added.

Common Pitfalls

1. Testing the Wrong Thing

Bad:

# Adding a new user registration endpoint
truths:
  - "cargo test"  # Too broad - doesn't prove endpoint exists

Good:

truths:
  - "curl -sf -X POST localhost:8080/api/register -d '{\"email\":\"test@example.com\"}' | jq -e '.user_id'"

2. Not Capturing Enough State

Bad:

# Adding command output
truths:
  - "loom status"  # Just checks it runs

Good:

truths:
  - "loom status | grep -q 'Active Plan:'"
  - "loom status | grep -q 'Executing:'"

3. Forgetting This Is About Implementation

Before/after is about what YOUR STAGE changes, not about test setup.

Bad thinking: "Before the test runs, I need to set up data. After the test runs, I clean up." Good thinking: "Before my stage, feature X doesn't exist. After my stage, feature X works."

4. Using Before/After When Simple Truths Suffice

Overkill:

# Just adding a config file
description: |
  BEFORE: config.toml doesn't exist
  AFTER: config.toml exists

truths:
  - "test -f config.toml"

Better:

artifacts:
  - "config.toml"

Reserve before/after thinking for behavioral changes, not simple file additions.

5. Bug Fix Direction Confusion

Wrong:

# Fix infinite loop bug
description: |
  BEFORE: Test passes
  AFTER: Test fails demonstrating the bug

Correct:

# Fix infinite loop bug
description: |
  BEFORE: Code enters infinite loop (bug exists)
  AFTER: Code completes successfully (bug fixed)

truths:
  - "timeout 5s cargo test test_no_infinite_loop"

YAML Structure Reference

Loom has explicit before_stage and after_stage fields that accept TruthCheck definitions. These run at specific points in the stage lifecycle:

  • before_stage: Runs BEFORE the agent starts working (verifies pre-conditions in a fresh worktree)
  • after_stage: Runs when the agent calls loom stage complete (verifies post-conditions)

1. Before/After Stage Fields (Explicit Delta Proof)

before_stage:
  - command: "cargo test test_feature"
    exit_code: 1
    description: "Feature test fails before implementation"

after_stage:
  - command: "cargo test test_feature"
    exit_code: 0
    description: "Feature test passes after implementation"

Each entry is a TruthCheck with fields: command (required), exit_code (default 0), description, stdout_contains, stdout_not_contains, stderr_empty.

2. Truths (Capture the After State)

truths:
  - "command that proves feature works"
  - "test that validates behavior"

Truths run AFTER implementation and should succeed.

3. Wiring (Prove Integration Points)

wiring:
  - source: "src/main.rs"
    pattern: "register_feature"
    description: "Feature registered in main entry point"

4. Artifacts (Prove Files Exist)

artifacts:
  - "src/feature/implementation.rs"
  - "tests/feature_tests.rs"

5. Stage Description (Document the Delta)

Also document delta-proof thinking in the stage description for human readers:

description: |
  Implement feature X.

  DELTA PROOF:
  - BEFORE: <what's true before this stage>
  - AFTER: <what should be true after this stage>

  [Implementation details...]

Complete Example

- id: add-metrics-endpoint
  name: "Add /metrics endpoint"
  stage_type: standard
  working_dir: "."
  description: |
    Add Prometheus-compatible /metrics endpoint.

    DELTA PROOF:
    - BEFORE: curl localhost:8080/metrics returns 404
    - AFTER: curl localhost:8080/metrics returns Prometheus format
    - AFTER: Metrics include request_count, response_time

    Implementation:
    - Create metrics middleware
    - Register /metrics endpoint
    - Export request_count and response_time gauges

  dependencies: ["add-middleware-support"]

  before_stage:
    - command: "curl -sf localhost:8080/metrics"
      exit_code: 1
      description: "Metrics endpoint does not exist yet"

  after_stage:
    - command: "curl -sf localhost:8080/metrics | grep -q 'request_count'"
      exit_code: 0
      description: "Metrics endpoint returns request_count"
    - command: "curl -sf localhost:8080/metrics | grep -q 'response_time'"
      exit_code: 0
      description: "Metrics endpoint returns response_time"

  truths:
    - "curl -sf localhost:8080/metrics | grep -q 'request_count'"
    - "curl -sf localhost:8080/metrics | grep -q 'response_time'"
    - "curl -sf localhost:8080/metrics | grep -q 'TYPE request_count counter'"

  wiring:
    - source: "src/routes/mod.rs"
      pattern: "Router.*metrics"
      description: "Metrics endpoint registered"
    - source: "src/middleware/metrics.rs"
      pattern: "pub fn track_metrics"
      description: "Metrics middleware implemented"

  artifacts:
    - "src/middleware/metrics.rs"
    - "src/routes/metrics.rs"

  acceptance:
    - "cargo test"
    - "cargo clippy -- -D warnings"

Integration with Loom Plans

Planning Phase

When writing stage descriptions:

  1. Think: "What can the system do NOW?"
  2. Think: "What should the system do AFTER this stage?"
  3. Document the delta explicitly
  4. Write verification that captures the after state

Stage Description Template

description: |
  [One-line summary of what this stage does]

  DELTA PROOF:
  - BEFORE: [State before this stage - expected to fail/pass]
  - AFTER: [State after this stage - expected to pass/fail]

  [Detailed implementation guidance]

  EXECUTION PLAN:
  [If using subagents, describe parallel work]

Verification Strategy

For each stage, choose verification mechanisms:

Verification TypeUse WhenProves
truthsBehavior is observable via shell commandsFeature works at runtime
wiringFeature must integrate with existing codeCode is connected/registered
artifactsNew files must existFiles were created
acceptanceStandard checks (build, test, lint)Code compiles and tests pass

Use truths and wiring together for strong delta-proofs.

Example: Full Stage with Delta Proof

- id: add-stage-complete-command
  name: "Add loom stage complete command"
  stage_type: standard
  working_dir: "loom"

  description: |
    Implement `loom stage complete <stage-id>` command to mark stages as complete.

    DELTA PROOF:
    - BEFORE: `loom stage complete --help` fails (command doesn't exist)
    - AFTER: `loom stage complete --help` shows usage
    - AFTER: `loom stage complete test-stage` transitions stage to Completed state

    Implementation:
    - Add StageComplete command to CLI
    - Implement state transition logic
    - Add validation for stage existence
    - Update stage file with completion timestamp

  dependencies: ["knowledge-bootstrap"]

  truths:
    - "loom stage complete --help"
    - "loom stage list | grep -q complete"

  wiring:
    - source: "src/main.rs"
      pattern: "Commands::StageComplete"
      description: "StageComplete command registered in CLI"
    - source: "src/commands/stage.rs"
      pattern: "pub fn complete"
      description: "Stage complete implementation exists"
    - source: "src/models/stage/transitions.rs"
      pattern: "fn transition_to_completed"
      description: "State transition logic implemented"

  artifacts:
    - "src/commands/stage.rs"

  acceptance:
    - "cargo test"
    - "cargo test stage_complete"
    - "cargo clippy -- -D warnings"

Working Directory and Paths

All verification paths are relative to working_dir:

working_dir: "loom"  # Commands execute from loom/ directory

truths:
  - "cargo test"  # Runs in loom/ (where Cargo.toml lives)

artifacts:
  - "src/commands/verify.rs"  # Resolves to loom/src/commands/verify.rs

wiring:
  - source: "src/main.rs"  # Resolves to loom/src/main.rs

If working_dir: ".", paths are relative to worktree root.

Best Practices

  1. Document the delta in stage descriptions - make before/after explicit
  2. Use truths for runtime behavior - prove the feature works when invoked
  3. Use wiring for integration - prove the feature is connected
  4. Use artifacts sparingly - prefer truths/wiring over file existence
  5. Test the delta - run truths against the actual implementation
  6. Think from user perspective - what would a user try to prove it works?

Summary

Before/after verification proves your stage changed the system:

  • New features: Before fails → After succeeds
  • Bug fixes: Before succeeds (bug exists) → After fails (bug gone)
  • Behavior changes: Before shows old behavior → After shows new behavior

Use before_stage/after_stage for explicit automated delta-proof, truths to capture the after state, wiring to prove integration, and artifacts to prove files exist.

Always think: "What can I measure that PROVES this stage made a difference?"

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

36.48%
按下载量换算43

Claude

28.81%
按下载量换算34

Cursor

17.25%
按下载量换算20

Gemini CLI

9%
按下载量换算11

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/cosmix/loom --skill before-after 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

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

来源信息

继续浏览同类 Skills