update the repo

This commit is contained in:
DatTT127
2026-06-23 13:39:43 +07:00
parent 3283a8f8af
commit fdb384434d
61 changed files with 1450 additions and 226 deletions

View File

@@ -0,0 +1,18 @@
# Checklist: file_naming_convention
## File/Directory Creation/Rename/Move
- [ ] All new files and directories use `snake_case` (lowercase, digits, underscores only)
- [ ] No spaces or special characters in file/directory names
- [ ] Hyphens (`-`) used only in `docker-compose.yaml`, `docker-compose.yml`, `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`
- [ ] `UPPER_SNAKE_CASE` used only for root-level configuration constants (e.g., `CONFIG.json`, `Dockerfile`)
- [ ] Forbidden extensions (`.pdf`, `.pptx`, `.docx`, `.xlsx`, `.csv`, `.zip`, `.pth`, `.png`, `.jpg`, `.jpeg`, `.gif`, `.bmp`, `.tiff`, `.webp`, `.mp4`, `.mov`, `.avi`, `.dcm`, `.nii`, `.nii.gz`) are not present in the repository
- [ ] Any file under `LEGACY/` that is modified includes an inline comment `# LEGACY:` explaining the change
- [ ] Test files follow the pattern: `tests/<same_path_as_source>/test_<source_filename>`
## Verification Steps
1. Check all created/renamed/moved files for snake_case naming
2. Verify hyphen usage is limited to allowed files: docker-compose.yaml/.yml, package-lock.json, yarn.lock, pnpm-lock.yaml
3. Confirm UPPER_SNAKE_CASE appears only for root config files
4. Scan for forbidden file extensions
5. Inspect any changes in LEGACY/ directory for required comment
6. Validate test file placement matches source file structure

View File

@@ -0,0 +1,74 @@
# Examples: file_naming_convention
## Correct Examples
### File Naming
- `patient_data.csv` → ❌ (forbidden extension, should be external)
- `patient_data.json` → ✅ (allowed extension, snake_case)
- `Dockerfile` → ✅ (UPPER_SNAKE_CASE allowed for root config)
- `docker-compose.yaml` → ✅ (hyphen allowed exception)
- `docker-compose.yml` → ✅ (hyphen allowed exception)
- `package-lock.json` → ✅ (hyphen allowed exception)
- `yarn.lock` → ✅ (hyphen allowed exception)
- `pnpm-lock.yaml` → ✅ (hyphen allowed exception)
- `config.json` → ✅ (snake_case, allowed extension)
- `api/v1/patient_routes.py` → ✅ (snake_case in path)
### Directory Naming
- `data_models/` → ✅
- `api_v2/` → ✅
- `legacy_data/` → ✅ (but see LEGACY/ rule below)
### LEGACY/ Directory
```python
# LEGACY: Temporary fix for migration issue #123
# TODO: Remove after migration complete
legacy_code_here()
```
→ ✅ (includes required comment)
### Test Files
```
src/
models/
patient_model.py
tests/
models/
test_patient_model.py
```
→ ✅ (test file mirrors source path)
## Incorrect Examples
### File Naming
- `PatientData.json` → ❌ (PascalCase, should be snake_case)
- `patient-data.json` → ❌ (hyphen not allowed except docker-compose and lockfiles)
- `patient data.json` → ❌ (spaces not allowed)
- `patient.PDF` → ❌ (forbidden extension)
- `secret_key.pem` → ❌ (forbidden extension)
- `package_lock.json` → ❌ (should be package-lock.json with hyphens)
- `yarn_lock` → ❌ (should be yarn.lock with hyphen and extension)
- `docker_compose.yaml` → ❌ (should be docker-compose.yaml with hyphens)
### Directory Naming
- `DataModels/` → ❌ (PascalCase)
- `data-models/` → ❌ (hyphens not allowed)
- `data models/` → ❌ (spaces)
### LEGACY/ Directory
```python
# Modified legacy function
def old_function():
pass
```
→ ❌ (missing `# LEGACY:` comment)
### Test Files
```
src/
utils/
helper.py
tests/
test_helper.py # ❌ Incorrect: should be tests/utils/test_helper.py
```
→ ❌ (test file does not mirror source path)

View File

@@ -0,0 +1,40 @@
# Skill: file_naming_convention
## Trigger Conditions
Any file or directory create, rename, or move operation.
## Rules
### 1. File and Directory Naming
- All files and directories must use `snake_case` (lowercase letters, digits, underscores only).
- No spaces or special characters (except hyphens in specific cases).
- Severity: `[ERROR]`
### 2. Hyphen Usage Exception
- Hyphens (`-`) are allowed ONLY in the following specific filenames (where changing the name would break standard tooling):
- `docker-compose.yaml`, `docker-compose.yml`
- `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`
- Files beginning with '.' (like `.gitignore`, `.env`, `.npmrc`) are exempt from snake_case requirements for the prefix portion, but the suffix should follow naming conventions where practical.
- Any other use of hyphens in file or directory names is prohibited.
- Severity: `[ERROR]`
### 3. Uppercase Reserved for Root Constants
- `UPPER_SNAKE_CASE` is reserved only for root-level configuration constants (e.g., `CONFIG.json`, `Dockerfile`).
- Using `UPPER_SNAKE_CASE` for regular files or directories is prohibited.
- Severity: `[ERROR]`
### 4. Forbidden Extensions
The following file extensions are forbidden in the repository (must be stored externally and referenced by URL):
- `.pdf`, `.pptx`, `.docx`, `.xlsx`, `.csv`, `.zip`, `.pth`, `.png`, `.jpg`, `.jpeg`, `.gif`, `.bmp`, `.tiff`, `.webp`, `.mp4`, `.mov`, `.avi`, `.dcm`, `.nii`, `.nii.gz`
- Severity: `[ERROR]`
### 5. LEGACY/ Directory Policy
- The `LEGACY/` directory is read-only.
- Any modification to files under `LEGACY/` must include an inline comment `# LEGACY:` explaining why the change is necessary.
- Failure to include this comment when modifying LEGACY/ files is a violation.
- Severity: `[ERROR]`
### 6. Test File Naming
- Test files must mirror the source file path in a parallel `tests/` directory.
- Example: `src/module.py``tests/test_module.py`
- Severity: `[WARN]`