This guide covers contribution workflow for frontend, backend, scripts, and docs.
It is written for typical open source collaboration through a fork-and-pull-request model.
- Read README.md, docs/handbook.md, and docs/reference.md.
- Make sure your local environment works:
./sclaw doctor
./sclaw start
./sclaw statusIf you work behind mainland China network constraints, use the mirror-enabled entrypoint with the same subcommands:
./sclaw_cn doctor
./sclaw_cn start
./sclaw_cn status- If your change touches chat, agent orchestration, reports, converters, or schema behavior, identify the matching validator with
node tests/runner.mjs validate --listbefore you start.
- Keep changes focused and small.
- Preserve module boundaries across
frontend,backend, and backend-hosted analysis skills. - Do not mix unrelated refactors into feature or bug-fix PRs.
- Keep user-visible text bilingual in English and Chinese.
- Treat deterministic behavior as a feature: avoid casual changes to schemas, fixtures, regression outputs, or contract payloads.
The recommended workflow is intentionally simple and keeps your fork easy to maintain.
Your fork's master should be used only to mirror the upstream repository. Do not develop directly on it.
Recommended one-time setup:
git remote add upstream <upstream-repository-url>
git fetch upstreamFor every feature, fix, or doc update:
git checkout master
git pull upstream master
git checkout -b my-featureRecommended branch naming:
feat/short-descriptionfix/short-descriptiondocs/short-descriptionrefactor/short-descriptiontest/short-description
Examples:
feat/builtin-skill-taxonomyfix/chat-stream-fallbackdocs/refresh-contributing-guide
- Commit implementation, tests, and docs in separate commits when that improves reviewability.
- Do not wait until the end of a long task to batch unrelated work into one commit.
- If a change naturally splits into multiple reviewable steps, keep that structure in git history.
Use conventional commits when possible:
feat(frontend): add bilingual report summary panelfix(backend): fallback unmatched skills to generic no-skill flowdocs: refresh handbook and protocol reference
Open the PR from your feature branch, not from master.
git push origin my-featureUse your branch to open a pull request against the upstream repository's master.
If the PR is squash-merged, the cleanup flow should stay conflict-free:
git checkout master
git pull upstream master
git branch -d my-featureYour local master should fast-forward cleanly. You do not need to rebase the already-merged feature branch. If you also want to clean up the remote branch in your fork:
git push origin --delete my-feature- Backend: keep route handlers thin; put orchestration and domain logic in services.
- Frontend: keep route/layout code in app routes and reusable UI in components.
- Analysis runtime: keep engine, schema, and regression behavior deterministic and scriptable.
- Scripts: prefer extending the existing regression runner (
node tests/runner.mjs validate ...) instead of creating one-off local-only helpers.
- Do not add new single-language user-facing flows.
- New UI copy, prompts, empty states, report-facing labels, and generated guidance should support both
enandzh. - Locale-sensitive output should follow the active frontend locale.
- TypeScript: strict mode, explicit types at important boundaries, thin API layers.
- Python: follow existing FastAPI and Pydantic style, keep logic readable and typed.
- Avoid broad incidental refactors unless the PR is explicitly scoped as a refactor.
Run the checks that match your change.
For the full test taxonomy, runner ownership, and CI workflow boundaries, see docs/testing.md.
Backend-focused:
npm run build --prefix backend
npm run lint --prefix backend
npm test --prefix backend -- --runInBandFrontend-focused:
npm run build --prefix frontend
npm run type-check --prefix frontend
npm run test:run --prefix frontend
npm run test:run:integration --prefix frontend # app routes, providers, console shell, accessibilityAnalysis runtime and cross-service validation:
node tests/runner.mjs backend-regression
node tests/runner.mjs analysis-regressionUseful targeted validators:
node tests/runner.mjs validate validate-agent-orchestration
node tests/runner.mjs validate validate-chat-stream-contract
node tests/runner.mjs validate validate-analyze-contract
node tests/runner.mjs validate validate-converter-api-contractExpectation by change type:
- Backend and contract work: cover success, failure, and missing-input behavior.
- Frontend work: run targeted tests plus
type-check; runtest:run:integrationfor app route, provider, console shell, or accessibility changes; runbuildfor routing, layout, or provider changes. - Analysis runtime work: keep regression fixtures stable and justify expected-output updates clearly.
- Docs-only changes: no code tests are required, but commands and file paths in the docs should be checked for accuracy.
PR quality matters more than PR size, but small and reviewable PRs are strongly preferred.
Use a clear title. Conventional-commit style is recommended:
feat(backend): split builtin skill runtime responsibilitiesfix(frontend): keep report locale consistentdocs: clarify fork and PR workflow
Every PR should include:
- What changed
- Why the change is needed
- Impacted areas:
frontend,backend,scripts,docs - Commands run and their results
- Screenshots for UI changes when helpful
- Example request and response payloads when API or contract behavior changed
- Migration or compatibility notes when behavior changes are not fully backward-compatible
A good PR usually has one clear purpose:
- one feature
- one fix
- one refactor
- one docs improvement
Split the work if reviewers would otherwise need to evaluate unrelated risks in one PR.
- Be ready to update the PR in response to review feedback.
- If review feedback changes behavior, update tests or docs in the same branch.
- Do not force-push away discussion unless you are intentionally cleaning up history before merge.
- Keep review threads resolved only after the requested change is actually addressed.
Open a draft PR when:
- you want early feedback on direction
- the scope is valid but not yet fully tested
- an architectural decision needs review before full implementation
Convert the PR to ready-for-review only after the validation checklist is meaningfully complete.
- Never commit live secrets, tokens, or private keys.
- Use
settings.json(viasclaw doctoror frontend Settings UI) for configuration. - Keep production credentials outside the repository.
- Document new configuration defaults when your change depends on them.
- Report sensitive security issues through the private process described in SECURITY.md, not public issues.
- If you are unsure whether a change belongs in backend API/services or backend-hosted analysis skills, explain your reasoning in the PR.
- If the change introduces new user-visible text, call out how bilingual support was handled.
- If the change updates a contract, mention which scripts or fixtures were used to validate it.
Chinese version: CONTRIBUTING_CN.md
Please also follow the organization-level Code of Conduct.