Créer une branche de bug

VérifiéPrudence

Crée une nouvelle branche de bug à partir d'une branche projet existante en guidant l'utilisateur pour ajouter un défi de débogage unique. Utile pour générer des exercices de débogage avec un script run.sh qui reproduit l'échec.

Spar Skills Guide Bot
DeveloppementIntermédiaire
12002/06/2026
Claude Code
#git#debugging#bug-challenge#automation

Recommandé pour

Notre avis

Crée une branche de bug à partir d'une branche de projet existante, avec un seul défi de débogage à résoudre.

Points forts

  • Automatise la création de branches de bug numérotées séquentiellement.
  • Guide l'utilisateur dans l'ajout d'un bug et la création du script de reproduction.
  • Vérifie l'état du dépôt et s'assure que tout est commité avant de finaliser.

Limites

  • Nécessite que l'utilisateur introduise manuellement le bug (aucune génération automatique de bug).
  • Ne prend pas en charge les bugs multi-fichiers complexes – conçu pour un seul bug simple.
Quand l'utiliser

Lorsque vous voulez créer un défi de débogage structuré avec une seule branche, un script de reproduction et une numérotation claire.

Quand l'éviter

Si vous avez besoin de générer automatiquement un bug ou de gérer des bugs complexes avec plusieurs dépendances.

Analyse de sécurité

Prudence
Score qualité90/100

The skill uses git and bash to create branches and run user-specified commands. While not inherently malicious, it allows the user to supply any command that will be executed, posing a risk if the user provides dangerous input. No input sanitization is mentioned.

Points d'attention
  • The skill instructs the execution of user-provided shell commands (via run.sh and uv run), which could be arbitrary and potentially destructive. It also uses git operations that modify the repository state.

Exemples

Basic usage
/add-bug
Specifying project name
/add-bug
Project name: tinydb
Providing description upfront
/add-bug
Project name: quixbugs-challenge
Description: Add off-by-one error in loop condition

name: add-bug description: Create a new bug branch from an existing project branch with a single debugging challenge

Add Bug Branch

Creates a new bug branch from an existing project branch with a single debugging challenge.

Usage

/add-bug

Instructions

When this command is invoked:

  1. Ask the user for required information:

    • Project name (the base project branch, e.g., tinydb, quixbugs-challenge)
    • Bug number (or auto-detect next available number)
    • Brief description of what bug they want to add (optional, for commit message)
  2. Verify current state:

    • Confirm the project branch exists
    • Check for uncommitted changes (warn if any exist)
    • Find the next available bug number by checking for existing <project-name>-bug* branches
  3. Create the bug branch:

    git checkout <project-name>
    git checkout -b <project-name>-bug<N>
    
  4. Guide the user through adding the bug:

    • Explain that they should now: a. Modify the code to introduce the bug b. Verify the bug causes a test failure or observable issue
    • Wait for the user to make their changes (don't make code changes automatically)
  5. Help create the run script:

    • Ask the user what command reproduces the bug (e.g., pytest tests/test_foo.py::test_bar)
    • Create run.sh with the appropriate command:
      #!/bin/bash
      uv run <command>
      
    • Make it executable: chmod +x run.sh
  6. Commit the bug:

    git add .
    git commit -m "[<project-name>] Add bug <N>: <description>"
    
  7. Verify the setup:

    • Test that ./run.sh reproduces the failure
    • Confirm all changes are committed
  8. Provide next steps:

    • Suggest pushing the branch: git push -u origin <project-name>-bug<N>
    • Remind that this branch is now a complete debugging challenge

Context

Bug branches are the actual debugging challenges given to participants. Each bug branch should:

  • Contain exactly ONE bug (not multiple bugs)
  • Have a run.sh script that demonstrates the failure
  • Be small enough to debug within 30 minutes
  • Have bugs that aren't obvious from simple code inspection
  • Include clear test failures or observable incorrect behavior

Types of Bugs

According to academic software engineering research, the majority of all bug fixes are one of two kinds:

  1. Changes to a conditional path (adding a predicate to a branch, adding/removing a branch, adding an early exit branch)
  2. Changing a method call by changing the expression passed to the method or changing the shape of the method call

Thus, bugs that we add should prefer to have solutions that are one of these types of fixes.

Guidelines for Good Bugs

A good 30-minute debugging challenge should:

  • ✅ Require executing code to understand the failure
  • ✅ Have bugs that aren't obvious from simple inspection
  • ✅ Be small enough to debug within the time limit
  • ✅ Have clear test cases that show failures
  • ✅ Test realistic debugging scenarios
  • ❌ Not be solvable by just reading the code for 5 minutes
  • ❌ Not be so complex that understanding the code takes most of the time

Bug Numbering

Bug numbers should be sequential per project. If tinydb-bug1 and tinydb-bug2 exist, the next bug should be tinydb-bug3.

The skill should auto-detect the next available number, but allow the user to override if needed.

Skills similaires