Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
node_modules
.claude/settings.local.json

# Eval-time scratch artifacts (real app clones, scaffold output, agent transcripts) --
# regenerable, not part of any shipped skill.
src/skills/*-workspace/
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ai-devtools

A pnpm monorepo for publishing AI development tools under the `@dhis2` scope.
A monorepo for publishing AI development tools under the `@dhis2` scope.

## Structure

Expand Down
116 changes: 116 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,97 @@ npx skills add dhis2/ai-devtools --skill dhis2-apps
npx skills add https://github.com/dhis2/ai-devtools/tree/main/src/skills/dhis2-apps
```

## `@dhis2/skill-dhis2-apps`

An AI skill for building production-quality custom DHIS2 web applications. It guides an AI agent through the full development lifecycle — scaffolding, data fetching, UI, testing, and App Hub compliance — using the DHIS2 App Platform, `@dhis2/ui`, and the DHIS2 Web API.

The skill reads `@dhis2/api-types` OpenAPI specs and platform library source directly from `node_modules` before writing any code, so it never guesses at API shapes or component props. It cross-checks endpoints across bundled version specs (v40–v43) and surfaces differences to the developer before implementation.

### How it works

```mermaid
flowchart TD
U([User request]) --> S[SKILL.md]

S --> Q{New or existing\nproject?}

Q -->|Neither d2.config.js\nnor app-runtime found| BOOT[bootstrapping.md]
Q -->|Existing project| RT[Routing table]

BOOT --> RT

RT --> RUN[running-your-app.md]
RT --> DF[data-fetching.md]
RT --> UI[ui-patterns.md]
RT --> RO[routing.md]
RT --> TY[types.md]
RT --> TE[testing.md]

DF -->|version differences\nacross DHIS2 releases| TY

UI --> UIF[ui-patterns/forms.md]
UI --> UIT[ui-patterns/tables.md]
UI --> UIS[ui-patterns/sidebar.md]
UI --> UIW[ui-patterns/widget.md]
UI --> UID[ui-patterns/dashboards.md]

RO --> UIS
UIW --> UID

S --> RULES["Rules (always active)\n─────────────────────\nReact 18 only · @dhis2/ui only\nRead source before writing code\ni18n via @dhis2/d2-i18n · displayName\nCSS Modules + design tokens\nVerify after each turn"]
```

### Install

```sh
npx skills add dhis2/ai-devtools --skill dhis2-apps
```

## `@dhis2/skill-modernise-apps`

An AI skill for bringing an existing DHIS2 app's tooling up to date. It covers six things an
app can need any combination of, or none:

- **Yarn → pnpm.** Bumps `@dhis2/cli-app-scripts` to a pnpm-capable version, adds a
`pnpm-workspace.yaml` with the hoist patterns `@dhis2/app-shell` needs, converts the
lockfile, fixes the phantom-dependency imports that Yarn 1's flat hoisting used to paper
over, and updates git hooks and CI to call `pnpm` instead of `yarn`.
- **`@dhis2/cli-style` → shared configs.** Replaces the `d2-style` CLI with the shared
`@dhis2/config-eslint`/`@dhis2/config-prettier`/`@dhis2/config-stylelint`/`@dhis2/config-lslint`/`@dhis2/config-commitlint`
packages (whichever tools the app already had configured) and migrates git hooks from the
old `.hooks/` + `d2-style` setup to native `husky`/`lint-staged` — the same setup a
freshly scaffolded app already uses by default.
- **Platform library bumps.** Updates `@dhis2/ui`, `@dhis2/app-runtime`, and
`@dhis2/d2-i18n` — non-breaking (current major) by default for each, with an explicit
choice offered whenever `latest` would cross a major version. Also bumps
`@dhis2/multi-calendar-dates` to its latest version when the app uses it, walking through
the real breaking change in `getNowInCalendar` (Temporal types and time-of-day data
dropped from its return value) with a before/after regression test rather than treating it
as routine.
- **README refresh.** A pnpm badge alongside existing badges, an app description pulled from
the App Hub when the app is published there, and the scaffold's verbose "Available
Scripts" section collapsed into a concise "Get Started".
- **CI modernisation.** Replaces bespoke GitHub Actions workflows with the shared
`dhis2/workflows-platform` reusable workflows wherever one exists, and bumps outdated
action versions and the Node version in whatever stays custom.
- **App Hub continuous delivery.** Wires the app to `dhis2/workflows-platform`'s shared
`release.yml` workflow so releases publish to apps.dhis2.org automatically on every
conventional-commit push, instead of the manual version-bump-and-draft-release flow —
offered when it's missing rather than added unprompted, since it needs an App Hub app ID
and API key from the user.

Each task ends with an install/build/lint pass to catch anything the change broke, plus an
optional sanity check that starts the app against a real DHIS2 server and confirms the UI
still renders after logging in.

### Install

```sh
npx skills add dhis2/ai-devtools --skill modernise-apps
```

---

## Contributing

```sh
Expand All @@ -28,3 +119,28 @@ pnpm changeset # record a changeset before opening a PR
```

See [CLAUDE.md](./CLAUDE.md) for repo structure and release flow details.

### Testing a skill locally, on another project

`npx skills add` accepts a local filesystem path, not just a GitHub org — no need to push
your changes anywhere first:

```sh
cd /path/to/some-other-project
npx skills add /path/to/ai-devtools --skill modernise-apps -y
```

This copies the skill into that project's `.agents/skills/<name>/` (with a `.claude/skills/`
symlink for Claude Code to discover it) and records the source path in `skills-lock.json`.
It's a one-time snapshot, not a live link — re-run the same command (or `npx skills update`)
after editing the skill to pick up changes. Add `-g`/`--global` instead to install it for
every local project under this machine's Claude Code profile, rather than just one.

Once installed, open a Claude Code session in that project and either describe a matching
task naturally (the skill's description should trigger it) or invoke it explicitly with
`/<skill-name>`.

For fast iteration while actively editing a skill, skip installing entirely and just point a
session at the file directly — always reflects your latest edits, but doesn't exercise
auto-triggering: _"Read and follow `/path/to/ai-devtools/src/skills/<name>/SKILL.md` to do
the task."_
2 changes: 2 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading