codebyplan 1.13.46 → 1.13.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/dist/cli.js +33 -13
  2. package/package.json +1 -1
  3. package/templates/agents/cbp-cc-executor.md +0 -1
  4. package/templates/agents/cbp-database-agent.md +0 -1
  5. package/templates/agents/cbp-e2e-maestro.md +0 -1
  6. package/templates/agents/cbp-e2e-playwright.md +0 -1
  7. package/templates/agents/cbp-e2e-tauri.md +0 -1
  8. package/templates/agents/cbp-e2e-vscode.md +0 -1
  9. package/templates/agents/cbp-e2e-xcuitest.md +0 -1
  10. package/templates/agents/cbp-improve-claude.md +0 -1
  11. package/templates/agents/cbp-improve-round.md +0 -1
  12. package/templates/agents/cbp-map-architecture.md +0 -1
  13. package/templates/agents/cbp-mechanical-edits.md +0 -1
  14. package/templates/agents/cbp-research.md +0 -1
  15. package/templates/agents/cbp-round-executor.md +7 -1
  16. package/templates/agents/cbp-security-agent.md +0 -1
  17. package/templates/agents/cbp-stripe-agent.md +173 -0
  18. package/templates/agents/cbp-task-check.md +0 -1
  19. package/templates/agents/cbp-task-planner.md +0 -1
  20. package/templates/agents/cbp-testing-qa-agent.md +0 -1
  21. package/templates/hooks/cbp-auto-test-hooks.sh +0 -1
  22. package/templates/hooks/cbp-canonical-templates-nudge.sh +0 -1
  23. package/templates/hooks/cbp-context-window-notify.sh +0 -1
  24. package/templates/hooks/cbp-e2e-spec-patterns.sh +0 -1
  25. package/templates/hooks/cbp-lint-format-on-edit.sh +0 -1
  26. package/templates/hooks/cbp-maestro-yaml-validate.sh +0 -1
  27. package/templates/hooks/cbp-mcp-caller-worktree-inject.sh +0 -1
  28. package/templates/hooks/cbp-mcp-migration-guard.sh +0 -1
  29. package/templates/hooks/cbp-mcp-round-sync.sh +0 -1
  30. package/templates/hooks/cbp-plugin-dispatch.sh +0 -1
  31. package/templates/hooks/cbp-pre-commit-quality-gate.sh +0 -1
  32. package/templates/hooks/cbp-session-start-hook.sh +0 -1
  33. package/templates/hooks/cbp-statusline.mjs +0 -1
  34. package/templates/hooks/cbp-statusline.py +0 -1
  35. package/templates/hooks/cbp-statusline.sh +0 -1
  36. package/templates/hooks/cbp-subagent-statusline.mjs +0 -1
  37. package/templates/hooks/cbp-subagent-statusline.py +0 -1
  38. package/templates/hooks/cbp-subagent-statusline.sh +0 -1
  39. package/templates/hooks/cbp-test-coverage-gate.sh +0 -1
  40. package/templates/hooks/cbp-test-hooks.sh +0 -1
  41. package/templates/hooks/validate-context-usage.sh +0 -1
  42. package/templates/hooks/validate-git-commit.sh +57 -9
  43. package/templates/hooks/validate-git-stash-deny.sh +0 -1
  44. package/templates/hooks/validate-structure-lengths.sh +0 -1
  45. package/templates/hooks/validate-structure-lib.sh +17 -1
  46. package/templates/hooks/validate-structure-patterns.sh +0 -1
  47. package/templates/hooks/validate-structure-scope.sh +43 -11
  48. package/templates/hooks/validate-structure-smoke.sh +0 -1
  49. package/templates/hooks/validate-structure-templates.sh +0 -1
  50. package/templates/hooks/validate-structure.sh +0 -1
  51. package/templates/hooks/verify-parity.sh +0 -1
  52. package/templates/rules/agent-claim-verification.md +0 -1
  53. package/templates/rules/architecture-map.md +0 -4
  54. package/templates/rules/cbp-operating-gotchas.md +0 -4
  55. package/templates/rules/context-file-loading.md +0 -1
  56. package/templates/rules/e2e-mandatory.md +0 -4
  57. package/templates/rules/parallel-waves.md +0 -1
  58. package/templates/rules/scope-vocabulary.md +14 -10
  59. package/templates/rules/supabase-branch-lifecycle.md +0 -1
  60. package/templates/rules/todo-backend.md +0 -1
  61. package/templates/settings.project.base.json +13 -0
  62. package/templates/skills/cbp-build-cc-agent/SKILL.md +2 -3
  63. package/templates/skills/cbp-build-cc-agent/reference/cbp-quality.md +6 -8
  64. package/templates/skills/cbp-build-cc-agent/scripts/validate-agent.sh +10 -1
  65. package/templates/skills/cbp-build-cc-claude-file/SKILL.md +0 -1
  66. package/templates/skills/cbp-build-cc-claude-file/scripts/validate-claude-file.sh +0 -1
  67. package/templates/skills/cbp-build-cc-mode/SKILL.md +0 -1
  68. package/templates/skills/cbp-build-cc-rule/SKILL.md +18 -8
  69. package/templates/skills/cbp-build-cc-rule/scripts/validate-rule.sh +4 -5
  70. package/templates/skills/cbp-build-cc-settings/SKILL.md +0 -1
  71. package/templates/skills/cbp-build-cc-settings/reference/cbp-conventions.md +0 -4
  72. package/templates/skills/cbp-build-cc-settings/scripts/validate-settings.sh +0 -1
  73. package/templates/skills/cbp-build-cc-skill/SKILL.md +0 -1
  74. package/templates/skills/cbp-build-cc-skill/reference/cbp-quality.md +6 -8
  75. package/templates/skills/cbp-build-cc-skill/scripts/validate-skill.sh +10 -2
  76. package/templates/skills/cbp-checkpoint-check/SKILL.md +0 -1
  77. package/templates/skills/cbp-checkpoint-complete/SKILL.md +0 -1
  78. package/templates/skills/cbp-checkpoint-create/SKILL.md +10 -11
  79. package/templates/skills/cbp-checkpoint-end/SKILL.md +0 -1
  80. package/templates/skills/cbp-checkpoint-plan/SKILL.md +0 -1
  81. package/templates/skills/cbp-checkpoint-plan/reference/alternative-comparison-template.md +0 -4
  82. package/templates/skills/cbp-checkpoint-plan/reference/dep-decision-rubric.md +0 -4
  83. package/templates/skills/cbp-checkpoint-plan/reference/e2e-discovery-probe.md +0 -4
  84. package/templates/skills/cbp-checkpoint-plan/reference/gap-analysis-playbook.md +0 -4
  85. package/templates/skills/cbp-checkpoint-start/SKILL.md +0 -1
  86. package/templates/skills/cbp-checkpoint-update/SKILL.md +0 -1
  87. package/templates/skills/cbp-frontend-a11y/SKILL.md +0 -1
  88. package/templates/skills/cbp-frontend-design/SKILL.md +0 -1
  89. package/templates/skills/cbp-frontend-ui/SKILL.md +0 -1
  90. package/templates/skills/cbp-frontend-ux/SKILL.md +0 -1
  91. package/templates/skills/cbp-git-branch-feat-create/SKILL.md +0 -1
  92. package/templates/skills/cbp-git-commit/SKILL.md +0 -1
  93. package/templates/skills/cbp-git-worktree-create/SKILL.md +0 -1
  94. package/templates/skills/cbp-git-worktree-remove/SKILL.md +0 -1
  95. package/templates/skills/cbp-map-architecture/SKILL.md +0 -1
  96. package/templates/skills/cbp-merge-main/SKILL.md +0 -1
  97. package/templates/skills/cbp-refresh-arch-map/SKILL.md +0 -1
  98. package/templates/skills/cbp-round-check/SKILL.md +0 -1
  99. package/templates/skills/cbp-round-complete/SKILL.md +0 -1
  100. package/templates/skills/cbp-round-end/SKILL.md +0 -1
  101. package/templates/skills/cbp-round-execute/SKILL.md +9 -2
  102. package/templates/skills/cbp-round-execute/reference/inline-fallback.md +0 -4
  103. package/templates/skills/cbp-round-input/SKILL.md +0 -1
  104. package/templates/skills/cbp-round-start/SKILL.md +0 -1
  105. package/templates/skills/cbp-round-update/SKILL.md +0 -1
  106. package/templates/skills/cbp-session-end/SKILL.md +0 -1
  107. package/templates/skills/cbp-session-start/SKILL.md +0 -1
  108. package/templates/skills/cbp-session-start/qa-regression.md +0 -1
  109. package/templates/skills/cbp-setup-e2e/SKILL.md +0 -1
  110. package/templates/skills/cbp-setup-eslint/SKILL.md +0 -1
  111. package/templates/skills/cbp-ship/SKILL.md +0 -1
  112. package/templates/skills/cbp-ship-configure/SKILL.md +0 -1
  113. package/templates/skills/cbp-ship-main/SKILL.md +0 -1
  114. package/templates/skills/cbp-stripe/SKILL.md +116 -0
  115. package/templates/skills/cbp-stripe/reference/billing.md +106 -0
  116. package/templates/skills/cbp-stripe/reference/connect.md +105 -0
  117. package/templates/skills/cbp-stripe/reference/payments.md +107 -0
  118. package/templates/skills/cbp-stripe/reference/security.md +117 -0
  119. package/templates/skills/cbp-stripe/reference/stripe-mcp-setup.md +59 -0
  120. package/templates/skills/cbp-stripe/reference/tax.md +96 -0
  121. package/templates/skills/cbp-stripe/reference/treasury.md +87 -0
  122. package/templates/skills/cbp-supabase-branch-check/SKILL.md +0 -1
  123. package/templates/skills/cbp-supabase-branch-check/reference/dag-steps.md +0 -4
  124. package/templates/skills/cbp-supabase-migrate/SKILL.md +0 -1
  125. package/templates/skills/cbp-supabase-setup/SKILL.md +0 -1
  126. package/templates/skills/cbp-task-check/SKILL.md +0 -1
  127. package/templates/skills/cbp-task-complete/SKILL.md +0 -1
  128. package/templates/skills/cbp-task-create/SKILL.md +0 -1
  129. package/templates/skills/cbp-task-start/SKILL.md +0 -1
  130. package/templates/skills/cbp-task-testing/SKILL.md +0 -1
  131. package/templates/skills/cbp-todo/SKILL.md +0 -1
  132. package/templates/skills/cbp-todo/qa-regression.md +0 -1
  133. package/templates/skills/supabase/SKILL.md +0 -1
  134. package/templates/skills/supabase-postgres-best-practices/SKILL.md +0 -1
