For: AI assistants (Cursor, GitHub Copilot, Codex, etc.) working on NiceGUI codebase
About: The project, examples and architecture is described in README.md
Standards: All coding standards are in CONTRIBUTING.md – follow those rules
Don't settle for the first solution. Question assumptions and think deeply about the true nature of the problem before implementing.
We work together as pair programmers, switching seamlessly between driver and navigator:
- Requirements first: Verify requirements are correct before implementing, especially when writing/changing tests
- Discuss strategy: Present options and trade-offs when uncertain about approach
- Step-by-step for large changes: Break down significant refactorings and get confirmation at each step
- Challenge assumptions: If the user makes wrong assumptions or states untrue facts, correct them directly
- Prefer simple, straightforward solutions
- Avoid over-engineering
- Remove obsolete code rather than working around it
- Code should be self-explanatory
Note: See CONTRIBUTING.md for detailed style principles, code organization rules, and async/event loop requirements.
nicegui.*is public API – breaking changes need deprecation paths- New parameters must have sensible defaults for backward compatibility
- Validate user inputs at API boundaries for critical operations
Look at similar elements in nicegui/elements/ for patterns on initialization, props handling, and event binding.
- Global mutable state in library code
- Blocking I/O in async handlers or WebSocket paths
- Broad exception catching without proper error context
- Debug prints in library code (use proper logging)
- Unnecessary dependencies – check if existing code suffices
- Duplicate logic – consolidate when introducing new patterns
- Overwriting .env files without explicit user confirmation
- Creating new files when editing existing ones would suffice
nicegui/– Core library (public API), highest stability requirementsexamples/– Standalone demos, must be minimal and runnablewebsite/– Documentation site, keep in sync with code behaviortests/– Test suite, prefer pytest patternsmain.py– Runs the nicegui.io website locally
Before claiming a task complete, verify:
- No blocking operations in async code?
- Public API backward compatible?
- Tests passing? (see CONTRIBUTING.md)
- Linters passing? (see CONTRIBUTING.md)
- Debug code removed?
- Check online sources for inspiration or verification rather than guessing
- Search the codebase for similar patterns before inventing new ones
- Ask the user by presenting options and trade-offs if strategy is unclear
- Start broad, then narrow: Explore with semantic search, then drill into specific files
Purpose: Maximize signal/noise, protect API stability, and offload maintainers. Act as a single, concise reviewer. Prefer one structured top-level comment with suggested diffs over many line-by-line nits.
Standards Reference: Before starting a review, internalize all coding standards, style guidelines, and contribution workflows defined in CONTRIBUTING.md and the principles above.
- Audience: PR authors and maintainers of
zauberzeug/nicegui - Voice: concise, technical, actionable. No style opinions when linters/formatters are green
- Output format: one summary + grouped findings (BLOCKER, MAJOR, CLEANUP) + suggested diff blocks where possible
- Security/Secrets: leaked creds/keys, unsafe eval/exec, command injection, uncontrolled deserialization, path traversal, template injection
- Concurrency/Async correctness: event loop blocking (long CPU/I/O in async handlers), missing awaits, race conditions, deadlocks, using
asyncio.create_task()instead ofbackground_tasks.create(), non-thread-safe mutations in background tasks - Public API stability: breaking changes in
nicegui.*without explicit deprecation path. New params must be backward compatible with sensible defaults - Performance regressions on hot paths: O(n²) additions, synchronous I/O, unnecessary per-request heavyweight objects
- Docs/Examples mismatch: code diverges from documented behavior, examples stop working
- Tests & CI: missing or incomplete tests; ignoring configured linters/type checks (see CONTRIBUTING.md for test requirements)
- PR description quality: missing/vague problem statement, motivation per PR template requirements
- Formatting & placement: unformatted files (violates CONTRIBUTING.md pre-commit requirements), surprising file placement without rationale
- Explanation of the change: missing/vague explanation of motivations behind the change, why it is needed, what is the impact
- Error-handling gaps: exceptions swallowed, broad
except:, unvalidated user input - File/feature placement: unexpected location or architecture drift; justify location or move accordingly
- Unnecessary complexity: simpler design meets requirements (violates CONTRIBUTING.md "prefer simple solutions" principle)
- Resource hygiene: unclosed files/sockets/tasks; memory leaks; missing context managers
- Logging/observability: noisy logs, missing error context; debug prints in library code
- Cross-platform pitfalls: Windows paths, locale/timezone assumptions, reliance on system binaries without guards
- Readability: complex logic without NOTE comments; magic numbers; missing docstrings on public API
- Test coverage: edge cases untested (empty/None, large payloads, cancellation)
- Micro-perf: avoid tiny allocations in tight loops; cache pure results; defer imports in cold paths
nicegui/(library): treat as public API. Ensure new props/arguments have defaults; validate inputs; add/extend testsexamples/: keep minimal and runnable; ensure no hidden dependencies; prefer idiomatic NiceGUI usagewebsite/& docs: verify snippets still run; avoid drift between docs and codetests/: prefer fast, deterministic tests; isolate network and time; use fixtures over sleeps
Structure your review comment like this:
Summary
What changed, risk hotspots, and migration impact in 2-4 bullets.
BLOCKER
Itemized violations of critical rules with short rationale and reproduction if relevant.
MAJOR
Concrete issues that should be fixed pre-merge.
CLEANUP
Low-noise, quick-win improvements.
Suggested diffs
Use GitHub's suggestion blocks (apply only if trivial and safe):
- data = Path('config.json').read_text()
+ with Path('config.json').open() as f:
+ data = f.read()- Prefer one top-comment; avoid scatter
- If evidence is weak/speculative, ask a short question instead of asserting
- If change is broad: propose a tiny follow-up PR rather than expanding this one
Mental checklist before posting review:
- Public API surface changed? Defaults/backward compatibility preserved?
- Async paths non-blocking? Tasks cleaned up? Timeouts and cancellations handled?
- Secrets and security basics ok? Inputs validated? No dangerous eval/exec?
- Tests: added/updated? any flakiness? coverage for edge cases?
- Docs/examples updated if behavior changed?
This file complements CONTRIBUTING.md. For style rules, formatting, and detailed contribution workflow, see CONTRIBUTING.md.
Maintainers: update this file as conventions evolve.