AGENT SKILL

通用问题复现取证流程

repro-evidence

与领域无关的通用 /repro 工作流,用于隔离状态复现、孪生克隆、证据导出、同症状判定以及红/绿结果溯源。

适用职业测试工程师
License 许可
MIT
最近更新
2026-11-14
Stars
★ 6
Forks
0

01 前言 Front Matter

name
repro-evidence
description
Generic, domain-agnostic /repro workflow for isolated state reproduction, twin clones, evidence exports, same-symptom verdicts, and red/green provenance.

03 SKILL.md 正文

Repro evidence (canonical)

This .claude skill is the canonical source of truth for reproduction workflows across projects in this repository. It defines the discipline for reproducing bugs against isolated, real environments with verifiable evidence before attempting any fix.

Repo-level skill first — always

Before anything else, look in the active repository for its own repro workflow: .claude/commands/repro.md, .claude/skills/repro*/SKILL.md, .claude/skills/repro*.md, and any repro entry in its AGENTS.md/CLAUDE.md. If one exists, read it and follow it; it wins on every difference within the repository's own scope, subject to the user's explicit instructions and the active permission boundaries, which take precedence over both. This skill applies only where the repository is silent. A repository that routes /repro to its own twin-clone or provider-specific evidence workflow owns that workflow.

Default comparison: original / control / candidate

Unless the repository skill or the user says otherwise, report every repro as three arms on the same inputs:

Arm What it is Source
Original What the real system actually did when the bug happened Read-only lookup of the real record (production data, logs, saved state); never re-run
Control A fresh replay on the code without the fix (base / pre-fix SHA) Same isolated starting state and input as the candidate
Candidate The same replay on the fix Same isolated starting state and input as the control
  • Original proves the bug was real; control proves the replay reproduces it today; candidate proves the fix. Control alone is not the original: an earlier fix already on the branch can make control look better than what users saw.
  • Use the same starting state, input, provider and model for control and candidate, run them interleaved, with enough trials per input to beat noise (n>=5 per arm for stochastic systems). That count is a floor, not proof: n>=5 bounds obvious noise, it does not establish a reliable effect size. Say how many trials you ran and what spread you saw rather than presenting a single run as decisive.
  • Report one plain table per input: the user-visible outcome for each arm, then counts across trials. Lead with the outcome the user cares about most, in their words.
  • Reproducing before a fix exists is normal. Report original and control, and record the candidate arm as not yet available; filing the issue first is the point of /repro. Fill the candidate column once there is a fix to replay, and never invent one.

0. Routing & When to Use

User intent Run
/repro, /repro <target_id_or_payload>, or "reproduce this bug" Default isolate + targeted repro in section 2
"first copy/snapshot read-only, second gets actions" Twin baseline + test subject in section 5
Canonical vs variant replay / comparative testing Isolated clone comparison under identical inputs across configurations
Complex multi-step regression suite Targeted regression suite only when explicitly requested

Do not silently substitute a broader, mocked, or easier harness for the requested repro.

1. Required environment

Always use real, unmocked instances of the target system for evidence-bearing repros (real database, real backend/services, real auth flows) — never a mocked or stubbed environment.

Key environment principles:

  • Real persistence & runtime: Connect to a real local or sandbox instance (e.g., local database container, sandbox tenant, local daemon) rather than in-memory mocks.
  • Dedicated test target/tenant: Run reproductions against dedicated test entities, test databases, or ephemeral test namespaces so production or baseline data is never altered.
  • Explicit credentials & configs: Ensure all required environment variables and credentials point directly to the isolated reproduction environment before executing commands.

2. Default: isolate state + targeted bug repro

Goal: Create a safe, isolated copy or snapshot of the reported state in a test environment, then reproduce the reported bug via the narrowest faithful path.

  1. Identify & locate source state: Identify the source entity, snapshot, fixture, record ID, or environment state where the bug occurred.
  2. Isolate/clone to test environment: Clone or snapshot the state into a safe, mutable sandbox target (e.g., a database snapshot, container image, test account/tenant, fixture file, or branch worktree depending on the target stack).
  3. Twin baseline for destructive replays: For destructive or state-altering replays, create two copies: a baseline read-only copy and a test subject copy (see §5).
  4. Align state: Align the test subject to the exact instant/state where the reported bug occurred without mutating the baseline.
  5. Replay triggering action: Replay only the exact user action, API request, CLI command, or input sequence needed to trigger the reported bug against the unmocked target.
  6. Export post-replay state: Dump or export the post-replay state from the target system to disk.
  7. Save evidence: Save raw request/response captures, error logs, stdout/stderr streams, and pre/post state snapshots when the repro touches runtime or persisted service state.