@@ -1,24 +1,22 @@
1
- ---
2
- scope: org-shared
3
- ---
4
-
5
1
  # Skill Authoring Quality
6
2
 
7
3
  Quality expectations and structure for `/.claude/skills/{name}/SKILL.md` files. This file adds CBP-specific constraints on top of the official Claude Code skills spec.
8
4
 
9
- ## Required CBP Frontmatter
5
+ ## CBP Frontmatter — the `scope:` marker
6
+
7
+ `scope:` is a CBP structural marker (not read by Claude Code itself). It is **required only on user-created skills** — ones the `codebyplan` package does NOT distribute. A package-managed skill (one with a template twin under `templates/skills/`) is `org-shared` by default and needs **no** marker; an explicit `scope: org-shared` on it is redundant. See `rules/scope-vocabulary.md`.
10
8
 
11
- Every skill MUST have `scope:` in addition to the Claude Code native fields:
9
+ For a user-created skill, add a marker alongside the Claude Code native fields:
12
10
 
13
11
  ```yaml
14
12
  ---
15
- scope: org-shared # structural marker: org-shared | project-shared | repo-only:<repo-name>
13
+ scope: project-shared # or: repo-only:<repo-name> (user-created skills only)
16
14
  name: cbp-skill-name
17
15
  description: One sentence — shown in skill list and used for auto-matching
18
16
  ---
19
17
  ```
