Repository navigation
Add dhis2-form-utils consumer skill; fix README/docs inaccuracies - #25
Conversation
Adds skills/dhis2-form-utils/ — a Claude Code skill teaching agents how to correctly use the library's hooks, rules engine, UI adapters, metadata layer, and devtools when building DHIS2 forms in downstream apps. While verifying the skill's snippets against real exports, found and fixed three inaccuracies in the existing docs: a nonexistent programMetadataExportQuery import, useTrackerForm marked "Planned" when it's implemented, and examples wrapping FormProvider manually when FormStateProvider already renders it internally. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 51 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe pull request updates usage examples for metadata queries and form providers. It adds skill documentation for event and tracker forms, metadata, rules, UI adapters, and devtools. ChangesDocumentation and usage guidance
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@README.md`:
- Around line 264-275: Synchronize the tracker-form documentation: retain the
Available, registration-only wording in README.md lines 264-275; update
docs/ARCHITECTURE.md lines 515-520 and its earlier planned-hooks entry to state
that useTrackerForm is implemented and covers registration only; align
skills/dhis2-form-utils/references/tracker-forms.md lines 1-8 with the same
implementation and registration scope.
In `@skills/dhis2-form-utils/references/devtools.md`:
- Around line 21-27: Update every RuleDevtoolsScope example to pass the required
formStore prop, including skills/dhis2-form-utils/references/devtools.md lines
21-27 and docs/dev-tools.md line 144. Preserve the existing formStore value used
by each example so trace subscriptions attach correctly.
In `@skills/dhis2-form-utils/references/rules-engine.md`:
- Around line 41-43: Update the documentation around the direct
`@dhis2/rule-engine` integration to qualify automatic action-type support: unknown
action types may be evaluated but are mapped to passthroughEffects, and effects
outside the known applyEffect mappings are ignored by buildFieldMap. State that
callers must provide handler mappings or effectHandlers separately when they
need state or submission support, while preserving the claim that new expression
functions are automatically available.
In `@skills/dhis2-form-utils/SKILL.md`:
- Line 21: Update the ASCII diagram code fence in SKILL.md to specify the text
language, changing the unlabeled fence to a text-labeled fence to satisfy
markdownlint MD040.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: ee73c4dd-8c1a-4aef-9481-47c9420880bd
📒 Files selected for processing (10)
README.mddocs/ARCHITECTURE.mddocs/dev-tools.mdskills/dhis2-form-utils/SKILL.mdskills/dhis2-form-utils/references/devtools.mdskills/dhis2-form-utils/references/event-forms.mdskills/dhis2-form-utils/references/metadata-and-schemas.mdskills/dhis2-form-utils/references/rules-engine.mdskills/dhis2-form-utils/references/tracker-forms.mdskills/dhis2-form-utils/references/ui-adapters.md
| | Hook | Status | Use case | | ||
| | ------------------ | --------- | ---------------------------------------- | | ||
| | `useEventForm` | Available | Single tracker event | | ||
| | `useTrackerForm` | Available | Tracker registration (enrollment + TEAs) | | ||
| | `useDataEntryForm` | Planned | Aggregate data sets | | ||
|
|
||
| `useEventForm`/`useTrackerForm` both return `{ form, formStore }`. Rule state stores live on | ||
| `formStore` (`formStore.fieldStore`, `formStore.nonFieldStore`) and are consumed through | ||
| `FormStateProvider` and the companion hooks below. `useTrackerForm` covers registration only | ||
| (TEAs + enrollment system fields) — the first program stage's data entry still goes through | ||
| a separate `useEventForm` call. See [use-tracker-form](/docs/use-tracker-form.md) for the | ||
| full picture. |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Synchronize the useTrackerForm implementation status.
README.md and the tracker reference say that useTrackerForm is available and implemented. The architecture guide still says that only useEventForm is implemented and lists useTrackerForm as planned. Update the architecture section so users receive one API status.
README.md#L264-L275: retain theAvailablestatus and registration-only explanation.docs/ARCHITECTURE.md#L515-L520: replace the stale implementation-status paragraph and planned-hooks entry earlier in the same section.skills/dhis2-form-utils/references/tracker-forms.md#L1-L8: keep the implementation and registration-only wording aligned with the architecture guide.
📍 Affects 3 files
README.md#L264-L275(this comment)docs/ARCHITECTURE.md#L515-L520skills/dhis2-form-utils/references/tracker-forms.md#L1-L8
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@README.md` around lines 264 - 275, Synchronize the tracker-form
documentation: retain the Available, registration-only wording in README.md
lines 264-275; update docs/ARCHITECTURE.md lines 515-520 and its earlier
planned-hooks entry to state that useTrackerForm is implemented and covers
registration only; align skills/dhis2-form-utils/references/tracker-forms.md
lines 1-8 with the same implementation and registration scope.
| ```tsx | ||
| <FormStateProvider formStore={formStore} form={form}> | ||
| <RuleDevtoolsScope> | ||
| <form>{/* fields */}</form> | ||
| <RulesPanel metadata={/* optional RuleDevtoolsMetadata for human-readable labels */} /> | ||
| </RuleDevtoolsScope> | ||
| </FormStateProvider> |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Expected: the component signature and all documentation examples use the same contract.
rg -n -C 8 '\bRuleDevtoolsScope\b' \
--glob '*.ts' --glob '*.tsx' --glob '*.md' .Repository: nnkogift/dhis2-form-utils
Length of output: 26151
Pass formStore to every RuleDevtoolsScope example.
RuleDevtoolsScopeProps requires formStore, and the playground wiring also passes it. Update skills/dhis2-form-utils/references/devtools.md#L23 so the copy-paste example can attach the trace subscription correctly. The docs examples already pass formStore.
📍 Affects 2 files
skills/dhis2-form-utils/references/devtools.md#L21-L27(this comment)docs/dev-tools.md#L144-L144
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@skills/dhis2-form-utils/references/devtools.md` around lines 21 - 27, Update
every RuleDevtoolsScope example to pass the required formStore prop, including
skills/dhis2-form-utils/references/devtools.md lines 21-27 and docs/dev-tools.md
line 144. Preserve the existing formStore value used by each example so trace
subscriptions attach correctly.
| Because evaluation goes through `@dhis2/rule-engine` directly, any new action type or | ||
| expression function DHIS2 adds to the engine is automatically available — no corresponding | ||
| change is needed in this library. |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Expected: unknown actions are explicitly forwarded, handled, or ignored.
rg -n -C 8 'applyEffect|partitionEffects|effectHandlers|EffectHandlersMap' \
utils/rules --glob '*.ts' --glob '*.tsx'Repository: nnkogift/dhis2-form-utils
Length of output: 16763
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== partitionEffects source =="
sed -n '1,120p' utils/rules/src/partitionEffects.ts
echo "== evaluate source relevant lines =="
sed -n '1,220p' utils/rules/src/evaluate.ts
echo "== documentation lines =="
sed -n '35,55p' skills/dhis2-form-utils/references/rules-engine.md
sed -n '1,80p' skills/dhis2-form-utils/references/rules-engine.md
echo "== effectHandlers mentions =="
rg -n "effectHandlers|handles|action" skills/dhis2-form-utils/references/rules-engine.md utils/rules/src utils/rules -g '*.ts' -g '*.md' -g '*.tsx'Repository: nnkogift/dhis2-form-utils
Length of output: 21298
Qualify the new action types claim.
@dhis2/rule-engine can evaluate new expressions, but unknown action types are mapped into passthroughEffects. Field effects outside the known applyEffect map are ignored by buildFieldMap, so callers need handler mapping or effectHandlers separately for state/submission support.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@skills/dhis2-form-utils/references/rules-engine.md` around lines 41 - 43,
Update the documentation around the direct `@dhis2/rule-engine` integration to
qualify automatic action-type support: unknown action types may be evaluated but
are mapped to passthroughEffects, and effects outside the known applyEffect
mappings are ignored by buildFieldMap. State that callers must provide handler
mappings or effectHandlers separately when they need state or submission
support, while preserving the claim that new expression functions are
automatically available.
| rules reactively via the official `@dhis2/rule-engine`, and wires the result into React Hook Form. It is strictly | ||
| layered: | ||
|
|
||
| ``` |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Add a language to the diagram code fence.
markdownlint-cli2 reports MD040 for this fence. Mark the ASCII diagram as text.
Proposed fix
-```
+```text
UI adapters (dhis2-ui / mantine / mui)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ``` |
🧰 Tools
🪛 markdownlint-cli2 (0.23.2)
[warning] 21-21: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@skills/dhis2-form-utils/SKILL.md` at line 21, Update the ASCII diagram code
fence in SKILL.md to specify the text language, changing the unlabeled fence to
a text-labeled fence to satisfy markdownlint MD040.
Source: Linters/SAST tools
dhis2-form-utils only covers building forms; point agents to the official DHIS2 AI devtools skill for app scaffolding, general Web API usage, auth, and build/deploy questions outside that scope. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>


Summary
skills/dhis2-form-utils/— a Claude Code skill (SKILL.md+references/*.md) that teaches agents how to correctly build DHIS2 forms with this library: event forms (useEventForm), tracker registration (useTrackerForm), the program rules engine, UI adapters, metadata/schemas, and devtools. Meant to be pulled into downstream repos'skills-lock.jsonthe same waydhis2-app-developmentis pulled into this one's.programMetadataExportQuerydoesn't exist — README examples now useuseEventProgramMetadataQuery.useTrackerFormwas marked "Planned" in the README's "Supported hooks" table; it's fully implemented — table corrected.FormProvidermanually around fields, butFormStateProvideralready rendersFormProviderinternally (utils/hooks/src/FormStateContext.tsx) — redundant/misleading wrapping removed fromREADME.md,docs/ARCHITECTURE.md,docs/dev-tools.md, and the new skill's reference files.Test plan
src/index.tsexports inutils/hooks,utils/rules,packages/metadata, andcomponents/{dhis2-ui,mantine,mui}.apps/storybook/decorators/{withEventForm,withTrackerForm}.tsx.🤖 Generated with Claude Code
Summary by CodeRabbit
useTrackerFormfor registration-only workflows and separate event-form usage.dhis2-form-utilsskill guide covering installation, architecture, and common form-building tasks.