@baldurpan/create-ai-workflow 0.2.0

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 (116) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +165 -0
  3. package/dist/agents-block.js +70 -0
  4. package/dist/bin.js +14 -0
  5. package/dist/check/markdown.js +47 -0
  6. package/dist/check/parse.js +113 -0
  7. package/dist/check/rules.js +245 -0
  8. package/dist/cli.js +109 -0
  9. package/dist/commands/check.js +41 -0
  10. package/dist/commands/install.js +76 -0
  11. package/dist/commands/standards-add.js +145 -0
  12. package/dist/commands/update.js +214 -0
  13. package/dist/layout.js +115 -0
  14. package/dist/log.js +20 -0
  15. package/dist/manifest.js +53 -0
  16. package/dist/paths.js +41 -0
  17. package/package.json +37 -0
  18. package/templates/blocks/agents-block.md +30 -0
  19. package/templates/claude/agents/planner.agent.md +60 -0
  20. package/templates/claude/agents/reviewer.agent.md +77 -0
  21. package/templates/context/README.md +81 -0
  22. package/templates/context/plan-template.md +69 -0
  23. package/templates/context/plan-template.notes.md +55 -0
  24. package/templates/context/roles/coder.md +76 -0
  25. package/templates/context/workflow.md +143 -0
  26. package/templates/skills/feature-close/SKILL.md +102 -0
  27. package/templates/skills/feature-implement/SKILL.md +142 -0
  28. package/templates/skills/feature-plan/SKILL.md +138 -0
  29. package/templates/skills/feature-status/SKILL.md +86 -0
  30. package/templates/skills/onboard/SKILL.md +122 -0
  31. package/templates/skills/orchestrate/SKILL.md +92 -0
  32. package/templates/skills/roadmap/SKILL.md +97 -0
  33. package/templates/standards/.source +8 -0
  34. package/templates/standards/README.md +104 -0
  35. package/templates/standards/architecture/api-design.md +212 -0
  36. package/templates/standards/architecture/dependency-boundaries.md +104 -0
  37. package/templates/standards/architecture/feature-driven.md +102 -0
  38. package/templates/standards/architecture/folder-structure.md +108 -0
  39. package/templates/standards/architecture/monorepos.md +107 -0
  40. package/templates/standards/architecture/refactoring.md +97 -0
  41. package/templates/standards/architecture/shared-code.md +81 -0
  42. package/templates/standards/docs/PHP-SPEC.md +1195 -0
  43. package/templates/standards/docs/SPEC.md +540 -0
  44. package/templates/standards/examples/bad/data-fetching.tsx +52 -0
  45. package/templates/standards/examples/bad/derived-state.tsx +60 -0
  46. package/templates/standards/examples/bad/feature-component.tsx +80 -0
  47. package/templates/standards/examples/bad/prop-drilling.tsx +70 -0
  48. package/templates/standards/examples/good/data-fetching.tsx +53 -0
  49. package/templates/standards/examples/good/derived-state.tsx +52 -0
  50. package/templates/standards/examples/good/feature-component.tsx +141 -0
  51. package/templates/standards/examples/good/invoice.schema.ts +20 -0
  52. package/templates/standards/examples/good/prop-drilling.tsx +83 -0
  53. package/templates/standards/philosophy/ai-agent-behavior.md +93 -0
  54. package/templates/standards/philosophy/core-principles.md +49 -0
  55. package/templates/standards/philosophy/incremental-abstraction.md +56 -0
  56. package/templates/standards/philosophy/maintainability.md +66 -0
  57. package/templates/standards/philosophy/readability.md +87 -0
  58. package/templates/standards/php/README.md +62 -0
  59. package/templates/standards/php/anti-patterns.md +259 -0
  60. package/templates/standards/php/architecture.md +241 -0
  61. package/templates/standards/php/frameworks.md +197 -0
  62. package/templates/standards/php/rules.md +205 -0
  63. package/templates/standards/php/security.md +190 -0
  64. package/templates/standards/php/testing.md +139 -0
  65. package/templates/standards/php/tooling.md +245 -0
  66. package/templates/standards/react/accessibility.md +130 -0
  67. package/templates/standards/react/anti-patterns.md +187 -0
  68. package/templates/standards/react/component-design.md +139 -0
  69. package/templates/standards/react/error-boundaries.md +195 -0
  70. package/templates/standards/react/forms.md +147 -0
  71. package/templates/standards/react/hooks.md +88 -0
  72. package/templates/standards/react/memoization.md +87 -0
  73. package/templates/standards/react/state-management.md +123 -0
  74. package/templates/standards/react/testing.md +118 -0
  75. package/templates/standards/react/use-effect.md +110 -0
  76. package/templates/standards/security/api-security.md +136 -0
  77. package/templates/standards/security/auth.md +112 -0
  78. package/templates/standards/security/secrets.md +105 -0
  79. package/templates/standards/security/validation.md +89 -0
  80. package/templates/standards/templates/.editorconfig +16 -0
  81. package/templates/standards/templates/.nvmrc +1 -0
  82. package/templates/standards/templates/AGENTS.md +46 -0
  83. package/templates/standards/templates/CLAUDE.md +3 -0
  84. package/templates/standards/templates/_dot_gitignore +50 -0
  85. package/templates/standards/templates/biome.json +53 -0
  86. package/templates/standards/templates/eslint.config.js +61 -0
  87. package/templates/standards/templates/project-readme.md +76 -0
  88. package/templates/standards/templates/pull-request-template.md +46 -0
  89. package/templates/standards/templates/tsconfig.json +35 -0
  90. package/templates/standards/tooling/biome.md +92 -0
  91. package/templates/standards/tooling/ci.md +128 -0
  92. package/templates/standards/tooling/dates.md +194 -0
  93. package/templates/standards/tooling/dependencies.md +90 -0
  94. package/templates/standards/tooling/nx.md +113 -0
  95. package/templates/standards/tooling/observability.md +183 -0
  96. package/templates/standards/tooling/prisma.md +152 -0
  97. package/templates/standards/tooling/shadcn.md +115 -0
  98. package/templates/standards/tooling/tailwind.md +135 -0
  99. package/templates/standards/tooling/tanstack-query.md +214 -0
  100. package/templates/standards/tooling/tanstack-router.md +365 -0
  101. package/templates/standards/tooling/tanstack.md +31 -0
  102. package/templates/standards/tooling/vite.md +135 -0
  103. package/templates/standards/typescript/anti-patterns.md +107 -0
  104. package/templates/standards/typescript/error-handling.md +216 -0
  105. package/templates/standards/typescript/naming.md +78 -0
  106. package/templates/standards/typescript/rules.md +159 -0
  107. package/templates/standards/typescript/tsconfig/base.json +32 -0
  108. package/templates/standards/typescript/tsconfig/nextjs.json +12 -0
  109. package/templates/standards/typescript/tsconfig/react.json +9 -0
  110. package/templates/standards/typescript/validation.md +104 -0
  111. package/templates/stubs/executors.md +49 -0
  112. package/templates/stubs/findings.md +40 -0
  113. package/templates/stubs/history.md +13 -0
  114. package/templates/stubs/roadmap.md +29 -0
  115. package/templates/stubs/stack.md +35 -0
  116. package/templates/stubs/verify.md +48 -0