20
18
 
21
- `scope:` is a CBP structural marker not read by Claude Code itself. Missing `scope:` fails validation (`validate-skill.sh` / `validate-structure-scope.sh`).
19
+ `validate-skill.sh` validates the value when present but does not require the key; `codebyplan claude verify-parity` is the central enforcer of the user-created requirement (and warns on a redundant `org-shared` marker on a managed skill).
22
20
 
23
21
  ## What Skills Are
24
22
 
@@ -46,8 +46,16 @@ fi
46
46
  # Description recommended
47
47
  grep -qE '^description:\s*' <<< "$fm" || echo " WARN: no description — Claude will use first paragraph" >&2
48
48
 
49
- # CBP scope required
50
- grep -qE '^scope:\s*' <<< "$fm" || err "missing CBP required field: scope (org-shared|project-shared|repo-only:<repo-name>)"
49
+ # CBP scope: OPTIONAL. Required only on user-created assets (no template twin) —
50
+ # that requirement is enforced centrally by `codebyplan claude verify-parity`.
51
+ # Package-managed skills default to org-shared (markerless). Here we only validate
52
+ # the VALUE when a marker is present.
53
+ if grep -qE '^scope:\s*' <<< "$fm"; then
54
+ scope_val=$(grep -E '^scope:' <<< "$fm" | head -1 | sed -E 's/^scope:[[:space:]]*//; s/[[:space:]]*$//')
55
+ if ! [[ "$scope_val" =~ ^(org-shared|project-shared|repo-only:[a-z0-9]([a-z0-9-]*[a-z0-9])?)$ ]]; then
56
+ err "scope value '$scope_val' is not a valid enum value (org-shared|project-shared|repo-only:<slug>)"
57
+ fi
58
+ fi
51
59
 
52
60
  # Model — skills MUST NOT pin a model. A skill's inline turn runs in the user's
53
61
  # active session, so it inherits the session model. Pinning one forces a model the
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-checkpoint-check
4
3
  description: Full re-evaluation of a checkpoint with before/after comparison
5
4
  argument-hint: [CHK-NNN]
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-checkpoint-complete
4
3
  description: Complete a checkpoint after all tasks are done
5
4
  argument-hint: [checkpoint-number]
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-checkpoint-create
4
3
  description: Mechanical checkpoint creation — capture the user's description, infer title + goal, dedup against existing modules, create the checkpoint row + feat branch, then hand off to /cbp-checkpoint-plan for deep planning. Creates ZERO tasks.
5
4
  argument-hint: [checkpoint description]
@@ -67,24 +66,24 @@ Ask the user via AskUserQuestion whether to claim this checkpoint now:
67
66
  - **Claim for me + this worktree** (default) — resolve `npx codebyplan resolve-worktree 2>/dev/null` and set it as the checkpoint `worktree_id` at create. The creator carries momentum straight through plan → start.
68
67
  - **Leave it open** — create with `worktree_id` null so anyone free can claim it later via `/cbp-checkpoint-start`.
69
68
 
70
- Record the choice; it drives both the create call (Step 8) and the plan→start routing in `/cbp-checkpoint-plan`.
69
+ Record the choice; it drives both the create call (Step 7) and the plan→start routing in `/cbp-checkpoint-plan`.
71
70
 
72
- ### Step 7: Determine Next Checkpoint Number
73
-
74
- Scan `.codebyplan/state/checkpoints/*.json` for the highest `number` field + 1. If state dir is absent, run `npx codebyplan sync` once. Break-glass fallback: MCP `get_checkpoints` when sync fails.
75
-
76
- ### Step 8: Create Checkpoint Row
71
+ ### Step 7: Create Checkpoint Row
77
72
 
78
73
  `codebyplan checkpoint create` (CLI write-through: writes `.codebyplan/state/checkpoints/<id>.json` + REST). Pass flags:
