Imported from ToDSung/tod-blog (
AGENTS.md). Install upstream withnpx skills add ToDSung/tod-blog. Copyright stays with the author.
AGENTS.md
Guidance for coding agents (Claude Code, Codex, Antigravity) working in this repository. Claude Code reads this via CLAUDE.md, which imports this file. Keep this file lean — details live in .agents/docs/ and are loaded on demand.
Read-on-demand routing
Load these ONLY when the trigger applies. Do not preload them all.
| When you are about to… | Read first |
|---|---|
| Delegate work to a subagent, choose a model, or verify a result | .agents/docs/model-dispatch.md |
| Decide: retry vs. change approach, escalate, declare done, or ask the user | .agents/docs/judgment-rubrics.md |
| Write a delegation prompt (search / implement / refactor / research / review) | .agents/docs/delegation-templates.md |
Edit any file under .agents/ or this AGENTS.md itself |
.agents/docs/maintenance.md |
Add or modify a component under packages/ui/src/ (including any shadcn add) |
.agents/docs/ui-conventions.md |
Write or modify source code in any package (comments, JSDoc, eslint-disable, @ts-expect-error) |
.agents/docs/code-comments.md |
| Add a backend / API / server to this repo | .agents/docs/backend-roadmap.md |
| Start a long or ambitious session; or something feels off about these docs | .agents/docs/letter-to-future-sessions.md |
| Understand why these rules exist | .agents/docs/harness-diagnosis.md |
Write or revise any document (specs/, .agents/docs/, READMEs) |
.agents/docs/writing-standards.md |
Prose written in this repo — internal documents and replies to the owner alike — follows that writing standard: Taiwan Traditional Chinese usage, sparing Markdown emphasis, every "done" backed by evidence. It builds on the iso-24495-skill plain-language skill; read the standard before writing a document, not after.
Lessons learned live in .agents/docs/lessons.md — append new entries there per the format in maintenance.md.
Repository overview
pnpm workspace monorepo (packages/*) — ToD's personal blog and AI-development testbed. The owner primarily develops via AI agents and uses this repo to probe their limits; expect experimental branches and agent-authored code.
packages/tod-blog(tod-blog) — Next.js 15 App Router site, React 19, Tailwind CSS 4. Statically exported (output: 'export'→out/), sitemap vianext-sitemappostbuild. Pages inapp/(landing,cv/,survey/), shared UI incomponents/.packages/articles(articles) — Docusaurus 3 site: blog posts (blog/) and docs (docs/), Markdown/MDX, mostly Chinese.packages/leetcode(@tod-workspace/leetcode) — TypeScript LeetCode solutions. One folder per problem undersrc/lib/named<number><ProblemName>(e.g.0020ValidParentheses), each with solution + Jest test. Helpers insrc/sort/,src/structure/,src/utils/.
TypeScript uses project references: each package's tsconfig.json extends tsconfig.base.json (strict, composite).
Never read these into context: pnpm-lock.yaml (694 KB), node_modules/, out/, build/, .next/, .docusaurus/. To check a dependency version, Grep the relevant package.json.
Commands
Use pnpm from the repo root; target a package with -F <name>.
pnpm install # install all workspace deps
# tod-blog (Next.js)
pnpm -F tod-blog dev # dev server
pnpm -F tod-blog build # static export + sitemap
pnpm -F tod-blog eslint:fix # lint & fix this package
# articles (Docusaurus)
pnpm -F articles start # dev server
pnpm -F articles build # build to build/
# leetcode (Jest — the only package with tests)
pnpm -F @tod-workspace/leetcode test # all tests
pnpm -F @tod-workspace/leetcode test src/lib/0020ValidParentheses # single problem
pnpm -F @tod-workspace/leetcode test -- -t "test name" # by test name
# lint everything (flat config at repo root)
npx eslint .
Windows environment gotchas
This machine: Windows 11, Chinese locale (cp950), PowerShell 5.1 primary shell.
- Hard rule: if the same command fails twice, stop retrying and change approach (switch shell, rewrite the command, or split into steps). Do not retry a third time with cosmetic changes.
- Garbled output (
�/ boxes) from git or CLIs is an encoding artifact, not a failure. Check the exit code before reacting. For git, prefergit log --oneline/--format=%sand avoid piping Chinese text throughcmd. - PowerShell 5.1: no
&&/||(useA; if ($?) { B }), no ternary/??/?., default file encoding UTF-16 LE (always pass-Encoding utf8when writing files other tools will read), don't use2>&1on native executables. - Prefer dedicated tools (Read/Grep/Glob/Edit/Write) over shell for file operations; use the Bash tool for POSIX one-liners like
diff -rq. - Paths: repo is
D:\code\tod-blog(Git Bash:/d/code/tod-blog). - pnpm not on agent-shell PATH (husky hooks need it — commit fails with exit 127 otherwise). Before
git commitin Git Bash:export PATH="/c/Users/user/AppData/Roaming/fnm/node-versions/v24.11.1/installation:$PATH"(version segment changes on Node upgrades —ls /c/Users/user/AppData/Roaming/fnm/node-versionsfor the current one).ghis not installed and the remote is SSH: for PRs, push the branch and give the user a prefilledhttps://github.com/ToDSung/tod-blog/compare/main...<branch>?quick_pull=1&title=...link.
Linting & formatting
- Root
eslint.config.mjs: type-aware flat config (typescript-eslint + Prettier). Enforced:import/order(alphabetized groups, newlines between groups),sort-imports(member sorting),@typescript-eslint/consistent-type-imports(useimport type). packages/leetcodeandpackages/tod-bloghave their owneslint.config.mjsextending the root.- Prettier config at root (
.prettierrc.json); lint-staged runseslint --fix+prettier --writeon staged JS/TS.
Git hooks & commits
- Commit only when the user asks. Finish the change, verify it, report what you did, and leave the result in the working tree for the user to read; the user decides when it becomes a commit. The same holds for anything that rewrites or publishes history (
commit --amend,rebase,reset,push). Subagents never commit — say so in the delegation prompt (see .agents/docs/delegation-templates.md). - Conventional Commits required — enforced by commitlint (husky
commit-msghook). pre-commitruns lint-staged; if any staged file is underpackages/leetcode/, it also runspnpm -F leetcode test --findRelatedTestson those files. (-F leetcodefilters by directory name and is equivalent to-F @tod-workspace/leetcode— both are valid; do not "fix" one into the other.) A failing related test blocks the commit. Never bypass hooks (--no-verify) without explicit user approval.
Cross-agent skills
Skills are shared across Claude Code, Codex, and Antigravity:
.agents/skills/is the single source of truth (read natively by Codex and Antigravity)..claude/skills/is generated, not edited — it is gitignored and rebuilt from.agents/skills/byscripts/sync-skills.mjs. Runpnpm skills:syncafter any change under.agents/skills/and after anynpx skillsinstall;pnpm installruns it too. It deletes each target directory before copying, so a symlink the skills CLI leaves behind is replaced by a real copy.iso-24495-skillis a local skill, deliberately not inskills-lock.json: it was cloned fromgit@github.com:danyuchn/iso-24495-skill.gitat commit113656band vendored (nested.gitremoved) rather than installed through the skills CLI, sonpx skills updatewill not touch it and must not be expected to. To take upstream changes, re-clone into a temp dir, copy the content over.agents/skills/iso-24495-skill/, runpnpm skills:sync, and update the commit noted here. It backs .agents/docs/writing-standards.md.skills-lock.jsontracks CLI-installed skills. Install withnpx skills@latest add <owner>/<repo> -a claude-code -a codex -a antigravity -y(one-s <name>per skill; comma lists reportedly not parsed — from prior session experience, unverified against current CLI; if a comma list works, update this line); refresh withnpx skills update.vercel-react-best-practices,vercel-composition-patternsandshadcn(official) are CLI-installed: all three are inskills-lock.jsonand have full copies under.claude/skills. They serve thepackages/uiwork (specs/ui-library/).