跳到主要内容
知仓学习社ZHICANG

nw-spike-methodology

Teaches agents how to run a timeboxed spike - throwaway code that validates one assumption before DESIGN

不碰外部(只输出文字)无严重或高危命中nWave-ai/nWave

它会碰到什么

扫了多少1 个文本文件,4 KB
它会碰到什么不碰外部(只输出文字)
命中总数0 处
命中统计严重 0 · 高 0 · 中 0 · 低 0

这一栏是扫描器报的事实,不是结论。命中多不等于有毒(安全工具、规则库、示例脚本本来就会包含危险写法),命中少也不等于干净。它和你手上的凭据、文件、网络有什么关系,需要你自己看。

技能内容

Spike Methodology

What a Spike IS

Throwaway code that validates exactly one assumption. Max 1 hour. Binary outcome: works or doesn't work. Code is deleted after validation; only findings persist.

What a Spike IS NOT

| Not This | Why |

|----------|-----|

| Prototype | Prototypes evolve into production code. Spikes are deleted. |

| MVP | MVPs ship to users. Spikes never leave the developer's machine. |

| Walking Skeleton | Skeletons wire end-to-end architecture. Spikes test one mechanism. |

| POC | POCs demonstrate feasibility to stakeholders. Spikes answer a developer question. |

The 4 Questions

Every spike answers exactly these:

  1. Does the core mechanism work? Can we parse the output? Call the API? Does the algorithm produce correct results?
  2. Does it meet the performance requirement? Is it under the time/memory/throughput budget?
  3. What edge cases exist? Empty input, malformed data, missing dependencies, concurrent access.
  4. What did we assume wrong? The design said X, but reality is Y. Document the delta.

When to Spike

  • New mechanism never tried before in this codebase
  • Performance requirement that cannot be validated by reasoning alone
  • External integration (API, library, OS feature) with unknown behavior
  • Algorithm where correctness is non-obvious

When to Skip

  • Pure refactoring (mechanism already proven)
  • Bug fix (behavior already understood)
  • Feature estimated at less than 1 day (spike overhead not justified)
  • Mechanism already validated by a prior spike or existing code

Rules

  1. Max 1 hour wall clock. If it takes longer, the problem is bigger than expected. Stop and escalate.
  2. No tests. No types. No error handling. No ports. No abstractions.
  3. Code lives in /tmp/spike_{feature_id}/ or a scratch directory. Never in src/.
  4. One file preferred. Two files maximum.
  5. Use time.perf_counter() for timing, not time.time().
  6. Print results to stdout. No logging frameworks.
  7. After validation: delete the code, keep the findings.

Spike Code Structure

#!/usr/bin/env python3
"""SPIKE: {feature} -- {one-line question being validated}

Throwaway code. Not production. Will be deleted after validation.
"""
import time

# 1. Setup (minimal, no frameworks)
# ...

# 2. Core mechanism attempt
start = time.perf_counter()
# ... the thing you're testing ...
elapsed = time.perf_counter() - start

# 3. Print findings
print(f"Mechanism: {'WORKS' if success else 'FAILS'}")
print(f"Timing: {elapsed*1000:.1f}ms (budget: {budget}ms)")
print(f"Edge cases: {edge_cases}")

Findings Output Format

Output goes to docs/feature/{feature-id}/spike/findings.md:

# Spike Findings -- {feature-id}

## Verdict: WORKS / DOESN'T WORK

## Question tested
{the one assumption being validated}

## Core mechanism
- Tested: {what was tested}
- Result: {what happened}

## Timing
- {operation}: {time}ms
- Total: {time}ms (budget: {budget}ms) -- PASS / FAIL

## Edge cases discovered
1. {edge case}: {what happened}
2. {edge case}: {what happened}

## Design implications
- {assumption that was wrong}: {correct reality}
- {approach the spike validated or invalidated}

## Spike code
Deleted. Was at /tmp/spike_{feature_id}/

Escalation

If the spike reveals the problem is fundamentally different from what was assumed:

  1. Stop the spike
  2. Write findings with verdict "DOESN'T WORK" or "BIGGER THAN EXPECTED"
  3. Return to DISCUSS to re-scope the feature
  4. The spike findings become input to the revised DISCUSS wave

想直接用这个技能?

本站把开放许可(MIT / Apache 等)的技能按仓库打包整理到网盘,点一下转存到你自己的网盘,不用一个个从 GitHub 拉。许可未声明的技能只给原始仓库链接,不打包。

同名技能的其他版本

有 2 个不同仓库或目录里都有叫 nw-spike-methodology 的技能。它们内容并不相同,别混用:

  • nWave-ai/nWave — Teaches agents how to run a timeboxed spike - throwaway code that validates one assumption