79
- - `--repo-id` (from `.codebyplan/repo.json`), `--number`, `--title`, `--goal`, `--deadline`, `--status pending`
74
+ - `--repo-id` (from `.codebyplan/repo.json`), `--title`, `--goal`, `--deadline`, `--status pending`
80
75
  - `--ideas` JSON `[{ description: <raw user text> }]`
81
76
  - `--worktree-id` the resolved worktree **only if the user chose "claim"**; omit when "leave open"
82
77
 
83
- Break-glass fallback: MCP `create_checkpoint` when the CLI is unavailable.
78
+ Do **not** pass `--number` — the database auto-assigns the next per-repo checkpoint number via a `BEFORE INSERT` trigger (advisory-locked `MAX(number)+1` scoped to `repo_id`). The DB-assigned number comes back on the created row (and is written into `.codebyplan/state/checkpoints/<id>.json`); read it for the branch slug (Step 8) and the result display (Step 9).
79
+
80
+ Break-glass fallback: MCP `create_checkpoint` (also omit `number`) when the CLI is unavailable.
84
81
 
85
82
  This is the first identity-stamping point — when claiming, passing `worktree_id` here engages the CHK-104 hard-lock from birth. No `context`, `research`, `plan`, or tasks are written here.
86
83
 
87
- ### Step 9: Create + Switch to Feat Branch
84
+ ### Step 8: Create + Switch to Feat Branch
85
+
86
+ `{NNN}` below is the DB-assigned checkpoint number read back from the Step 7 `codebyplan checkpoint create` response.
88
87
 
89
88
  Read `.codebyplan/git.json` `branch_config.production` (default `"main"`) as `BASE`. codebyplan repos are main-only — never create or branch from a `development`/integration branch.
90
89
 
@@ -107,7 +106,7 @@ Persist the branch via `codebyplan checkpoint update --id <checkpoint-id> --bran
107
106
 
108
107
  **Note — Supabase preview branch**: no Supabase branch is created here. Creation is lazy — it happens on the first DB change when `/cbp-supabase-migrate` runs on this feat branch, which provisions a Supabase branch named identically to the git branch. See `cbp-supabase-migrate` Step 2.3 for the creation protocol.
109
108
 
110
- ### Step 10: Show Result + Auto-Trigger Plan
109
+ ### Step 9: Show Result + Auto-Trigger Plan
111
110
 
112
111
  ```
113
112
  ## Checkpoint Created
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-checkpoint-end
4
3
  description: Single point for all shipment — branch promotion to main via /cbp-ship-main, runtime deploy via /cbp-ship, branch cleanup, summary. Standalone tasks bypass shipment entirely.
5
4
  effort: xhigh
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-checkpoint-plan
4
3
  description: Deep inline planning for a checkpoint — assess, gap-analyse, decide dependencies, compare alternatives, optionally e2e-probe a suspected-broken area, then create tasks as vertical slices. Runs after /cbp-checkpoint-create (mechanical) and before /cbp-checkpoint-start (activate + claim). Does NOT activate or claim.
5
4
  argument-hint: [checkpoint-number]
@@ -1,7 +1,3 @@
1
- ---
2
- scope: org-shared
3
- ---
4
-
5
1
  # Alternative Comparison Template
6
2
 
7
3
  Loaded by `/cbp-checkpoint-plan` Step 6. Use when a meaningful design fork has more than one viable answer. Surfacing the alternatives — instead of silently picking one — is what lets the user redirect before tasks are created.
@@ -1,7 +1,3 @@
1
- ---
2
- scope: org-shared
3
- ---
4
-
5
1
  # Dependency Decision Rubric
6
2
 
7
3
  Loaded by `/cbp-checkpoint-plan` Step 5. Use when an idea could be built by extending something already installed OR by pulling in a new dependency. The goal is a deliberate, recorded choice — never a silent `pnpm add`.
@@ -1,7 +1,3 @@
1
- ---
2
- scope: org-shared
3
- ---
4
-
5
1
  # E2E Discovery Probe
6
2
 
7
3
  Loaded by `/cbp-checkpoint-plan` Step 4. The probe answers one question before you plan a fix: **is this area actually broken, and how?** It reuses the config-matched `cbp-e2e-*` specialist (the framework owners of e2e execution) in `whole_checkpoint_mode` rather than introducing a second smoke-test path. See `context/testing/e2e.md` for the dispatch contract that selects which specialist to spawn.
@@ -1,7 +1,3 @@
1
- ---
2
- scope: org-shared
3
- ---
4
-
5
1
  # Gap Analysis Playbook
6
2
 
7
3
  Loaded by `/cbp-checkpoint-plan` Step 3. The job: find what the raw request misses, before any task is created. Most "half-ass" outcomes come from planning only what was literally asked and ignoring the foundations it depends on or the adjacent breakage it sits next to.
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-checkpoint-start
4
3
  description: Activate a planned checkpoint and claim it for the current user/worktree, then route into task work. Runs after /cbp-checkpoint-plan (which produces tasks but never activates). Refuses to start an unplanned checkpoint.
5
4
  argument-hint: [checkpoint-number]
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-checkpoint-update
4
3
  description: Update checkpoint state (activate, update context, etc.)
5
4
  argument-hint: [checkpoint-number]
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-frontend-a11y
4
3
  description: Pre-implementation accessibility playbook loaded BEFORE writing UI / styling code. Produces a per-component checklist of WCAG 2.1 AA obligations from semantic HTML, ARIA roles/states, keyboard patterns, and contrast requirements.
