claude-orchestration 1.0.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.
package/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # claude-orchestration
2
+
3
+ CLI tool to scaffold Claude orchestration workflows into your project.
4
+
5
+ ## Usage
6
+
7
+ ```bash
8
+ npx claude-orchestration
9
+ ```
10
+
11
+ This will create a `.claude/` directory with workflow templates:
12
+
13
+ ```
14
+ .claude/
15
+ orchestration.md
16
+ workflows/
17
+ react/
18
+ feature.md
19
+ bugfix.md
20
+ refactor.md
21
+ pr.md
22
+ docs.md
23
+ ```
24
+
25
+ ## What it does
26
+
27
+ 1. Copies workflow templates to `.claude/` in your project
28
+ 2. Appends orchestration reference to your `CLAUDE.md` (if it exists)
29
+
30
+ ## Workflows
31
+
32
+ | Workflow | Use When |
33
+ |----------|----------|
34
+ | `feature.md` | Building new functionality |
35
+ | `bugfix.md` | Diagnosing and fixing bugs |
36
+ | `refactor.md` | Improving code without behavior changes |
37
+ | `pr.md` | Creating pull requests |
38
+ | `docs.md` | Writing documentation |
39
+
40
+ The tool auto-detects React projects and routes to React-specific workflows with React 18 best practices.
41
+
42
+ ## License
43
+
44
+ MIT
package/bin/cli.js ADDED
@@ -0,0 +1,106 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { promises as fs } from "node:fs";
4
+ import path from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = path.dirname(__filename);
9
+
10
+ if (process.argv.includes("--help") || process.argv.includes("-h")) {
11
+ console.log(`
12
+ Usage: npx claude-orchestration
13
+
14
+ Scaffolds Claude orchestration workflows into your project.
15
+
16
+ Creates a .claude/ directory with workflow templates for:
17
+ - feature.md Building new functionality
18
+ - bugfix.md Diagnosing and fixing bugs
19
+ - refactor.md Improving code structure
20
+ - pr.md Creating pull requests
21
+ - docs.md Writing documentation
22
+
23
+ Options:
24
+ -h, --help Show this help message
25
+ -v, --version Show version number
26
+ `);
27
+ process.exit(0);
28
+ }
29
+
30
+ if (process.argv.includes("--version") || process.argv.includes("-v")) {
31
+ const pkg = JSON.parse(
32
+ await fs.readFile(path.join(__dirname, "..", "package.json"), "utf-8")
33
+ );
34
+ console.log(pkg.version);
35
+ process.exit(0);
36
+ }
37
+
38
+ const SOURCE_DIR = path.join(__dirname, "..", "templates", "claude");
39
+ const DEST_NAME = ".claude";
40
+ const CLAUDE_MD = "CLAUDE.md";
41
+
42
+ const ORCHESTRATION_INSTRUCTION = `
43
+
44
+ ## Orchestration
45
+
46
+ For complex tasks, refer to .claude/orchestration.md for available workflows.
47
+ `;
48
+
49
+ async function fileExists(filePath) {
50
+ try {
51
+ await fs.access(filePath);
52
+ return true;
53
+ } catch {
54
+ return false;
55
+ }
56
+ }
57
+
58
+ async function updateClaudeMd(projectDir) {
59
+ const claudeMdPath = path.join(projectDir, CLAUDE_MD);
60
+
61
+ if (await fileExists(claudeMdPath)) {
62
+ const content = await fs.readFile(claudeMdPath, "utf-8");
63
+
64
+ if (content.includes(".claude/orchestration.md")) {
65
+ console.log(` Skipped: ${CLAUDE_MD} already references orchestration.md`);
66
+ return;
67
+ }
68
+
69
+ await fs.appendFile(claudeMdPath, ORCHESTRATION_INSTRUCTION);
70
+ console.log(` Updated: ${CLAUDE_MD}`);
71
+ }
72
+ }
73
+
74
+ async function copyDir(src, dest) {
75
+ await fs.mkdir(dest, { recursive: true });
76
+ const entries = await fs.readdir(src, { withFileTypes: true });
77
+
78
+ for (const entry of entries) {
79
+ const srcPath = path.join(src, entry.name);
80
+ const destPath = path.join(dest, entry.name);
81
+
82
+ if (entry.isDirectory()) {
83
+ await copyDir(srcPath, destPath);
84
+ } else {
85
+ await fs.copyFile(srcPath, destPath);
86
+ console.log(` Created: ${path.relative(process.cwd(), destPath)}`);
87
+ }
88
+ }
89
+ }
90
+
91
+ async function main() {
92
+ const targetDir = path.join(process.cwd(), DEST_NAME);
93
+
94
+ console.log("Claude Orchestration Setup\n");
95
+
96
+ try {
97
+ await copyDir(SOURCE_DIR, targetDir);
98
+ await updateClaudeMd(process.cwd());
99
+ console.log("\nDone! Orchestration files have been added to .claude/");
100
+ } catch (error) {
101
+ console.error("Error copying files:", error.message);
102
+ process.exit(1);
103
+ }
104
+ }
105
+
106
+ main();
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "claude-orchestration",
3
+ "version": "1.0.0",
4
+ "description": "CLI tool to scaffold Claude orchestration workflows into your project",
5
+ "bin": {
6
+ "claude-orchestration": "bin/cli.js"
7
+ },
8
+ "scripts": {
9
+ "test": "node bin/cli.js --help"
10
+ },
11
+ "keywords": [
12
+ "claude",
13
+ "orchestration",
14
+ "ai",
15
+ "scaffolding",
16
+ "cli",
17
+ "react",
18
+ "workflows"
19
+ ],
20
+ "author": "Enrique MD",
21
+ "license": "MIT",
22
+ "type": "module",
23
+ "files": [
24
+ "bin",
25
+ "templates"
26
+ ],
27
+ "engines": {
28
+ "node": ">=18.0.0"
29
+ }
30
+ }
@@ -0,0 +1,36 @@
1
+ # Orchestration
2
+
3
+ ## Technology Detection
4
+
5
+ Before selecting a workflow, determine the technology stack:
6
+
7
+ **React Project Indicators:**
8
+ - Files with `.jsx` or `.tsx` extensions
9
+ - Imports from `react`, `react-dom`, or `@react-*` packages
10
+ - React hooks (`useState`, `useEffect`, `useContext`, etc.)
11
+ - JSX syntax (`<Component />`, `<div className=...>`)
12
+ - `package.json` with `react` as a dependency
13
+ - Frameworks: Next.js, Remix, Gatsby, Create React App
14
+
15
+ If React indicators are present → use `workflows/react/` directory
16
+
17
+ ## Available Workflows
18
+
19
+ | Workflow | Use When |
20
+ |----------|----------|
21
+ | `feature.md` | Building new functionality |
22
+ | `bugfix.md` | Diagnosing and fixing bugs |
23
+ | `refactor.md` | Improving code without behavior changes |
24
+ | `pr.md` | Creating and preparing pull requests |
25
+ | `docs.md` | Writing or updating documentation |
26
+
27
+ **Workflow Path:**
28
+ - React projects: `workflows/react/{workflow}.md`
29
+ - Other projects: `workflows/{workflow}.md`
30
+
31
+ ## Rules
32
+
33
+ - Use judgment to select **at most one** workflow per task
34
+ - Skip workflows for trivial tasks (typos, simple renames, one-line fixes)
35
+ - Workflows are process guidance, not rigid scripts
36
+ - Read the workflow file before starting, adapt steps as needed
@@ -0,0 +1,52 @@
1
+ # React Bugfix Workflow
2
+
3
+ ## Architecture Rules
4
+
5
+ - **Feature architecture**: Organize by feature, not by type
6
+ - **No barrel exports**: Never use `index.ts` to re-export
7
+ - **Entry point naming**: File must match folder name (`Button/Button.tsx`)
8
+
9
+ ## Before Starting
10
+
11
+ - [ ] Can I reproduce the bug?
12
+ - [ ] What is the expected vs actual behavior?
13
+ - [ ] Is this related to React 18 concurrent features?
14
+
15
+ ## Process
16
+
17
+ ### 1. Reproduce and Isolate
18
+ - Confirm the bug exists
19
+ - Check if it only occurs in Strict Mode (development)
20
+ - Find the minimal reproduction case
21
+
22
+ ### 2. Locate the Root Cause
23
+
24
+ **Common React 18 issues:**
25
+ - Effects with missing cleanup functions
26
+ - Effects depending on stale closures
27
+ - Race conditions from concurrent rendering
28
+ - Automatic batching behavior changes
29
+
30
+ ### 3. Fix
31
+
32
+ Keep changes within the affected feature folder. Don't introduce barrel exports.
33
+
34
+ ```tsx
35
+ // Fix: Add cleanup for effects
36
+ useEffect(() => {
37
+ const controller = new AbortController()
38
+ fetchData(controller.signal)
39
+ return () => controller.abort()
40
+ }, [])
41
+ ```
42
+
43
+ ### 4. Verify
44
+ - Confirm the bug is fixed
45
+ - Test with Strict Mode enabled
46
+ - Add a test that would have caught this bug
47
+
48
+ ## Reminders
49
+
50
+ - A bugfix is not an opportunity to refactor
51
+ - The best fix is usually the smallest fix
52
+ - If you discover other issues, note them separately
@@ -0,0 +1,203 @@
1
+ # React Documentation Workflow
2
+
3
+ ## React 18 Best Practices
4
+
5
+ ### Architecture Rules
6
+ - **Feature architecture**: Organize by feature, not by type
7
+ - **No barrel exports**: Never use `index.ts` to re-export from a folder
8
+ - **Entry point naming**: Main file must match folder name (`Button/Button.tsx`, not `Button/index.tsx`)
9
+ - **Colocation**: Keep related files together (component, hooks, types, tests, styles)
10
+
11
+ ## Before Starting
12
+
13
+ - [ ] Who is the audience for this documentation?
14
+ - [ ] What should they be able to do after reading it?
15
+ - [ ] What existing docs need to stay in sync?
16
+ - [ ] Does this document React 18 patterns correctly?
17
+
18
+ ## Process
19
+
20
+ ### 1. Understand the Subject
21
+ - Read the code or feature being documented
22
+ - Try it yourself if possible
23
+ - Note any React 18-specific behavior or patterns
24
+ - Identify any non-obvious behavior or gotchas
25
+
26
+ ### 2. Check Existing Docs
27
+ - Find related documentation
28
+ - Identify what's missing or outdated
29
+ - Note the existing style and format
30
+ - Check for outdated React patterns (class components, lifecycle methods)
31
+
32
+ ### 3. Write
33
+
34
+ **Document the architecture:**
35
+ ```markdown
36
+ ## File Structure
37
+
38
+ features/
39
+ auth/
40
+ auth.tsx # Main entry point
41
+ auth.hooks.ts # useAuth, useSession
42
+ auth.types.ts # AuthState, User
43
+ components/
44
+ LoginForm/
45
+ LoginForm.tsx # Login form component
46
+ ```
47
+
48
+ **Document import conventions:**
49
+ ```markdown
50
+ ## Importing
51
+
52
+ Always use direct imports:
53
+
54
+ // Correct
55
+ import { LoginForm } from '@/features/auth/components/LoginForm/LoginForm'
56
+ import { useAuth } from '@/features/auth/auth.hooks'
57
+
58
+ // Incorrect - never use barrel imports
59
+ import { LoginForm } from '@/features/auth/components'
60
+ ```
61
+
62
+ **Document React 18 patterns:**
63
+ ```markdown
64
+ ## Component Patterns
65
+
66
+ ### Using Transitions
67
+ For non-urgent state updates, use useTransition:
68
+
69
+ const [isPending, startTransition] = useTransition()
70
+
71
+ startTransition(() => {
72
+ setFilteredResults(results)
73
+ })
74
+
75
+ ### Suspense for Loading States
76
+ Wrap async components with Suspense:
77
+
78
+ <Suspense fallback={<Skeleton />}>
79
+ <AsyncComponent />
80
+ </Suspense>
81
+ ```
82
+
83
+ ### 4. Validate
84
+ - Code examples actually work
85
+ - Import paths follow the direct import convention
86
+ - Examples use React 18 patterns (not deprecated ones)
87
+ - Links are valid
88
+ - Instructions produce expected results
89
+ - No references to removed features or old patterns
90
+
91
+ ### 5. Review
92
+ - Read it from a newcomer's perspective
93
+ - Check for outdated React terminology
94
+ - Ensure logical flow
95
+ - Verify architecture rules are explained clearly
96
+
97
+ ## Documentation Templates
98
+
99
+ ### Component Documentation
100
+ ```markdown
101
+ # ComponentName
102
+
103
+ Brief description of what the component does.
104
+
105
+ ## Location
106
+
107
+ `features/{feature}/components/ComponentName/ComponentName.tsx`
108
+
109
+ ## Import
110
+
111
+ import { ComponentName } from '@/features/{feature}/components/ComponentName/ComponentName'
112
+
113
+ ## Props
114
+
115
+ | Prop | Type | Required | Description |
116
+ |------|------|----------|-------------|
117
+ | ... | ... | ... | ... |
118
+
119
+ ## Usage
120
+
121
+ <ComponentName prop="value" />
122
+
123
+ ## Related
124
+
125
+ - [RelatedComponent](./RelatedComponent.md)
126
+ - [useRelatedHook](../hooks.md#userelatedhook)
127
+ ```
128
+
129
+ ### Hook Documentation
130
+ ```markdown
131
+ # useHookName
132
+
133
+ Brief description of what the hook does.
134
+
135
+ ## Location
136
+
137
+ `features/{feature}/{feature}.hooks.ts`
138
+
139
+ ## Import
140
+
141
+ import { useHookName } from '@/features/{feature}/{feature}.hooks'
142
+
143
+ ## Parameters
144
+
145
+ | Parameter | Type | Required | Description |
146
+ |-----------|------|----------|-------------|
147
+
148
+ ## Returns
149
+
150
+ | Property | Type | Description |
151
+ |----------|------|-------------|
152
+
153
+ ## Usage
154
+
155
+ const { data, isLoading } = useHookName(param)
156
+
157
+ ## React 18 Notes
158
+
159
+ Any specific React 18 considerations (Suspense, transitions, etc.)
160
+ ```
161
+
162
+ ### Feature Documentation
163
+ ```markdown
164
+ # Feature Name
165
+
166
+ ## Overview
167
+
168
+ What this feature does and why it exists.
169
+
170
+ ## Architecture
171
+
172
+ features/
173
+ {feature}/
174
+ {feature}.tsx # Entry point
175
+ {feature}.hooks.ts # Hooks
176
+ {feature}.types.ts # Types
177
+ components/ # Feature components
178
+
179
+ ## Key Components
180
+
181
+ - **ComponentA**: Description
182
+ - **ComponentB**: Description
183
+
184
+ ## Hooks
185
+
186
+ - **useHookA**: Description
187
+ - **useHookB**: Description
188
+
189
+ ## Usage
190
+
191
+ How to use this feature in the application.
192
+ ```
193
+
194
+ ## Reminders
195
+
196
+ - Good docs explain why, not just what
197
+ - Keep examples simple and focused
198
+ - Always show correct import paths (direct, not barrel)
199
+ - Update related docs to stay consistent
200
+ - Remove documentation for removed features
201
+ - Match the tone and style of existing project docs
202
+ - Ensure all code examples use React 18 patterns
203
+ - Document any migration notes from older patterns
@@ -0,0 +1,99 @@
1
+ # React Feature Workflow
2
+
3
+ ## React 18 Best Practices
4
+
5
+ ### Architecture Rules
6
+ - **Feature architecture**: Organize by feature, not by type
7
+ - **No barrel exports**: Never use `index.ts` to re-export from a folder
8
+ - **Entry point naming**: Main file must match folder name (`Button/Button.tsx`, not `Button/index.tsx`)
9
+ - **Colocation**: Keep related files together (component, hooks, types, tests, styles)
10
+
11
+ ### File Structure Example
12
+ ```
13
+ features/
14
+ auth/
15
+ auth.tsx # Feature entry point (matches folder name)
16
+ auth.hooks.ts # Feature-specific hooks
17
+ auth.types.ts # Feature-specific types
18
+ auth.test.tsx # Feature tests
19
+ components/
20
+ LoginForm/
21
+ LoginForm.tsx # Component entry (matches folder name)
22
+ LoginForm.test.tsx
23
+ ```
24
+
25
+ ### Import Rules
26
+ ```tsx
27
+ // CORRECT: Direct imports
28
+ import { LoginForm } from '@/features/auth/components/LoginForm/LoginForm'
29
+ import { useAuth } from '@/features/auth/auth.hooks'
30
+
31
+ // WRONG: Barrel imports
32
+ import { LoginForm } from '@/features/auth/components'
33
+ import { useAuth } from '@/features/auth'
34
+ ```
35
+
36
+ ## Before Starting
37
+
38
+ - [ ] What problem does this feature solve?
39
+ - [ ] What's the minimal viable version?
40
+ - [ ] Which feature folder does this belong in?
41
+ - [ ] Are there existing patterns in the codebase to follow?
42
+
43
+ ## Process
44
+
45
+ ### 1. Understand the Context
46
+ - Read related existing code
47
+ - Identify the feature folder this belongs in
48
+ - Check for similar implementations to learn from
49
+ - Review existing hooks and utilities that can be reused
50
+
51
+ ### 2. Plan the Implementation
52
+ - Break down into small, testable pieces
53
+ - Plan the component hierarchy
54
+ - Identify shared vs feature-specific code
55
+ - Design state management approach (local state, context, or external)
56
+
57
+ ### 3. Implement with React 18 Patterns
58
+
59
+ **Component Patterns:**
60
+ - Use function components exclusively
61
+ - Prefer `useState` and `useReducer` for local state
62
+ - Use `useTransition` for non-urgent updates
63
+ - Use `useDeferredValue` for expensive computations
64
+ - Wrap lazy-loaded components with `Suspense`
65
+
66
+ **Hooks:**
67
+ - Extract reusable logic into custom hooks
68
+ - Abstract complex business logic to hooks—components should only handle rendering
69
+ - Name hooks descriptively: `useAuthState`, `useFormValidation`
70
+ - Keep hooks focused on single responsibilities
71
+ - Place feature hooks in `{feature}.hooks.ts`
72
+
73
+ **State Management:**
74
+ - Lift state only as high as necessary
75
+ - Use composition over prop drilling
76
+ - Consider React Context for feature-wide state
77
+ - Use `useSyncExternalStore` for external state integration
78
+
79
+ ### 4. Validate
80
+ - Run existing tests to catch regressions
81
+ - Add tests for new components and hooks
82
+ - Test loading and error states
83
+ - Verify Suspense boundaries work correctly
84
+ - Ensure types pass with strict mode
85
+
86
+ ### 5. Clean Up
87
+ - Remove any debugging code
88
+ - Ensure code follows project conventions
89
+ - Check for unused imports or variables
90
+ - Verify no barrel exports were introduced
91
+
92
+ ## Reminders
93
+
94
+ - Create new files following the naming convention (folder name = entry file name)
95
+ - Never create `index.ts` or `index.tsx` files
96
+ - Import directly from the file, not from folder paths
97
+ - Match the style of surrounding code
98
+ - Don't add features beyond what was requested
99
+ - Use Suspense for code splitting, not just loading states
@@ -0,0 +1,22 @@
1
+ # Pull Request Workflow
2
+
3
+ ## Process
4
+
5
+ 1. Get the diff between current branch and main/master
6
+ 2. Analyze the changes to understand what was done
7
+ 3. Generate a PR name and description
8
+
9
+ ## Output Format
10
+
11
+ ```
12
+ PR Name: <concise title describing the change>
13
+
14
+ Description:
15
+ <2-3 sentences summarizing what changed and why>
16
+ ```
17
+
18
+ ## Guidelines
19
+
20
+ - PR name should be imperative mood ("Add feature" not "Added feature")
21
+ - Keep description brief and focused on the "what" and "why"
22
+ - Mention breaking changes if any
@@ -0,0 +1,52 @@
1
+ # React Refactor Workflow
2
+
3
+ ## Architecture Rules
4
+
5
+ - **Feature architecture**: Organize by feature, not by type
6
+ - **No barrel exports**: Never use `index.ts` to re-export
7
+ - **Entry point naming**: File must match folder name (`Button/Button.tsx`)
8
+ - **Colocation**: Keep related files together
9
+
10
+ ## Before Starting
11
+
12
+ - [ ] What specific improvement am I making?
13
+ - [ ] Is there adequate test coverage?
14
+ - [ ] How will I verify behavior is unchanged?
15
+
16
+ ## Process
17
+
18
+ ### 1. Ensure Safety Net
19
+ - Run tests to confirm they pass before changes
20
+ - Add tests if coverage is insufficient
21
+
22
+ ### 2. Plan the Refactor
23
+ - Map all imports and dependencies
24
+ - Identify all callers of components and hooks
25
+ - Break into small, safe steps
26
+
27
+ ### 3. Execute Incrementally
28
+
29
+ **Update imports to direct paths:**
30
+ ```tsx
31
+ // Before (barrel)
32
+ import { Button } from '@/components'
33
+
34
+ // After (direct)
35
+ import { Button } from '@/shared/components/Button/Button'
36
+ ```
37
+
38
+ **Rename entry points:**
39
+ ```
40
+ Button/index.tsx → Button/Button.tsx
41
+ ```
42
+
43
+ ### 4. Validate
44
+ - All tests pass
45
+ - No `index.ts` or `index.tsx` files remain
46
+ - All entry points match folder names
47
+
48
+ ## Reminders
49
+
50
+ - Refactoring changes structure, not behavior
51
+ - If you find bugs, fix them separately
52
+ - Keep scope contained—one feature at a time