Logotipo de Bug Fix Knowledge

Bug Fix Knowledge

Comunidad
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

Descripción general

Editordykyi-roman
Repositorioawesome-claude-code
Nombre de la habilidadbug-fix-knowledge
Estrellas
98
Forks
25
Archivos incluidos
Solo instrucciones
LicenciaMIT
Enlaces
  • Instrucciones en Markdown

    Un archivo SKILL.md que el modelo carga cuando lo necesita, de modo que solo consume tokens cuando la petición encaja con la habilidad.

  • Funciona con cualquier LLM

    Las habilidades de IA están en Markdown, no en código específico de un proveedor, por lo que funcionan con GPT, Claude, Gemini, Grok o un modelo local.

  • Todo en las instrucciones

    Todo lo que necesita el modelo está en las instrucciones: no hay archivos adicionales que sincronizar.

  • Código abierto

    Publicada por dykyi-roman en GitHub. Revisa el contenido original antes de instalarla.

Instalación

Instala la habilidad de IA Bug Fix Knowledge en TypingMind para usarla con cualquier LLM, o añádela a otro agente que lea SKILL.md.

1

Instalar en TypingMind

TypingMind instala una habilidad directamente desde su carpeta de GitHub: lee SKILL.md, empaqueta los archivos de recursos y guarda el resultado localmente.

  1. Abre la aplicación y ve a Plugins → Habilidades.
  2. Elige «Instalar desde GitHub».
  3. Pega la URL de la carpeta de la habilidad que se muestra a continuación y confirma.
    https://github.com/dykyi-roman/awesome-claude-code/tree/master/skills/bug-fix-knowledge
  4. Activa la habilidad en cada chat en el que quieras tenerla disponible.
Plugins → Habilidades → Añadir habilidad → URL de GitHub; después, pega la URL de la carpeta y pulsa Continuar.
2

Instalar en otro agente

Cualquier agente que lea el formato Agent Skills puede usar esta habilidad: copia la carpeta en el directorio de habilidades de ese 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
Reinicia Claude Code después de copiarla para que detecte la nueva habilidad.

Úsala en TypingMind

Activa Bug Fix Knowledge en cualquier chat de TypingMind y el modelo se encargará del resto. Su nombre y descripción se incluyen en el prompt del sistema y, en cuanto una petición encaja con la habilidad, el modelo carga las instrucciones completas por sí solo. No tienes que invocarla manualmente y no consume tokens hasta que se utiliza.

El modelo carga Bug Fix Knowledge automáticamente en cuanto una petición es relevante para esa habilidad.

Funciona con cualquier modelo de IA

Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que Bug Fix Knowledge no está vinculada al modelo para el que se creó. Instálala una sola vez en TypingMind y úsala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modelo local que ejecutes tú, todo con tus propias claves API.

  • Se carga solo cuando se necesita

    El prompt del sistema solo incluye el nombre y la descripción. Las instrucciones se cargan con la primera petición que encaja con la habilidad, por lo que una habilidad que no se usa no supone ningún coste.

  • Cambia de modelo durante el chat

    Como la habilidad contiene instrucciones y no código, cambiar de modelo no impide que funcione: el nuevo modelo lee el mismo archivo SKILL.md.

Instrucciones de la habilidad

Este es el contenido de SKILL.md que carga el modelo. Léelo antes de instalar la habilidad: contiene instrucciones que tu modelo 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

Preguntas frecuentes

¿Qué hace la habilidad de IA Bug Fix Knowledge?

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

¿Por qué usar Bug Fix Knowledge en TypingMind?

Porque la instalas una vez y la usas con cualquier modelo. Bug Fix Knowledge está escrita en Markdown, no en código específico de un proveedor, por lo que la misma habilidad funciona con GPT-5, Claude, Gemini, Grok o un modelo local, y puedes cambiar de modelo en mitad del chat sin que deje de funcionar. TypingMind utiliza tus propias claves API, de modo que pagas directamente a los proveedores en lugar de pagar una suscripción por puesto, y tus habilidades y chats permanecen en tu propio almacenamiento.

¿Cómo instalo Bug Fix Knowledge en TypingMind?

Abre Plugins → Habilidades → Instalar desde GitHub en TypingMind y pega https://github.com/dykyi-roman/awesome-claude-code/tree/master/skills/bug-fix-knowledge. TypingMind lee el archivo SKILL.md de esa carpeta e instala su contenido como una habilidad que puedes activar en cada chat.

¿Qué modelos de IA pueden usar Bug Fix Knowledge?

Cualquier modelo que conectes en TypingMind. Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que GPT, Claude, Gemini, Grok y los modelos locales pueden cargar esta habilidad cuando una solicitud se corresponda con ella.

¿Con cuántos modelos de IA puedo usar Bug Fix Knowledge?

Con tantos como quieras. Siempre que un modelo admita habilidades, puedes usar Bug Fix Knowledge con él: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama y muchos más, todos en TypingMind con tus propias claves API.

¿Es gratuita la habilidad de IA Bug Fix Knowledge?

Sí. dykyi-roman la ha publicado en GitHub bajo la licencia MIT. Solo pagas a tu proveedor de IA por los tokens que utilizas.

¿Qué son las habilidades de IA?

Una habilidad de IA es un conjunto de instrucciones reutilizables que enseña a un modelo de IA a realizar una tarea concreta. Sigue el formato abierto Agent Skills: un archivo SKILL.md con un nombre y una descripción, además de los scripts, plantillas o archivos de referencia que pueda necesitar el modelo. El modelo solo lee las instrucciones cuando tu solicitud se corresponde con la habilidad, por lo que una habilidad instalada no supone ningún coste hasta que se utiliza.

¿En qué se diferencian las habilidades de IA de los plugins o los servidores MCP?

Un plugin o un servidor MCP proporciona al modelo nuevas herramientas que puede invocar: código que se ejecuta en algún lugar y devuelve un resultado. En cambio, una habilidad de IA aporta conocimientos y procedimientos al modelo: cómo abordar una tarea, qué pasos seguir y qué se considera un buen resultado. Las habilidades son instrucciones en Markdown, por lo que no necesitan servidor, clave API ni entorno de ejecución, y funcionan con cualquier modelo.

Ver el directorio

Crea ya tu propio espacio de trabajo con IA

Suscríbete a nuestro boletín para recibir avisos sobre nuevas funciones y próximos sorteos 👇