Guidance for AI agents working with Terminal.Gui. For humans, see CONTRIBUTING.md. See also: llms.txt for machine-readable context.
| Your Task | Go Here |
|---|---|
| "Build me an app that..." | .claude/tasks/build-app.md |
| "Add a feature to Terminal.Gui..." | Continue below (Contributor Guide) |
| "Fix a bug in Terminal.Gui..." | Continue below (Contributor Guide) |
dotnet new install Terminal.Gui.Templates@2.0.0-alpha.*
dotnet new tui-simple -n myapp
cd myapp
dotnet runSee .claude/tasks/build-app.md for complete app development guide. See .claude/cookbook/common-patterns.md for UI recipes.
The rest of this file is for contributors modifying Terminal.Gui itself.
READ .claude/REFRESH.md first. It contains a quick checklist to prevent common mistakes.
USE .claude/POST-GENERATION-VALIDATION.md to validate ALL code. This catches the most common formatting violations AI agents make.
See .claude/rules/ for detailed guidance:
formatting.md- SPACING, BRACES, BLANK LINES (most commonly violated!)type-declarations.md- No var except built-in typestarget-typed-new.md- Usenew ()notnew TypeName()terminology.md- SubView/SuperView, never "child/parent"event-patterns.md- Lambdas, closures, handlerscollection-expressions.md- Use[...]syntaxcwp-pattern.md- Cancellable Workflow Patterncode-layout.md- Backing fields, member orderingapi-documentation.md- XML documentation requirementstesting-patterns.md- Test patterns and requirements
See .claude/tasks/ for task checklists:
scenario-modernization.md- Upgrading UICatalog scenariosclean-code-review.md- Creating clean git commit historiesbuild-app.md- Building applications with Terminal.Gui
When in planning mode:
- Create plan files in
./plans/(relative to the repository root) - Plan files should be markdown format
- Include detailed implementation steps, file changes, and verification steps
- Reference existing code patterns and reuse opportunities
Terminal.Gui - Cross-platform .NET console UI toolkit
- Language: C# (net8.0)
- Branch:
v2_develop - Version: v2 (Alpha)
dotnet restore
dotnet build --no-restore
dotnet test Tests/UnitTestsParallelizable --no-build
dotnet test Tests/UnitTests --no-build| Concept | Documentation |
|---|---|
| Application Lifecycle | docfx/docs/application.md |
| View Hierarchy | docfx/docs/View.md |
| Layout (Pos/Dim) | docfx/docs/layout.md |
| CWP Events | docfx/docs/cancellable-work-pattern.md |
| Terminology | docfx/docs/lexicon.md |
- Space BEFORE
()and[]-Method ()notMethod(),array [i]notarray[i](MOST VIOLATED!) - Braces on NEXT line - ALL opening braces use Allman style
- Blank lines - before
return/break/continue, after control blocks - No
varexcept:int,string,bool,double,float,decimal,char,byte - Use
new ()notnew TypeName() - Use
[...]notnew () { ... }for collections - SubView/SuperView for containment (Parent/Child only for non-containment refs)
- Unused lambda params - use
_:(_, _) => { }
- Prefer
UnitTestsParallelizableoverUnitTests - Add comment:
// Claude - Opus 4.5 - Never decrease coverage
- Avoid
Application.Initin tests
/Terminal.Gui/ - Core library
/Tests/ - Unit tests
/Examples/UICatalog/ - Demo app
/docfx/docs/ - Documentation
/.claude/ - AI agent guidance
- Don't forget space before
()and[]- this is the #1 mistake! - Don't put braces on same line (use Allman style)
- Don't skip blank lines before returns or after control blocks
- Don't use
varfor non-built-in types - Don't use redundant type names with
new - Don't say "child/parent" for containment (use SubView/SuperView)
- Don't modify unrelated code
- Don't introduce new warnings
- Don't skip POST-GENERATION-VALIDATION.md after writing code