Logo di Bug Fix Knowledge

Bug Fix Knowledge

Community
dykyi-roman
bug-fix-knowledge

Bug fix knowledge base. Provides bug categories, symptoms, fix patterns, and minimal intervention principles for PHP 8.4 projects.

Add to TypingMind

Panoramica

Pubblicato dadykyi-roman
Repositoryawesome-claude-code
Nome della skillbug-fix-knowledge
Stelle
98
Fork
25
File inclusi
Solo istruzioni
LicenzaMIT
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • Tutto nelle istruzioni

    Tutto ciò che serve al modello è nelle istruzioni: nessun file aggiuntivo da sincronizzare.

  • Open source

    Pubblicata da dykyi-roman su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Bug Fix Knowledge in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/dykyi-roman/awesome-claude-code/tree/master/skills/bug-fix-knowledge
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Aggiungi skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella della skill nella directory delle skill di quell'agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/dykyi-roman/awesome-claude-code.git /tmp/awesome-claude-code
mkdir -p .claude/skills
cp -r /tmp/awesome-claude-code/skills/bug-fix-knowledge .claude/skills/bug-fix-knowledge
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Bug Fix Knowledge in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Bug Fix Knowledge non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Bug Fix Knowledge non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

Bug Fix Knowledge Base

Comprehensive knowledge for diagnosing and fixing bugs in PHP applications following DDD, CQRS, and Clean Architecture patterns.

Bug Categories and Symptoms

1. Logic Errors

Symptoms:

  • Incorrect output for valid input
  • Wrong branch taken in conditionals
  • Inverted boolean logic
  • Off-by-one errors in loops
  • Missing edge case handling

Common Causes:

  • > instead of >=, && instead of ||
  • Negation errors (!$condition vs $condition)
  • Loop boundary mistakes (< count vs <= count)
  • Missing break in switch statements

Fix Pattern:

php
// Before: Logic error
if ($amount > $limit) { // Should be >=
    throw new LimitExceededException();
}

// After: Fixed
if ($amount >= $limit) {
    throw new LimitExceededException();
}

2. Null Pointer Issues

Symptoms:

  • "Call to a member function on null"
  • "Cannot access property on null"
  • Unexpected null returns
  • Missing null checks after optional operations

Common Causes:

  • Repository returning null for non-existent entity
  • Optional relationships not checked
  • Nullable parameters not validated
  • Method chaining on potentially null objects

Fix Pattern:

php
// Before: Null pointer risk
$user = $this->userRepository->find($id);
$email = $user->getEmail(); // Crashes if user is null

// After: Safe with null check
$user = $this->userRepository->find($id);
if ($user === null) {
    throw new UserNotFoundException($id);
}
$email = $user->getEmail();

// Alternative: Null coalescing
$email = $user?->getEmail() ?? throw new UserNotFoundException($id);

3. Boundary Issues

Symptoms:

  • Array index out of bounds
  • Empty collection access
  • String index errors
  • Numeric overflow/underflow

Common Causes:

  • Accessing first/last element without checking emptiness
  • Loop index exceeding array size
  • Integer overflow in calculations
  • Missing bounds validation

Fix Pattern:

php
// Before: Boundary issue
$firstItem = $items[0]; // Crashes if empty

// After: Safe boundary check
if ($items === []) {
    throw new EmptyCollectionException('items');
}
$firstItem = $items[0];

// Alternative: Using first() with default
$firstItem = $items[0] ?? throw new EmptyCollectionException('items');

4. Race Conditions

Symptoms:

  • Intermittent failures
  • Data corruption under load
  • Lost updates
  • Duplicate records

Common Causes:

  • Check-then-act without locking
  • Shared mutable state
  • Missing database transactions
  • Concurrent file access

Fix Pattern:

php
// Before: Race condition
if (!$this->repository->exists($id)) {
    $this->repository->save($entity); // Another process might insert between check and save
}

// After: Atomic operation with locking
$this->lockManager->acquire("entity:$id");
try {
    if (!$this->repository->exists($id)) {
        $this->repository->save($entity);
    }
} finally {
    $this->lockManager->release("entity:$id");
}

// Alternative: Database-level uniqueness
// Use UNIQUE constraint + INSERT ... ON DUPLICATE KEY

5. Resource Leaks

Symptoms:

  • Memory exhaustion over time
  • "Too many open files"
  • Database connection pool exhaustion
  • Slow performance degradation

Common Causes:

  • Unclosed file handles
  • Missing database connection release
  • Event listeners not removed
  • Circular references preventing GC

Fix Pattern:

php
// Before: Resource leak
$handle = fopen($path, 'r');
$content = fread($handle, filesize($path));
// Missing fclose()

// After: Proper resource management
$handle = fopen($path, 'r');
try {
    $content = fread($handle, filesize($path));
} finally {
    fclose($handle);
}

// Better: Use high-level functions
$content = file_get_contents($path);

6. Exception Handling Issues

Symptoms:

  • Silent failures
  • Generic error messages
  • Lost exception context
  • Swallowed exceptions

Common Causes:

  • Empty catch blocks
  • Catching too broad exception types
  • Not re-throwing after logging
  • Missing exception chaining