5
4
  effort: xhigh
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-frontend-design
4
3
  description: Up-front design playbook loaded BEFORE writing UI / styling code. Detects the stack, loads the matching reference file, commits to an aesthetic direction, and prevents generic AI-slop output. Modelled on Anthropic's frontend-design skill, adapted for CBP repos with existing design systems.
5
4
  effort: xhigh
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-frontend-ui
4
3
  description: Visual quality self-review pass invoked twice per round — once by round-executor Step 3.8 (phase 'style_only', no screenshots) for token/spacing/typography/color/cohesion, once by /cbp-round-execute Step 5b (phase 'screenshot_review', with e2e screenshots) for rendered-output review and baseline regressions. Default phase 'full' runs everything for back-compat.
5
4
  effort: xhigh
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-frontend-ux
4
3
  description: Interaction-quality self-review pass loaded by round-executor AFTER UI code is written. Catches navigation flow issues, missing feedback states, cognitive-load problems, form usability gaps, and accessibility violations. Auto-applies in-scope mechanical UX fixes within the round's files_changed. Replaces the post-implementation ux-agent spawn with an inline skill invocation.
5
4
  effort: xhigh
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-git-branch-feat-create
4
3
  description: Create feature branch from the production branch (main, config-driven)
5
4
  argument-hint: "[name] e.g. add-user-auth"
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-git-commit
4
3
  description: Create scoped commit with conventional format
5
4
  argument-hint: "[--task|--all] [type]: [description]"
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-git-worktree-create
4
3
  description: Create git worktree with clean command setup and register in CodeByPlan
5
4
  argument-hint: <branch-name> e.g. codebyplan-app
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-git-worktree-remove
4
3
  description: Remove git worktree and deregister from CodeByPlan
5
4
  argument-hint: <name> e.g. codebyplan-app
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-map-architecture
4
3
  effort: xhigh
5
4
  description: Orchestrate architecture map generation for one or all modules. Spawns the cbp-map-architecture agent per module, writes per-module .md files to .claude/architecture/, regenerates INDEX.md and graph.md, and stamps each module via the CLI. Idempotent — safe to re-run.
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-merge-main
4
3
  description: Merge main into the current feat branch with interactive per-conflict resolution and inline QA re-run
5
4
  effort: high
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-refresh-arch-map
4
3
  effort: high
5
4
  description: Drift-scoped refresh of the .claude/architecture/ map — re-runs the cbp-map-architecture agent for ONLY the modules whose stamped git SHA has changed, regenerates INDEX.md + graph.md, and re-stamps. Idempotent; no-op when no module has drifted.
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-round-check
4
3
  description: Run automated checks standalone for the current round
5
4
  effort: low
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-round-complete
4
3
  description: Reconcile user git-add approvals, complete the round, and route to the next step
5
4
  argument-hint: [chk-task-round | task-round]
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-round-end
4
3
  description: Summary wrap-up after testing phase completes
5
4
  effort: high
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-round-execute
4
3
  description: Execute the approved plan from /cbp-round-start — runs per-wave executors, inline testing-qa per wave, and routes to /cbp-round-end
5
4
  effort: xhigh
@@ -119,6 +118,14 @@ If the approved plan includes database schema changes, RLS policies, or type gen
119
118
  2. Wait for completion
120
119
  3. Merge `files_changed` into executor output
121
120
 
121
+ ### Step 3b-stripe: Stripe Work (if plan includes Stripe integration)
122
+
123
+ If the approved plan includes Stripe integration work (files under `stripe/`, or plan steps referencing `payment`, `checkout`, `webhook`, `subscription`, or an explicit `stripe_work: true` flag from the planner):
124
+
125
+ 1. Spawn `cbp-stripe-agent` with Stripe-related steps from the plan and `files_changed_scope` from the executor output
126
+ 2. Wait for completion
127
+ 3. Merge `files_changed` into executor output
128
+
122
129
  ### Step 3c: Completion Check
123
130
 
124
131
  - `status: 'completed'` and all deliverables done → proceed to Step 4
@@ -229,7 +236,7 @@ Trigger `/cbp-round-end`.
229
236
 
230
237
  - **Reads**: `.codebyplan/state/checkpoints/<id>/tasks/<id>.json`, `checkpoints/<id>/tasks/<id>/rounds/<id>.json` (local-first; `npx codebyplan sync` on miss; MCP `get_current_task` / `get_rounds` as break-glass)
231
238
  - **Writes**: `codebyplan round update --id <uuid> --task-id <uuid> --checkpoint-id <uuid>` (Steps 6+7 — context with executor_output + testing_qa_output + e2e_eligible + e2e_outputs + frontend_ui_review; break-glass: MCP `update_round`)
232
- - **Spawns**: `cbp-round-executor` (per wave or single), `cbp-testing-qa-agent` (per wave, parallel sibling of the `cbp-e2e-*` specialists), the `cbp-e2e-*` specialists (config-driven dispatch per `context/testing/e2e.md`, one per eligible framework in `.codebyplan/e2e.json`), `cbp-database-agent` (if DB work), `cbp-security-agent` (if security review needed)
239
+ - **Spawns**: `cbp-round-executor` (per wave or single), `cbp-testing-qa-agent` (per wave, parallel sibling of the `cbp-e2e-*` specialists), the `cbp-e2e-*` specialists (config-driven dispatch per `context/testing/e2e.md`, one per eligible framework in `.codebyplan/e2e.json`), `cbp-database-agent` (if DB work), `cbp-stripe-agent` (if Stripe work), `cbp-security-agent` (if security review needed)
233
240
  - **Skill invocations**: `cbp-frontend-ui` at Step 5b with `phase: 'screenshot_review'` (post-e2e)
