@robosoft/skillhub-cli 0.1.1 → 0.3.2
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/CHANGELOG.md +21 -21
- package/README.md +166 -184
- package/bin/skillhub.mjs +734 -364
- package/docs/skillhub-cli-logic.md +115 -83
- package/package.json +8 -5
- package/skillhub-registry/CHANGELOG.md +65 -0
- package/skillhub-registry/CLAUDE.md +108 -0
- package/skillhub-registry/README.md +196 -16
- package/skillhub-registry/docs/cheat-sheet.md +272 -0
- package/skillhub-registry/docs/contributing.md +166 -0
- package/skillhub-registry/docs/cost-hygiene.md +175 -0
- package/skillhub-registry/docs/customization.md +321 -0
- package/skillhub-registry/docs/exception-process.md +194 -0
- package/skillhub-registry/docs/installation.md +277 -0
- package/skillhub-registry/domain/api.md +303 -0
- package/skillhub-registry/domain/frontend/web-app.md +17 -0
- package/skillhub-registry/domain/frontend-app.md +46 -0
- package/skillhub-registry/domain/frontend-architecture.md +126 -0
- package/skillhub-registry/rules/anti-patterns.md +95 -0
- package/skillhub-registry/rules/code-standards.md +182 -0
- package/skillhub-registry/rules/frontend/antipattern.md +21 -0
- package/skillhub-registry/rules/frontend/component-standards.md +10 -0
- package/skillhub-registry/rules/frontend-app.md +24 -0
- package/skillhub-registry/rules/general.md +51 -0
- package/skillhub-registry/skills/api/SKILL.md +167 -0
- package/skillhub-registry/skills/build/SKILL.md +114 -0
- package/skillhub-registry/skills/fast/SKILL.md +56 -0
- package/skillhub-registry/skills/feature-dev/SKILL.md +166 -0
- package/skillhub-registry/skills/frontend/app/SKILL.md +28 -0
- package/skillhub-registry/skills/frontend/app/rules/main.md +6 -0
- package/skillhub-registry/skills/frontend/app/skill.json +10 -0
- package/skillhub-registry/skills/frontend/app/templates/feature/{{kebabName}}.tsx.hbs +11 -0
- package/skillhub-registry/skills/frontend-app/SKILL.md +48 -0
- package/skillhub-registry/skills/frontend-app/rules/main.md +6 -0
- package/skillhub-registry/skills/frontend-app/skill.json +11 -0
- package/skillhub-registry/skills/frontend-app/templates/feature/{{kebabName}}.tsx.hbs +11 -0
- package/skillhub-registry/skills/performance/SKILL.md +168 -0
- package/skillhub-registry/skills/react/SKILL.md +224 -0
- package/skillhub-registry/skills/refactor/SKILL.md +149 -0
- package/skillhub-registry/skills/review/SKILL.md +199 -0
- package/skillhub-registry/skills/strict/SKILL.md +74 -0
- package/skillhub-registry/skills/testing/SKILL.md +132 -0
- package/skillhub-registry/accessibility-review/1.0.0/SKILL.md +0 -22
- package/skillhub-registry/accessibility-review/1.0.0/checklist/ui-review.md +0 -8
- package/skillhub-registry/accessibility-review/1.0.0/skill.json +0 -9
- package/skillhub-registry/nextjs-clean-architecture/1.0.0/SKILL.md +0 -37
- package/skillhub-registry/nextjs-clean-architecture/1.0.0/checklist/definition-of-done.md +0 -9
- package/skillhub-registry/nextjs-clean-architecture/1.0.0/rules/folder-structure.md +0 -7
- package/skillhub-registry/nextjs-clean-architecture/1.0.0/skill.json +0 -9
- package/skillhub-registry/shadcn-crud-generator/1.0.0/SKILL.md +0 -25
- package/skillhub-registry/shadcn-crud-generator/1.0.0/skill.json +0 -9
- package/skillhub-registry/shadcn-crud-generator/1.0.0/templates/feature/actions.ts.hbs +0 -16
- package/skillhub-registry/shadcn-crud-generator/1.0.0/templates/feature/page.tsx.hbs +0 -13
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# Cost Hygiene Guide
|
|
2
|
+
|
|
3
|
+
**Status:** Recommended practices for all developers using this template
|
|
4
|
+
**Last updated:** 2026-05-06
|
|
5
|
+
**Owner:** [Your name / team]
|
|
6
|
+
|
|
7
|
+
This guide explains how Claude API pricing actually works and the habits that keep org costs predictable. None of these rules affect *what* you build — only *how much* it costs to build it.
|
|
8
|
+
|
|
9
|
+
> **TL;DR:** Use Sonnet by default. Start fresh chats for new tasks. Don't edit CLAUDE.md mid-session. Don't switch models mid-session. Active sessions are cheap; long-idle sessions waste cache. That's most of it.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Why This Matters
|
|
14
|
+
|
|
15
|
+
Claude Code charges per token. Bad habits at the individual level multiply across a team:
|
|
16
|
+
|
|
17
|
+
- One dev wasting $5/day on cache misses → $25/week → $1,250/year
|
|
18
|
+
- Multiply by 50 devs → **$62,500/year wasted** with zero benefit
|
|
19
|
+
|
|
20
|
+
Most of these wastes are invisible — they don't slow you down or break anything. They just quietly inflate the bill. This guide is how we avoid that.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## How Pricing Works (Quick Version)
|
|
25
|
+
|
|
26
|
+
Claude charges for **input tokens** (everything sent to the model) and **output tokens** (everything the model writes).
|
|
27
|
+
|
|
28
|
+
Every message in a Claude Code session sends:
|
|
29
|
+
1. Your CLAUDE.md and auto-loaded rules
|
|
30
|
+
2. Tool definitions
|
|
31
|
+
3. The **entire conversation history so far**
|
|
32
|
+
4. Your new message
|
|
33
|
+
|
|
34
|
+
So your tenth message costs more than your first — because it re-sends the previous nine exchanges.
|
|
35
|
+
|
|
36
|
+
### The Saving Grace: Prompt Caching
|
|
37
|
+
|
|
38
|
+
Anthropic caches stable content (CLAUDE.md, tools, earlier conversation) at 10% of normal price after the first message. The cache stays warm for 5 minutes per hit.
|
|
39
|
+
|
|
40
|
+
This means:
|
|
41
|
+
- **Active session messages are cheap** (~10% of full price)
|
|
42
|
+
- **First message of a session pays full price** (rebuilds the cache)
|
|
43
|
+
- **Cache breaks** if you change CLAUDE.md, switch models, or modify tools mid-session
|
|
44
|
+
|
|
45
|
+
Claude Code handles caching automatically — you don't configure anything. But you can break it accidentally.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## The Six Habits
|
|
50
|
+
|
|
51
|
+
### 1. Use Sonnet by default. Switch to Opus only when needed.
|
|
52
|
+
|
|
53
|
+
| Model | Input cost | Output cost | When to use |
|
|
54
|
+
|---|---|---|---|
|
|
55
|
+
| **Haiku 4.5** | $1/M | $5/M | Simple tasks, classification, summarization |
|
|
56
|
+
| **Sonnet 4.6** | $3/M | $15/M | **Default for daily coding work** |
|
|
57
|
+
| **Opus 4.7** | $5/M | $25/M | Hard reasoning, complex multi-file refactors |
|
|
58
|
+
|
|
59
|
+
**Rule of thumb:** Start with Sonnet. If it produces low-quality output on a hard task, switch to Opus *for that task* in a new session. Don't switch mid-session — it invalidates the cache.
|
|
60
|
+
|
|
61
|
+
### 2. One task = one session
|
|
62
|
+
|
|
63
|
+
Don't pile unrelated tasks into one chat to "save tokens." The opposite happens:
|
|
64
|
+
|
|
65
|
+
- ❌ One long chat with 5 tasks → message 50 sends history of all 4 prior tasks
|
|
66
|
+
- ✅ Five focused chats → each only carries its own task's history
|
|
67
|
+
|
|
68
|
+
When you start a new task, start a new session — or use `/clear` inside Claude Code to reset conversation while preserving the warm cache.
|
|
69
|
+
|
|
70
|
+
### 3. Don't switch models mid-session
|
|
71
|
+
|
|
72
|
+
Switching from Sonnet to Opus partway through a conversation **rebuilds the cache for the new model from scratch**. Every cached token now costs full price again.
|
|
73
|
+
|
|
74
|
+
If you realize the task needs Opus, finish what you're doing, then start a new session with Opus.
|
|
75
|
+
|
|
76
|
+
### 4. Don't edit CLAUDE.md while teammates are working
|
|
77
|
+
|
|
78
|
+
Editing CLAUDE.md invalidates the cache for everyone who has an active session in that project. Their next message pays the full re-cache cost.
|
|
79
|
+
|
|
80
|
+
**Best practice:**
|
|
81
|
+
- Make CLAUDE.md changes in a PR
|
|
82
|
+
- Merge during off-hours when possible
|
|
83
|
+
- Announce major changes in the team channel
|
|
84
|
+
|
|
85
|
+
For per-developer experiments, use `CLAUDE.local.md` — it loads alongside CLAUDE.md but is gitignored and personal.
|
|
86
|
+
|
|
87
|
+
### 5. Use `/compact` for long sessions
|
|
88
|
+
|
|
89
|
+
When a session gets long (you'll feel it slowing down), run `/compact` in Claude Code. It summarizes earlier messages while preserving the conversation flow.
|
|
90
|
+
|
|
91
|
+
Why it matters: long histories cost a lot to re-send every turn. Compaction shrinks the history while keeping the warm cache intact.
|
|
92
|
+
|
|
93
|
+
Run `/compact` when:
|
|
94
|
+
- The session feels sluggish
|
|
95
|
+
- You've completed a sub-task and want to continue with more
|
|
96
|
+
- Claude starts referencing details that no longer matter
|
|
97
|
+
|
|
98
|
+
### 6. Don't leave sessions idle
|
|
99
|
+
|
|
100
|
+
The cache expires after 5 minutes of inactivity. If you walk away for 30 minutes and come back, your next message rebuilds the entire cache at full price.
|
|
101
|
+
|
|
102
|
+
If you're stepping away:
|
|
103
|
+
- For short breaks (<5 min): no problem, cache stays warm
|
|
104
|
+
- For longer breaks: just close the session, start fresh when you're back
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Monitoring Your Usage
|
|
109
|
+
|
|
110
|
+
Inside Claude Code, run: /cost
|
|
111
|
+
|
|
112
|
+
This shows the current session's:
|
|
113
|
+
- Total input/output tokens
|
|
114
|
+
- Cache write vs. cache read tokens (high cache reads = good)
|
|
115
|
+
- Total dollar cost
|
|
116
|
+
- Wall-clock duration
|
|
117
|
+
|
|
118
|
+
Get in the habit of checking this at the end of long sessions. If you see mostly cache writes and few cache reads, something is invalidating the cache repeatedly — investigate.
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Org-Level Controls
|
|
123
|
+
|
|
124
|
+
These are administrator concerns, not individual dev concerns:
|
|
125
|
+
|
|
126
|
+
- **Spending limits** can be set in the Anthropic Console (per-org and per-user caps)
|
|
127
|
+
- **Usage alerts** can notify when spend exceeds thresholds
|
|
128
|
+
- **Batch API** offers 50% discount for non-urgent workloads (build pipelines, doc generation)
|
|
129
|
+
- **Workspaces** isolate caches between teams within the same org
|
|
130
|
+
|
|
131
|
+
Talk to your admin if you need these configured.
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Common Mistakes (And What They Cost)
|
|
136
|
+
|
|
137
|
+
| Mistake | Why it costs more | Fix |
|
|
138
|
+
|---|---|---|
|
|
139
|
+
| Long single chat for many tasks | History grows linearly per message | New session per task |
|
|
140
|
+
| Switching Sonnet ↔ Opus mid-session | Cache rebuilds for the new model | Pick one, stick with it |
|
|
141
|
+
| Editing CLAUDE.md while teammates work | Invalidates their caches too | PR merges, announce changes |
|
|
142
|
+
| Leaving session idle 30+ min | Cache expires, full reprocess on return | Close idle sessions |
|
|
143
|
+
| Default to Opus for routine work | 1.7x cost vs Sonnet for similar quality | Sonnet first, Opus when proven needed |
|
|
144
|
+
| Pasting whole files when `@filename` works | Re-pastes entire file every message | Use `@` references |
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Anti-Patterns We Don't Recommend
|
|
149
|
+
|
|
150
|
+
These sound clever but actually cost more:
|
|
151
|
+
|
|
152
|
+
- ❌ "Keep one mega-chat to save tokens" — wrong direction; long history is expensive
|
|
153
|
+
- ❌ "Use Haiku for everything to save money" — false economy; Haiku produces worse code on complex tasks, leading to rework and more total tokens
|
|
154
|
+
- ❌ "Disable CLAUDE.md to save context" — defeats the entire template's purpose; the cost is negligible
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## When Cost Is Genuinely a Concern
|
|
159
|
+
|
|
160
|
+
If your team is hitting real budget limits:
|
|
161
|
+
|
|
162
|
+
1. **Run `/cost` for a week**, log the data, find which sessions are expensive
|
|
163
|
+
2. **Look for cache-miss patterns** — investigate whether CLAUDE.md is being edited frequently or models are being swapped
|
|
164
|
+
3. **Move bulk work to Batch API** (50% discount) for things like documentation generation, large refactors planned overnight
|
|
165
|
+
4. **Consider Haiku for narrow, simple workflows** like commit message generation, PR description drafts
|
|
166
|
+
|
|
167
|
+
Don't optimize until you have data. Most teams overestimate their token costs and underestimate the value of fast iteration.
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Questions / Reporting Issues
|
|
172
|
+
|
|
173
|
+
- Cost questions or alerts: [your-team-channel]
|
|
174
|
+
- Template issues: see `docs/contributing.md`
|
|
175
|
+
- Anthropic billing dashboard: https://console.anthropic.com/settings/billing
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
# Customization Guide
|
|
2
|
+
|
|
3
|
+
**Status:** Pilot — guidance for extending the v0.1.0 template
|
|
4
|
+
**Last updated:** 2026-05-06
|
|
5
|
+
**Owner:** Raj Shah
|
|
6
|
+
|
|
7
|
+
This guide explains how to extend the template — adding a new skill for a new tech stack, documenting org-specific decisions in `domain/`, or layering personal preferences on top — without breaking the existing rules or forcing a major version bump. Read [`installation.md`](installation.md) first if you haven't already; this guide assumes the template is installed and working.
|
|
8
|
+
|
|
9
|
+
> **TL;DR:** Universal rules go in `rules/` and must be added to `CLAUDE.md` `@import` lines. Topic-specific guidance goes in a skill folder under `skills/<name>/SKILL.md` with matching `name:` frontmatter. Org-specific decisions go in `domain/`. Personal-only tweaks go in `CLAUDE.local.md` (gitignored). Test every addition with a real prompt before committing.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## When to Customize
|
|
14
|
+
|
|
15
|
+
Three common scenarios. Each has a "right place" — putting customizations in the wrong location is the biggest source of confusion.
|
|
16
|
+
|
|
17
|
+
### 1. New domain skill for a new tech stack
|
|
18
|
+
|
|
19
|
+
You start a Vue.js project, or a Python service, or AWS infrastructure work — and the existing skills don't cover it.
|
|
20
|
+
|
|
21
|
+
**Where it goes:** `skills/<stack-name>/SKILL.md`
|
|
22
|
+
|
|
23
|
+
**Why:** Skills are loaded *on demand* when their topic comes up. Adding stack-specific guidance as a skill keeps it out of the always-on path (so it doesn't bloat every session) but still automatically applies when relevant.
|
|
24
|
+
|
|
25
|
+
### 2. Org-specific decisions
|
|
26
|
+
|
|
27
|
+
Your team standardizes on a specific database pattern, deployment workflow, or API envelope shape. These aren't universal best practices — they're *our* choices, valid only inside this org.
|
|
28
|
+
|
|
29
|
+
**Where it goes:** `domain/<topic>.md` (e.g., `domain/database.md`, `domain/deployment.md`)
|
|
30
|
+
|
|
31
|
+
**Why:** `rules/` and `skills/` are meant to be portable across orgs. `domain/` is the explicit "this is our shop" layer. Skills reference `domain/` files when relevant, keeping universal advice and org-specific advice cleanly separated.
|
|
32
|
+
|
|
33
|
+
### 3. Personal preferences
|
|
34
|
+
|
|
35
|
+
You like Claude to use British spelling. You prefer two-line function signatures. You want Claude to always remind you to commit before refactoring. None of that belongs in the shared template — your teammates didn't sign up for it.
|
|
36
|
+
|
|
37
|
+
**Where it goes:** `CLAUDE.local.md` (in the project root, gitignored)
|
|
38
|
+
|
|
39
|
+
**Why:** `CLAUDE.local.md` loads alongside the project's shared `CLAUDE.md` but is per-developer. It's the right escape hatch for individual taste without polluting team conventions.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## How to Add a New Skill
|
|
44
|
+
|
|
45
|
+
### Step 1 — Decide what kind of skill it is
|
|
46
|
+
|
|
47
|
+
Skills come in two flavors:
|
|
48
|
+
|
|
49
|
+
| Type | Triggers when | Example |
|
|
50
|
+
|---|---|---|
|
|
51
|
+
| **Topic-based** | The user's task touches the topic, even without an explicit command | `react` triggers on JSX/TSX work; `testing` triggers when writing tests |
|
|
52
|
+
| **Action-based** | The user invokes a slash command | `/build`, `/refactor`, `/review`, `/fast`, `/strict` |
|
|
53
|
+
|
|
54
|
+
Some skills are both — `/feature-dev` is action-based (slash command), but its existence shapes how Claude approaches multi-step work even when not invoked explicitly. Pick whichever framing fits the skill, and lean on the description to capture the trigger surface.
|
|
55
|
+
|
|
56
|
+
### Step 2 — Create the folder
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
mkdir -p skills/<skill-name>
|
|
60
|
+
touch skills/<skill-name>/SKILL.md
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
The folder name **must match** the `name:` field in the frontmatter. We hit a real bug during template creation where `skills/react/SKILL.md` had `name: react-frontend` — slash commands and triggering became unpredictable. Match them exactly.
|
|
64
|
+
|
|
65
|
+
### Step 3 — Write the YAML frontmatter
|
|
66
|
+
|
|
67
|
+
Every `SKILL.md` starts with a YAML block delimited by `---` on the very first line. Two fields are required:
|
|
68
|
+
|
|
69
|
+
```yaml
|
|
70
|
+
---
|
|
71
|
+
name: <must match folder name>
|
|
72
|
+
description: <one paragraph; under 1024 characters; pushy keyword coverage>
|
|
73
|
+
---
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Description guidance — be pushy.** Claude tends to *under-trigger* skills, not over-trigger them. List every keyword, library name, file extension, abbreviation, and synonym that should make the skill load. The description is the only signal Claude uses to decide whether to apply the skill, so generic ("Vue conventions") is far worse than verbose ("Vue.js conventions for component structure, Composition API, Options API, Pinia, Vue Router, Nuxt, .vue files, single-file components...").
|
|
77
|
+
|
|
78
|
+
Keep the total length under 1024 characters — Claude Code enforces this. The existing skills sit between 530 and 910 characters; that's a reasonable target range.
|
|
79
|
+
|
|
80
|
+
### Step 4 — Write the content
|
|
81
|
+
|
|
82
|
+
Use one of the existing skills as a template. `skills/api/SKILL.md` and `skills/react/SKILL.md` are good representatives — they show the standard layering pattern:
|
|
83
|
+
|
|
84
|
+
> These rules layer on top of `rules/general.md`, `rules/code-standards.md`, and `rules/anti-patterns.md`.
|
|
85
|
+
|
|
86
|
+
Always include that line near the top so readers (and Claude) understand the skill *adds to* the universal rules rather than replacing them.
|
|
87
|
+
|
|
88
|
+
Section structure to follow:
|
|
89
|
+
- Brief intro paragraph (what does this skill cover, when does it apply)
|
|
90
|
+
- Substantive guidance in `##` sections, ordered most-to-least important
|
|
91
|
+
- Concrete examples (good vs. bad) wherever the rule has a concrete shape
|
|
92
|
+
- A "What's out of scope" section at the end pointing to other skills or docs
|
|
93
|
+
|
|
94
|
+
### Step 5 — Test that it triggers
|
|
95
|
+
|
|
96
|
+
After writing the skill, restart Claude Code in a project and ask something the skill should respond to. For a Vue skill:
|
|
97
|
+
|
|
98
|
+
> "Review this `.vue` component: [paste a snippet]"
|
|
99
|
+
|
|
100
|
+
Then ask Claude:
|
|
101
|
+
|
|
102
|
+
> "Which skills did you load for that response?"
|
|
103
|
+
|
|
104
|
+
If Claude lists your new skill, triggering works. If not, the description is too vague — add more keywords and try again.
|
|
105
|
+
|
|
106
|
+
### Complete Minimal Example
|
|
107
|
+
|
|
108
|
+
Save this as `skills/vue/SKILL.md` and adapt freely:
|
|
109
|
+
|
|
110
|
+
```markdown
|
|
111
|
+
---
|
|
112
|
+
name: vue
|
|
113
|
+
description: Vue.js conventions for component structure, Composition API usage, single-file components, and Vue-specific patterns. Use this skill whenever the user works with .vue files, mentions Vue, Composition API, Options API, script setup, Pinia, Vue Router, Vuex, Nuxt, or any Vue-related library. Apply when reviewing Vue components, building new components, debugging reactivity issues, or refactoring Vue applications. Trigger even when Vue is implied by file extension (.vue) or framework-specific syntax, even if the user does not explicitly mention "Vue".
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
# Vue Skill
|
|
117
|
+
|
|
118
|
+
This skill applies our Vue conventions. It loads when the task involves Vue, single-file components, the Composition API, or Vue-adjacent libraries.
|
|
119
|
+
|
|
120
|
+
These rules layer on top of `rules/general.md`, `rules/code-standards.md`, and `rules/anti-patterns.md`.
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Components
|
|
125
|
+
|
|
126
|
+
- Use the Composition API for new code. Options API is acceptable in legacy files; do not mix the two within one component.
|
|
127
|
+
- Use `<script setup>` syntax — it is shorter and avoids the `setup()` boilerplate.
|
|
128
|
+
- Keep components under 200 lines. Above that, extract sub-components or composables.
|
|
129
|
+
- One component per file. File name matches the component name in PascalCase (e.g., `UserProfile.vue`).
|
|
130
|
+
|
|
131
|
+
## Reactivity
|
|
132
|
+
|
|
133
|
+
- Prefer `ref()` for primitives, `reactive()` for objects with stable shape.
|
|
134
|
+
- Never destructure a `reactive()` object — destructuring breaks reactivity. Use `toRefs()` if you need destructuring.
|
|
135
|
+
- Use `computed()` for derived state, never inline expressions in templates for non-trivial logic.
|
|
136
|
+
|
|
137
|
+
## State Management
|
|
138
|
+
|
|
139
|
+
- For component-local state: `ref` / `reactive`.
|
|
140
|
+
- For cross-component state: Pinia. Do not introduce Vuex in new code.
|
|
141
|
+
- Stores live in `src/stores/<name>.ts` and export a single `useXStore` composable.
|
|
142
|
+
|
|
143
|
+
## What's Out of Scope
|
|
144
|
+
|
|
145
|
+
- **Component testing** → see `skills/testing/SKILL.md`.
|
|
146
|
+
- **Performance and bundle size** → see `skills/performance/SKILL.md`.
|
|
147
|
+
- **Org-specific API conventions used inside Vue components** → see `domain/api.md`.
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## How to Add a New Rule
|
|
153
|
+
|
|
154
|
+
### Step 1 — Universal or topic-specific?
|
|
155
|
+
|
|
156
|
+
Ask: does this rule apply to **every** language, framework, and codebase the team uses?
|
|
157
|
+
|
|
158
|
+
- **Yes** → it goes in `rules/` (universal).
|
|
159
|
+
- **No** → it goes in the relevant skill (e.g., a React-only rule belongs in `skills/react/SKILL.md`).
|
|
160
|
+
|
|
161
|
+
If you can't articulate why a rule applies universally, it almost certainly doesn't.
|
|
162
|
+
|
|
163
|
+
### Step 2a — Editing an existing rule file
|
|
164
|
+
|
|
165
|
+
The simplest case. Open `rules/general.md`, `rules/code-standards.md`, or `rules/anti-patterns.md` and add the rule under the appropriate `##` section. No further wiring is needed — these three files are already loaded via `@import` from `CLAUDE.md`.
|
|
166
|
+
|
|
167
|
+
### Step 2b — Creating a new rule file
|
|
168
|
+
|
|
169
|
+
Sometimes the new rule is large enough to deserve its own file (e.g., `rules/security.md`, `rules/accessibility.md`).
|
|
170
|
+
|
|
171
|
+
1. Create `rules/<name>.md` with the standard header (Status / Last updated / Owner / brief intro).
|
|
172
|
+
2. **Add the import to `CLAUDE.md`:**
|
|
173
|
+
|
|
174
|
+
```markdown
|
|
175
|
+
@rules/general.md
|
|
176
|
+
@rules/code-standards.md
|
|
177
|
+
@rules/anti-patterns.md
|
|
178
|
+
@rules/<your-new-file>.md
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Without this step, the file exists on disk but Claude never loads it. This is the single most common rule-authoring bug.
|
|
182
|
+
|
|
183
|
+
### Step 3 — Test that the rule actually changes behavior
|
|
184
|
+
|
|
185
|
+
Vague rules don't change anything. After adding the rule:
|
|
186
|
+
|
|
187
|
+
1. Pick a task that *should* be affected by the rule.
|
|
188
|
+
2. Ask Claude to do that task in a fresh session.
|
|
189
|
+
3. Verify the output reflects the rule.
|
|
190
|
+
|
|
191
|
+
If Claude ignores the rule, it's almost always one of:
|
|
192
|
+
- The rule is too abstract ("write good code" is not a rule)
|
|
193
|
+
- The rule lacks a "Why" so Claude can't judge edge cases
|
|
194
|
+
- The rule lacks a concrete example so Claude can't pattern-match
|
|
195
|
+
|
|
196
|
+
Match the existing rule format: state the rule, give a `> **Why:**` blockquote, then a good vs. bad example where applicable.
|
|
197
|
+
|
|
198
|
+
### Critical guidance
|
|
199
|
+
|
|
200
|
+
- **Universal rules apply to ALL languages.** If a rule starts with "in JavaScript" or "in React", it does not belong in `rules/` — it belongs in a skill.
|
|
201
|
+
- **Keep `rules/` lean.** As of v0.1.0, the three rule files plus `CLAUDE.md` total around 376 lines. Past roughly 500 total lines, individual rules start getting "lost in the noise" and Claude applies them less reliably. If you're tempted to add a fourth rule file, ask whether it's actually a skill in disguise.
|
|
202
|
+
- **Don't contradict existing rules.** If a new rule conflicts with one already in `rules/`, Claude will pick arbitrarily turn-to-turn. Resolve the contradiction first.
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## How to Add Org-Specific Knowledge to `domain/`
|
|
207
|
+
|
|
208
|
+
`domain/` is for **decisions specific to this org's codebase** — your envelope shape, your auth header name, your canonical pagination style. These are not universal best practices and not portable to other orgs.
|
|
209
|
+
|
|
210
|
+
The current template ships with `domain/api.md` as a worked example.
|
|
211
|
+
|
|
212
|
+
### Adding a new domain file
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
touch domain/<topic>.md
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Common topics teams add:
|
|
219
|
+
|
|
220
|
+
- `domain/database.md` — naming conventions, migration policy, transaction boundaries
|
|
221
|
+
- `domain/deployment.md` — environments, release workflow, rollback procedure
|
|
222
|
+
- `domain/auth.md` — session model, token handling, role checks
|
|
223
|
+
- `domain/logging.md` — log levels, structured fields, what to redact
|
|
224
|
+
|
|
225
|
+
### Cross-referencing from a skill
|
|
226
|
+
|
|
227
|
+
`domain/` files are **not** auto-loaded. They are referenced by skills that need them. Pattern from `skills/api/SKILL.md`:
|
|
228
|
+
|
|
229
|
+
> **Important:** This skill covers universal best practices. Org-specific conventions (your envelope shape, your auth header, your pagination style) live in `domain/api.md` — read both when working in this codebase.
|
|
230
|
+
|
|
231
|
+
When you add `domain/database.md`, edit whichever skill is most likely to involve database work (e.g., `skills/api/SKILL.md` if your APIs hit the DB directly, or a future `skills/persistence/SKILL.md`) and add a similar pointer.
|
|
232
|
+
|
|
233
|
+
### Why not just put it all in a skill?
|
|
234
|
+
|
|
235
|
+
Skills are meant to encode universal best practices that travel across orgs. Mixing org-specific decisions into them makes the template harder to share, harder to upstream, and harder to reason about. Keep the layers clean: `rules/` (universal foundations), `skills/` (universal topical expertise), `domain/` (this org's choices).
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## Personal vs. Shared Customizations
|
|
240
|
+
|
|
241
|
+
Claude Code supports a layered `CLAUDE.md` hierarchy. Each layer is loaded into every session in your project:
|
|
242
|
+
|
|
243
|
+
| Location | Scope | Source-controlled? | Purpose |
|
|
244
|
+
|---|---|---|---|
|
|
245
|
+
| `~/.claude/CLAUDE.md` | All your projects | No (it's your own machine) | Global defaults — this is where the template installs to |
|
|
246
|
+
| `<project>/CLAUDE.md` | This project, all contributors | Yes | Project-specific shared rules |
|
|
247
|
+
| `<project>/CLAUDE.local.md` | This project, you only | No (gitignored) | Personal preferences |
|
|
248
|
+
|
|
249
|
+
> [verify against current Claude Code docs] — the resolution order across these three layers (which overrides which) has shifted across Claude Code versions. Confirm the current behavior in the official docs before relying on a specific override pattern.
|
|
250
|
+
|
|
251
|
+
### What goes in `CLAUDE.local.md`
|
|
252
|
+
|
|
253
|
+
- "Always use British spelling in comments."
|
|
254
|
+
- "When refactoring, remind me to run the test suite first — I forget."
|
|
255
|
+
- "Default to `pnpm` not `npm` for any install command."
|
|
256
|
+
- Per-project temporary overrides while you experiment with a rule change before proposing it for the shared template.
|
|
257
|
+
|
|
258
|
+
### What does *not* go in `CLAUDE.local.md`
|
|
259
|
+
|
|
260
|
+
- Anything your teammates need to follow too (that's project `CLAUDE.md` or a PR to the shared template).
|
|
261
|
+
- API keys, tokens, or other secrets — `CLAUDE.local.md` is gitignored but still lives in your project tree.
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## Testing Your Customizations
|
|
266
|
+
|
|
267
|
+
The template's strength is that customizations apply automatically. The risk is that a broken customization fails *silently* — Claude just ignores it.
|
|
268
|
+
|
|
269
|
+
### After adding a skill
|
|
270
|
+
|
|
271
|
+
1. **Trigger test.** Open a fresh Claude Code session in a project and ask something the skill should match. Then ask "which skills did you load?" — your skill should be named.
|
|
272
|
+
2. **Composition test.** Combine your new skill with `/strict` and `/fast` separately. Confirm the skill's content shows up under both modes.
|
|
273
|
+
3. **Boundary test.** Ask something *outside* the skill's scope and confirm the skill does *not* trigger. An over-eager skill is as bad as one that doesn't trigger — it pollutes unrelated sessions with irrelevant guidance.
|
|
274
|
+
|
|
275
|
+
### After adding a rule
|
|
276
|
+
|
|
277
|
+
1. **Compliance test.** Pick a prompt that violates the new rule. Confirm Claude flags or avoids the violation.
|
|
278
|
+
2. **Cache check.** After editing `CLAUDE.md` or any always-on rule file, the prompt cache invalidates — see [`cost-hygiene.md`](cost-hygiene.md). Avoid editing during teammates' active sessions.
|
|
279
|
+
|
|
280
|
+
### Re-verification prompt
|
|
281
|
+
|
|
282
|
+
A short "is the structure still correct" check is useful after non-trivial changes. The verification prompts used during initial template creation (folder structure, frontmatter validity, missing `@import`s, name/folder mismatches) work well as a recurring check — adapt them to whatever you just added.
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## Common Pitfalls
|
|
287
|
+
|
|
288
|
+
| Pitfall | Effect | Fix |
|
|
289
|
+
|---|---|---|
|
|
290
|
+
| Forgetting to add a new rule file to `CLAUDE.md` `@import`s | Rule never loads; you wonder why Claude ignores it | Add `@rules/<file>.md` to `CLAUDE.md` |
|
|
291
|
+
| Frontmatter `name:` doesn't match folder name | Skill triggers unpredictably; slash commands may not register | Make them identical (e.g., both `vue`) |
|
|
292
|
+
| Skill description too vague | Skill rarely triggers even on perfect prompts | Add every keyword, synonym, file extension, library name |
|
|
293
|
+
| Mixing universal rules with language-specific rules in `rules/` | Future readers confused; rules feel arbitrary | Move language-specific rules into a skill |
|
|
294
|
+
| New rule contradicts an existing rule | Claude picks arbitrarily, behavior is inconsistent | Reconcile before merging — delete or qualify the older rule |
|
|
295
|
+
| Putting org-specific decisions in `skills/` | Template becomes non-portable; harder to share | Move to `domain/` and reference from the skill |
|
|
296
|
+
| Editing `CLAUDE.md` mid-session while teammates work | Invalidates their prompt cache, costs more | Land changes via PR; announce major changes |
|
|
297
|
+
| Adding a skill without testing triggering | You think it works; it doesn't fire on real prompts | Always run the trigger test before committing |
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
## When to Promote a Local Change to the Template
|
|
302
|
+
|
|
303
|
+
A customization that proves useful in **more than one project**, or that **another developer has independently asked for**, is a candidate for the shared template.
|
|
304
|
+
|
|
305
|
+
The eventual process will live in `docs/contributing.md` — that file does not yet exist in v0.1.0. Until it does:
|
|
306
|
+
|
|
307
|
+
1. Open the customization (your `CLAUDE.local.md` snippet, your `domain/foo.md`, your draft skill) and clean it up.
|
|
308
|
+
2. Message Raj Shah with a short pitch: what problem it solves, why it generalizes, what it would replace or extend.
|
|
309
|
+
3. If accepted, it lands as a PR against the template repo and ships in the next minor or patch release per [`CHANGELOG.md`](../CHANGELOG.md).
|
|
310
|
+
|
|
311
|
+
Don't sit on a useful customization out of politeness — the template is meant to grow, and proposals are how it grows.
|
|
312
|
+
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
## Where to Get Help
|
|
316
|
+
|
|
317
|
+
- **Proposing a change to the shared template** → `docs/contributing.md` (not yet published in v0.1.0); for now, message Raj Shah directly.
|
|
318
|
+
- **Installation reference** → [`installation.md`](installation.md)
|
|
319
|
+
- **Cost implications of editing rules and skills** → [`cost-hygiene.md`](cost-hygiene.md)
|
|
320
|
+
- **Overall context on what the template is** → [`README.md`](../README.md)
|
|
321
|
+
- **Anything not covered here** → message Raj Shah
|