Fix Pattern:

php
// Before: Swallowed exception
try {
    $this->service->process($data);
} catch (Exception $e) {
    // Silent failure - bug hidden
}

// After: Proper exception handling
try {
    $this->service->process($data);
} catch (ValidationException $e) {
    throw new ProcessingFailedException(
        "Failed to process data: {$e->getMessage()}",
        previous: $e
    );
}

7. Type Issues

Symptoms:

  • "Type error: Argument must be of type X, Y given"
  • Unexpected type coercion
  • String/int confusion
  • Array/object mismatch

Common Causes:

  • Missing strict_types declaration
  • Implicit type casting
  • Mixed types from external sources
  • Legacy code without type hints

Fix Pattern:

php
// Before: Type issue
function calculate($amount) { // No type hint
    return $amount * 1.1; // Fails if string passed
}

// After: Strict typing
declare(strict_types=1);

function calculate(float $amount): float {
    return $amount * 1.1;
}

8. SQL Injection

Symptoms:

  • Security vulnerabilities
  • Unexpected query results
  • Data corruption
  • Authentication bypass

Common Causes:

  • String concatenation in queries
  • Missing parameter binding
  • Unvalidated user input in queries
  • Dynamic table/column names

Fix Pattern:

php
// Before: SQL injection vulnerability
$query = "SELECT * FROM users WHERE email = '$email'";

// After: Parameterized query
$query = "SELECT * FROM users WHERE email = :email";
$stmt = $pdo->prepare($query);
$stmt->execute(['email' => $email]);

9. Infinite Loops

Symptoms:

  • Application hangs
  • 100% CPU usage
  • Request timeouts
  • Memory exhaustion

Common Causes:

  • Missing or unreachable exit condition
  • Iterator not advancing
  • Recursive call without base case
  • Circular dependencies in processing

Fix Pattern:

php
// Before: Potential infinite loop
while ($item = $queue->pop()) {
    $this->process($item);
    // If process() adds items back to queue, infinite loop
}

// After: Safe with limit
$maxIterations = 10000;
$iterations = 0;
while ($item = $queue->pop()) {
    if (++$iterations > $maxIterations) {
        throw new MaxIterationsExceededException($maxIterations);
    }
    $this->process($item);
}

Minimal Intervention Principles

1. Single Responsibility Fix

  • Fix ONLY the bug, nothing else
  • No refactoring while fixing
  • No "while I'm here" improvements
  • Keep the diff minimal

2. Preserve Behavior

  • Existing tests must pass
  • API contracts must not change
  • Side effects must be preserved (if intentional)
  • Error messages format should match

3. Backward Compatibility

  • Public method signatures unchanged
  • Return types unchanged
  • Exception types unchanged
  • Event payloads unchanged

4. Test First

  • Write failing test that reproduces bug
  • Fix should make test pass
  • No fix without reproduction test

Fix Validation Checklist

Before applying a fix, verify:

  1. Reproduction Test Exists

    • Test fails without fix
    • Test passes with fix
    • Test covers edge cases
  2. Minimal Change

    • Only affected code changed
    • No unrelated refactoring
    • No formatting changes
  3. No Regressions

    • All existing tests pass
    • No new warnings
    • Performance not degraded
  4. Code Quality

    • No new code smells
    • SOLID principles respected
    • DDD patterns maintained
  5. Documentation

    • PHPDoc updated if needed
    • CHANGELOG entry added
    • Issue linked in commit

DDD-Specific Bug Patterns

Domain Layer Bugs

  • Value Object validation bypass
  • Entity invariant violation
  • Aggregate boundary crossing
  • Domain Event lost

Application Layer Bugs

  • Use Case not transactional
  • Command/Query mixing
  • Missing authorization check
  • Event handler not idempotent

Infrastructure Layer Bugs

  • Repository returning detached entity
  • Cache invalidation missing
  • Message not acknowledged
  • Connection not released

Quick Reference: Fix by Error Message

Error MessageLikely BugQuick Fix
"Call to member function on null"Null pointerAdd null check
"Undefined array key"Boundary issueCheck array_key_exists
"Type error: Argument X"Type issueAdd type validation
"Maximum execution time"Infinite loopAdd iteration limit
"Allowed memory exhausted"Resource leakClose resources in finally
"Integrity constraint violation"Race conditionAdd locking/transaction
"Cannot modify readonly property"Immutability violationCreate new instance

Domande frequenti

Cosa fa la skill IA Bug Fix Knowledge?

Bug fix knowledge base. Provides bug categories, symptoms, fix patterns, and minimal intervention principles for PHP 8.4 projects.

Perché usare Bug Fix Knowledge su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Bug Fix Knowledge è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che la skill smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Bug Fix Knowledge in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/dykyi-roman/awesome-claude-code/tree/master/skills/bug-fix-knowledge. TypingMind legge il file SKILL.md e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Bug Fix Knowledge?

Qualsiasi modello che colleghi a TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Bug Fix Knowledge?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Bug Fix Knowledge: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Bug Fix Knowledge è gratuita?

Sì. È pubblicata su GitHub da dykyi-roman con licenza MIT. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, template o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Elenco completo

Crea subito il tuo spazio di lavoro AI

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