Files
vba/AGENTS.md
2026-05-28 12:58:08 +09:00

3.3 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_CASE with 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 Next is completely forbidden. Missing sheet/object should raise error directly via Err.Raise ERR_SHEET_MISSING. Do not suppress errors when checking if a sheet/worksheet/object exists.
  • Object variables must be explicitly Set obj = Nothing in Finally block or at end of procedure
  • Long operations must disable ScreenUpdating, Calculation, EnableEvents and restore on exit
  • Comments must be in English only. No Chinese, Japanese, or Korean characters allowed in any code comments or inline documentation
  • Forbidden: Select / Selection / ActiveCell. Always reference Range/Worksheet objects directly
  • Forbidden: hardcoded file paths or connection strings. Use config sheet or constants module
  • Forbidden: non-English comments (Chinese / Japanese / Korean)

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