2.1 First-touch state proof for stale persisted-state bugs

When the bug involves stale persisted state, orphaned sessions/records, legacy flags, schema migrations, cleanup hooks, or routing/state loops:

  1. Capture pre-state directly: Capture the isolated test subject's pre-state via the most direct, low-level read path available (e.g., direct DB query, raw storage inspection, direct file read) BEFORE making any application-level API call that could clean, migrate, normalize, or project state.
  2. Avoid pre-action observers: Do not call administrative fetch endpoints, state-summarizing APIs, UI initialization routes, or preview endpoints before the evidence-bearing action unless the claim explicitly includes those first-touch paths.
  3. Execute production ingress as first touch: Run the exact production ingress being validated (e.g., primary streaming endpoint, user action handler, webhook handler) as the first application touch.
  4. Capture post-state directly: Capture the post-state with another direct, low-level read.
  5. Record routing/transition evidence: Record selected handler, routing branch, or transition evidence when the claim asserts state transitions or recovery from stuck states.

[!WARNING] If a pre-action observer can itself mutate, sanitize, or seal the state, the evidence only proves that cleanup logic exists somewhere; it does NOT prove that the reported production path is fixed.

3. Red/green code provenance requirement

A RED repro must never run against the candidate fix codepath. Before labeling any run RED or GREEN, explicitly record the code and environment provenance:

  • RED replay: Must run against a pre-fix checkout, pre-fix deployment, or an explicitly human-approved baseline/main environment without the fix applied.
  • GREEN replay: Must run against the candidate fix checkout or deployment.
  • Ambiguous environment: An unknown or unproven remote deployment version is NOT valid RED evidence. Label it AMBIGUOUS ENVIRONMENT until the deployed commit SHA and configuration are proven or explicitly approved by a human.
  • Historical red artifact: If only the original production/reported artifact shows the failure and no fresh replay was executed, label it HISTORICAL RED ARTIFACT, not a fresh red replay.

Never compare a fixed-branch replay against another fixed-branch replay and call the first run RED.

4. Same-symptom requirement (fail closed)

A reproduction only counts if the IDENTICAL user-visible phenotype reappears, not a loosely-related internal signal. Before running a repro, write down the exact observable bug phenotype in concrete terms:

  • Source entity / environment & identifier: The exact record, account, endpoint, or system context.
  • Exact input / action sequence: The precise payload, command, or user event being replayed.
  • Exact user-visible symptom required: The specific error message, UI anomaly, incorrect output, corrupted field, or failed response that constitutes the bug.
  • Prior artifact(s) to reproduce: Prior logs, response bodies, or state dumps that must be repeated, omitted, or contradicted.
  • Falsification criteria: Evidence that would disprove the repro claim.

Do not call a related internal signal a reproduction unless the same observable symptom appears in the new run.

Illustrative Examples:

  • Stale cached value re-served after invalidation:
    • Reported bug: User updates profile name to "Alice", but subsequent GET /user/profile continues returning old name "Bob" with cache header X-Cache: HIT.
    • Valid REPRO: Fresh replay in isolated environment updates profile, executes GET /user/profile, and receives "Bob" with X-Cache: HIT.
    • RELATED: An internal cache key was not purged in Redis, but the API endpoint returned the updated name "Alice" (e.g. bypassed cache or fetched from DB). Label RELATED INTERNAL CACHE DESYNC, not ORIGINAL BUG REPRO.
    • NON-REPRO: API returns "Alice" with X-Cache: MISS. Label NON-REPRO FOR ORIGINAL PHENOTYPE.
  • Orphaned session token causing 500 on checkout:
    • Reported bug: Expired session token triggers unhandled null pointer exception and HTTP 500 error on POST /checkout.
    • Valid REPRO: Replay against cloned session state reproduces the exact unhandled exception stack trace and HTTP 500 response.
    • RELATED: Replay returns HTTP 400 with Invalid session payload. Label RELATED VALIDATION ERROR, not ORIGINAL BUG REPRO.
  • Batch job silent record drop:
    • Reported bug: Records with null timestamp are silently omitted from export CSV without error log.
    • Valid REPRO: Cloned dataset containing null timestamp records yields export CSV missing those exact rows with zero error logs.
    • RELATED: Batch job fails with explicit NullPointerException log. Label RELATED LOGIC ERROR, not ORIGINAL BUG REPRO.

Mandatory Verdict Table

