bkit Core Rules
Automatically applied rules that don't require user commands.
1. PDCA Auto-Apply Rules
No Guessing: If unsure, check docs → If not in docs, ask user
SoR Priority: Code > CLAUDE.md > docs/ design documents
| Request Type |
Claude Behavior |
| New feature |
Check docs/02-design/ → Design first if missing |
| Bug fix |
Compare code + design → Fix |
| Refactoring |
Current analysis → Plan → Update design → Execute |
| Implementation complete |
Suggest Gap analysis |
Template References
| Document Type |
Template Path |
| Plan |
${CLAUDE_PLUGIN_ROOT}/templates/plan.template.md |
| Design |
${CLAUDE_PLUGIN_ROOT}/templates/design.template.md |
| Analysis |
${CLAUDE_PLUGIN_ROOT}/templates/analysis.template.md |
| Report |
${CLAUDE_PLUGIN_ROOT}/templates/report.template.md |
2. Level Auto-Detection
Detection Order
- Check CLAUDE.md for explicit Level declaration
- File structure based detection
Enterprise (2+ conditions met)
- infra/terraform/ folder
- infra/k8s/ or kubernetes/ folder
- services/ folder (2+ services)
- turbo.json or pnpm-workspace.yaml
- docker-compose.yml
- .github/workflows/ (CI/CD)
Dynamic (1+ conditions met)
- bkend settings in .mcp.json
- lib/bkend/ or src/lib/bkend/
- supabase/ folder
- firebase.json
Starter
None of the above conditions met.
Level-specific Behavior
| Aspect |
Starter |
Dynamic |
Enterprise |
| Explanation |
Friendly, avoid jargon |
Technical but clear |
Concise, use terms |
| Code comments |
Detailed |
Core logic only |
Architecture only |
| Error handling |
Step-by-step guide |
Technical solutions |
Brief cause + fix |
| PDCA docs |
Simple |
Feature-specific |
Detailed architecture |
| Primary Agent |
starter-guide |
bkend-expert |
enterprise-expert |
| Reference Skill |
starter |
dynamic |
enterprise |
Level Upgrade Signals
- Starter → Dynamic: "Add login", "Save data", "Admin page"
- Dynamic → Enterprise: "High traffic", "Microservices", "Own server"
Hierarchical CLAUDE.md Rules
project/
├── CLAUDE.md # Project-wide (always reference)
├── services/CLAUDE.md # Backend work context
├── frontend/CLAUDE.md # Frontend work context
└── infra/CLAUDE.md # Infrastructure context
Rule: Area-specific rules > Project-wide rules
3. Agent Auto-Trigger Rules
Level-Based Selection
When user requests feature development:
- Detect project level
- Invoke appropriate agent automatically
Task-Based Selection
| User Intent |
Auto-Invoke Agent |
| "code review", "security scan" |
bkit:code-analyzer |
| "design review", "spec check" |
bkit:design-validator |
| "gap analysis" |
bkit:gap-detector |
| "report", "summary" |
bkit:report-generator |
| "QA", "log analysis" |
bkit:qa-monitor |
| "pipeline", "which phase" |
bkit:pipeline-guide |
Proactive Suggestions
After completing major tasks, suggest relevant agents.
Do NOT Auto-Invoke When
- User explicitly declines
- Task is trivial
- User wants to understand process
- Agent already invoked for same task
4. Code Quality Standards
Pre-coding Checks
- Does similar functionality exist? Search first
- Check utils/, hooks/, components/ui/
- Reuse if exists; create if not
Core Principles
DRY: Extract to common function on 2nd use
SRP: One function, one responsibility
No Hardcoding: Use meaningful constants
Extensibility: Write in generalized patterns
Self-Check After Coding
- Same logic exists elsewhere?
- Can function be reused?
- Hardcoded values present?
- Function does only one thing?
When to Refactor
- Same code appears 2nd time
- Function exceeds 20 lines
- if-else nests 3+ levels
- Same parameters passed to multiple functions
5. Task Classification
Classify tasks to apply appropriate PDCA level:
| Classification |
Content Size |
PDCA Level |
Action |
| Quick Fix |
< 50 chars |
None |
Execute immediately |
| Minor Change |
50-200 chars |
Lite |
Show summary, proceed |
| Feature |
200-1000 chars |
Standard |
Check/create design doc |
| Major Feature |
> 1000 chars |
Strict |
Require design, user confirmation |
Classification Keywords
Quick Fix: fix, typo, correct, adjust, tweak
Minor Change: improve, refactor, enhance, optimize, update
Feature: add, create, implement, build, new feature
Major Feature: redesign, migrate, architecture, overhaul, rewrite
6. Output Style Auto-Selection (v1.5.1)
When project level is detected, automatically suggest the matching output style:
| Level |
Suggested Style |
Trigger Condition |
| Starter |
bkit-learning |
Level detected as Starter |
| Dynamic |
bkit-pdca-guide |
Level detected as Dynamic |
| Enterprise |
bkit-enterprise |
Level detected as Enterprise |
Auto-Selection Rules
- On session start: Suggest output style matching detected level
- On
/starter init, /dynamic init, /enterprise init: Auto-suggest style for that level
- On PDCA phase transitions: Suggest
bkit-pdca-guide if not already active
- User can override with
/output-style at any time
Available Output Styles
| Style |
Best For |
Key Features |
bkit-learning |
Beginners, learning |
Learning points, TODO(learner) markers, concept explanations |
bkit-pdca-guide |
PDCA workflows |
Status badges, checklists, phase progress, gap analysis suggestions |
bkit-enterprise |
Architecture decisions |
Tradeoff analysis, cost impact, deployment strategy, SOLID compliance |
7. Agent Teams Auto-Suggestion (v1.5.1)
Suggest Agent Teams when conditions are met:
Suggestion Triggers
| Condition |
Suggestion |
| Major Feature (>= 1000 chars) AND Dynamic/Enterprise level |
"Agent Teams can parallelize PDCA phases. Try /pdca team {feature}" |
| Match Rate < 70% AND Dynamic/Enterprise level |
"Consider Agent Teams for faster parallel Check-Act iteration" |
| Enterprise project init |
"Your project supports 4-teammate Agent Teams mode" |
| Dynamic project init |
"Your project supports 2-teammate Agent Teams mode" |
Team Availability
| Level |
Available |
Teammates |
Roles |
| Starter |
No |
- |
- |
| Dynamic |
Yes |
2 |
developer, qa |
| Enterprise |
Yes |
4 |
architect, developer, qa, reviewer |
Requirements
- Environment:
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1
- If env var not set: Suggest setting it when team mode would be beneficial
- Command:
/pdca team {feature} to start team mode
8. Agent Memory Awareness (v1.5.1)
Agent Memory is automatically active for all bkit agents. No user action required.
How It Works
- Agents remember project context across sessions via
memory: project scope
- Some agents (
starter-guide, pipeline-guide) use memory: user for cross-project learning
- Memory persists in
.claude/agent-memory/ (project) or ~/.claude/agent-memory/ (user)
Memory Scopes
| Scope |
Agents Using |
Persistence |
project |
9 agents (code-analyzer, gap-detector, pdca-iterator, etc.) |
Per-project, across sessions |
user |
2 agents (starter-guide, pipeline-guide) |
Global, across all projects |
Proactive Mention
- On session start: "Agent Memory is active — agents remember context across sessions"
- When agent is invoked: Agent may reference previous session context
- No configuration needed — fully automatic
9. Plugin Hot Reload (v1.6.0)
After modifying bkit plugin files, use /reload-plugins to apply changes without restarting Claude Code.
- No need to exit and re-enter the session
- Changes to skills, agents, hooks, and templates are reflected immediately
- Note: Changes to CLAUDE.md require
/clear to fully refresh
Wildcard Permissions (CC 2.1.0+)
CC 2.1.0+ supports Bash(pattern*) wildcard permissions.
bkit Recommended Patterns
Bash(npm *) - Allow all npm commands
Bash(git log*) - Allow git log variants
Bash(node *) - Allow node execution
Bash(npx *) - Allow npx execution
Deny Recommendations
Bash(rm -rf*) - Deny recursive delete (dangerous)
Bash(git push --force*) - Deny force push
Configuration
Add to .claude/settings.json:
{
"permissions": {
"allow": ["Bash(npm *)", "Bash(git log*)"],
"deny": ["Bash(rm -rf*)"]
}
}
1---2name: bkit-rules3description: Core rules for bkit — PDCA methodology, level detection, agent triggering, quality standards, Sprint management (8-phase container with 4 auto-pause triggers, v2.1.13), and Trust Level scope (L0-L4 gates PDCA + Sprint auto-run). Triggers: bkit rules, core rules, methodology4---56# bkit Core Rules78> Automatically applied rules that don't require user commands.910## 1. PDCA Auto-Apply Rules1112**No Guessing**: If unsure, check docs → If not in docs, ask user13**SoR Priority**: Code > CLAUDE.md > docs/ design documents1415| Request Type | Claude Behavior |16|--------------|-----------------|17| New feature | Check `docs/02-design/` → Design first if missing |18| Bug fix | Compare code + design → Fix |19| Refactoring | Current analysis → Plan → Update design → Execute |20| Implementation complete | Suggest Gap analysis |2122### Template References2324| Document Type | Template Path |25|---------------|---------------|26| Plan | `${CLAUDE_PLUGIN_ROOT}/templates/plan.template.md` |27| Design | `${CLAUDE_PLUGIN_ROOT}/templates/design.template.md` |28| Analysis | `${CLAUDE_PLUGIN_ROOT}/templates/analysis.template.md` |29| Report | `${CLAUDE_PLUGIN_ROOT}/templates/report.template.md` |3031---3233## 2. Level Auto-Detection3435### Detection Order36371. Check CLAUDE.md for explicit Level declaration382. File structure based detection3940### Enterprise (2+ conditions met)4142- infra/terraform/ folder43- infra/k8s/ or kubernetes/ folder44- services/ folder (2+ services)45- turbo.json or pnpm-workspace.yaml46- docker-compose.yml47- .github/workflows/ (CI/CD)4849### Dynamic (1+ conditions met)5051- bkend settings in .mcp.json52- lib/bkend/ or src/lib/bkend/53- supabase/ folder54- firebase.json5556### Starter5758None of the above conditions met.5960### Level-specific Behavior6162| Aspect | Starter | Dynamic | Enterprise |63|--------|---------|---------|------------|64| Explanation | Friendly, avoid jargon | Technical but clear | Concise, use terms |65| Code comments | Detailed | Core logic only | Architecture only |66| Error handling | Step-by-step guide | Technical solutions | Brief cause + fix |67| PDCA docs | Simple | Feature-specific | Detailed architecture |68| Primary Agent | `starter-guide` | `bkend-expert` | `enterprise-expert` |69| Reference Skill | `starter` | `dynamic` | `enterprise` |7071### Level Upgrade Signals7273- Starter → Dynamic: "Add login", "Save data", "Admin page"74- Dynamic → Enterprise: "High traffic", "Microservices", "Own server"7576### Hierarchical CLAUDE.md Rules7778```79project/80├── CLAUDE.md # Project-wide (always reference)81├── services/CLAUDE.md # Backend work context82├── frontend/CLAUDE.md # Frontend work context83└── infra/CLAUDE.md # Infrastructure context84```8586Rule: Area-specific rules > Project-wide rules8788---8990## 3. Agent Auto-Trigger Rules9192### Level-Based Selection9394When user requests feature development:951. Detect project level962. Invoke appropriate agent automatically9798### Task-Based Selection99100| User Intent | Auto-Invoke Agent |101|-------------|-------------------|102| "code review", "security scan" | `bkit:code-analyzer` |103| "design review", "spec check" | `bkit:design-validator` |104| "gap analysis" | `bkit:gap-detector` |105| "report", "summary" | `bkit:report-generator` |106| "QA", "log analysis" | `bkit:qa-monitor` |107| "pipeline", "which phase" | `bkit:pipeline-guide` |108109### Proactive Suggestions110111After completing major tasks, suggest relevant agents.112113### Do NOT Auto-Invoke When114115- User explicitly declines116- Task is trivial117- User wants to understand process118- Agent already invoked for same task119120---121122## 4. Code Quality Standards123124### Pre-coding Checks1251261. Does similar functionality exist? Search first1272. Check utils/, hooks/, components/ui/1283. Reuse if exists; create if not129130### Core Principles131132**DRY**: Extract to common function on 2nd use133**SRP**: One function, one responsibility134**No Hardcoding**: Use meaningful constants135**Extensibility**: Write in generalized patterns136137### Self-Check After Coding138139- Same logic exists elsewhere?140- Can function be reused?141- Hardcoded values present?142- Function does only one thing?143144### When to Refactor145146- Same code appears 2nd time147- Function exceeds 20 lines148- if-else nests 3+ levels149- Same parameters passed to multiple functions150151---152153## 5. Task Classification154155Classify tasks to apply appropriate PDCA level:156157| Classification | Content Size | PDCA Level | Action |158|----------------|--------------|------------|--------|159| Quick Fix | < 50 chars | None | Execute immediately |160| Minor Change | 50-200 chars | Lite | Show summary, proceed |161| Feature | 200-1000 chars | Standard | Check/create design doc |162| Major Feature | > 1000 chars | Strict | Require design, user confirmation |163164### Classification Keywords165166**Quick Fix**: fix, typo, correct, adjust, tweak167**Minor Change**: improve, refactor, enhance, optimize, update168**Feature**: add, create, implement, build, new feature169**Major Feature**: redesign, migrate, architecture, overhaul, rewrite170171---172173## 6. Output Style Auto-Selection (v1.5.1)174175When project level is detected, automatically suggest the matching output style:176177| Level | Suggested Style | Trigger Condition |178|-------|-----------------|-------------------|179| Starter | `bkit-learning` | Level detected as Starter |180| Dynamic | `bkit-pdca-guide` | Level detected as Dynamic |181| Enterprise | `bkit-enterprise` | Level detected as Enterprise |182183### Auto-Selection Rules184185- On session start: Suggest output style matching detected level186- On `/starter init`, `/dynamic init`, `/enterprise init`: Auto-suggest style for that level187- On PDCA phase transitions: Suggest `bkit-pdca-guide` if not already active188- User can override with `/output-style` at any time189190### Available Output Styles191192| Style | Best For | Key Features |193|-------|----------|-------------|194| `bkit-learning` | Beginners, learning | Learning points, TODO(learner) markers, concept explanations |195| `bkit-pdca-guide` | PDCA workflows | Status badges, checklists, phase progress, gap analysis suggestions |196| `bkit-enterprise` | Architecture decisions | Tradeoff analysis, cost impact, deployment strategy, SOLID compliance |197198---199200## 7. Agent Teams Auto-Suggestion (v1.5.1)201202Suggest Agent Teams when conditions are met:203204### Suggestion Triggers205206| Condition | Suggestion |207|-----------|-----------|208| Major Feature (>= 1000 chars) AND Dynamic/Enterprise level | "Agent Teams can parallelize PDCA phases. Try `/pdca team {feature}`" |209| Match Rate < 70% AND Dynamic/Enterprise level | "Consider Agent Teams for faster parallel Check-Act iteration" |210| Enterprise project init | "Your project supports 4-teammate Agent Teams mode" |211| Dynamic project init | "Your project supports 2-teammate Agent Teams mode" |212213### Team Availability214215| Level | Available | Teammates | Roles |216|-------|:---------:|:---------:|-------|217| Starter | No | - | - |218| Dynamic | Yes | 2 | developer, qa |219| Enterprise | Yes | 4 | architect, developer, qa, reviewer |220221### Requirements222223- Environment: `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1`224- If env var not set: Suggest setting it when team mode would be beneficial225- Command: `/pdca team {feature}` to start team mode226227---228229## 8. Agent Memory Awareness (v1.5.1)230231Agent Memory is automatically active for all bkit agents. No user action required.232233### How It Works234235- Agents remember project context across sessions via `memory: project` scope236- Some agents (`starter-guide`, `pipeline-guide`) use `memory: user` for cross-project learning237- Memory persists in `.claude/agent-memory/` (project) or `~/.claude/agent-memory/` (user)238239### Memory Scopes240241| Scope | Agents Using | Persistence |242|-------|-------------|-------------|243| `project` | 9 agents (code-analyzer, gap-detector, pdca-iterator, etc.) | Per-project, across sessions |244| `user` | 2 agents (starter-guide, pipeline-guide) | Global, across all projects |245246### Proactive Mention247248- On session start: "Agent Memory is active — agents remember context across sessions"249- When agent is invoked: Agent may reference previous session context250- No configuration needed — fully automatic251252## 9. Plugin Hot Reload (v1.6.0)253254After modifying bkit plugin files, use `/reload-plugins` to apply changes without restarting Claude Code.255- No need to exit and re-enter the session256- Changes to skills, agents, hooks, and templates are reflected immediately257- Note: Changes to CLAUDE.md require `/clear` to fully refresh258259## Wildcard Permissions (CC 2.1.0+)260261CC 2.1.0+ supports `Bash(pattern*)` wildcard permissions.262263### bkit Recommended Patterns264- `Bash(npm *)` - Allow all npm commands265- `Bash(git log*)` - Allow git log variants266- `Bash(node *)` - Allow node execution267- `Bash(npx *)` - Allow npx execution268269### Deny Recommendations270- `Bash(rm -rf*)` - Deny recursive delete (dangerous)271- `Bash(git push --force*)` - Deny force push272273### Configuration274Add to `.claude/settings.json`:275```json276{277 "permissions": {278 "allow": ["Bash(npm *)", "Bash(git log*)"],279 "deny": ["Bash(rm -rf*)"]280 }281}282```