Skip to content

feat(#256): /process skill — extract process from code, BPMN 2.0 output#259

Merged
atlas-apex merged 3 commits into
devfrom
feature/GH-256-process-skill
May 16, 2026
Merged

feat(#256): /process skill — extract process from code, BPMN 2.0 output#259
atlas-apex merged 3 commits into
devfrom
feature/GH-256-process-skill

Conversation

@atlas-apex

Copy link
Copy Markdown
Collaborator

Summary

  • New /process skill at .claude/skills/process/SKILL.md — maps a named business process by reading code first (state machines, queue chains, cron, state-column transitions, API choreography, existing BPMN, documented steps), interviews only on the gaps, then emits a lint-clean BPMN 2.0 file that opens cleanly in Camunda Modeler.
  • Anchor-scoped + reachability-bounded — operator supplies a process slug + entry point (--from-endpoint, --from-machine, --from-job, --scope); the scan never runs exhaustively across a repo.
  • Cross-repo traversal via apexyard.projects.yaml registry — handoffs to registered repos recurse into them (offers default-yes to clone workspace/<name>/ when missing); unregistered targets render as external participant pools.
  • Output: projects/<project>/processes/<slug>.bpmn + a .process-source.md sibling for replay + a per-project README.md index.
  • Sibling to /c4 (system topology) and /extract-features (feature inventory) — same read-first-then-ask family.
  • AgDR-0024 captures seven design sub-decisions (BPMN 2.0 vs DMN/CMMN/Mermaid, bpmn-auto-layout vs manual coords, bpmnlint as the gate, read-first-then-ask, swimlanes-default vs pools-opt-in, registry-lookup vs heuristic matching, on-demand cloning offer).

Testing

  1. Smoke test (single-repo discovery + BPMN emit + xmllint validity, 18 assertions):
    bash .claude/skills/process/tests/smoke.sh
  2. Cross-repo registry-lookup test (cloned / missing / external / no-registry cases, 6 assertions):
    bash .claude/skills/process/tests/test_cross_repo.sh
  3. BPMN emitter edge cases (XML escaping for &<>'", message flows, --pools mode, incoming/outgoing flow refs on every node, exporter metadata, 21 assertions):
    bash .claude/skills/process/tests/test_bpmn_emit.sh
    All 45 assertions pass locally. Each test builds its own synthetic fixture under $TMPDIR and cleans up on exit.
  4. Manual smoke (optional, requires Node + npm + Camunda Modeler):
    /process onboarding --from-endpoint "POST /signup" --project signup-svc
    open projects/signup-svc/processes/onboarding.bpmn   # drag-drop into Camunda Modeler

Runtime requirements

Dependency Used for Without it
bash >= 4 the skill itself required
git, xmllint, jq (or python3) discovery + emission required
yq registry parsing falls back to awk
node + npx bpmn-auto-layout + bpmnlint falls back to bare BPMN with warning; --skip-lint bypasses the gate

Disclosed up-front in SKILL.md § Runtime requirements — same shape as the LSP-plugin disclosure pattern.

Out of scope (v1, per the ticket)

  • DMN / CMMN support
  • Camunda 7 / 8 extension attributes (vanilla BPMN 2.0 only)
  • BPMN execution / engine integration
  • Round-trip from hand-edited .bpmn back into the interview state
  • Heuristic URL matching for cross-repo handoffs (registry-only)
  • Live syncing across runs
  • DSL output for Cadence / Temporal / Step Functions
  • Multi-process canvases

Glossary

Term Definition
BPMN 2.0 Business Process Model and Notation, OMG standard — XML format for business processes, openable in Camunda Modeler / bpmn.io / Cawemo.
Anchor An operator-supplied entry point for the process trace (endpoint, state machine, job, directory) — bounds the scope of the scan.
Reachability-scoped Discovery follows only what's connected to the anchor; stops at the connected-component boundary; sister subsystems aren't scanned.
Swimlane A horizontal partition inside a single BPMN pool — used here to distinguish per-service responsibilities within one process.
Pool A standalone process boundary in BPMN — used here for fully-separated participants where message-flow arrows are the only inter-pool connection.
Message flow A dashed arrow in BPMN representing communication between pools (queue publish, HTTP call, event emit).
bpmnlint Open-source linter for BPMN files (npm package); enforces well-formedness + readability rules.
bpmn-auto-layout npm package that generates <bpmndi> coordinates so the file opens with a readable diagram in Camunda Modeler.
Process anchor slug Short kebab-case identifier for a named process — used as the BPMN file name and the process index key.
Registry-lookup Cross-repo signal source: only repos in apexyard.projects.yaml participate in the cross-repo trace; everything else renders as external.
AgDR Agent Decision Record — captures the technical decisions made by the agent during a feature; required before architectural work.

Closes #256

- New skill at .claude/skills/process/SKILL.md that maps a named business
  process by scanning across seven discovery axes (explicit workflow defs,
  queue/job chains, cron triggers, state-column transitions, API
  choreography, existing BPMN/Mermaid, documented steps), interviews only
  on gaps, then emits a lint-clean BPMN 2.0 file the operator can open in
  Camunda Modeler.

- Anchor-scoped discovery (operator supplies process slug + entry point —
  endpoint / state machine / queue job / directory) with reachability
  bounding from the anchor. No exhaustive scans.

- Cross-repo traversal via apexyard.projects.yaml — when a handoff target
  matches a registered project, the skill recurses into that repo (offers
  to clone workspace/<name>/ if missing, default-yes). Unregistered
  targets render as external participant pools.

- generate-bpmn.sh emits valid BPMN 2.0 XML with bpmn:laneSet,
  bpmn:messageFlow for cross-pool handoffs, source citations via
  bpmn:documentation on every element. Pipes through `npx bpmn-auto-layout`
  for <bpmndi> coords; falls back to bare BPMN with warning when Node is
  missing.

- lint.sh wraps `bpmnlint` (recommended ruleset + label-required +
  no-disconnected + no-implicit-split) as the merge gate; overridable via
  per-project .bpmnlintrc.

- AgDR-0024 captures the seven sub-decisions: BPMN 2.0 over alternatives
  (DMN/CMMN/Mermaid sequence/raw flowchart), bpmn-auto-layout over manual
  coords, bpmnlint as the gate, read-first-then-ask over operator-only
  authoring, swimlanes-default vs pools-opt-in, registry-lookup vs
  heuristic URL matching, on-demand cloning offer vs black-box fallback.

- Three test scripts cover discovery (smoke.sh — 18 checks across all
  seven axes on a synthetic Express+Prisma+BullMQ+XState fixture),
  cross-repo registry lookup (test_cross_repo.sh — 6 checks), and BPMN
  emission edge cases (test_bpmn_emit.sh — 21 checks: special-char XML
  escaping, message flows, --pools mode, flow refs, xmllint validity).

- CLAUDE.md skill registry bumped to 44; docs/multi-project.md "How
  skills behave" table updated.

Closes #256

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
me2resh added a commit that referenced this pull request May 16, 2026

@atlas-apex atlas-apex left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Code Review: PR #259

Commit: 2a5b08558f244da8aab58659d04ce0f8e5fe52cc

Solid implementation across all six focus areas: (1) the seven grep signatures are realistic and well-bounded — vendored-dir pruning is consistent, the state-write pattern \.(status|state|phase|step|stage)\s*=\s*['\"][a-zA-Z_-]+['\"] is narrow enough to avoid common false positives, and head -N caps prevent runaway output; (2) anchor-required scoping is enforced at discover.sh:809-812 with a clear stderr error and exit 2; (3) cross-repo.sh cleanly handles cloned / missing / external / no-registry with all four paths covered in test_cross_repo.sh, and the default-yes clone offer mirrors /handover's pattern correctly; (4) BPMN emission is well-formed — xml_escape covers all five entities, <bpmn:incoming>/<bpmn:outgoing> refs are populated for every node, source-evidence <bpmn:documentation> is consistently attached, and xmllint --noout is asserted in the smoke test; (5) lint.sh degrades gracefully with a specific exit-3 + actionable message when npx is missing, and generate-bpmn.sh falls back to bare BPMN on Node absence with a warning rather than crashing; 45 assertions across three test files all pass. Two non-blocking items to address in a follow-up: (a) AgDR frontmatter ID mismatch — file is AgDR-0025-process-skill-bpmn-and-discovery.md but the YAML frontmatter says id: AgDR-0024 (line 2 of the AgDR), which collides with PR #260's AgDR-0024; please fix the frontmatter id: to AgDR-0025 and update the PR description (still claims "AgDR-0024 captures..." inside the AgDR's prose at the bottom of the Decision section). (b) Cross-PR consolidation with #260 — PR #260 ships .claude/hooks/_lib-multi-repo-trace.sh (324 LOC: mrt_resolve_target, mrt_is_third_party, mrt_workspace_for, mrt_offer_clone) explicitly intended for /process to consume, and its PR body states "the consumer that lands later should consolidate to a single file (Rex will flag the duplication)." Whichever PR merges second should refactor cross-repo.sh to delegate to _lib-multi-repo-trace.sh — the current cross-repo.sh reimplements roughly the same registry lookup, yq/awk fallback, and workspace-resolution logic. Approving (logged as comment because PR author = reviewer); please file the consolidation follow-up as a chore ticket against whichever PR lands second.

Verdict

APPROVED (filed as comment — cannot self-approve)


🤖 Reviewed by Rex (Code Reviewer Agent)
📌 Reviewed commit: `2a5b08558f244da8aab58659d04ce0f8e5fe52cc`

@atlas-apex atlas-apex left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

LGTM — re-approving at c1e081e: verified the 1-line frontmatter fix (id: AgDR-0024 → AgDR-0025) addresses the prior non-blocking drift; no other changes in this commit.

@atlas-apex atlas-apex merged commit 827bde6 into dev May 16, 2026
3 checks passed
@atlas-apex atlas-apex deleted the feature/GH-256-process-skill branch May 16, 2026 09:25
atlas-apex added a commit that referenced this pull request May 16, 2026
…ies + classifications (#260)

* feat(#257): /dfd skill — extract Data Flow Diagram with trust boundaries + classifications

Introduces /dfd as the canonical Data Flow Diagram producer. The DFD
becomes the source of truth for /threat-model and /compliance-check —
both refactored in this commit to consume from
projects/<name>/architecture/dfd.md instead of regenerating their own
data-flow views.

Six-axis discovery (external actors, processes, data stores, data
flows, trust boundaries, data classifications). Classifications detect
via three additive pathways: code annotations (@pii, @sensitive,
CLASSIFIED:), env-var heuristics (*_SECRET, *_TOKEN, EMAIL_*), and
schema-column heuristics (email, phone, card_number). An optional
explicit registry at docs/data-classification.{md,yaml} overrides
heuristic labels.

Two output formats: Mermaid markdown (default, renders inline on
GitHub, zero new toolchain) and OWASP Threat Dragon v2 JSON (on
--format=dragon, for visual editing in Threat Dragon). The Dragon
serialiser is a pure function over the in-memory model so #255
(/threat-model --format=dragon) can share or import it.

Multi-repo discovery via a new shared helper _lib-multi-repo-trace.sh
(intended to also be consumed by /process #256). Three resolvers:
mrt_resolve_target (hostname/URL/topic → registered project),
mrt_is_third_party (known SaaS vendor detection), mrt_workspace_for
(workspace clone path resolution).

The refactors of /threat-model and /compliance-check are surgical —
Step 1 of /threat-model now reads dfd.md and offers /dfd first if it
doesn't exist; Step 4 of /compliance-check reads the classifications +
external-services list from dfd.md for cross-border-transfer and DPA
detection. Output formats and audit-history persistence contracts in
both consumers are unchanged.

AgDR-0024 captures the design rationale: Mermaid as primary, Threat
Dragon as secondary; classifications as a first-class concept; the
single-source-of-truth refactor; the shared multi-repo trace helper.

Cross-PR coordination:
  - #255 (/threat-model --format=dragon) — shares the Threat Dragon
    serialiser; if #255 lands first with the serialiser inside
    /threat-model, this skill imports from there
  - #256 (/process) — shares the _lib-multi-repo-trace.sh helper; if
    /process extracted its own version first, the consumer that lands
    later should consolidate

Tests (.claude/skills/dfd/tests/smoke.sh, 52 assertions) cover all
three fixtures from the AC: single-service six-axis discovery,
cross-service trust-boundary detection, three-pathway classification
detection. Plus Mermaid generator output shape, Threat Dragon JSON
schema validation, and verification that /threat-model and
/compliance-check actually reference dfd.md.

Closes #257

* fix(#257): renumber AgDR to 0026 — #258 + #259 took 0024 + 0025 during parallel landing

* fix(#257): address Rex blockers — shellcheck SC2221/2222, MD032, lychee 404, AgDR refs

- _lib-multi-repo-trace.sh: drop redundant subset patterns in third-party detector
  (e.g. *api.amplitude.com* covered by broader *amplitude.com*) — clears SC2221/2222.
- dfd/SKILL.md: blank lines around Discovery + Classifications lists — clears MD032.
- dfd/SKILL.md: Threat Dragon schema link now points to the repo root (sub-path 404'd).
- AgDR cross-refs across 5 files renumbered 0024 → 0026 (renumber missed downstream).

---------

Co-authored-by: me2resh <ahmed.abdelaliem@gmail.com>
me2resh added a commit that referenced this pull request Jun 5, 2026
…ut (#259)

* feat(#256): /process skill — extract process from code, BPMN 2.0 output

- New skill at .claude/skills/process/SKILL.md that maps a named business
  process by scanning across seven discovery axes (explicit workflow defs,
  queue/job chains, cron triggers, state-column transitions, API
  choreography, existing BPMN/Mermaid, documented steps), interviews only
  on gaps, then emits a lint-clean BPMN 2.0 file the operator can open in
  Camunda Modeler.

- Anchor-scoped discovery (operator supplies process slug + entry point —
  endpoint / state machine / queue job / directory) with reachability
  bounding from the anchor. No exhaustive scans.

- Cross-repo traversal via apexyard.projects.yaml — when a handoff target
  matches a registered project, the skill recurses into that repo (offers
  to clone workspace/<name>/ if missing, default-yes). Unregistered
  targets render as external participant pools.

- generate-bpmn.sh emits valid BPMN 2.0 XML with bpmn:laneSet,
  bpmn:messageFlow for cross-pool handoffs, source citations via
  bpmn:documentation on every element. Pipes through `npx bpmn-auto-layout`
  for <bpmndi> coords; falls back to bare BPMN with warning when Node is
  missing.

- lint.sh wraps `bpmnlint` (recommended ruleset + label-required +
  no-disconnected + no-implicit-split) as the merge gate; overridable via
  per-project .bpmnlintrc.

- AgDR-0024 captures the seven sub-decisions: BPMN 2.0 over alternatives
  (DMN/CMMN/Mermaid sequence/raw flowchart), bpmn-auto-layout over manual
  coords, bpmnlint as the gate, read-first-then-ask over operator-only
  authoring, swimlanes-default vs pools-opt-in, registry-lookup vs
  heuristic URL matching, on-demand cloning offer vs black-box fallback.

- Three test scripts cover discovery (smoke.sh — 18 checks across all
  seven axes on a synthetic Express+Prisma+BullMQ+XState fixture),
  cross-repo registry lookup (test_cross_repo.sh — 6 checks), and BPMN
  emission edge cases (test_bpmn_emit.sh — 21 checks: special-char XML
  escaping, message flows, --pools mode, flow refs, xmllint validity).

- CLAUDE.md skill registry bumped to 44; docs/multi-project.md "How
  skills behave" table updated.

Closes #256

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(#256): renumber AgDR to 0025 — #258 took 0024 during parallel landing

* fix(#256): align AgDR-0025 frontmatter id (renumber missed YAML field)

---------

Co-authored-by: me2resh <ahmed.abdelaliem@gmail.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
me2resh added a commit that referenced this pull request Jun 5, 2026
…ies + classifications (#260)

* feat(#257): /dfd skill — extract Data Flow Diagram with trust boundaries + classifications

Introduces /dfd as the canonical Data Flow Diagram producer. The DFD
becomes the source of truth for /threat-model and /compliance-check —
both refactored in this commit to consume from
projects/<name>/architecture/dfd.md instead of regenerating their own
data-flow views.

Six-axis discovery (external actors, processes, data stores, data
flows, trust boundaries, data classifications). Classifications detect
via three additive pathways: code annotations (@pii, @sensitive,
CLASSIFIED:), env-var heuristics (*_SECRET, *_TOKEN, EMAIL_*), and
schema-column heuristics (email, phone, card_number). An optional
explicit registry at docs/data-classification.{md,yaml} overrides
heuristic labels.

Two output formats: Mermaid markdown (default, renders inline on
GitHub, zero new toolchain) and OWASP Threat Dragon v2 JSON (on
--format=dragon, for visual editing in Threat Dragon). The Dragon
serialiser is a pure function over the in-memory model so #255
(/threat-model --format=dragon) can share or import it.

Multi-repo discovery via a new shared helper _lib-multi-repo-trace.sh
(intended to also be consumed by /process #256). Three resolvers:
mrt_resolve_target (hostname/URL/topic → registered project),
mrt_is_third_party (known SaaS vendor detection), mrt_workspace_for
(workspace clone path resolution).

The refactors of /threat-model and /compliance-check are surgical —
Step 1 of /threat-model now reads dfd.md and offers /dfd first if it
doesn't exist; Step 4 of /compliance-check reads the classifications +
external-services list from dfd.md for cross-border-transfer and DPA
detection. Output formats and audit-history persistence contracts in
both consumers are unchanged.

AgDR-0024 captures the design rationale: Mermaid as primary, Threat
Dragon as secondary; classifications as a first-class concept; the
single-source-of-truth refactor; the shared multi-repo trace helper.

Cross-PR coordination:
  - #255 (/threat-model --format=dragon) — shares the Threat Dragon
    serialiser; if #255 lands first with the serialiser inside
    /threat-model, this skill imports from there
  - #256 (/process) — shares the _lib-multi-repo-trace.sh helper; if
    /process extracted its own version first, the consumer that lands
    later should consolidate

Tests (.claude/skills/dfd/tests/smoke.sh, 52 assertions) cover all
three fixtures from the AC: single-service six-axis discovery,
cross-service trust-boundary detection, three-pathway classification
detection. Plus Mermaid generator output shape, Threat Dragon JSON
schema validation, and verification that /threat-model and
/compliance-check actually reference dfd.md.

Closes #257

* fix(#257): renumber AgDR to 0026 — #258 + #259 took 0024 + 0025 during parallel landing

* fix(#257): address Rex blockers — shellcheck SC2221/2222, MD032, lychee 404, AgDR refs

- _lib-multi-repo-trace.sh: drop redundant subset patterns in third-party detector
  (e.g. *api.amplitude.com* covered by broader *amplitude.com*) — clears SC2221/2222.
- dfd/SKILL.md: blank lines around Discovery + Classifications lists — clears MD032.
- dfd/SKILL.md: Threat Dragon schema link now points to the repo root (sub-path 404'd).
- AgDR cross-refs across 5 files renumbered 0024 → 0026 (renumber missed downstream).

---------

Co-authored-by: me2resh <ahmed.abdelaliem@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants