This file guides agentic coding agents operating in this repository.
Scope: /Users/liuc9/github/useful-scripts and subdirectories.
- No centralized build system found (
Makefile,package.json,pyproject.toml, etc.). - No repo-wide lint/formatter config found (
.editorconfig,.eslintrc,.prettierrc,ruff.toml, etc.). - Repo is a collection of standalone utilities (bash/sh, Python, R, Perl, AppleScript).
Use the smallest, safest command that exercises parsing/usage.
-
Shell
- Syntax check:
bash -n path/to/script.sh - Dry-run/usage:
bash path/to/script.sh --help(only if script supports it)
- Syntax check:
-
Python
- Syntax check:
python -m py_compile path/to/script.py - Usage check:
python path/to/script.py --help(only if script supports it)
- Syntax check:
-
R
- Parse check:
Rscript -e "parse('path/to/script.R')"
- Parse check:
-
Perl
- Syntax check:
perl -c path/to/script.pl
- Syntax check:
-
AppleScript
- Compile check (macOS):
osacompile -o /tmp/out.scpt path/to/script.applescript - Note:
osacompilewrites to/tmp; request approval if sandbox forbids it.
- Compile check (macOS):
- No test harness exists.
- When adding tests later, prefer the pattern:
python -m pytest -q tests/test_<area>.py -k <case>(only if pytest is added)
If a verification command fails:
- Stop and inspect output.
- Fix only issues introduced by your change.
- Re-run the same command and report results.
- Treat each script as a standalone artifact; avoid cross-repo refactors.
- Match existing style within the file you modify (shebang, indentation, naming).
- Keep changes minimal and localized.
- Do not add new dependencies/tools unless explicitly requested.
Observed: scripts commonly use #!/bin/bash, simple inline logic, and minimal strict-mode.
- Shebang: Do not change existing shebangs. For new scripts, prefer
#!/usr/bin/env bash. - Strict mode: Only add
set -euo pipefailif the script already uses strict mode or if you’re prepared to fix fallout. - Quoting: Quote variable expansions (
"$var") unless word-splitting/globbing is intended. - Conditionals: Prefer
[[ ... ]]in bash scripts. - Loops: Quote array expansions (
"${arr[@]}") unless intentional. - External tools: Many scripts assume Linux tools (
find,awk,sed -i,lftp,nohup,zgrep). If you touch these paths, consider portability and document assumptions.
Observed: scripts are CLI-oriented, import multiple modules in one line sometimes, and often omit type hints.
- Python version: Don’t assume a specific version unless the script indicates it.
- Imports: Prefer one import per line when editing nearby code.
- Standard library first, then third-party (e.g.,
Bio,numpy), then local.
- Standard library first, then third-party (e.g.,
- Naming: Functions and variables in
snake_case. - Types: Add type hints only if the file already uses them; avoid type-suppression tricks.
- CLI: Preserve existing CLI shape (
sys.argv, customhelp()); don’t redesign argument parsing unless requested.
Observed: functions use fn_* naming and <- assignment.
- Keep assignment style consistent (
<-). - Prefer explicit namespace calls (
biomaRt::useMart) as in existing scripts. - Do not introduce new tidyverse piping unless already used in-file.
Observed: some scripts use use strict; and are vendor/NCBI-derived.
- Respect upstream formatting and comments (especially license/public domain blocks).
- Avoid refactors; make the smallest fix.
- Keep
use strict;/warnings consistent with the file.
- Preserve existing CLI/argument parsing patterns.
- Avoid UI/activation changes unless explicitly requested.
- Never add empty catch blocks.
- Prefer explicit exit codes for CLI scripts.
- When adding new external commands, check exit status if failure would be confusing/dangerous.
- Top-level contains most scripts.
- Subdirs exist (e.g.,
ncbi-script/,slurm-submit-jobs/). Treat each as its own mini-toolbox.
- No Cursor rules found in
.cursor/rules/or.cursorrules. - No GitHub Copilot instructions found in
.github/copilot-instructions.md.
- Read before edit: Always read a file before modifying it.
- Absolute paths: Use absolute paths rooted at
/Users/liuc9/github/useful-scripts/when using tools. - No commits: Do not commit or push unless explicitly requested.
- No new docs: Do not create new documentation unless asked (this file is an exception).
- No assumptions: If a tool/config is not present, don’t claim it exists.
Ask before:
- Adding dependencies (pip/CRAN/CPAN/npm/brew).
- Changing script outputs, flags, or defaults.
- Making portability-breaking changes (Linux-only vs macOS behavior).
- Adding a new test harness to the repo.