Guidance for automated agents working in this repository.
- コード1行増やすごとに技術負債が増えると心得よ。
- See
CLAUDE.mdfor project-wide guidance. - If working on the web UI, also read
gbdraw/web/CLAUDE.md.
- Before starting work that may create a branch or commit, fetch
originand create a fresh work branch from the latestorigin/dev:git switch --no-track -c <branch-name> origin/dev. - All agent-authored commits must be made on a work branch derived from
origin/dev. Do not base agent work onmainormaster. - Do not configure a work branch to track
mainordev. Before committing or pushing, verify the current branch and its upstream; publish only to the same-named remote work branch. - Never commit directly to, or push directly to,
mainordevunless the user explicitly authorizes that exact direct target in the current request.
gbdrawis a Python 3.10+ bioinformatics tool for publication-quality genome diagrams.- Outputs: SVG, PNG, PDF, EPS, PS.
- Main package lives in
gbdraw/; tests intests/; web UI ingbdraw/web/index.htmlwith JS modules undergbdraw/web/js/(app entry points ingbdraw/web/js/app/with submodules grouped by feature).
# Fast tests (skip slow)
pytest tests/ -v -m "not slow"
# Full tests
pytest tests/ -v
# Compare generated SVGs with tracked references (read-only)
pytest tests/test_output_comparison.py::TestOutputComparison -v
# Update tracked references only for an intentional, reviewed geometry change
pytest tests/test_output_comparison.py::TestGenerateReferences --update-reference-outputs -v
# Lint
ruff check gbdraw/
# Prepare the generated browser wheel for offline web packaging/tests
python tools/prepare_browser_wheel.py
# Refresh the cache-bust token when preparing a deployable web bundle
python tools/prepare_browser_wheel.py --refresh-cache-bust
# Build
python -m build- Allow at least 30 minutes for test commands before treating them as timed out, and monitor long runs incrementally. Keep shorter test-owned timeout assertions unchanged unless the task explicitly requires changing them.
- Do not conclude that browser testing is unavailable just because
node_modules/,package.json, or@playwright/testis missing at the repo root. This workspace may have Playwright installed through Python/conda instead. - Check both paths when browser verification matters:
command -v playwright && playwright --versionpython -c "from playwright.sync_api import sync_playwright; print('python playwright ok')"
- The JavaScript specs under
tests/web/*.playwright.spec.jsrequire Node's@playwright/test. Verify it withnode -e "console.log(require.resolve('@playwright/test'))"before trying to run those specs. - If Node's
@playwright/testis unavailable, use Python Playwright for targeted browser checks instead of skipping browser verification. - In Codex/agent sandboxes, Chromium may fail with
sandbox_host_linux.cc ... Operation not permitted. When that happens, rerun the same local browser check with the required sandbox escalation rather than reporting that Playwright is unavailable.
- Audit production-code and test diffs separately before handoff. Optimize for fewer change points, branches, and duplicated behavior rather than raw line counts.
- Follow the architecture fitness-function ratchet for every architecture-bearing change. Ordinary non-increasing changes use concise owner/path evidence and remove superseded paths in the same change. Complete before/after OE, PE, and CB sets are reserved for the exception conditions defined by that policy.
- Keep the web UI as a single-page app with no build step;
gbdraw/web/index.htmlhosts HTML/CSS/templates and loads ES modules fromgbdraw/web/js/(app.jsentry withapp/,services/,utils/). - Keep larger UI modules split into focused subfolders under
gbdraw/web/js/app/(for examplelegend/,legend-layout/,feature-editor/) and keep thecreate*entry points in the top-levelapp/*.jsfiles. - If adding CDN dependencies, update the CSP in
gbdraw/web/index.html. - Treat
tests/reference_outputs/as read-only during normal tests. If diagram output changes intentionally, regenerate it with--update-reference-outputs, review the SVG diff, and rerunTestOutputComparison. - Do not manually edit generated artifacts under
dist/orgbdraw.egg-info/. - Treat
gbdraw/web/gbdraw-<version>-py3-none-any.whlas a generated, gitignored asset. Prepare it when tests or packaging need it, but do not commit it.
For changes affecting Web runtime or normative Web behavior contracts:
- Follow
docs/internal/PRODUCT_IMPACT_RATCHET.md. - Identify every reachable user-visible difference or continuation and separate the product outcome from the owner or path used to implement it.
- Search explicit supported behavior, compatibility commitments, authoritative
domain rules, and accepted base-branch decisions. Current code and tests are
evidence, not automatic product authority. Cite a
BD-###only when it exists in the base branch. - Before implementation, use the same policy's developer preflight when a
proposed change may alter a material user effect but no registered concern is
triggered. Use
docs/internal/PRODUCT_DECISION_PACKET_TEMPLATE.mdwhen evidence or Product judgment is required. - Compare option realization with AND-of-OR requirements. Matching option IDs do not prove that independent behavior contributions remain satisfied.
- Keep the common path automatic for changes with no registered Product Impact delta or unresolved outcome.
- Stop the affected convergence when materially different user-visible outcomes remain unresolved. Do not select a product option autonomously.
- Present the Product Decision Owner with stable outcome choices, decision
routes, and the documented
PRODUCT_DECISIONresponse template. - After an explicit human choice, serialize only that outcome and show the generated machine representation for review. Do not infer missing rationale, retirement intent, or accepted residual risk, and do not broaden the choice.
- Candidate authority never authorizes the same candidate runtime.
- Treat
examples/gbdraw_social_preview.pngas an owner-maintained asset. Automated agents must not regenerate, replace, or edit it. - Treat every public figure that demonstrates a feature as a finished example, even when the underlying change is small.
- Start from a realistic Gallery-quality recipe or session when one exists, and change only the setting being demonstrated where practical.
- Keep the labels, legend, color rules, record metadata, quantitative tracks, and comparison context that make the source figure useful. Remove an element only when the example has a clear reason to omit it.
- Keep minimal smoke diagrams in tests. Do not use them as tutorial images, Gallery entries, release examples, or other public showcases.
- Render and visually inspect the final artifact at a readable scale. Confirm that its documented command, session, or reproduction recipe generates the displayed figure.
- Before creating, changing, or reviewing PR wording,
read and apply
.agents/skills/write-clear-pull-request/SKILL.md. - Prepare the title and body file. Run
node tools/check-pr-language.mjs --title "<title>" --body-file <path>once beforegh pr create, using the same wording. - Rerun only after a material rewrite before merge; never for ordinary shell commands.
- Do not use
gh pr create --fill,--fill-first, or--fill-verbose.
- After completing an implementation, treat the session as one commit and provide a proposed commit title and summary in English.