docs: AGENTS.md

Signed-off-by: Ryan Yin <xiaoyin_c@qq.com>
This commit is contained in:
Ryan Yin
2026-06-23 20:31:15 +08:00
parent b493cbae45
commit ef1c02f3cf
+16 -15
View File
@@ -31,7 +31,7 @@ If rules conflict, follow the higher-priority source and state the conflict brie
- Never write secret literals into tracked files. - Never write secret literals into tracked files.
- Use environment variables, secret managers, or placeholders. - Use environment variables, secret managers, or placeholders.
- Redact sensitive output in logs and summaries. - Redact sensitive output in logs and summaries.
- For infra/IaC changes, prefer plan/eval/check before apply/switch. - For infra/IaC changes, prefer plan/eval/check before apply/deploy.
## 4) Scope Discipline ## 4) Scope Discipline
@@ -50,33 +50,34 @@ If rules conflict, follow the higher-priority source and state the conflict brie
- Prefer structural search tools first for code find/replace (`ast-grep`/`jq`/`yq`), then text tools - Prefer structural search tools first for code find/replace (`ast-grep`/`jq`/`yq`), then text tools
(`rg`, `fd`). (`rg`, `fd`).
- Prefer project task runners (`just`, `make`, `task`, `npm scripts`, etc.) over ad-hoc commands - Prefer project task runners (`just`, `make`, `npm scripts`, etc.) over ad-hoc commands when
when equivalent. equivalent.
- If a required command is not already available, use only `nix run`, `flake.nix`/`shell.nix` or - Only use `nix run`, `flake.nix`/`shell.nix`, or `uv`/`pnpm` for missing commands & packages.
`uv`/`pnpm` to provide it. Otherwise, ask the user—never use another installer.
- If that is still insufficient, stop and ask the user to prepare the environment instead of using
any other installation method.
- Use `gh` CLI for GitHub operations, especially code/PR/issue search and inspection. - Use `gh` CLI for GitHub operations, especially code/PR/issue search and inspection.
## 7) Environment Defaults ## 7) Environment Defaults
- Primary OS: NixOS. - Primary OS: NixOS & macOS.
- Shell: default to `nushell`, `bash` also exists. - Shell: default to Nushell, Bash also exists.
## 8) Script Engineering Principles ## 8) Script Engineering Principles
Treat scripts as interruptible jobs that must be diagnosable and safe to rerun: Treat scripts as interruptible jobs that must be diagnosable and safe to rerun:
- Split workflows into explicit stages; allow running a selected stage via flags/arguments. - Prefer Python for complex or maintainable automation, Nushell for personal tooling. Use Bash only
- Make reruns idempotent; persist progress after each stage and support resume. for simple quick scripts.
- Cache external data with invalidation strategy to speed retries and improve reproducibility. - Verbose logging of progress, decisions, and errors.
- For HTTP flows, separate transport success from business success; support retry/backoff. - Stage workflows with selective execution via cli flags.
- Provide independent verification commands/checks for key outputs (counts, samples, invariants). - Idempotent reruns; persist progress and support resume.
- Cache external data with invalidation.
- Separate HTTP transport from business success; retry with backoff.
- Verify key outputs independently.
## 9) Communication Defaults ## 9) Communication Defaults
- Respond in the language the user is currently using, prefer English & Chinese. - Respond in the language the user is currently using, prefer English & Chinese.
- Code, commands, identifiers, and code comments: English. - Code, commands, identifiers, and code comments: Prefer English.
- Be concise, concrete, and action-oriented. - Be concise, concrete, and action-oriented.
## 10) Project Overlay ## 10) Project Overlay