@coding-with-hassan/devkit
v1.6.0
Published
CLI for the developer workflow shared across Hassan's client projects: docker compose orchestration, db helpers, and husky hook installation.
Maintainers
Readme
@coding-with-hassan/devkit
The way of working of Hassan's client projects as one versioned package: parallel git worktrees with isolated Docker stacks, the pre-commit chain, a CI job with commit standards and an Nx cache, the Claude Code standards/agents/hooks, and the bilingual acceptance-test workbooks. A project installs it, fills one config block in package.json, runs hassan-devkit init, and picks up every later standard by bumping the version. Design: docs/design/way-of-working.md; decisions: docs/adr/.
New projects start from hassan-devkit-template: a maintained Nx apps/* + libs/* pnpm workspace in the shape of a real project (a NestJS API with the error-code contract, an Angular staff app, a server-rendered Angular customer site and the shared libs), already wired to this package. It reaches a running stack with pnpm install and pnpm docker:dev:up, and typing /project-setup in the fresh clone takes it to its setup PR (see Claude Code layer). init is for adopting the devkit in a workspace that already exists.
Install
pnpm add -D @coding-with-hassan/devkitConfigure
Add a hassan-devkit block to your client repo's root package.json so the db commands know which compose service to address:
{
"hassan-devkit": {
"db": {
"service": "db",
"user": "postgres",
"name": "de_autozaak"
}
}
}service is the docker-compose service name, not a hardcoded container name. The CLI runs docker compose exec <service>, so the project name in your compose file handles disambiguation when multiple client stacks share a host.
The docker commands assume docker/docker-compose.dev.yml and a .env file at the repo root (the convention the template repo ships with).
Optionally add a docker.preUp hook — a shell command docker:up runs from the repo root right before docker compose up. Use it to refresh values your compose file reads from .env (image tags derived from the lockfile, compose profiles, ports) so they can never go stale between ups; a non-zero exit aborts the up:
{
"hassan-devkit": {
"docker": { "preUp": "scripts/worktree.sh env" }
}
}Wire it into your scripts (flat repos; Nx workspaces get this from init)
{
"scripts": {
"docker:dev:up": "hassan-devkit docker:up",
"docker:dev:down": "hassan-devkit docker:down",
"docker:dev:logs": "hassan-devkit docker:logs",
"db:list-tables": "hassan-devkit db:list-tables",
"db:psql": "hassan-devkit db:psql",
"prepare": "hassan-devkit hooks:install"
}
}The way of working
Everything below assumes an Nx apps/* + libs/* pnpm monorepo (the template's shape); the docker:*, db:*, i18n:check and hooks:* commands further down stay layout-agnostic for the older flat repos. Requires Node ≥ 22.13.
Configure once, derive the rest
Everything a project declares lives in the hassan-devkit block of the root package.json (validated by hassan-devkit config:check, unknown keys are rejected):
"hassan-devkit": {
"worktree": {
"baseDir": "../my-app-worktrees", // default ../<root-name>-worktrees
"projectName": "my-app", // compose project of slot 0
"ports": { "api": 3000, "db": 5432, "web": 4200 }, // base host ports; slot N adds N*10
"profiles": { "default": ["api"], "required": ["api"] },
"seeds": { "service": "backend", "scripts": ["seed:admin-user"] },
"ready": { "url": "http://localhost:${DEVKIT_PORT_API}/api-json" },
"env": { "API_PROXY_TARGET": "http://localhost:${DEVKIT_PORT_API}" }
},
"tracker": { "kind": "jira", "project": "DAZ", "baseUrl": "https://x.atlassian.net",
"transitions": { "prOpened": "In Review", "merged": "Acceptance" } }, // optional, these are the defaults; null turns one off
// | { "kind": "github", "prefix": "GH" } | { "kind": "none" }
"commits": { "docsUrl": "https://…/Git+Workflow" }, // types/extraScopes/requireSigned/exemptAuthors have defaults
"ci": { "checks": [{ "name": "translations", "paths": ["^libs/i18n/"], "run": "pnpm exec nx run-many -t check-translations" }] },
"testCases": { "dir": "docs/testing", "languages": ["en", "nl"] },
"design": { "url": "https://claude.ai/artifact/…" } // the project's design system; the `sync-theme` skill reads it, and stores the link when it is missing
}Never declared, always derived:
| Fact | Source |
|---|---|
| Workspace projects (name = dir basename, kind api / spa / lib) | pnpm-workspace.yaml globs → dirs with a package.json; nest-cli.json / angular.json decide the kind |
| Commit scopes | project names + commits.extraScopes (default docker, workspace, docs, deps) |
| Compose profile → services / buildable images | docker compose --profile '*' config |
| Dev image tag | sha256 of lockfile, workspace file, every package.json, every docker/Dockerfile*.dev |
| Canonical remote | upstream when present, else origin |
Managed .env values use fixed keys: COMPOSE_PROJECT_NAME, COMPOSE_PROFILES, DEVKIT_IMAGE_TAG, DEVKIT_SLOT, DEVKIT_BRANCH, DEVKIT_PORT_<KEY> (one per worktree.ports entry, upper snake case) plus the expanded worktree.env extras. Compose files reference ${DEVKIT_PORT_API} etc.
Commands
hassan-devkit init [--dry-run] [--force]— idempotent scaffold: merges the config skeleton and default scripts intopackage.json(adds only missing keys), writes the slot-0 managed block into.env.dist, creates thescripts/pre-commit-extra.shseam. Files the project edited are kept unless--force, which prints a diff first. Re-run after editing the config to refresh.env.dist.hassan-devkit config:show [--json]— declared + derived values (projects, scopes, compose profiles, image tag).hassan-devkit config:check— validate the block; exit 1 with the offending paths.hassan-devkit commits:show [--json]— the commit-subject contract shared by CI and the commit-writer agent: ticket token, types, derived scopes and the regex^<TICKET> (<types>)\((<scopes>)\): [a-z].hassan-devkit format:file <...files>— format files as the pre-commit hook would, ahead of the commit: the Prettier commands of the project'slint-staged.config.*(fallback: the derived config) whose globs match each file, run from the repo root. One status line per file (formatted,unchanged,no-formatter,missing,outside,failed); exit 1 only when a formatter failed. The Claudepost-edithook is its main caller.
Worktrees
One worktree per ticket, each with its own Docker stack (own compose project, host ports = base + slot×10, own volumes), sharing the dev images with every checkout on the same dependency manifest. Worktrees live under worktree.baseDir (default ../<root-name>-worktrees); slot 0 is the main checkout. A repo without docker/docker-compose.dev.yml gets worktrees without a stack.
hassan-devkit worktree:create <BRANCH> [--profiles a,b] [--no-up]— prune merged worktrees, fetchupstream/originmain, add the worktree off it, allocate the lowest free slot (under a lock), write the managed.env, run the tracker hook,pnpm install, bootstrap husky (fails loudly if.husky/_/pre-commitis missing), build the images the tag lacks,up, wait forworktree.ready.url, runworktree.seeds. The stack is set up from the new worktree's ownpackage.jsonand compose file (ports, profiles,ready,seeds,env), not from the checkout the command is run in, which may be behind the remotemain; onlybaseDirandmaxSlotare read from that checkout, and a note names theworktreekeys on which the two differ. The seed step always prints a line:seeding: pnpm <script> (service <service>)before each script,no seed scripts configured (worktree.seeds.scripts)for an empty list,not seeding: …when scripts are configured and the stack was not started. A failing seed script fails the command.hassan-devkit worktree:env [--slot N]— refresh this checkout's managed block (keeps slot + profiles, recomputes the image tag, builds missing images, drops stalenode_modulesvolumes). Refuses a slot another checkout holds.docker:upruns it implicitly.hassan-devkit worktree:profiles list|add|remove <names>— the compose profiles this stack runs (derived from the compose file;worktree.profiles.requiredcannot be removed).hassan-devkit worktree:stop— stop the stack of the checkout it is run from (docker compose stopacross every profile) and keep everything: containers, volumes, slot and.env.pnpm docker:dev:upstarts the same stack again. It stops only a stack the devkit manages for that checkout: without a compose file, with an emptyworktreeblock or without a.envit says why, stops nothing and exits 0. A stop that fails exits 1./open-prruns it once the PR is open.hassan-devkit worktree:remove <BRANCH> [--keep-data] [--force]— stack down (volumes deleted unless--keep-data), worktree removed, branch kept, unreferenced image tags garbage-collected.hassan-devkit worktree:prune [--dry-run]— remove every worktree whose PR is merged (gh pr list --head, base repo =upstream) and reportmergedto the tracker for its ticket; dirty trees are never force-removed.hassan-devkit worktree:list— worktrees with slot, ports, profiles, image tag; warns on duplicate slots.
Tracker adapters (tracker.kind)
| kind | on worktree:create | PR opened / PR merged | credentials |
| --- | --- | --- | --- |
| jira | assign the branch's <PROJECT>-<n> ticket to you; To Do → In Progress | move the ticket to tracker.transitions.prOpened (default In Review) / .merged (default Acceptance) | JIRA_EMAIL, JIRA_API_TOKEN, JIRA_URL from the environment or ~/.config/jira/env |
| github | gh issue edit <n> --add-assignee @me on the base repo for a <PREFIX>-<n>-… branch; PR bodies end with Closes #<n> | nothing: an open PR stays the progress signal | gh auth |
| none | nothing | nothing | — |
hassan-devkit tracker:transition <TICKET> <prOpened|merged>— report a PR event for a ticket (a key, or a branch name starting with it). The jira adapter moves the ticket to the statustracker.transitionsnames for the event, looked up by target status name among the ticket's available transitions; a ticket already in or past that status is left alone, and a key set tonullturns the transition off. Run it withprOpenedafter opening the PR (theopen-prskill does);worktree:prunereportsmergeditself for the ticket of every worktree it removes.
All best effort: a missing token or unreachable tracker prints a note: and never blocks the worktree or fails the command (in tracker:transition, an unknown event name is a usage error and exits 1). init renders docs/agents/issue-tracker.md, triage-labels.md and domain.md from this config for the engineering skills.
Ticket dependency chart (tickets:graph)
hassan-devkit tickets:graph [--epic <KEY>] [--out <file>] reads the configured tracker and prints the ticket dependencies as a Mermaid flowchart: what blocks what, and what can be started next.
- Scope: every ticket that is not done, plus the tickets that block them directly, so a done blocker one hop away stays visible.
--epic DAZ-241(a bare241or#241works too) narrows to one epic and keeps the blockers from other epics. - Chart: one subgraph per epic, an arrow from a blocker to the ticket it blocks, nodes coloured by status category (to do, in progress, done). Ready tickets — not started, every blocker done — are highlighted; a blocker that is not a node (an epic, an issue that could not be read) still counts until it is done. An edge that a longer path of unfinished tickets already implies is dropped (transitive reduction), so a project-wide chart stays readable.
- Output: the chart on stdout (everything else goes to stderr, so it pipes) and a Markdown page around it — chart, colour key, the ready tickets by name — in
docs/tickets/dependencies.md. That path is in the managed.gitignoreblock (written byinitand on every install); the chart is never committed.--out <file>writes somewhere else, relative to the cwd; a.mmd/.mermaidfile gets the chart alone.
| kind | tickets | blocking edges | epic | status category |
| --- | --- | --- | --- | --- |
| jira | the issues of tracker.project that are not done, plus the issues blocking them; sub-tasks are left out | Blocks issue links | the parent | the status's own category |
| github | the open issues of the base repo, plus the issues they reference | Blocked by #<n> lines in the body (Blocked by: #1, #2 and a ## Blocked by section count too; a mention inside a sentence or a code fence does not) | the Part of #<n> line or ## Parent section | closed is done, open with an assignee is in progress, open without one is to do |
| none | — the command exits with a note | | | |
Credentials are those of the adapters above. Unlike the worktree:create hook this is not best effort: a tracker that cannot be read fails the command.
Unlinked dependencies (the ticket-graph skill). The chart shows the dependencies the tracker holds as links; one that is only stated in a ticket description is missing from it, and the ticket it blocks can look ready. The house skill ticket-graph covers that gap. Asking Claude for the ticket graph, what blocks what or what to start next triggers it (or type /ticket-graph):
- It runs
tickets:graph, with--epicwhen you named one, and shows the chart. - It reads the descriptions of the tickets on the chart and looks for dependencies that have no link. One that is already linked, that the chart implies through a path of unfinished tickets, or that has a done ticket at either end is left out.
- It shows the chart again with those as dashed edges and lists each with the sentence it came from.
- It asks which ones to record. The confirmed ones become the links the command reads — a
Blockslink in Jira, aBlocked by #<n>line appended to the GitHub issue body — and the command runs again, which shows whether each write landed.
Nothing is written to the tracker before that answer, and only the dependencies you picked are recorded.
Pre-commit chain
hassan-devkit hooks:install (wired as the prepare script, so it runs on every pnpm install in every checkout) installs husky, (re)creates its per-checkout shim dir and writes the shared .husky/pre-commit:
scripts/pre-commit-extra.sh— the project's own guards (optional; must exit 0)hassan-devkit i18n:check— flat projects' translation keys (no-op otherwise)hassan-devkit ci:doctor— only when.github/workflows/ci.ymlis stagedlint-staged— targets derived from the workspace:
// lint-staged.config.mjs
import lintStaged from '@coding-with-hassan/devkit/lint-staged';
export default lintStaged({ exclude: ['api-client'], extra: { 'scripts/**/*.mjs': ['prettier --write'] } });Every project with an ESLint/Prettier config gets pnpm -C <dir> exec … entries (api: **/*.ts; spa/lib: src/**/*.{ts,html} and src/**/*.{scss,css,json}). No project list to maintain. The same config drives hassan-devkit format:file, so what Claude's post-edit hook formats on edit is exactly what the hook would have rewritten at commit time.
The hook never rewrites silently. lint-staged re-stages the fixes eslint --fix / prettier --write applied, so the hook snapshots the staged tree (git write-tree) before and after it runs: when the tree changed, the commit is aborted and the rewritten files are listed — the tree that gets committed and pushed must be one that was built and tested (an auto-fix such as type → interface can break a production build that was green locally). Fixers cascade (Prettier reformats what eslint --fix produced only on the next run), so lint-staged is re-run until the staged tree is stable (at most three extra passes) before the files are listed. The fixes stay staged: review them (git diff --cached), rebuild what they touch, then run the same git commit again — the second attempt on the unchanged tree passes. Clean commits pass in one go with no extra output.
hassan-devkit ci:doctor fails when the installed devkit does not satisfy the declared range (stale node_modules), when the config block is invalid, or when the husky shims are missing.
CI (ci:*)
init scaffolds a thin .github/workflows/ci.yml for Nx workspaces (Node from ci.nodeVersion, base branch ci.baseBranch, exempt authors from commits.exemptAuthors). The file only sequences these commands, so a devkit bump changes what CI does without touching it; ci:doctor fails when the file drifts from the installed template (init --force refreshes it).
hassan-devkit ci:commit-standards [--repo o/r --pr n]— every non-merge PR commit must matchhassan-devkit commits:showand, withcommits.requireSigned, be Verified on GitHub. PRs bycommits.exemptAuthorsskip the check. NeedsGH_TOKEN.hassan-devkit ci:cache attach|detach— move Nx's task cache between.nxand the cacheable.nx-ci-cachefolder, re-homing the machine-id-named index so restored entries are actually hit.hassan-devkit ci:check [--base --head]—ci:doctor, thenformat:checkfor the projects owning a changed file (content files included), then everyci.checks[]whosepathsregex matches a changed file runs itsruncommand.hassan-devkit ci:affected [--targets lint,build] [--base --head] [--with-content] [--dry-run]— graph targets (build) for touched projects and dependents, own-files targets (lint,format:check) only for projects owning a changed file; files no target reads (docs,ci.affected.contentOnly) are dropped first;ci.affected.adoptedmaps files outside any project to the project whose target reads them — an adopted file always counts, even underdocs/or acontentOnlyglob (e.g."docs/testing/*.ts": "daz-i18n"for acceptance-case data a lib'sformat:checkcovers).
Claude Code layer
hassan-devkit claude:install (run by prepare and by init) wires the house standards into Claude Code without copying content:
- one
@importline in the project'sCLAUDE.md(.claude/CLAUDE.mdwhen it exists) pullingnode_modules/@coding-with-hassan/devkit/claude/standards.md— Docker via scripts, worktrees, commit/push consent + commit-writer, tickets, the acceptance-case quality gate, lint/format/CI parity, domain docs, grilling rounds asked through the question dialog; where a house rule and a skill body differ, the house rule wins. In-repo imports load at launch without an approval dialog; .claude/agents/commit-writer.mdas a stub whose body says "read the shipped file and follow it" — the stub never changes, the content ships with the devkit version;- one
.claude/skills/<name>/SKILL.mdstub per skill, same pattern: the house skillsadd-error-code,implement-ticket,merge-upstream,open-pr,project-setup,sync-themeandticket-graph(bodies shipped by the devkit; all model-invocable exceptopen-prandproject-setup, which are user-typed only —merge-upstreamruns only when the user asks to bringmainin or fix a PR's conflicts, since that ask is the consent for the merge commit;open-prtakes a ticket branch from finished work to an open PR, see below;project-setuptakes a fresh template clone to its setup PR, see below;add-error-codenames no project: it finds the API app, the i18n lib and the frontends fromhassan-devkit config:show --jsonand follows the error-code contract from there;sync-themederives the theme library from the project's design system, see below;ticket-graphis described under Ticket dependency chart) and every skill of the project'smattpocock-skillsdependency —initaddsgithub:mattpocock/skills#v1.2.3todevDependencies, a GitHub tarball pinned to an upstream release tag that pnpm integrity-locks — exceptimplementandsetup-matt-pocock-skills, which the house skill andinitreplace. The stub copies the skill's frontmatter verbatim (user-invocable-only skills stay user-only) and points at the body undernode_modules. Stubs are derived on every install and gitignored through a managed block (which also lists thetickets:graphchart), so nothing is committed and a bump changes nothing in git; they are what makes the skills reach every clone and the skill pickers that only scan.claude/skills(T3 Code). ASKILL.mdthe project wrote itself at one of those paths (anything that is not a stub) is the project's own copy: it is neither overwritten nor gitignored, andclaude:installprints a note until the folder is deleted, after which the stub takes over. Renovate bumps the tag (the shared preset automerges it), so an upstream skills release needs no devkit release; - two managed hook entries merged idempotently into
.claude/settings.json, both runninghassan-devkit claude:hook <id>from the checkout'snode_modules(recognised by that id, so a reworded command replaces the entry and the inlinejqhook of devkit ≤ 1.2 is dropped):pre-bash(PreToolUseonBash) deniesgh pr createwithout--assignee,docker composerun directly,git worktree add|remove|prune|…andgit commitonci.baseBranch— each with the house command to use instead;post-edit(PostToolUseonEdit|Write|MultiEdit) runsformat:fileon the edited file and tells Claude to re-read it when Prettier changed it. The rules live in the package, so a bump adds a guard with nothing to re-commit; every hook fails open (a broken hook never blocks a tool call).
/open-pr closes a ticket's work in one user-typed step. The skill has disable-model-invocation: true, so Claude can never start it: typing it is the explicit ask for the commits, the push and the PR that the consent rule requires. In order, stopping at the first failure and reporting it:
- the
merge-upstreamskill (canonicalmainin, conflicts resolved); hassan-devkit ci:checkandhassan-devkit ci:affected, on the working tree, so pending work is checked before it is committed (and checked again when the pre-commit hook rewrote a staged file);- the pending work committed through the
commit-writerplan (skipped when there is none); git push -u origin <branch>, never forced;- no open PR for the branch:
gh pr create --assignee @me, titled<TICKET> <Short title>from the branch name, with a body written with theprskill and ending with the tracker's ticket reference (Closes #<n>for GitHub); a PR already open: its body rewritten for the branch as it is now; hassan-devkit tracker:transition <TICKET> prOpened;hassan-devkit worktree:stop: the checkout's stack is stopped while the PR waits for review, so it no longer holds Docker memory. Nothing is removed (worktree:prunedoes that once the PR is merged), andpnpm docker:dev:upstarts it again when review feedback needs it. A failed stop is reported and does not fail the skill;- the PR link.
It refuses to run on the base branch. When uncommitted work collides with what the merge brings in, a bare merge-upstream stops; here the ask for the commits is given, so the pending work is checked and committed first, then merged, and the checks run again on the merged result. The pr skill ships with mattpocock-skills from v1.3; on an older tag the body is a plain one (what changed and why, how it was verified, what to review).
sync-theme keeps the theme library in line with the project's design system, so the translation is no longer redone by prompt for each project and again at every design change. Asking Claude to sync or update the theme, the brand colours, the fonts or the logo from the design system triggers it (or type /sync-theme):
- It takes the design system link from
hassan-devkit.design.url. When the key is missing it asks for the link and stores it in the rootpackage.json, so the next run needs no question. - It reads the design system (a Claude design system, read through the artifact tool): colours per colour scheme, typography, radii, spacing and the logo assets.
- It updates the PrimeNG preset of the theme library, the font setup of every frontend and their logo and favicon. Values come from the design system, the structure stays the project's; a logo is copied, never redrawn. Nothing is at a fixed path: the theme library and the frontends are found through
hassan-devkit config:show --json. - It runs
hassan-devkit ci:affected, updates the acceptance cases that state what changed (a brand name, a logo) and reports four lists: what changed, what it derived (a ramp from a single brand colour), what in the design system has no counterpart in the preset, and what the theme keeps that the design system says nothing about.
It runs in a ticket worktree like any other change, stops on the base branch and never commits. A design token the theme has no place for is reported, not given a new token group: growing the theme stays your decision. A design system that cannot be read stops the skill; no value is guessed.
/project-setup turns a repository freshly created from the template into its project, up to the setup PR. Run it once, in the fresh clone after pnpm install. Like /open-pr it has disable-model-invocation: true: it writes outside the working tree (a ticket, a worktree, the repository's settings), so only you can start it. Every step first checks whether it is already done, so after an interruption you type it again and it continues where it stopped (the last step, the checks, runs on every run):
- It asks for the project name, the tracker (a Jira project, or GitHub issues with a ticket key), the languages and a concept brief (a file or pasted text). It derives the slug, the database name and a set of host ports that collide with none of the projects checked out next to it, and shows them for correction.
- It creates the setup ticket in the tracker, with the answers and the brief as its description, and the setup worktree:
hassan-devkit worktree:create <TICKET>-Project-Setup --no-up. - It renames the template's placeholders in that worktree: the
hassan-devkitconfig block, the project name (template,Template), the ticket key (TPL, and with it thetpl-i18npackage), the host ports and the languages. Generated files are regenerated, not edited: the lockfile, the managed block of.env.distanddocs/agents/*.md(hassan-devkit init --only env,agents), the API spec and its packages (from the worktree's own stack, which starts here under the project's name), the acceptance workbooks. - It runs the
grill-with-docsskill on the concept brief, which writesCONTEXT.mdand an ADR for each decision the brief forces.grill-with-docsis user-typed only; typing/project-setupis the ask for it here. - It runs the
sync-themeskill (skipped, and reported, when there is no design system yet). - It sets the repository settings: merge commits as the only merge method (a squash or a rebase drops the commits' signatures and standard subjects) and delete branch on merge. Branch rules are not set: they are unavailable on private repositories on the free plan. For Renovate it removes the template's own automerge rule from
renovate.jsonand gives you the link to add the repository to the Renovate app, which a personal token cannot do. - It runs
hassan-devkit ci:checkandhassan-devkit ci:affected, then reports and hands over: you type/open-prfor the setup PR.
It never commits or pushes. Its report ends with what to do once the setup PR is merged: run hassan-devkit worktree:prune in the main checkout before bringing main in, because the setup worktree was created under the template's worktree.baseDir and the devkit stops looking there once the project's own config is in. The report also names what the merge does not reach: the main checkout's own .env, and with a Jira tracker the ticket's merged transition. Specs and tickets come after it, with the to-spec and to-tickets skills; deployment configuration is out of scope.
Project-specific rules stay in the project's own CLAUDE.md below the import. A devkit bump therefore changes what Claude does with nothing to re-commit.
Acceptance test cases (test-cases:generate)
The quality gate for application code is the bilingual acceptance-case set in docs/testing/ (testCases.dir), not unit tests. Data files tc-data-<suite>.ts export *_AREAS, *_KNOWN_ISSUES and *_README; the shared vocabulary comes from the package:
import { tc, type Area, type KnownIssue, type Readme } from '@coding-with-hassan/devkit/test-cases';hassan-devkit test-cases:generate [--lang xx] [--testers file.json] writes test-cases-<suite>-<lang>.xlsx per suite and language (testCases.languages, default en, nl; workbook UI strings ship for those two) next to the data, plus a personalised copy per tester (Tester column prefilled, credentials in the Read Me sheet). Each workbook has a Read Me, a Summary with per-area counts, one sheet per area with a Pass/Fail/Blocked/Skipped dropdown, and a Known Issues sheet. The workbooks are gitignored artifacts; commit the data files with the feature. The data files are TypeScript loaded through Node's built-in type stripping (Node ≥ 22.13, no tsx), which keeps import specifiers verbatim — hence the type modifiers above. testCases.title sets the project name in the Read Me title. init scaffolds a starter tc-data-app.ts when the section is configured and the directory is empty.
Upgrading from 0.x
- Node ≥ 22.13 (the acceptance-case generator loads TypeScript data with Node's type stripping).
- Config block:
hassan-devkit.db,docker.preUpandi18nkeep working; addworktree,tracker,commits,ci,testCasesas needed —hassan-devkit init --only configwrites the skeleton. Unknown keys are now rejected (config:check). hooks:installno longer runshusky init(which rewrote yourpreparescript); it (re)creates husky's per-checkout shims and skips inside container builds (HUSKY=0, no.git). The hook body gained theci:doctorstep for staged workflow files;i18n:checkstays.- lint-staged: replace
@coding-with-hassan/lint-staged-configwithlint-staged.config.mjsimporting@coding-with-hassan/devkit/lint-staged(targets derived from the workspace;init --only hooksscaffolds it). docker:uprunsworktree:envimplicitly oncehassan-devkit.worktreenames ports or profiles; adocker.preUphook that only refreshed.envcan go. Managed.envkeys areDEVKIT_SLOT,DEVKIT_IMAGE_TAG,DEVKIT_BRANCH,DEVKIT_PORT_*— rename them in your compose file.- CI:
init --only ci --forcewrites the thin workflow; delete hand-rolled affected/cache scripts. Commit scopes are derived from the workspace (commits:show). - Claude:
init --only claude,agentsadds the standards import, the stubs, the PR-assignee hook and regeneratesdocs/agents; trim yourCLAUDE.mdto project specifics. - Skills (1.1):
init --only configadds themattpocock-skillsdevDependency;pnpm installthen writes the skill stubs and the.gitignoreblock, andclaude:installprints the one-offgit rm --cachedfor theimplement-ticketstub you committed under 1.0. With the plugin still enabled in~/.claude, a bare/grillingruns the project stub and/mattpocock-skills:grillingthe plugin (same body). add-error-code(1.5): the skill ships with the devkit. A project with its own committed.claude/skills/add-error-code/keeps it, andclaude:installsays so on every install. To switch:git rm -r .claude/skills/add-error-code,pnpm install(writes the stub and adds the folder to the.gitignoreblock), commit the deletion with.gitignore. Keep the project's.claude/rules/api-errors.md: the shipped skill reads the project-specific names from it.- Adopt piece by piece with
init --only <part>;ci:doctorreports what is not adopted yet.
Layout-agnostic commands
Docker
hassan-devkit docker:up— runs thedocker.preUphook when configured, thendocker compose up -d --buildhassan-devkit docker:down—docker compose downhassan-devkit docker:logs— tail logshassan-devkit docker:restart <service>—docker compose restart <service>
Database
hassan-devkit db:list-tables—\dthassan-devkit db:describe <table>—\d <table>hassan-devkit db:count <table>—SELECT COUNT(*) FROM <table>hassan-devkit db:truncate <table>—TRUNCATE TABLE <table> CASCADEhassan-devkit db:psql— interactive psql shell
i18n
hassan-devkit i18n:check— validates translation JSON: flags keys missing from any language file and enforces UPPERCASE_SNAKE_CASE key naming. Add--detailed(per-module key counts) or--detailed --show-keysto inspect. No-ops when the project has no i18n directory, and runs automatically in the shared pre-commit hook.Configure via the
hassan-devkit.i18nblock in package.json (both fields optional):{ "hassan-devkit": { "i18n": { "dir": "public/assets/i18n", "languages": ["en", "nl"] } } }diris resolved from the repo root — in a monorepo point it at the app (e.g.spa/public/assets/i18n). Defaults:public/assets/i18nand["en", "nl"].
Husky hooks
hassan-devkit hooks:install— installs husky if needed, then writes the sharedpre-commithook content into.husky/pre-commit. Re-run after bumping@coding-with-hassan/devkitto pick up changes to the hook.hassan-devkit pre-commit— runs the hook body directly. Used internally; the installed.husky/pre-commitfile invokes this.hassan-devkit hooks:print— print the hook content to stdout (for inspection / diffing).
Per-project extras
If a project needs to run something extra before the standard i18n:check + lint-staged steps, drop a scripts/pre-commit-extra.sh in the repo root. It runs first, must exit 0 to continue. (Translation consistency is now built in via i18n:check — see above — so it no longer belongs here.)
