Skip to content

Add dhis2-form-utils consumer skill; fix README/docs inaccuracies - #25

Merged
nnkogift merged 2 commits into
mainfrom
feature/dhis2-form-utils-skill
Aug 5, 2026
Merged

nnkogift merged 2 commits into
mainfrom
feature/dhis2-form-utils-skill

Conversation

@nnkogift

@nnkogift nnkogift commented Aug 5, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Adds 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.json the same way dhis2-app-development is pulled into this one's.
  • While verifying the skill's snippets against real exports, found and fixed three inaccuracies in the existing docs:
    • programMetadataExportQuery doesn't exist — README examples now use useEventProgramMetadataQuery.
    • useTrackerForm was marked "Planned" in the README's "Supported hooks" table; it's fully implemented — table corrected.
    • Examples wrapped RHF's FormProvider manually around fields, but FormStateProvider already renders FormProvider internally (utils/hooks/src/FormStateContext.tsx) — redundant/misleading wrapping removed from README.md, docs/ARCHITECTURE.md, docs/dev-tools.md, and the new skill's reference files.

Test plan

  • Every snippet cross-checked against actual src/index.ts exports in utils/hooks, utils/rules, packages/metadata, and components/{dhis2-ui,mantine,mui}.
  • Corrected wiring snippets verified against the real, tested decorators apps/storybook/decorators/{withEventForm,withTrackerForm}.tsx.
  • Docs-only change — no build/test impact.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Updated quick-start and architecture examples to simplify form provider setup.
    • Documented useTrackerForm for registration-only workflows and separate event-form usage.
    • Added comprehensive guidance for event forms, tracker forms, metadata, schemas, rules, UI adapters, and developer tools.
    • Added a new dhis2-form-utils skill guide covering installation, architecture, and common form-building tasks.

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>
@coderabbitai

coderabbitai Bot commented Aug 5, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@nnkogift, you've reached your PR review limit, so we couldn't start this review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ef187619-b349-4df1-bee3-afca29888bef

📥 Commits

Reviewing files that changed from the base of the PR and between 7a86268 and 0aec943.

📒 Files selected for processing (1)
  • skills/dhis2-form-utils/SKILL.md
📝 Walkthrough

Walkthrough

The 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.

Changes

Documentation and usage guidance

Layer / File(s) Summary
Usage examples and provider wiring
README.md, docs/ARCHITECTURE.md, docs/dev-tools.md
Examples use useEventProgramMetadataQuery, remove nested FormProvider usage, and document useTrackerForm.
Library overview and core references
skills/dhis2-form-utils/SKILL.md, skills/dhis2-form-utils/references/metadata-and-schemas.md, skills/dhis2-form-utils/references/rules-engine.md
New guidance covers package usage, metadata and schemas, rules, effects, payload filtering, and exported APIs.
Form, adapter, and devtools references
skills/dhis2-form-utils/references/event-forms.md, skills/dhis2-form-utils/references/tracker-forms.md, skills/dhis2-form-utils/references/ui-adapters.md, skills/dhis2-form-utils/references/devtools.md
New references document event forms, tracker registration, UI adapters, provider wiring, and rules devtools.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the new consumer skill and the documentation fixes, which match the pull request objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/dhis2-form-utils-skill

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale comment

Left a non-blocking comment (not approved): Cursor Security Agent completed as skipped, so automated review signals are incomplete. Human review is still needed; no additional eligible reviewers were available to assign.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router and Approver

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between e009dd5 and 7a86268.

📒 Files selected for processing (10)
  • README.md
  • docs/ARCHITECTURE.md
  • docs/dev-tools.md
  • skills/dhis2-form-utils/SKILL.md
  • skills/dhis2-form-utils/references/devtools.md
  • skills/dhis2-form-utils/references/event-forms.md
  • skills/dhis2-form-utils/references/metadata-and-schemas.md
  • skills/dhis2-form-utils/references/rules-engine.md
  • skills/dhis2-form-utils/references/tracker-forms.md
  • skills/dhis2-form-utils/references/ui-adapters.md

Comment thread README.md
Comment on lines +264 to +275
| 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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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 the Available status 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-L520
  • skills/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.

Comment on lines +21 to +27
```tsx
<FormStateProvider formStore={formStore} form={form}>
<RuleDevtoolsScope>
<form>{/* fields */}</form>
<RulesPanel metadata={/* optional RuleDevtoolsMetadata for human-readable labels */} />
</RuleDevtoolsScope>
</FormStateProvider>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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.

Comment on lines +41 to +43
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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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:

```

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 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.

Suggested change
```
🧰 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>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a non-blocking comment (not approved): Cursor Security Agent completed as skipped, so required automated review signals are incomplete. Human review is still needed; no additional eligible reviewers were available to assign.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router and Approver

@nnkogift
nnkogift merged commit 18d3701 into main Aug 5, 2026
14 checks passed
@nnkogift
nnkogift deleted the feature/dhis2-form-utils-skill branch August 5, 2026 06:41
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.

1 participant