234
241
  - **Triggers**: `/cbp-round-end` (auto)
235
242
  - **Triggered by**: `/cbp-round-start` (auto, after plan approval)
@@ -1,7 +1,3 @@
1
- ---
2
- scope: org-shared
3
- ---
4
-
5
1
  # Inline-fallback procedures
6
2
 
7
3
  When `round-executor` or `testing-qa-agent` cannot be spawned (env limits, monthly cap, 5xx, rate limit, context overflow), the orchestrator falls through to an inline procedure that walks the agent's Phase checklist using its own tools.
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-round-input
4
3
  description: Gather input for a new round with deep analysis of unapproved work
5
4
  argument-hint: [chk-task-round | task-round | requirements-text]
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-round-start
4
3
  description: Start a round — planning phase only
5
4
  triggers: [cbp-round-execute]
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-round-update
4
3
  description: Triage a finished round (Claude-only); direct user to run round-complete on a clean round, or trigger round-input when more work is needed
5
4
  argument-hint: [chk-task-round | task-round]
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-session-end
4
3
  description: End a development session
5
4
  effort: xhigh
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-session-start
4
3
  description: Start a development session
5
4
  triggers: [cbp-todo]
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-session-start-qa-regression
4
3
  description: Manual regression procedure for the cbp-session-start worktree-ownership awareness + resolve-worktree distress channel (CHK-137 TASK-3)
5
4
  ---
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-setup-e2e
4
3
  description: Detect installed E2E frameworks, ask which to enable, record credentials source (gitignored env-file path + var names only, never secrets), and write/refresh .codebyplan/e2e.json. Interactive, idempotent.
5
4
  argument-hint: "[--force]"
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-setup-eslint
4
3
  description: Detect each app's tech stack, resolve matching DB ESLint presets, confirm which to enable per app, run `codebyplan eslint init` to generate eslint.config.mjs, and write/refresh .codebyplan/eslint.json. Interactive, idempotent.
5
4
  argument-hint: "[--force]"
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-ship
4
3
  description: Orchestrate runtime deployment for a checkpoint — Vercel web, EAS mobile (Expo Go dev build / TestFlight preview), Tauri desktop, npm package publish, VS Code extension, Railway backend, Supabase migrations. Detects configured surfaces, walks the user through what to deploy, executes per-surface deploy steps, verifies each landed.
5
4
  effort: xhigh
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-ship-configure
4
3
  description: Configure shipment for one or more surfaces in the current repo — Vercel link, EAS project + eas.json scaffold, Apple credentials probe, npm publish auth check (including `codebyplan` asset-publish automation via the publish-on-main workflow), Railway project link, Supabase access token verify; Supabase GitHub branching integration via /cbp-supabase-setup. Interactive step-by-step; never stores credentials in the repo.
5
4
  argument-hint: [--surface=<id>]
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-ship-main
4
3
  description: Ship feat branch to production branch via PR — thin wrapper around `codebyplan ship`
5
4
  effort: high
