3.0 KiB
AGENTS.md - VBA Coding Constraints
Project Overview
- Project Name: Commuter Allowance Editor
- App: Excel 2021
- Purpose: Edit commuter certification by referencing master data
VBA Coding Constraints
Naming Conventions
- Module:
mod[Domain][Action](e.g.,modReportGenerator,modDataValidation) - Class Module:
cls[Noun](e.g.,clsInvoiceParser,clsDbConnection) - Public Procedure: PascalCase (e.g.,
GenerateMonthlyReport) - Private Procedure: camelCase with prefix (e.g.,
parseRawData,validateInput) - Constant:
UPPER_SNAKE_CASEwith scope prefix (e.g.,PUB_MAX_RETRY_COUNT,PRV_DEFAULT_PATH) - Variable: Hungarian or semantic naming, but must be consistent across the project
Mandatory Rules
- ✅ Every module must start with
Option Explicit - ✅ All Public procedures must have a comment header (description, params, return value, author, date)
- ✅
On Error Resume Nextis forbidden as global error handling. Only allowed in small scopes paired withOn Error GoTo 0 - ✅ Object variables must be explicitly
Set obj = NothinginFinallyblock or at end of procedure - ✅ Long operations must disable
ScreenUpdating,Calculation,EnableEventsand restore on exit - ❌ Forbidden:
Select/Selection/ActiveCell. Always reference Range/Worksheet objects directly - ❌ Forbidden: hardcoded file paths or connection strings. Use config sheet or constants module
Project Structure
vba/ AGENTS.md, README.md, .gitignore, LICENSE 通勤手当テンプレート2026xxxx.xlsm (latest date version) data/ CSV master data (14 files) documents/ design docs (3 files) sql/ DB definitions (4 files) src/sh/ juk/ address module init_module/Import_modules.bas module/Common_Button.bas tuk/ commuter module init_module/ Import_modules.bas Test_Cache.bas module/ Common_Button.bas (306 lines) Common_Constants.bas Common_File_Utils.bas (347 lines) Common_Functions.bas (486 lines) Common_Global_Cache.bas (586 lines) Common_Selector.bas (161 lines) Common_Shape.bas sheet/ sheet classes (13 files) C1.cls (846 lines) - commuter allowance editor M1.cls (167 lines) - section master M2.cls (400 lines) - section detail master O1.cls (5 lines) - address master O2.cls (6 lines) - sender master (507) O3.cls (61 lines) - master 225 T1.cls (54 lines) - commutation pass master T2.cls (114 lines) - ticket master T3.cls (74 lines) - master 246 Z1.cls (64 lines) - transport master (222) Z2.cls (54 lines) - decision master (223) Z3.cls (57 lines) - monthly amount decision master (224) Z4.cls - master Z4
Sheet class prefixes: C=commuter editing, M=section master, O=other, T=commuter route, Z=master config