edge-cases

GitHub

分析检查点规范与现有测试,识别并补充缺失的边界、异常及空值等边缘情况测试用例,确保测试覆盖度。

.codex/skills/edge-cases/SKILL.md SprocketLab/slop-code-bench

触发场景

编写测试后 审查测试覆盖率时

安装

npx skills add SprocketLab/slop-code-bench --skill edge-cases -g -y
更多选项

非标准路径

npx skills add https://github.com/SprocketLab/slop-code-bench/tree/main/.codex/skills/edge-cases -g -y

不安装直接使用

npx skills use SprocketLab/slop-code-bench@edge-cases

指定 Agent (Claude Code)

npx skills add SprocketLab/slop-code-bench --skill edge-cases -a claude-code -g -y

安装 repo 全部 skill

npx skills add SprocketLab/slop-code-bench --all -g -y

预览 repo 内 skill

npx skills add SprocketLab/slop-code-bench --list

SKILL.md

Frontmatter
{
    "name": "edge-cases",
    "description": "Analyze checkpoint tests and suggest missing edge cases. Use after writing tests or when reviewing test coverage. Invoke with \/edge-cases <problem> <checkpoint>."
}

Edge Case Analyzer

Analyze a checkpoint's spec and existing tests to identify and add missing edge cases.

Usage: /edge-cases execution_server checkpoint_2

Workflow

  1. Read the spec - Understand all requirements, constraints, error conditions
  2. Read existing tests - See what's already covered
  3. Identify gaps - Find missing edge cases
  4. Implement edge-case tests - Add fully implemented tests with real assertions

Step 1: Gather Context

Read these files for the specified problem/checkpoint:

problems/{problem}/checkpoint_N.md
problems/{problem}/tests/conftest.py
problems/{problem}/tests/test_checkpoint_N.py

Step 2: Analyze for Gaps

For each requirement in the spec, ask:

  1. What happens with empty/null input?
  2. What happens at boundary values (0, -1, max, min)?
  3. What happens with malformed input?
  4. What happens with missing required fields?
  5. What happens with unexpected types?
  6. Are there race conditions or state edge cases?
  7. Are there format edge cases (unicode, special chars)?
    • Use \uXXXX escapes to keep source files ASCII when needed.

Cross-reference with existing tests:

  • Which spec requirements have tests?
  • Which error conditions are tested?
  • Which boundary conditions are tested?
  • What did the spec mention that tests don't cover?

See references/edge-case-categories.md for the category checklist and references/patterns.md for problem-type patterns.


Important: Avoid Ambiguous Cases

Only add edge cases where the spec is clear about expected behavior.

If the spec is ambiguous or there are multiple valid interpretations:

  • Don't add a test - it's not a valid edge case
  • The spec should define the expected behavior, not the tests
  • Tests should verify spec compliance, not invent requirements

Good edge case: Spec says "return error for negative values" → test with -1 Bad edge case: Spec doesn't mention negatives → we don't know what should happen

Ask yourself: "Can I point to the spec line that defines this behavior?"

  • Yes → Valid edge case
  • No → Skip it or note the spec ambiguity

Step 3: Implement Edge Case Tests

Append to test_checkpoint_N.py with fully implemented tests. Do not add TODOs, pytest.fail, or placeholder assertions. If you cannot implement an edge case from the spec, skip it or ask for clarification instead of adding incomplete tests.

Keep tests readable with tiny helper functions for recurring patterns (CLI runs, input setup, HTTP JSON requests). Prefer local helpers in the test module unless the helper is shared across multiple test files. See references/helper-patterns.md for helper ideas and references/example-patterns.md for CLI/HTTP layouts.

Do not leave placeholder docstrings. Either quote the spec line or remove the docstring entirely.


Markers to Use

All edge cases use @pytest.mark.functionality.

Edge cases are additional coverage beyond the core tests - they should not block a passing submission. Core tests cover the main spec requirements; edge cases catch less common scenarios.


After Adding Tests

  1. ALWAYS Run eval-snapshot to verify:
    slop-code --quiet eval-snapshot problems/{problem}/solutions/checkpoint_N \
        -p {problem} -o /tmp/eval -c N \
        -e configs/environments/docker-python3.12-uv.yaml --json
    

Reference

版本历史

  • 13de1a7 当前 2026-07-24 22:39

同 Skill 集合

.claude/skills/audit-spec/SKILL.md
.claude/skills/edge-cases/SKILL.md
.claude/skills/fix-solution/SKILL.md
.claude/skills/reclassify-tests/SKILL.md
.claude/skills/run-tests/SKILL.md
.claude/skills/test-ambiguity-detector/SKILL.md
.claude/skills/validate-run/SKILL.md
.codex/skills/checkpoint-ambiguity-review/SKILL.md

元信息

文件数
0
版本
06b5c06
Hash
26e295ad
收录时间
2026-07-24 22:39

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-17 17:47
浙ICP备14020137号-1