For every claimed reproduction, construct a verdict table:

Original required symptom New observation Evidence file / reference Verdict
<Exact user-visible failure> <Exact observation from fresh run> <path/to/evidence/file> REPRO / RELATED / NON-REPRO

Only REPRO satisfies the repro task. RELATED and NON-REPRO provide valuable diagnostics, but they do not complete the repro task and must never be described as "the original bug reproduced."

5. Twin baseline + test subject

When the initial state must remain pristine for comparative verification or multiple replay attempts:

  1. Create two independent copies: Snapshot/clone the source state into two separate entities or sandbox targets.
  2. Assign roles: Designate one as baseline read-only and the other as test subject.
  3. Protect the baseline: Never apply actions, test mutations, manual patches, or destructive commands to the baseline read-only instance.
  4. Mutate only test subject: Perform alignment, intermediate state adjustments, cleanup, and replay exclusively on the test subject.
  5. Export comparison: Export both snapshots only when a direct before/after diff is required; otherwise export the test subject along with raw execution evidence.

6. Save evidence after repro

Export the post-replay state and execution artifacts to a discoverable local directory on the dedicated Scratch volume resolved dynamically via the canonical scratch skill ~/.claude/skills/scratch-space/SKILL.md:

# Recommended evidence directory convention:
# Resolve dynamically via ~/.claude/skills/scratch-space/SKILL.md:
# Option A (managed lease via diskm):
#   EVIDENCE_DIR="$(diskm scratch-new <repo-path> repro-export --kind evidence)"
# Option B (canonical scratch resolver script):
#   EVIDENCE_DIR="$(~/.claude/skills/scratch-space/scripts/scratch-dir.sh "<project>/repro-exports/<slug>")"

EVIDENCE_DIR="$(~/.claude/skills/scratch-space/scripts/scratch-dir.sh "<project>/repro-exports/<slug>")"

# Example export commands depending on the stack:
# 1. Database dump / query output:
# pg_dump -d <test_db> -t <table_name> > "$EVIDENCE_DIR/post_state.sql"
# 2. Raw API / HTTP responses:
# curl -s -D "$EVIDENCE_DIR/headers.txt" -o "$EVIDENCE_DIR/response.json" ...
# 3. Log captures:
# cp /path/to/test-service.log "$EVIDENCE_DIR/execution.log"

Ensure all relevant evidence files (raw request/response payloads, logs, state diffs, error traces) are saved and referenced in the final verdict table.

7. Checklist

Step Done?
Source entity/state identified and isolated to a test sandbox
Red/green code and environment provenance recorded
Same-symptom criteria written before replay
Baseline/test clone separation preserved (if destructive replay)
Exact input/action sequence replayed against unmocked system
First-touch direct pre-state captured (for stale persisted-state bugs)
Production ingress under test was the first application touch
Post-replay state export saved to evidence directory
Raw payload captures, logs, and state snapshots saved
Verdict table filled with REPRO, RELATED, or NON-REPRO

04 同仓库更多 Skills

jleechanorg
jleechanorg/jleechan-skills

disk-reclaim-playbook

Use Disk Magician to diagnose disk growth or qualify cleanup on macOS or Linux.

★ 6
jleechanorg
jleechanorg/jleechan-skills

claudea-bench

Compare `claudea` and normal `claude` on a fair split of comparable work by default; use `--strict` for duplicate runs of the exact same task.

★ 6
jleechanorg
jleechanorg/jleechan-skills

pr

Alias for the canonical pr-lifecycle PR workflow skill (/pr-workflow, /prw).

★ 6
jleechanorg
jleechanorg/jleechan-skills

whisper

OpenAI's general-purpose speech recognition model. Supports 99 languages, transcription, translation to English, and language identification. Six model sizes from tiny (39M params) to large (1550M params). Use for speech-to-text, podcast transcription, or multilingual audio processing. Best for robust, multilingual ASR.

★ 6
jleechanorg
jleechanorg/jleechan-skills

webapp-testing

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

★ 6
jleechanorg
jleechanorg/jleechan-skills

pr-report

This skill should be used when the user asks for a PR report, PR audit, PR delta analysis, /pr-report, or wants per-PR summary with delta files/lines. Generates a structured report for one or more open PRs covering purpose, files changed, +/− line counts, /code-standards + /thermo review findings, /ponytail simplification opportunities, file-overlap combination candidates, and /green status per pr-green-definition. Output: machine-readable JSONL + human-readable markdown. Read-only by default; can apply simplifications if user opts in.

★ 6