agentleFS
Thank-you-LinusThank-you-Linus/Linus-Dashboard/.claude/skills/debug/SKILL.md

debug

Skill214 starsChanged 31 days agoMITView on GitHub

Debug errors, bugs, and unexpected behavior systematically in Home Assistant integration. Use when investigating errors, analyzing stack traces, fixing bugs, or troubleshooting unexpected behavior.

192 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use add-discord, add-slack and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • MicrosoftSkill

    add-discord

    Add Discord bot channel integration via Chat SDK.

    Also in 11 projects that use this

  • MicrosoftSkill

    add-slack

    Add Slack channel integration via Chat SDK.

    Also in 11 projects that use this

  • +10 more from microsoft

The file

We split this skill into the rules it gives an agent

12 rules. 0 are common, 11 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 175 edited versions we read keep these.

  • 11

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When does it occur? (startup, service call, state change)

    line 28
  2. Distinctive:

    Read the file where error occurs

    line 86
  3. Distinctive:

    Follow code standards from .aidriven/rules/clean_code.md

    line 113
  4. Distinctive:

    Add error handling if missing

    line 114
  5. Distinctive:

    Update documentation if behavior changed

    line 115
  6. Distinctive:

    Verify error is gone

    line 120
  7. Distinctive:

    Check logs for new errors

    line 121
  8. Distinctive:

    Update inline comments if needed

    line 133
  9. Distinctive:

    Update CHANGELOG if user-facing

    line 135
  10. Very specific:

    Solution: Add await before async function calls

    line 142
  11. Distinctive:

    Solution: Check entry setup and platform registration

    line 152
  12. Distinctive:

    Solution: Verify state updates and coordinator refresh

    line 161

“Common” is measured: kept by at least 6 in 10 of the 175 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Debug Errors and Bugs Systematically

Debug errors, bugs, and unexpected behavior in the Linus Dashboard Home Assistant integration.


Context Loading

Before debugging, load:

  1. .aidriven/memorybank.md - Project architecture
  2. .aidriven/rules/clean_code.md - Code standards
  3. .aidriven/rules/homeassistant_integration.md - HA patterns
  4. .aidriven/rules/async_patterns.md - Async best practices

Debug Process

Step 1: Understand the Error

Collect Information:

  • Error message (full stack trace)
  • When does it occur? (startup, service call, state change)
  • Which file/function is involved?
  • User actions that trigger it
  • Home Assistant version and logs

Questions to Ask:

  1. Is this a Python exception or HA-specific error?
  2. Does the error occur consistently or randomly?
  3. Are there related errors in home-assistant.log?
  4. What changed recently (code, config, HA version)?

Step 2: Analyze Root Cause

Common Error Categories:

1. Async/Await Issues

# Symptoms:
# - "coroutine was never awaited"
# - Event loop blocking
# - Timeouts

# Check for:
await missing_function()  # Missing await
blocking_io_call()  # Blocking I/O in async context

2. Home Assistant Integration Errors

# Symptoms:
# - Integration fails to load
# - Config flow errors
# - Entity not showing up

# Check for:
# - Missing async_setup_entry/async_unload_entry
# - Incorrect platform registration
# - Missing unique_id on entities
# - Data not stored in hass.data correctly

3. API/Network Errors

# Symptoms:
# - Connection refused
# - Timeouts
# - 4xx/5xx HTTP errors

# Check for:
# - Supabase URL/key configuration
# - Network connectivity
# - API rate limits
# - Timeout values

Step 3: Investigate

Review Code:

  • Read the file where error occurs
  • Trace the execution path
  • Check function signatures
  • Review recent changes with git log

Check Logs:

# Home Assistant logs
tail -f /config/home-assistant.log | grep linus

# Check for warnings
grep -i "warning.*linus" /config/home-assistant.log

Add Debug Logging:

import logging
_LOGGER = logging.getLogger(__name__)

_LOGGER.debug("Variable value: %s", variable)
_LOGGER.info("Entering function with args: %s", args)

Step 4: Fix the Issue

Apply Fix:

  • Make minimal changes to fix root cause
  • Follow code standards from .aidriven/rules/clean_code.md
  • Add error handling if missing
  • Update documentation if behavior changed

Test the Fix:

  1. Restart Home Assistant
  2. Reproduce the original error scenario
  3. Verify error is gone
  4. Check logs for new errors
  5. Test related functionality

Step 5: Verify and Document

Verification:

  • Error no longer occurs
  • No new errors introduced
  • Related features still work
  • Logs are clean

Documentation:

  • Update inline comments if needed
  • Note the fix in commit message
  • Update CHANGELOG if user-facing

Common Issues and Solutions

Issue: "coroutine was never awaited"

Solution: Add await before async function calls

# Before
result = async_function()

# After
result = await async_function()

Issue: Integration doesn't load

Solution: Check entry setup and platform registration

# Ensure proper setup
async def async_setup_entry(hass, entry):
    await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
    return True

Issue: Entity not updating

Solution: Verify state updates and coordinator refresh

# Ensure coordinator updates
await self.coordinator.async_request_refresh()

Issue: Timeout errors

Solution: Increase timeout or optimize slow operations

# Add proper timeout
async with timeout(30):
    result = await slow_operation()

Debug Tools

Home Assistant Developer Tools:

  • Services tab - Test service calls
  • States tab - Check entity states
  • Events tab - Monitor events
  • Template tab - Test templates

Python Debugging:

# Add breakpoint (if debugging locally)
import pdb; pdb.set_trace()

# Add detailed logging
_LOGGER.debug("State: %s, Attrs: %s", self.state, self.extra_state_attributes)

Git Tools:

# Find when bug was introduced
git log --oneline -- path/to/file.py

# Check recent changes
git diff HEAD~5 -- path/to/file.py

Checklist

Before completing debug:

  • Root cause identified
  • Fix implemented following code standards
  • Error no longer reproduces
  • Related functionality tested
  • Logs reviewed for new issues
  • Changes documented

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.