audit-concurrency

Audit customtkinter concurrency patterns for main-thread widget updates and .after() marshaling.

Updated Feb 26, 2026
One-click install
npx skills add https://github.com/ElPoot/contabilidad --skill audit-concurrency
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: audit-concurrency
Source: https://github.com/ElPoot/contabilidad/tree/main/.agents/skills/audit-concurrency
Command: npx skills add https://github.com/ElPoot/contabilidad --skill audit-concurrency

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents UI freezes and crashes by auditing whether the app updates customtkinter widgets only from the main thread and whether worker results are correctly marshaled back using the expected .after() pattern.

Core Features & Use Cases

  • Main-thread UI safety checks: Detects direct widget updates (configure/insert/delete/pack/grid) performed from worker threads.
  • Worker-to-UI communication verification: Flags missing or incorrect use of .after() (including Queue-based patterns) when returning from background work.
  • Blocking-call detection in UI callbacks: Finds heavyweight operations (e.g., indexing, HTTP requests, time.sleep) triggered directly from event handlers that would freeze the interface.

Use case: When the app loads sessions or processes “orphaned PDFs” using background workers, use this Skill to ensure the UI stays responsive and avoids undefined behavior on Windows.

Quick Start

Ask the AI to run the audit-concurrency Skill to check gestor_contable/gui for UI updates from workers and any blocking operations on the main thread.

Frequently Asked Questions about audit-concurrency

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does my customtkinter UI freeze when running background threads?

Your customtkinter UI freezes when background threads directly manipulate widgets instead of returning results to the main thread. Auditing concurrency detects unsafe worker thread widget mutations and verifies proper .after() or queue-based marshaling to keep the interface responsive.

How do I prevent race conditions and UI freezes in Python threading applications?

Preventing race conditions requires auditing thread usage to ensure widgets are only manipulated from the main thread. You verify worker targets avoid direct widget mutations and confirm results safely return using .after() or queue-based UI marshaling.

How do I use .after() to update customtkinter widgets from a worker thread?

To update customtkinter widgets from a worker thread, use .after() to schedule UI updates on the main thread. Auditing verifies this worker-to-UI communication pattern is correctly implemented and flags missing or incorrect .after() usage when returning from background work.

Does this concurrency audit work for Windows customtkinter applications?

Yes, this concurrency audit works for Windows customtkinter applications. It specifically prevents undefined behavior on Windows by checking UI callbacks for blocking calls like HTTP requests or time.sleep, ensuring worker results are safely marshaled back to the main thread.

What blocking calls cause UI freezes in customtkinter event handlers?

Blocking calls like time.sleep, HTTP requests, and indexing operations triggered directly from customtkinter event handlers cause UI freezes. The audit detects these heavyweight operations in UI callbacks and flags them to prevent the interface from becoming unresponsive.

When should I use a queue instead of .after() for thread-safe UI updates?

You should use a queue instead of .after() for thread-safe UI updates when managing complex worker-to-UI communication patterns. The audit verifies both queue-based and .after() marshaling methods to confirm worker results are safely returned to the customtkinter main thread.