@@ -0,0 +1,116 @@
1
+ ---
2
+ scope: org-shared
3
+ name: cbp-stripe
4
+ description: "Stripe integration guidance — load when implementing or reviewing payments, Checkout, subscriptions/billing, webhooks, Connect, Tax, or Treasury. Encodes the API-selection routing table, the no-payment_method_types rule, restricted-key security, and Stripe SDK conventions."
5
+ effort: xhigh
6
+ ---
7
+
8
+ # Stripe Integration (CBP)
9
+
10
+ Load this skill before writing or reviewing any Stripe integration code — accepting payments,
11
+ Checkout Sessions, subscriptions, webhooks, marketplaces (Connect), tax compliance, or
12
+ embedded financial accounts (Treasury). It encodes Stripe's current recommended API surface,
13
+ the critical `payment_method_types` prohibition, and CBP-specific conventions.
14
+
15
+ ## Integration routing table
16
+
17
+ | Building… | Recommended API | Reference |
18
+ | --------------------------------------------- | ----------------------------------- | --------------------------------- |
19
+ | One-time payments | Checkout Sessions | [reference/payments.md](reference/payments.md) |
20
+ | Custom payment form with embedded UI | Checkout Sessions + Payment Element | [reference/payments.md](reference/payments.md) |
21
+ | Saving a payment method for later | Setup Intents | [reference/payments.md](reference/payments.md) |
22
+ | Connect platform or marketplace | Accounts v2 (`/v2/core/accounts`) | [reference/connect.md](reference/connect.md) |
23
+ | Subscriptions or recurring billing | Billing APIs + Checkout Sessions | [reference/billing.md](reference/billing.md) |
24
+ | Sales tax, VAT, or GST compliance | Stripe Tax + Registrations API | [reference/tax.md](reference/tax.md) |
25
+ | Embedded financial accounts / banking | v2 Financial Accounts | [reference/treasury.md](reference/treasury.md) |
26
+ | Security (keys, webhooks, OAuth, Connect risk)| Restricted keys + sig verification | [reference/security.md](reference/security.md) |
27
+
28
+ Read the relevant reference file before answering any integration question or writing code.
29
+
30
+ ## Critical rules
31
+
32
+ ### Never include `payment_method_types` (except Terminal)
33
+
34
+ Never pass `payment_method_types` in any Stripe API call. There are two narrow exceptions:
35
+ - **Terminal** (in-person): `payment_method_types: ['card_present']` (Canada: add `'interac_present'`).
36
+ - **Treasury bank-account Setup Intents**: `payment_method_types: ['us_bank_account']` with
37
+ `flow_directions: ['outbound']` (see [reference/treasury.md](reference/treasury.md)).
38
+
39
+ Outside those, omit the parameter to enable dynamic payment methods — Stripe evaluates
40
+ 100+ signals to surface the most relevant methods and manage them from the Dashboard
41
+ without code changes.
42
+
43
+ This applies to ALL call sites:
44
+ - `checkout.sessions.create` — omit entirely
45
+ - `paymentIntents.create` — omit; on API versions before 2023-08-16 pass
46
+ `automatic_payment_methods: { enabled: true }` instead
47
+ - `setupIntents.create` — same as PaymentIntents
48
+ - `subscriptions.create` — omit `payment_settings.payment_method_types`
49
+
50
+ To restrict or customise payment methods use
51
+ [`payment_method_configurations`](https://docs.stripe.com/payments/payment-method-configurations.md)
52
+ or `excluded_payment_method_types` — never `payment_method_types`.
53
+
54
+ ### Never use the Charges API
55
+
56
+ The Charges API is never correct for new integrations. Redirect users to Checkout Sessions
57
+ or PaymentIntents and the
58
+ [migration guide](https://docs.stripe.com/payments/payment-intents/migration/charges.md).
59
+
60
+ ### Never use the Sources API
61
+
62
+ Sources API is deprecated. Use Setup Intents to save payment methods.
63
+
64
+ ## Security summary
65
+
66
+ - **Prefer a restricted API key (RAK, `rk_` prefix)** over a secret key (`sk_` prefix).
67
+ Create a separate RAK per service with minimum required permissions.
68
+ - Test-mode keys: `sk_test_…` (secret) and `rk_test_…` (restricted).
69
+ - **Never commit secrets.** Store in a secrets vault or, at minimum, server-side env vars.
70
+ Never embed keys in client-side code or mobile apps.
71
+ - **Verify webhook signatures** via `stripe.webhooks.constructEvent(body, sig, secret)`.
72
+ Never process an unverified webhook event.
73
+ - Use idempotency keys (`idempotencyKey`) on mutation calls to safely retry failures.
74
+ - See [reference/security.md](reference/security.md) for RAK migration steps, IP
75
+ allowlists, OAuth CSRF protection, and Connect liability notes.
76
+
77
+ ### CBP-specific (Next.js)
78
+
79
+ Any Next.js API route that imports `stripe` **MUST** export:
80
+
81
+ ```ts
82
+ export const dynamic = 'force-dynamic';
83
+ ```
84
+
85
+ Source: `.claude/skills/cbp-frontend-design/reference/nextjs-scss.md` Rule 6. Without this,
86
+ Next.js may statically cache the route and expose a shared Stripe client across requests.
87
+
88
+ ## SDK and API version
89
+
90
+ - Latest Stripe API version: **`2026-05-27.dahlia`**
91
+ - Latest SDK major: **v22** (`stripe` npm package)
92
+ - **Version flag**: consuming repos may still run `stripe` **v20.4.1** (per CBP vendor
93
+ inventory). Always check the installed version (`cat package.json | grep '"stripe"'`)
94
+ before applying v22-only patterns. Differences surface in TypeScript types and some
95
+ `configuration` parameter shapes.
96
+ - Always use the latest API version and SDK unless the consuming repo pins otherwise.
97
+
98
+ ## Key documentation
99
+
100
+ - [Integration Options](https://docs.stripe.com/payments/payment-methods/integration-options.md) — start here for any new integration
101
+ - [API Tour](https://docs.stripe.com/payments-api/tour.md) — overview of Stripe's API surface
102
+ - [Go Live Checklist](https://docs.stripe.com/get-started/checklist/go-live.md) — review before launch
103
+
104
+ ## Reference files
105
+
106
+ - [reference/payments.md](reference/payments.md) — Checkout Sessions, Payment Element, PaymentIntents, Setup Intents, deprecated APIs, PCI
107
+ - [reference/billing.md](reference/billing.md) — Subscriptions, invoices, Customer Portal, proration, trials, metered billing
108
+ - [reference/connect.md](reference/connect.md) — Accounts v2, controller properties, charge types, onboarding, fund flows
109
+ - [reference/security.md](reference/security.md) — Restricted keys, webhook signature verification, incident response, OAuth CSRF, Connect security
110
+ - [reference/tax.md](reference/tax.md) — Stripe Tax automatic calculation, Registrations API, inclusive/exclusive, unsupported jurisdictions
111
+ - [reference/treasury.md](reference/treasury.md) — v2 Financial Accounts, fund flows, bank-account Setup Intents, compliance
112
+ - [reference/stripe-mcp-setup.md](reference/stripe-mcp-setup.md) — optional live Stripe MCP setup (test/restricted key) for the cbp-stripe-agent
113
+
114
+ ---
115
+
116
+ Adapted from Stripe's official `stripe-best-practices` skill (github.com/stripe/ai), used under the MIT License (Copyright (c) 2024-2025 Stripe).
@@ -0,0 +1,106 @@
1
+ # Billing / Subscriptions Reference
2
+
3
+ Adapted from Stripe's official `stripe-best-practices` skill (github.com/stripe/ai), MIT License, Copyright (c) 2024-2025 Stripe.
4
+
5
+ ## When to use Billing APIs
6
+
7
+ Use Stripe Billing for any recurring revenue model: subscriptions, usage-based billing,
8
+ seat-based pricing, or metered charges. Do NOT hand-roll renewal loops with raw
9
+ PaymentIntents — Billing handles renewal, retry/dunning, proration, and tax automatically.
10
+
11
+ References: [Subscription design guide](https://docs.stripe.com/billing/subscriptions/design-an-integration.md) |
12
+ [Use cases](https://docs.stripe.com/billing/subscriptions/use-cases.md) |
13
+ [SaaS guide](https://docs.stripe.com/saas.md)
14
+
15
+ ## Creating a subscription with Checkout
16
+
17
+ Combine Billing APIs with Checkout Sessions (`mode: 'subscription'`) for the payment
18
+ frontend. Checkout handles the initial payment, trial management, and proration.
19
+
20
+ ```ts
21
+ const session = await stripe.checkout.sessions.create({
22
+ mode: 'subscription',
23
+ // Do NOT pass payment_method_types
24
+ line_items: [{ price: priceId, quantity: 1 }],
25
+ subscription_data: { trial_period_days: 14 },
26
+ success_url: `${baseUrl}/success?session_id={CHECKOUT_SESSION_ID}`,
27
+ cancel_url: `${baseUrl}/pricing`,
28
+ });
29
+ ```
30
+
31
+ ## Customer Portal (self-service management)
32
+
33
+ For upgrades, downgrades, cancellation, and payment method updates, use the
34
+ [Customer Portal](https://docs.stripe.com/customer-management/integrate-customer-portal.md)
35
+ rather than building a custom flow.
36
+
37
+ ```ts
38
+ const portalSession = await stripe.billingPortal.sessions.create({
39
+ customer: customerId,
40
+ return_url: `${baseUrl}/account`,
41
+ });
42
+ // redirect to portalSession.url
43
+ ```
44
+
45
+ ## Key Billing objects
46
+
47
+ | Object | Purpose | Docs |
48
+ | ------ | ------- | ---- |
49
+ | `Price` | Unit amount + recurring interval | [Prices API](https://docs.stripe.com/api/prices.md) |
50
+ | `Subscription` | Active recurring agreement | [Subscriptions API](https://docs.stripe.com/api/subscriptions.md) |
51
+ | `Invoice` | Statement + payment trigger | [Invoices API](https://docs.stripe.com/api/invoices.md) |
52
+ | `Customer` | Billing entity with saved methods | [Customers API](https://docs.stripe.com/api/customers.md) |
53
+
54
+ Do NOT use the deprecated `plan` object — use `Price` instead.
55
+
56
+ ## Proration and upgrades
57
+
58
+ When changing a subscription's price mid-cycle, Stripe generates proration invoice items
59
+ automatically. Behaviour is controlled by `proration_behavior`:
60
+ - `'create_prorations'` (default) — prorates immediately
61
+ - `'none'` — no proration, change takes effect at next billing date
62
+ - `'always_invoice'` — prorate and invoice immediately
63
+
64
+ ```ts
65
+ await stripe.subscriptions.update(subscriptionId, {
66
+ items: [{ id: itemId, price: newPriceId }],
67
+ proration_behavior: 'create_prorations',
68
+ });
69
+ ```
70
+
71
+ ## Metered / usage-based billing
72
+
73
+ 1. Create a `Price` with `recurring.usage_type: 'metered'`.
74
+ 2. Report usage via `stripe.subscriptionItems.createUsageRecord(itemId, { quantity, timestamp })`.
75
+ 3. Stripe aggregates usage and bills at the end of the period.
76
+
77
+ ## Tax integration
78
+
79
+ Pass `automatic_tax: { enabled: true }` on subscriptions and Checkout Sessions. Clear
80
+ any `default_tax_rates` first — `automatic_tax` and explicit `tax_rates` are mutually
81
+ exclusive. See [reference/tax.md](tax.md) for the full setup.
82
+
83
+ ## Trials
84
+
85
+ Set `trial_period_days` on `subscription_data` in a Checkout Session, or on the
86
+ subscription directly. After trial ends Stripe automatically charges unless cancelled.
87
+
88
+ ## Webhook events to handle
89
+
90
+ | Event | Action |
91
+ | ----- | ------ |
92
+ | `customer.subscription.created` | Provision access |
93
+ | `customer.subscription.updated` | Reflect plan change |
94
+ | `customer.subscription.deleted` | Revoke access |
95
+ | `invoice.payment_succeeded` | Extend access period |
96
+ | `invoice.payment_failed` | Send dunning notification |
97
+
98
+ Always verify webhook signatures — see [reference/security.md](security.md).
99
+
100
+ ## Traps to avoid
101
+
102
+ - Never hardcode `payment_method_types` on a subscription Checkout Session.
103
+ - Never build manual renewal loops with raw PaymentIntents.
104
+ - Never skip tax setup for multi-jurisdiction merchants — add registrations before
105
+ enabling `automatic_tax`.
106
+ - Don't use the deprecated `plan` object; use `Price` instead.