Logo di Debug Backend

Debug Backend

Community
yerdaulet-damir
debug-backend

Systematic 5-step backend debugging flow for AI-coded FastAPI apps. Load this skill when a bug is reported, a test fails, or unexpected behavior appears in any backend layer. Forces layer isolation before touching code — prevents the "touch 8 files and make it worse" pattern.

Panoramica

Autoreyerdaulet-damir
Repositoryvibe-coding-rules
Nome della skilldebug-backend
Stelle
34
Fork
1
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 yerdaulet-damir su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Debug Backend 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/yerdaulet-damir/vibe-coding-rules/tree/main/.claude/skills/debug-backend
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Nuova 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 nella cartella delle skill di quell'agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/yerdaulet-damir/vibe-coding-rules.git /tmp/vibe-coding-rules
mkdir -p .claude/skills
cp -r /tmp/vibe-coding-rules/.claude/skills/debug-backend .claude/skills/debug-backend
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Debug Backend 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 Debug Backend 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 Debug Backend 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à.

debug-backend

Stop. Do not edit any file yet. Work through these 5 steps in order.


Step 1 — Locate the layer

Run these greps to find where the bug lives. Check one layer at a time.

bash
# Is it a routing problem? (wrong status code, missing auth, bad request parsing)
grep -n "HTTPException\|status_code\|Depends(" app/routers/<file>.py

# Is it a service logic problem? (wrong calculation, wrong state transition)
grep -n "def \|raise \|return " app/services/<file>.py

# Is it a repository problem? (wrong query, missing user_id scope, transaction issue)
grep -n "SELECT\|filter\|where\|FOR UPDATE" app/repositories/<file>.py

# Is it a provider problem? (timeout, wrong response shape, missing error handling)
grep -n "httpx\|raise\|return\|except" app/providers/<file>.py

Decision: fix only in the layer where the bug lives. Never fix a service bug in the router.


Step 2 — Check the 3 most common AI antipatterns

These cause 80% of production bugs in AI-coded backends. Grep for each:

bash
# Antipattern 1: SQLAlchemy Session leaked into services
grep -rn "AsyncSession\|Session\|from sqlalchemy" app/services/

# Antipattern 2: Provider returning raw dict instead of domain type
grep -rn "return {" app/providers/

# Antipattern 3: Business logic in router (calculation, state change, external call)
grep -c "await.*service\|await.*repo\|if.*balance\|FOR UPDATE" app/routers/*.py
ResultRoot causePrinciple
Session in servicesHexagonal boundary brokenB1
return {} from providerMissing ACLB3
Logic in routerLayer violationA3 / code-standards
No user_id filter in queryMulti-tenancy gapsecurity-rules

Step 3 — Write a reproducing test first

Before changing any production code, write a failing test that captures the exact bug.

python
# Template: place in tests/unit/ or tests/integration/
async def test_<bug_description>():
    # Arrange: minimal setup that triggers the bug
    repo = FakeCreditsRepo()
    repo.seed_balance("user-1", Decimal("5.00"))
    service = CreditsUserService(repo=repo)

    # Act: call the exact code path that fails
    with pytest.raises(ValueError, match="Insufficient balance"):
        await service.charge("user-1", Decimal("10.00"), idempotency_key="idem-1")

    # Assert: prove the invariant that was violated
    assert await repo.get_balance("user-1") == Decimal("5.00")  # not negative

Run it: pytest tests/unit/test_<file>.py::test_<bug_description> -v It must be RED before you fix anything.


Step 4 — Fix in the correct layer

Minimum change. No opportunistic refactoring. No unrelated cleanup.

Router bug   → fix only app/routers/
Service bug  → fix only app/services/
Repo bug     → fix only app/repositories/
Provider bug → fix only app/providers/

After fixing: run the reproducing test. It must turn GREEN.

bash
pytest tests/unit/test_<file>.py::test_<bug_description> -v
# Expected: PASSED

Step 5 — Run architecture lint

bash
bash scripts/lint-architecture.sh

Must exit 0. If a check fails, the fix introduced a new architecture violation — revert and fix properly.


Common error → root cause table

ErrorWhere to look firstLikely cause
422 Unprocessable EntityRouter — Pydantic schemaWrong field type or missing required field
500 Internal Server ErrorService — exception not caughtProvider returned unexpected shape (dict not JobResult)
KeyError: 'url'Provider — ACL missingProvider response changed, parser not updated
InsufficientFunds on correct balanceRepo — concurrent holdTwo requests raced, no FOR UPDATE lock
401 on authenticated routeRouter — Depends(get_current_user_id) missingAuth dependency not wired
Test passes, prod failsRepo — fake vs real divergedFakeCreditsRepo doesn't match CreditsRepoProtocol
Logs silent on errorService — bare except:Exception swallowed, add logger.exception(...)

Verification

The skill was applied correctly when:

  • A failing test exists that reproduces the bug
  • Fix touches exactly one layer
  • bash scripts/lint-architecture.sh exits 0
  • No unrelated files were modified
  • The reproducing test is now green

Domande frequenti

Cosa fa la skill IA Debug Backend?

Systematic 5-step backend debugging flow for AI-coded FastAPI apps. Load this skill when a bug is reported, a test fails, or unexpected behavior appears in any backend layer. Forces layer isolation before touching code — prevents the "touch 8 files and make it worse" pattern.

Perché usare Debug Backend su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Debug Backend è 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 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 Debug Backend in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/yerdaulet-damir/vibe-coding-rules/tree/main/.claude/skills/debug-backend. TypingMind legge il file SKILL.md e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Debug Backend?

Qualsiasi modello che colleghi in 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 Debug Backend?

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

La skill IA Debug Backend è gratuita?

Sì. È pubblicata su GitHub da yerdaulet-damir 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, modelli 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.

Vedi tutti

Crea subito la tua area di lavoro IA

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