Skip to content

docs(agents): express form behaviour in the JSON schema before form code - #1766

Merged
gabrielseco merged 1 commit into
mainfrom
docs/schema-first-form-behaviour
Oct 28, 2026
Merged

gabrielseco merged 1 commit into
mainfrom
docs/schema-first-form-behaviour

Conversation

@gabrielseco

@gabrielseco gabrielseco commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Agents working on forms now get a rule to put behaviour in the JSON schema first, and only write form code when the schema can't express it.

Why

A derived value (a second invoice day that follows the first) was first built with useEffect + setValue in the form component. It could be done entirely in the schema, which also reaches partners using the headless hook. Nothing in the agent guidance said to try the schema first.

What changed

Toggle details
  • .agents/rules/json-schema-form-usage.md: new "Express Form Behaviour in the Schema First" section. It gives an order to try (conditionals, computed values, a derived read-only const, then form code), tells agents to search for a precedent first, and lists the gotchas found while doing this (a const field renders as a statement and only with a description, selects submit strings, var takes dot paths).
  • AGENTS.md: one line under "Conventions worth knowing" pointing at the rule.
  • Docs only. No code or public API change.

Screenshots

N/A

Related Resources

Testing

N/A. pnpm run check-format passes.

  • Tested against the example/ app in a browser: N/A, docs only
  • Feature flag: N/A

🤖 Generated with Claude Code


Note

Low Risk
Documentation-only changes to agent rules; no runtime, API, or partner-facing package behaviour is modified.

Overview
Adds agent guidance to implement form behaviour (visibility, defaults, cross-field values) in JSON Schema before reaching for useEffect/watch/setValue in *Form.tsx, so headless hook consumers get the same behaviour.

.agents/rules/json-schema-form-usage.md gets a new Express Form Behaviour in the Schema First section: a ordered checklist (conditionals → x-jsf-logic computed values → computed read-only const + statement → form code with PR justification), pointers to search precedents in jsfEngineSituations.ts and flow schemas, and gotchas (const fields render as statements, string oneOf values, JSON Logic dot paths).

AGENTS.md adds a Schema first bullet under conventions linking to that rule.

Reviewed by Cursor Bugbot for commit 263c6a7. Bugbot is set up for automated code reviews on this repo. Configure here.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Deploy preview for remote-flows ready!

Project:remote-flows
Status: ✅  Deploy successful!
Preview URL:https://remote-flows-ly58xknk4-remotecom.vercel.app
Latest Commit:263c6a7

Deployed with vercel-action

@github-actions

Copy link
Copy Markdown
Contributor

Deploy preview for adp-cost-calculator ready!

Project:adp-cost-calculator
Status: ✅  Deploy successful!
Preview URL:https://adp-cost-calculator-g6n4nr43l-remotecom.vercel.app
Latest Commit:263c6a7

Deployed with vercel-action

@github-actions

Copy link
Copy Markdown
Contributor

📊 Coverage Report

✅ Coverage increased! 🎉

Metric Current Previous Change Status
Lines 89.80% 89.78% +0.02% 🟢
Statements 89.67% 89.66% +0.02% 🟢
Functions 88.53% 88.53% 0% ⚪
Branches 81.43% 81.40% +0.02% 🟢

Detailed Breakdown

Lines Coverage
  • Covered: 5457 / 6077
  • Coverage: 89.80%
  • Change: +0.02% (1 lines)
Statements Coverage
  • Covered: 5523 / 6159
  • Coverage: 89.67%
  • Change: +0.02% (1 statements)
Functions Coverage
  • Covered: 1443 / 1630
  • Coverage: 88.53%
  • Change: 0% (0 functions)
Branches Coverage
  • Covered: 3385 / 4157
  • Coverage: 81.43%
  • Change: +0.02% (1 branches)

✅ Coverage check passed

@gabrielseco
gabrielseco merged commit 1548cab into main Oct 28, 2026
13 checks passed
@gabrielseco
gabrielseco deleted the docs/schema-first-form-behaviour branch October 28, 2026 09:27
@gabrielseco gabrielseco mentioned this pull request Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants