AgentSkillsCN

code-conventions

在实现完成后,运行所有TUI代码规范检查(常量、枚举、快捷键、模型、内联CSS),以强化项目标准,及时发现并修正可能存在的编码疏漏。

SKILL.md
--- frontmatter
name: code-conventions
description: Run all TUI code convention checks (constants, enums, keybindings, models, inline CSS) after implementation to enforce project standards and catch misplaced patterns.

Code Conventions Check

Run convention checks for kubeagle.

What It Checks

CheckConventionCorrect Location
ConstantsUPPER_CASE values, thresholds, patternsconstants/
EnumsEnum class definitionsconstants/enums.py
KeybindingsBINDINGS lists, Binding() callskeyboard/
ModelsBaseModel, dataclass, NamedTuplemodels/
Inline CSSCSS/DEFAULT_CSS class variablescss/**/*.tcss files

Instructions

Run checks in parallel when possible. Exclude tests/ and __pycache__/.

1. Constants

bash
rg --line-number --glob '*.py' '^[A-Z][A-Z_0-9]+\s*=' kubeagle

Exclude matches under kubeagle/constants/ and kubeagle/keyboard/.

2. Enums

bash
rg --line-number --glob '*.py' 'class\s+\w+\((str,\s*)?Enum\)' kubeagle

Exclude kubeagle/constants/enums.py.

3. Keybindings

bash
rg --line-number --glob '*.py' '^\s*BINDINGS\s*=\s*\[' kubeagle
rg --line-number --glob '*.py' 'Binding\s*\(' kubeagle

Exclude kubeagle/keyboard/.

4. Models

bash
rg --line-number --glob '*.py' 'class\s+\w+\(.*BaseModel.*\)' kubeagle
rg --line-number --glob '*.py' '@dataclass' kubeagle

Exclude kubeagle/models/.

5. Inline CSS

bash
rg --line-number --glob '*.py' "DEFAULT_CSS\\s*=\\s*['\\\"]" kubeagle
rg --files kubeagle | rg '\\.tcss$'

Exclude kubeagle/css/.

Report Format

text
## SUMMARY
Total violations: [N]
Status: PASS / FAIL

Use architecture rules in AGENTS.md as the source of truth for keybinding locations.