@traxodev/claude-setup-kit 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,80 @@
1
+ # claude-setup-kit
2
+
3
+ Install Claude Code setup guides and the `/setup-claude` command on any machine — so you can set up Claude properly in any repo with a single command.
4
+
5
+ ---
6
+
7
+ ## What it does
8
+
9
+ Installs a collection of guide files that teach Claude how to set up a repo correctly — creating `CLAUDE.md`, agents, rules, skills, and commands that are tailored to the codebase.
10
+
11
+ After installation, open Claude Code in any repo and run `/setup-claude`. Claude will:
12
+
13
+ - Explore the repo and understand the tech stack
14
+ - Ask clarifying questions before writing anything
15
+ - Create rule files, skill files, and agent files in `.claude/`
16
+ - Create `CLAUDE.md` last, once everything else exists
17
+ - Handle both fresh setups and repos that already have a partial setup
18
+
19
+ ---
20
+
21
+ ## Installation
22
+
23
+ **One-time run (recommended):**
24
+ ```bash
25
+ npx claude-setup-kit
26
+ ```
27
+
28
+ **Or install globally:**
29
+ ```bash
30
+ npm install -g claude-setup-kit
31
+ claude-setup-kit
32
+ ```
33
+
34
+ Running it again on a machine that already has it installed will prompt you to update to the latest version.
35
+
36
+ ---
37
+
38
+ ## What gets installed
39
+
40
+ | What | Where |
41
+ |---|---|
42
+ | Guide files | `~/.claude/setup/claude-setup/` |
43
+ | `/setup-claude` command | `~/.claude/commands/setup-claude.md` |
44
+
45
+ The guide files cover:
46
+ - **Instructions** — golden rules, creation order, file structure, verification
47
+ - **Workflow** — end-to-end ticket-to-PR flow (branch → implement → review → push)
48
+ - **Rules** — how to create rule files for a repo
49
+ - **Skills** — how to create skill files for a repo
50
+ - **Agents** — how to create agent files, mandatory checklists, monorepo structure
51
+ - **CLAUDE.md** — how to create the entry point file for any repo
52
+
53
+ ---
54
+
55
+ ## Usage
56
+
57
+ Once installed, open Claude Code in any repo:
58
+
59
+ ```
60
+ /setup-claude
61
+ ```
62
+
63
+ Claude will detect whether the repo is fresh or already has a setup, and act accordingly.
64
+
65
+ ---
66
+
67
+ ## Monorepo support
68
+
69
+ `/setup-claude` handles monorepos — it creates a root `CLAUDE.md` with shared global agents, and a separate `CLAUDE.md` with app-specific rules, skills, and agents for each app.
70
+
71
+ ---
72
+
73
+ ## Updating
74
+
75
+ Re-run the install command to update your guide files to the latest version:
76
+
77
+ ```bash
78
+ npx claude-setup-kit
79
+ # → "claude-setup-kit is already installed. Update to the latest version? (y/n)"
80
+ ```
package/bin/install.js ADDED
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+ const os = require('os');
6
+ const readline = require('readline');
7
+
8
+ const INSTALL_DIR = path.join(os.homedir(), '.claude', 'setup', 'claude-setup');
9
+ const COMMANDS_DIR = path.join(os.homedir(), '.claude', 'commands');
10
+ const TEMPLATES_DIR = path.join(__dirname, '..', 'templates');
11
+
12
+ const GUIDE_FILES = [
13
+ 'claude-setup-instructions.md',
14
+ 'claude-setup-workflow.md',
15
+ 'claude-setup-rules.md',
16
+ 'claude-setup-skills.md',
17
+ 'claude-setup-agents.md',
18
+ 'claude-setup-claude-md.md',
19
+ ];
20
+
21
+ function prompt(question) {
22
+ return new Promise((resolve) => {
23
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
24
+ rl.question(question, (answer) => { rl.close(); resolve(answer); });
25
+ });
26
+ }
27
+
28
+ async function main() {
29
+ const alreadyInstalled = fs.existsSync(INSTALL_DIR);
30
+
31
+ if (alreadyInstalled) {
32
+ const answer = await prompt('claude-setup-kit is already installed. Update to the latest version? (y/n): ');
33
+ if (answer.trim().toLowerCase() !== 'y') {
34
+ console.log('Skipped. No changes made.');
35
+ process.exit(0);
36
+ }
37
+ }
38
+
39
+ fs.mkdirSync(INSTALL_DIR, { recursive: true });
40
+ fs.mkdirSync(COMMANDS_DIR, { recursive: true });
41
+
42
+ for (const file of GUIDE_FILES) {
43
+ fs.copyFileSync(path.join(TEMPLATES_DIR, file), path.join(INSTALL_DIR, file));
44
+ }
45
+
46
+ // Generate setup-claude.md with the correct absolute paths for this machine
47
+ const template = fs.readFileSync(path.join(TEMPLATES_DIR, 'setup-claude.md'), 'utf8');
48
+ const installPath = INSTALL_DIR.split(path.sep).join('/'); // normalize to forward slashes
49
+ const generated = template.replace(/\{\{INSTALL_PATH\}\}/g, installPath);
50
+ fs.writeFileSync(path.join(COMMANDS_DIR, 'setup-claude.md'), generated);
51
+
52
+ console.log(`\n✓ Guide files installed to: ${INSTALL_DIR}`);
53
+ console.log(`✓ Command installed to: ${path.join(COMMANDS_DIR, 'setup-claude.md')}`);
54
+ console.log('\nDone! Open Claude Code in any repo and run /setup-claude to get started.');
55
+ }
56
+
57
+ main().catch((err) => {
58
+ console.error('Error:', err.message);
59
+ process.exit(1);
60
+ });
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "@traxodev/claude-setup-kit",
3
+ "version": "1.0.0",
4
+ "description": "Install Claude Code setup guides and the /setup-claude command for any repo",
5
+ "bin": {
6
+ "claude-setup-kit": "./bin/install.js"
7
+ },
8
+ "files": [
9
+ "bin/",
10
+ "templates/"
11
+ ],
12
+ "keywords": [
13
+ "claude",
14
+ "claude-code",
15
+ "anthropic",
16
+ "ai",
17
+ "setup",
18
+ "agents",
19
+ "developer-tools"
20
+ ],
21
+ "engines": {
22
+ "node": ">=16"
23
+ },
24
+ "license": "MIT"
25
+ }
@@ -0,0 +1,129 @@
1
+ ---
2
+ name: Claude Setup — Agent Files
3
+ description: How to create agent files in .claude/agents/ when setting up Claude for a repo
4
+ ---
5
+
6
+ # Creating Agent Files
7
+
8
+ Agents = **specialised roles** that own a category of task end-to-end.
9
+
10
+ ---
11
+
12
+ ## Global Agents — Always Create at Root
13
+
14
+ These exist once at the repo root and are shared across all apps:
15
+
16
+ - `developer` — general-purpose catch-all (last resort — invoke specialist agents first)
17
+ - `code-reviewer` — **always auto-invoked after every implementation, without user prompt** — non-negotiable, must exist in every repo
18
+ - `git` — handles all branch creation, pushing, and PR creation
19
+
20
+ **In a monorepo:** global agents live at root `.claude/agents/`. Specialist agents belong inside the app they serve (`apps/web/.claude/agents/`, `apps/api/.claude/agents/`, etc.).
21
+
22
+ ## Specialist Agents — Create Per App
23
+
24
+ Add these based on what the app actually does:
25
+
26
+ | Ticket / task type | Agent name |
27
+ |---|---|
28
+ | Frontend / UI / components | `frontend-developer` |
29
+ | API / backend / services | `api-builder` |
30
+ | Database / migrations / queries | `database-developer` |
31
+ | Tests only | `test-writer` |
32
+ | Bug investigation and fix | `debugger` |
33
+
34
+ If the needed agent type is not in this table, create one on the fly, save it to `.claude/agents/`, and notify the user: **"I created a `[name]` agent to handle this — saved to `.claude/agents/[name].md`"**
35
+
36
+ ## Agent Filename Rule
37
+
38
+ The agent's filename **must exactly match** its invocation name:
39
+
40
+ ```
41
+ ✓ agent name: debugger → .claude/agents/debugger.md
42
+ ✗ agent name: debugger → .claude/agents/debug-agent.md
43
+ ```
44
+
45
+ CLAUDE.md's orchestration table, the workflow file, and the agent filename must all use the same name — a mismatch means the agent will never be invoked correctly.
46
+
47
+ ---
48
+
49
+ ## What Each Agent File Must Include
50
+
51
+ 1. **One-line role description**
52
+ 2. **"Before starting" reading list** — directories to read, not specific files
53
+ 3. **Phased workflow** — ordered steps the agent follows
54
+ 4. **Code quality checklist** — what it checks before handing off
55
+ 5. **When to ask vs decide** — what requires user input vs autonomous action
56
+ 6. **Output format** — how the agent communicates results
57
+
58
+ ---
59
+
60
+ ## Reference Style
61
+
62
+ Reference directories, never specific files — file paths go stale:
63
+
64
+ ```
65
+ ✓ Read `.claude/rules/` for coding standards and `.claude/skills/` for recipes.
66
+ ✗ Read `.claude/rules/typescript.md` and `.claude/rules/components.md`.
67
+ ```
68
+
69
+ ---
70
+
71
+ ## File Skeleton
72
+
73
+ Every agent file must start with frontmatter:
74
+
75
+ ```markdown
76
+ ---
77
+ name: [agent name]
78
+ description: [one-line role description]
79
+ ---
80
+
81
+ ## Role
82
+
83
+ [What this agent owns end-to-end]
84
+
85
+ ## Before Starting
86
+
87
+ Read `.claude/rules/` for coding standards and `.claude/skills/` for recipes.
88
+
89
+ ## Workflow
90
+
91
+ 1. [phase one]
92
+ 2. [phase two]
93
+ ...
94
+
95
+ ## Quality Checklist
96
+
97
+ - [ ] [check one]
98
+ - [ ] [check two]
99
+
100
+ ## When to Ask
101
+
102
+ Always ask — never assume:
103
+ - **Which branch to create this from?** — before any branch is created
104
+ - **Which branch should I target for this PR?** — before any PR is created
105
+
106
+ Ask for anything else that would cause irreversible or hard-to-reverse actions if guessed wrong.
107
+ ```
108
+
109
+ ---
110
+
111
+ ## `code-reviewer` Mandatory Checklist
112
+
113
+ Every `code-reviewer` agent created must include these checks — they are non-negotiable regardless of the repo:
114
+
115
+ - No duplicate code introduced
116
+ - Proper component / module structure (files in the right place, correctly named)
117
+ - Code quality and conventions match `.claude/rules/`
118
+ - No leftover debug code, dead code, or temporary hacks
119
+ - No breaking changes to public APIs, exported functions, or shared interfaces — if found, **flag explicitly to the user before continuing**
120
+
121
+ If the review fails → return to the implementing agent with specific, actionable feedback. If it fails 3 times in a row → stop and escalate to the user.
122
+
123
+ ---
124
+
125
+ ## Scope
126
+
127
+ - Workflows should be scannable — not every scenario, just what to do and when
128
+ - Keep agents focused — a specialist agent is better than one mega-agent
129
+ - Multiple coding agents must always exist — never rely on a single agent for all implementation work
@@ -0,0 +1,99 @@
1
+ ---
2
+ name: Claude Setup — CLAUDE.md
3
+ description: How to create CLAUDE.md at the repo root when setting up Claude for a repo
4
+ ---
5
+
6
+ # Creating CLAUDE.md
7
+
8
+ `CLAUDE.md` is the entry point for every agent. Keep it under 200 lines — it is a map, not a manual.
9
+
10
+ Create this **last** — after all rules, skills, and agents exist — so the references table is accurate.
11
+
12
+ ---
13
+
14
+ ## Required Sections (in this order)
15
+
16
+ 1. **Agent orchestration table** — user intent phrases mapped to agent names (put this first)
17
+ 2. **Project References table** — every rule and skill file listed by path
18
+ 3. **Project overview** — what this repo does and who uses it
19
+ 4. **Tech stack table** — language, framework, key libraries, package manager
20
+ 5. **Commands** — install, dev, build, test, lint — must be **exact runnable commands**, not descriptions (agents execute these directly without asking)
21
+ 6. **Project structure** — annotated directory tree of the main source
22
+ 7. **Architecture overview** — how pieces connect; key shared abstractions
23
+ 8. **Non-negotiable rules summary** — 6–10 bullets linking to `.claude/rules/` for detail
24
+
25
+ ---
26
+
27
+ ## Agent Orchestration Table
28
+
29
+ Maps natural language intent to agent names so Claude routes correctly:
30
+
31
+ ```markdown
32
+ | When the user says... | Invoke |
33
+ |---|---|
34
+ | shares a Jira ticket / "work on [TICKET-ID]" | full workflow (intake → branch → implement → review → push) |
35
+ | "add a feature", "implement", "build" | `developer` or specialist |
36
+ | "fix a bug", "investigate", "debug" | `debugger` |
37
+ | "review", "check the code" | `code-reviewer` |
38
+ | "push", "create a PR", "branch" | `git` |
39
+ | "write tests", "add coverage" | `test-writer` |
40
+ | anything else | `developer` |
41
+ ```
42
+
43
+ The catch-all row (`anything else → developer`) is **mandatory** and must always be the last row — it ensures every request has a handler even if it doesn't match a specific pattern.
44
+
45
+ ---
46
+
47
+ ## Project References Table
48
+
49
+ Lists every rule, skill, and agent file so agents know what exists:
50
+
51
+ ```markdown
52
+ | Type | File |
53
+ |---|---|
54
+ | Rule | `.claude/rules/git.md` |
55
+ | Rule | `.claude/rules/typescript.md` |
56
+ | Skill | `.claude/skills/add-endpoint.md` |
57
+ | Agent | `.claude/agents/debugger.md` |
58
+ | Agent | `.claude/agents/frontend-developer.md` |
59
+ ```
60
+
61
+ ---
62
+
63
+ ## If CLAUDE.md Exceeds 200 Lines
64
+
65
+ Move overflow content to a rule or skill file and replace it with a one-line link. Common offenders:
66
+
67
+ | Section that grows | Move it to |
68
+ |---|---|
69
+ | Architecture detail | `.claude/rules/architecture.md` |
70
+ | Complex commands / scripts | `.claude/rules/commands.md` |
71
+ | Onboarding notes | `.claude/rules/onboarding.md` |
72
+
73
+ Never truncate — always move and link.
74
+
75
+ ---
76
+
77
+ ## Monorepo — Per-app CLAUDE.md
78
+
79
+ Each app's `CLAUDE.md` is a complete, self-contained entry point for that app. Its agent orchestration table should only list the app's own specialist agents — **do not re-list `git` and `code-reviewer`**, they are global agents that live at the root and are inherited automatically.
80
+
81
+ ```markdown
82
+ | When the user says... | Invoke |
83
+ |---|---|
84
+ | shares a Jira ticket / "work on [TICKET-ID]" | full workflow |
85
+ | "add a feature", "implement", "build" | `frontend-developer` |
86
+ | "fix a bug", "debug" | `debugger` |
87
+ | "write tests" | `test-writer` |
88
+ | anything else | `developer` |
89
+ ```
90
+
91
+ The root `CLAUDE.md` orchestration table covers `git`, `code-reviewer`, and any cross-app workflows.
92
+
93
+ ---
94
+
95
+ ## Scope
96
+
97
+ - Summary only — detail belongs in rule or skill files, not here
98
+ - If a section grows past ~20 lines, move the detail to a rule or skill file and link it
99
+ - Agents read `CLAUDE.md` first — keep it fast to scan
@@ -0,0 +1,142 @@
1
+ ---
2
+ name: Claude Setup Instructions
3
+ description: Entry point for setting up CLAUDE.md, agents, rules, and skills in any repo — golden rules, creation order, and verification
4
+ ---
5
+
6
+ # Claude Setup Instructions
7
+
8
+ Reference this file whenever asked to create `CLAUDE.md`, agents, rules, or skills in any repo.
9
+
10
+ > **Also read:** [`claude-setup-workflow.md`](claude-setup-workflow.md) — required companion file covering the end-to-end ticket-to-PR workflow. Read both before proceeding.
11
+
12
+ ---
13
+
14
+ ## Golden Rules (always enforced)
15
+
16
+ - **Every `.md` file — including this one — must stay under 200 lines.** Split into focused files if exceeded.
17
+ - `CLAUDE.md` → repo root. Agents / rules / skills → inside `.claude/` only. Never in root.
18
+ - Rules and skills must reflect **actual patterns in this codebase**, not generic best practices.
19
+ - Agent files reference **directories** (`.claude/rules/`), never specific file paths — they go stale.
20
+ - No stale references — if a file is renamed or split, update every file that pointed to it.
21
+ - `CLAUDE.md` Project References table must list every rule and skill file by name.
22
+
23
+ ---
24
+
25
+ ## File Structure
26
+
27
+ | File | Location |
28
+ |---|---|
29
+ | `CLAUDE.md` | Repo root |
30
+ | Agents | `.claude/agents/*.md` |
31
+ | Rules | `.claude/rules/*.md` |
32
+ | Skills | `.claude/skills/*.md` |
33
+ | Commands | `.claude/commands/*.md` |
34
+
35
+ ---
36
+
37
+ ## Creation Order
38
+
39
+ Follow this order — each step depends on the previous:
40
+
41
+ 1. Understand the codebase (see Step 1 below)
42
+ 2. Ask clarifying questions (see Step 2 below)
43
+ 3. Create rule files → see [`claude-setup-rules.md`](claude-setup-rules.md)
44
+ 4. Create skill files → see [`claude-setup-skills.md`](claude-setup-skills.md)
45
+ 5. Create agent files → see [`claude-setup-agents.md`](claude-setup-agents.md)
46
+ 6. Create command files → `.claude/commands/` (see Step 6 below)
47
+ 7. Create `CLAUDE.md` last → see [`claude-setup-claude-md.md`](claude-setup-claude-md.md)
48
+ 8. Verify (see Step 8 below)
49
+
50
+ ---
51
+
52
+ ## Step 1 — Understand the Codebase
53
+
54
+ Read the repo before writing anything. Identify:
55
+
56
+ - **Language, runtime, framework** and primary libraries (state, HTTP, testing, UI, database)
57
+ - **Project structure** — monorepo? multiple apps? where is the main work target?
58
+ - **Existing patterns** — shared abstractions, naming conventions, import resolution
59
+ - **Build & dev commands** — install, dev, build, test, lint
60
+
61
+ Read: manifest files, config files, and representative source files across different layers.
62
+
63
+ **If it's a monorepo:** create one `CLAUDE.md` at the repo root (shared conventions, global agents, repo map) and one `CLAUDE.md` per app (app-specific stack, commands, rules, skills, and agents). Claude Code reads `CLAUDE.md` files and `.claude/` folders up the directory tree — place each file at the level where its context applies:
64
+
65
+ | What | Root | Per-app |
66
+ |---|---|---|
67
+ | `CLAUDE.md` | Repo overview, shared rules, links to apps | App-specific stack, commands, rules, skills, and agents |
68
+ | `.claude/agents/` | Global agents: `git`, `code-reviewer` | Specialist agents: `frontend-developer`, `api-builder`, `debugger`, etc. |
69
+ | `.claude/rules/` | Shared conventions (git, commit style) | App-specific coding standards |
70
+ | `.claude/skills/` | — | App-specific recipes |
71
+ | `.claude/commands/` | Shared commands (e.g. `/setup-claude`) | App-specific commands (e.g. `/run-checks`, `/add-metric`) |
72
+
73
+ ---
74
+
75
+ ## Step 2 — Ask Clarifying Questions
76
+
77
+ Ask before writing if any of the following are unclear:
78
+
79
+ - Is this a monorepo with multiple apps, or a single-app repo?
80
+ - What is this repo's primary purpose and who uses it?
81
+ - What are the most common day-to-day developer tasks?
82
+ - Are there workflows complex enough to warrant a specialist agent?
83
+ - Any team conventions or rules not visible from reading the code?
84
+
85
+ Do not guess — a wrong assumption produces misleading documentation.
86
+
87
+ ---
88
+
89
+ ## Step 6 — Custom Slash Commands (`.claude/commands/`)
90
+
91
+ Slash commands are shortcuts for workflows you trigger repeatedly in Claude Code (`/command-name`). Each `.md` file in `.claude/commands/` becomes one command.
92
+
93
+ **Create a command when:** a workflow is triggered often and has a fixed sequence of steps (e.g. `/review-pr`, `/add-metric`, `/run-checks`). Each command file must have a clear one-line purpose, the exact steps to follow, and be named in `kebab-case`.
94
+
95
+ **Do not create commands for:** one-off tasks or anything a naturally invoked agent already handles.
96
+
97
+ ---
98
+
99
+ ## Step 8 — Verify
100
+
101
+ ```bash
102
+ # No file exceeds 200 lines
103
+ wc -l CLAUDE.md .claude/**/*.md
104
+
105
+ # No stale file references
106
+ grep -r "rules\.md\|skills\.md\|agents\.md" CLAUDE.md .claude/
107
+
108
+ # Every file listed in CLAUDE.md Project References actually exists
109
+ # (manually cross-check the table in CLAUDE.md against ls .claude/rules/ and ls .claude/skills/)
110
+ ```
111
+
112
+ Fix anything found before finishing.
113
+
114
+ ---
115
+
116
+ ## Updating an Existing Setup
117
+
118
+ Whether adding to a partially set up repo or making ongoing updates to a complete one:
119
+
120
+ 1. Read every affected file in full before touching anything
121
+ 2. Identify gaps — missing agents, outdated rules, incomplete CLAUDE.md sections
122
+ 3. Do not overwrite files wholesale — edit to fill gaps and preserve what is correct
123
+ 4. New rule/skill/agent added → update `CLAUDE.md` Project References table
124
+ 5. File renamed or split → grep for all references and update them
125
+ 6. Always re-run the verify step after any change
126
+ 7. If a rule file no longer applies, delete it and remove it from the CLAUDE.md Project References table
127
+
128
+ **Triggers for updating:** new major dependency adopted, team agrees on a new pattern, an agent consistently produces wrong output (signals a rule gap), a skill references files that have moved, or a significant refactor changes how a layer is structured.
129
+
130
+ ## When to Split a File
131
+
132
+ Split at 200 lines by meaning — by phase (scaffold vs wiring), by concern (frontend vs backend), or by frequency (common vs rare tasks). Name splits clearly: `add-metric-scaffold.md` + `add-metric-wiring.md`, not `add-metric-part1.md`.
133
+
134
+ ## What NOT to Put in These Files
135
+
136
+ | Don't put this here | It belongs here instead |
137
+ |---|---|
138
+ | Step-by-step recipes | Skills file |
139
+ | Coding standards | Rules file |
140
+ | Project history / decisions | Git commit messages / ADRs |
141
+ | Edge cases and exceptions | Inline code comments |
142
+ | Invented patterns not in the codebase | Nowhere — don't invent |
@@ -0,0 +1,69 @@
1
+ ---
2
+ name: Claude Setup — Rule Files
3
+ description: How to create rule files in .claude/rules/ when setting up Claude for a repo
4
+ ---
5
+
6
+ # Creating Rule Files
7
+
8
+ Rules = **how code must be written** in this repo. One file per concern.
9
+
10
+ Derive topics from what you observed in the codebase — do not copy a template. Common concerns:
11
+
12
+ - Language conventions (types, error handling, async patterns)
13
+ - File structure, naming conventions, import style
14
+ - How modules / components / services are structured
15
+ - Testing conventions and any critical gotchas
16
+ - Git & branching (always include — see below)
17
+
18
+ Every rule file must cover: where files live, how they are named, what is forbidden, and any non-obvious patterns that would trip up a new developer.
19
+
20
+ ---
21
+
22
+ ## Always Create `git.md`
23
+
24
+ Always create a `git.md` rule file containing:
25
+
26
+ - Branch naming pattern — ask the user for the project's ticket format (e.g. `COB-XXXX` or `PROJ-XXXX-description`)
27
+ - Always ask which branch to create the new branch from before starting any work
28
+ - After the user names the base branch, fetch the latest remote state and check if that branch is behind — if it is, warn the user and ask if they want to pull before branching
29
+ - Commit messages must be clear and descriptive — reference the ticket where relevant
30
+ - Never commit `.env` files, credentials, API keys, tokens, or secrets
31
+ - If a sensitive file is staged accidentally, remove it and add to `.gitignore` before committing
32
+
33
+ ---
34
+
35
+ ## File Skeleton
36
+
37
+ Every rule file must start with frontmatter:
38
+
39
+ ```markdown
40
+ ---
41
+ name: [concern name]
42
+ description: [one-line description of what this rule covers]
43
+ ---
44
+
45
+ [Rule stated plainly]
46
+
47
+ ✓ Correct:
48
+ [code example]
49
+
50
+ ✗ Wrong:
51
+ [code example]
52
+ ```
53
+
54
+ Not every rule needs a code example. Location and naming rules can be stated plainly:
55
+
56
+ ```markdown
57
+ - Service files live in `src/services/` — one file per domain entity
58
+ - Filenames use kebab-case: `user-profile.service.ts`, not `UserProfile.service.ts`
59
+ ```
60
+
61
+ Only add code examples when the rule covers logic, patterns, or syntax — not when it's a file/folder convention.
62
+
63
+ ---
64
+
65
+ ## Scope
66
+
67
+ - Non-obvious and project-specific only — skip what any developer already knows
68
+ - If a rule applies everywhere in any codebase, it doesn't belong here
69
+ - Derive from observed patterns — never invent rules that aren't in the code
@@ -0,0 +1,66 @@
1
+ ---
2
+ name: Claude Setup — Skill Files
3
+ description: How to create skill files in .claude/skills/ when setting up Claude for a repo
4
+ ---
5
+
6
+ # Creating Skill Files
7
+
8
+ Skills = **step-by-step recipes** for the most common repeatable tasks.
9
+
10
+ Derive tasks from the repo's domain — think "add a new X", "create a Y", "wire up a Z". Examples: `add-endpoint`, `add-migration`, `add-page`, `add-metric`, `add-handler`.
11
+
12
+ ## What Deserves a Skill
13
+
14
+ Create a skill when a task meets all three:
15
+ 1. **Repeatable** — done regularly, not once
16
+ 2. **Multi-step** — more than 2–3 non-obvious steps
17
+ 3. **Pattern-dependent** — getting it wrong without the recipe would produce inconsistent code
18
+
19
+ If a task is trivial, one-off, or fully handled by an agent's built-in workflow — skip it.
20
+
21
+ ---
22
+
23
+ ## What Each Skill File Must Include
24
+
25
+ 1. **Reference file to read first** — the rule or source file that governs this area
26
+ 2. **Steps in dependency order** — what to do and in what sequence
27
+ 3. **Code snippets** — using this repo's actual patterns, not generic examples
28
+ 4. **Verify checklist** — how to confirm the task was done correctly
29
+
30
+ Split into `[name]-scaffold.md` / `[name]-wiring.md` if over 200 lines.
31
+
32
+ ---
33
+
34
+ ## File Skeleton
35
+
36
+ Every skill file must start with frontmatter:
37
+
38
+ ```markdown
39
+ ---
40
+ name: [skill name]
41
+ description: [one-line description of what this skill does]
42
+ ---
43
+
44
+ ## Before Starting
45
+
46
+ Read: [path to relevant rule or source file]
47
+
48
+ ## Steps
49
+
50
+ 1. [first step]
51
+ 2. [second step]
52
+ ...
53
+
54
+ ## Verify
55
+
56
+ - [ ] [check one]
57
+ - [ ] [check two]
58
+ ```
59
+
60
+ ---
61
+
62
+ ## Scope
63
+
64
+ - The 80% happy path only — edge cases belong in code comments, not skill files
65
+ - Derive tasks from what developers actually do in this repo
66
+ - Do not create skills for one-off tasks or anything already handled by an agent workflow
@@ -0,0 +1,153 @@
1
+ ---
2
+ name: Claude Development Workflow
3
+ description: End-to-end workflow from Jira ticket to merged PR — intake, branching, implementation, review, and push
4
+ ---
5
+
6
+ # Claude Development Workflow
7
+
8
+ This is the standard workflow every time a user shares a Jira ticket. Follow all phases in order.
9
+
10
+ ---
11
+
12
+ ## Phase 1 — Ticket Intake
13
+
14
+ 1. User shares a Jira ticket (file, link, or pasted content)
15
+ 2. Read and fully understand the ticket — acceptance criteria, scope, affected areas
16
+ 3. If anything is unclear, ask the user targeted questions before proceeding
17
+ 4. Do not start work until requirements are understood and confirmed
18
+ 5. If the ticket scope is large (multiple unrelated concerns, touches many layers), flag it to the user and suggest splitting into smaller PRs — wait for their decision before proceeding
19
+
20
+ ---
21
+
22
+ ## Phase 2 — Branch Creation
23
+
24
+ 1. Check for uncommitted or staged work in the repo — if any exists, warn the user before doing anything: **"There is uncommitted work in the repo. Please stash or commit it before I create a new branch."** Do not proceed until the working tree is clean.
25
+ 2. Invoke the `git` agent to handle branching
26
+ 3. Before creating, ask the user: **"Which branch should I create this from?"**
27
+ 4. Once the user names the base branch, fetch the latest remote state and check if that branch is behind its remote tracking branch — if it is, warn the user: **"[branch] is behind its remote by N commit(s). Should I pull the latest before branching?"** Do not proceed until the user confirms or declines.
28
+ 5. Name the branch following the pattern in `.claude/rules/git.md` (ticket ID + short description)
29
+
30
+ ---
31
+
32
+ ## Phase 3 — Implementation
33
+
34
+ 1. Determine the ticket type and select the appropriate specialist agent automatically (see Agent Selection table below)
35
+ 2. If no suitable agent exists → create it on the fly and inform the user:
36
+ > "I created a `[name]` agent to handle this — saved to `.claude/agents/[name].md`"
37
+ 3. Hand off to the agent. Claude selects agents autonomously — the user will never need to specify which agent to use
38
+ 4. Multiple coding agents must always exist and be used — never rely on a single agent for all implementation work
39
+
40
+ ---
41
+
42
+ ## Phase 4 — Code Review
43
+
44
+ 1. On implementation completion, invoke the `code-reviewer` agent automatically — no user prompt needed
45
+ 2. Review must check:
46
+ - No duplicate code
47
+ - Proper component/module structure
48
+ - Code quality and conventions match `.claude/rules/`
49
+ - No leftover debug code, dead code, or temporary hacks
50
+ - No breaking changes to public APIs, exported functions, or shared interfaces — if found, flag explicitly to the user before continuing
51
+ 3. If review **fails** → return to the implementing agent with specific, actionable feedback and repeat from Phase 3
52
+ 4. If the review fails **3 times in a row**, stop looping and escalate to the user: **"The code has failed review 3 times. Here are the outstanding issues: [list]. Please advise how you'd like to proceed."**
53
+ 5. Loop until the review passes or the user intervenes
54
+
55
+ ---
56
+
57
+ ## Phase 5 — Build, Test & Lint Verification
58
+
59
+ 1. Verify that lint, test, and build commands are all defined in `CLAUDE.md` — if any are missing, ask the user to provide them before continuing
60
+ 2. If the implementation added new environment variables, ensure they are added to `.env.example` (or equivalent) before running any verification commands
61
+ 3. Run the lint/format command defined in `CLAUDE.md` — fix all errors before continuing
62
+ 4. Run the test command defined in `CLAUDE.md` — if tests fail, return to the implementing agent with the failure output and loop until all tests pass
63
+ 5. Run the build command defined in `CLAUDE.md` — fix any build failures before proceeding
64
+ 6. Do not push until lint, tests, and build all pass
65
+
66
+ ---
67
+
68
+ ## Phase 6 — Push & PR
69
+
70
+ 1. Invoke the `git` agent to push the branch to GitHub
71
+ 2. If the push is rejected because the remote has diverged, rebase the branch on top of the latest remote and resolve any merge conflicts — if a conflict cannot be resolved automatically, stop and ask the user to resolve it manually before continuing
72
+ 3. Before creating the PR, always ask the user: **"Which branch should I target for this PR?"**
73
+ 4. Create the PR only after the user confirms the target branch
74
+ 5. PR description must follow this structure:
75
+ - **Title:** `[TICKET-ID] Short description of the change`
76
+ - **What:** What was changed and why
77
+ - **How:** Brief summary of the approach taken
78
+ - **Testing:** What was tested and how (unit, integration, manual)
79
+ - **New env vars:** list any new environment variables added and their purpose (must also be added to `.env.example` or equivalent before pushing)
80
+ - **Breaking changes:** explicitly call out any removed or changed public APIs, exports, or shared interfaces
81
+ - **Checklist:** lint passes, tests pass, build passes, no console logs, no hardcoded values
82
+
83
+ ---
84
+
85
+ ## Phase 7 — PR Review Feedback (Human Reviewers)
86
+
87
+ If a teammate leaves review comments on the PR:
88
+
89
+ 1. Read all comments in full before making any changes
90
+ 2. Group comments by type:
91
+ - **Must fix** — blocking issues, bugs, broken logic
92
+ - **Should fix** — quality/convention issues the reviewer flagged
93
+ - **Discuss** — opinions or suggestions that need a decision
94
+ 3. For **Discuss** items, summarise them to the user and ask for a decision before touching code
95
+ 4. For **Must fix** and **Should fix** items, invoke the appropriate agent to implement the changes
96
+ 5. After changes are made, run the full Phase 5 verification (lint → test → build) again
97
+ 6. Invoke `code-reviewer` agent again before pushing the update
98
+ 7. Push the updated branch — the existing PR updates automatically, no new PR needed
99
+ 8. If the same reviewer comments are not addressed after 2 iterations, escalate to the user: **"I've made 2 attempts to address [reviewer]'s comments but they remain unresolved. Please review and advise."**
100
+ 9. Once the PR is approved, notify the user: **"The PR has been approved. Please merge when ready."** — do not merge autonomously unless the user explicitly asks
101
+
102
+ ---
103
+
104
+ ## Phase 8 — Hotfix Workflow
105
+
106
+ Use this flow only for urgent production bugs — not for regular tickets.
107
+
108
+ 1. Confirm with the user: **"Is this a hotfix for production?"** — do not assume
109
+ 2. Skip the normal ticket intake questions — move fast
110
+ 3. Check for uncommitted work (same as Phase 2, step 1)
111
+ 4. Invoke the `git` agent to branch directly from `main` or `production` (ask user which) — name the branch `hotfix/[short-description]` unless the user specifies a different convention
112
+ 5. Invoke the `debugger` agent to investigate and fix the issue
113
+ 6. Run Phase 5 verification (lint → test → build) — all must pass
114
+ 7. Invoke `code-reviewer` — one pass only, no loop limit for hotfixes
115
+ 8. Push and create PR — ask user for target branch (typically `main` or `production`)
116
+ 9. After the hotfix PR is merged, ask the user: **"Should I backport this fix to the development branch as well?"** — if yes, cherry-pick the commit onto the dev branch and open a second PR
117
+
118
+ ---
119
+
120
+ ## Agent Selection Table
121
+
122
+ Claude must self-select the correct agent. The user will never specify.
123
+
124
+ | Ticket / task type | Agent to invoke |
125
+ |---|---|
126
+ | Frontend / UI / components | `frontend-developer` or equivalent |
127
+ | API / backend / services | `api-builder` or equivalent |
128
+ | Database / migrations / queries | `database-developer` or equivalent |
129
+ | Tests only | `test-writer` or equivalent |
130
+ | Bug investigation and fix | `debugger` or equivalent |
131
+ | After any implementation | `code-reviewer` (always) |
132
+ | Branch, push, PR | `git` agent (always) |
133
+
134
+ If the required agent does not exist in `.claude/agents/`, create it and notify the user.
135
+
136
+ ---
137
+
138
+ ## Multiple Coding Agents — Mandatory
139
+
140
+ Always create more than one coding agent when setting up a repo. At minimum:
141
+
142
+ - `developer` — general-purpose fallback
143
+ - One specialist per major concern in the codebase (e.g. `frontend-developer`, `api-builder`, `test-writer`, `debugger`)
144
+
145
+ The `developer` agent is the last resort — invoke specialist agents first when the task clearly fits one.
146
+
147
+ ---
148
+
149
+ ## Self-Sufficiency Rules
150
+
151
+ - Claude selects agents based on ticket type — never ask the user which agent to use
152
+ - If a needed agent is missing, create it silently and notify the user after
153
+ - The full loop (intake → branch → implement → review → build → PR) runs without user intervention except for the two mandatory confirmations: **base branch** and **PR target branch**
@@ -0,0 +1,45 @@
1
+ Read all of the following files in full before doing anything else — together they are your complete guide:
2
+
3
+ - {{INSTALL_PATH}}/claude-setup-instructions.md
4
+ - {{INSTALL_PATH}}/claude-setup-workflow.md
5
+ - {{INSTALL_PATH}}/claude-setup-rules.md
6
+ - {{INSTALL_PATH}}/claude-setup-skills.md
7
+ - {{INSTALL_PATH}}/claude-setup-agents.md
8
+ - {{INSTALL_PATH}}/claude-setup-claude-md.md
9
+
10
+ Do not skip steps. Do not write any file before finishing the clarifying questions step.
11
+
12
+ **Before anything else — detect the current state:**
13
+ Check whether `.claude/` and `CLAUDE.md` already exist in the repo.
14
+
15
+ - If they **do not exist** → follow the **Fresh Setup** flow below
16
+ - If they **already exist** → follow the **Update Existing Setup** flow below
17
+
18
+ ---
19
+
20
+ **Fresh Setup — single-app repo:**
21
+ 1. Explore the repo — tech stack, folder structure, key abstractions, build/test/lint commands
22
+ 2. Ask the user any clarifying questions before writing any files
23
+ 3. Create rule files → `.claude/rules/`
24
+ 4. Create skill files → `.claude/skills/`
25
+ 5. Create agent files → `.claude/agents/` — always more than one coding agent
26
+ 6. Create command files → `.claude/commands/` if needed
27
+ 7. Create `CLAUDE.md` in the repo root last
28
+ 8. Run the verify step
29
+
30
+ **Fresh Setup — monorepo:**
31
+ 1. Explore the repo — understand all apps, shared code, and root structure
32
+ 2. Ask the user any clarifying questions (including which apps need setup)
33
+ 3. At root: create shared rules, global agents (`git`, `code-reviewer`), and root `CLAUDE.md`
34
+ 4. For each app: create app-specific rules, skills, specialist agents, and per-app `CLAUDE.md`
35
+ 5. Create commands at root or per-app level as appropriate
36
+ 6. Run the verify step for root and each app
37
+
38
+ **Update Existing Setup:**
39
+ 1. Read every existing file in `.claude/` and `CLAUDE.md` in full before touching anything
40
+ 2. Explore the repo to understand what has changed since the setup was created
41
+ 3. Ask the user any clarifying questions before making changes
42
+ 4. Identify gaps — missing agents, outdated rules, incomplete CLAUDE.md sections
43
+ 5. Do not overwrite files wholesale — edit to fill gaps and preserve what is correct
44
+ 6. Update `CLAUDE.md` Project References table to reflect actual state of `.claude/`
45
+ 7. Run the verify step