- Apply these rules unless directly overridden by user instruction.
- Conflict order: (1) user instruction, (2) this guide, (3) generic assistant defaults.
- Save markdown files under
doc/. - Sub-folders under
doc/are allowed. - Prefix plan/summary filenames with
YYYYMMDD(example:20260219_implementation_summary.md).
- Assume no
sudoaccess. - Keep installs user-local and reproducible.
- Ensure
$HOME/.local/binis onPATH. - Package/tool install priority:
mamba- standalone user-space binary
condauv(Python packages only)pip
- If installation fails, report the cause and provide concrete next options.
- Use
rufffor lint/format andpyrightfor static type checks. - Tool configuration lives in
pyproject.toml.
- During iteration (changed files):
ruff check <changed_files> --fixruff format <changed_files>
- Before handoff:
ruff check . --fixruff format .pyright
- Run
pyrightafter changes affecting more than one file or a shared/core module. - Core/shared module: utility logic imported by multiple scripts/modules.
- Explicitly report type-check pass/fail.
- If type checks fail, fix relevant errors before handoff.
- Follow PEP 8; use 4-space indentation and
snake_case. - Prefer explicit names over abbreviations.
- Prefer
pathliboveros.pathwhere feasible. - Prefer f-strings over
.format()/%. - Add type hints; prefer
collections.abcabstract types where useful. - Guard entry points with
if __name__ == "__main__":. - No wildcard imports.
- Use
logging(notprint) in serious/production code. - Prefer
enumerate()over manual counters. - Avoid hard-coded absolute paths.
- Put reusable logic in importable modules under
src/. - Keep runnable scripts thin (arg parsing + orchestration).
- Use ordered step script names in
src/when applicable:01_...py,02_...py,03_...py.
- Use
logging.getLogger(__name__). - Use consistent levels:
DEBUG,INFO,WARNING,ERROR. - Include stable identifiers in workflow logs when available (e.g.,
run_id,gene,pmid).
- For iEnigma usage, follow:
/home/jhuang/project/NER_label_extraction/doc/iEnigma_v1.0_readme.md
- Never commit credentials, keys, tokens, or secrets.
- Keep large generated artifacts in designated output folders (for example,
result/). - Do not commit caches, temp files, or local environment folders.
- Update
.gitignorefor new generated artifact patterns.
- Add
pytesttests (tests/test_*.py) for reusable/shared logic; runpython -m pytest. - One-off scripts may use lightweight validation unless promoted to reusable workflow logic.
- Prefer Conventional Commits (
feat: ...,fix: ...). - If asked to commit all changes, split into logical commits when appropriate.
- In PRs: state goal, list impacted artifacts (especially under
data/), and include a small command/output example when behavior changes.