@@ -0,0 +1,97 @@
1
+ # Refactoring
2
+
3
+ ## Core Rules
4
+
5
+ - Preserve behavior
6
+ - Prefer additive refactors
7
+ - Write tests before refactoring untested code
8
+ - Avoid massive rewrites unless explicitly requested
9
+ - Ask before major architectural divergence
10
+
11
+ ## Refactoring Strategies
12
+
13
+ ### Additive Refactor (Preferred)
14
+
15
+ Add the new implementation alongside the old. Migrate callers incrementally. Delete the old when all callers are migrated.
16
+
17
+ ```
18
+ Step 1: Add new implementation (zero callers)
19
+ Step 2: Migrate callers one by one
20
+ Step 3: Delete old implementation
21
+ ```
22
+
23
+ This is always safer than a big-bang rewrite because:
24
+ - Each step is independently reviewable
25
+ - Regressions are isolated
26
+ - Rollback is possible at any step
27
+
28
+ ### Strangler Fig
29
+
30
+ For large-scale feature replacements:
31
+
32
+ 1. Identify the boundary (API, component interface, route)
33
+ 2. Build the replacement behind the boundary
34
+ 3. Route new traffic to the replacement
35
+ 4. Verify equivalence
36
+ 5. Remove the old implementation
37
+
38
+ ### Extract
39
+
40
+ For large files that need decomposition:
41
+
42
+ ```
43
+ Step 1: Read the file and identify responsibilities
44
+ Step 2: Pick one responsibility to extract
45
+ Step 3: Create the new file
46
+ Step 4: Move the code, update imports
47
+ Step 5: Run tests — fix regressions
48
+ Step 6: Repeat for the next responsibility
49
+ ```
50
+
51
+ Do not extract all responsibilities in one commit. One extraction per PR is easier to review.
52
+
53
+ ## Before Refactoring Untested Code
54
+
55
+ Write at least one integration test that covers the behavior you are preserving:
56
+
57
+ ```
58
+ Step 1: Write a test that captures the current behavior
59
+ Step 2: Confirm the test passes
60
+ Step 3: Refactor
61
+ Step 4: Confirm the test still passes
62
+ ```
63
+
64
+ ## DO NOT
65
+
66
+ - Rename things across many files in the same PR as a behavior change
67
+ - Mix refactoring and feature changes in the same commit
68
+ - Perform a rewrite and call it a refactor
69
+ - Remove test coverage while refactoring
70
+
71
+ ## Signs a Refactor Has Gone Wrong
72
+
73
+ - Tests are failing that were passing before
74
+ - The behavior is different — even if "improved"
75
+ - The PR is impossible to review because the diff is too large
76
+ - You are rebuilding instead of reshaping
77
+
78
+ ## Asking Before Proceeding
79
+
80
+ Ask before:
81
+ - Reorganizing the folder structure of a feature
82
+ - Changing the state management approach
83
+ - Replacing a library dependency
84
+ - Changing how data flows through a module
85
+
86
+ ## PRIORITY
87
+
88
+ ```
89
+ Behavior preservation > Code quality improvement > Elegance
90
+ ```
91
+
92
+ ## See Also
93
+
94
+ - [`../philosophy/incremental-abstraction.md`](../philosophy/incremental-abstraction.md) — when to abstract
95
+ - [`../philosophy/ai-agent-behavior.md`](../philosophy/ai-agent-behavior.md) — agent refactoring rules
96
+ - [`../react/testing.md`](../react/testing.md) — write tests before refactoring untested code
97
+ - [`../tooling/ci.md`](../tooling/ci.md) — PR sizing and additive PRs
@@ -0,0 +1,81 @@
1
+ # Shared Code
2
+
3
+ ## Core Rule
4
+
5
+ Code is shared when it is genuinely reused across multiple features — not when it might be reused someday.
6
+
7
+ ## The Three-Feature Rule
8
+
9
+ Do not move code to `shared/` until it is used by at least three distinct features. Two uses may be coincidence. Three is a pattern.
10
+
11
+ ## `shared/` Structure
12
+
13
+ ```
14
+ shared/
15
+ components/ ← UI components reused across 3+ features
16
+ Button.tsx
17
+ Modal.tsx
18
+ DataTable.tsx
19
+ hooks/ ← hooks reused across 3+ features
20
+ useDebounce.ts
21
+ useMediaQuery.ts
22
+ schemas/ ← Zod schemas shared between frontend and backend
23
+ user.schema.ts
24
+ pagination.schema.ts
25
+ utils/ ← pure utility functions
26
+ format-currency.ts
27
+ parse-date.ts
28
+ types/ ← shared TypeScript types not derivable from schemas
29
+ pagination.types.ts
30
+ ```
31
+
32
+ ## Naming Rules for `shared/`
33
+
34
+ Name shared things after what they do, not what they are:
35
+
36
+ ```
37
+ shared/utils/format-currency.ts ← clear purpose
38
+ shared/utils/helpers.ts ← meaningless catch-all (avoid)
39
+ shared/utils/utils.ts ← avoid
40
+ shared/utils/common.ts ← avoid
41
+ ```
42
+
43
+ ## DO NOT
44
+
45
+ - Create `shared/` as a dumping ground — every file must have a reason to be there
46
+ - Put feature-specific logic in `shared/` because it seems "useful"
47
+ - Create a single `index.ts` barrel export that re-exports everything in `shared/` — it makes tree-shaking worse and creates implicit coupling
48
+ - Put application state, context providers, or business logic in `shared/`
49
+
50
+ ## `lib/` vs `shared/`
51
+
52
+ Some projects use `lib/` for third-party integrations and adapter code:
53
+
54
+ ```
55
+ lib/
56
+ db.ts ← Prisma client singleton
57
+ auth.ts ← Auth.js / Clerk adapter
58
+ email.ts ← email provider adapter
59
+ stripe.ts ← Stripe adapter
60
+ ```
61
+
62
+ `lib/` wraps external services. `shared/` contains internal reusable code.
63
+
64
+ ## When Code Outgrows `shared/`
65
+
66
+ In a large app or monorepo, promote heavily-used `shared/` code to a dedicated package:
67
+
68
+ ```
69
+ packages/
70
+ ui/ ← shared component library
71
+ schemas/ ← shared Zod schemas
72
+ utils/ ← shared utility functions
73
+ ```
74
+
75
+ Do not create packages prematurely. Start in `shared/`, promote when the boundary is clear.
76
+
77
+ ## See Also
78
+
79
+ - [`feature-driven.md`](feature-driven.md) — feature ownership
80
+ - [`dependency-boundaries.md`](dependency-boundaries.md) — allowed imports
81
+ - [`../philosophy/incremental-abstraction.md`](../philosophy/incremental-abstraction.md) — three-instance rule