Initial commit
This commit is contained in:
36
hooks/examples/context/code-review-start.md
Normal file
36
hooks/examples/context/code-review-start.md
Normal file
@@ -0,0 +1,36 @@
|
||||
## Project-Specific Code Review Requirements
|
||||
|
||||
This file demonstrates convention-based context injection.
|
||||
|
||||
**Location:** `.claude/context/code-review-start.md`
|
||||
|
||||
**Triggered by:** Running a code review command (SlashCommandStart hook)
|
||||
|
||||
**Purpose:** Inject project-specific review requirements automatically.
|
||||
|
||||
---
|
||||
|
||||
### Additional Security Checks
|
||||
|
||||
For this project, code reviews MUST verify:
|
||||
|
||||
1. **Authentication:** All API endpoints require valid JWT
|
||||
2. **Input Validation:** All user inputs use allowlist validation
|
||||
3. **Rate Limiting:** Public endpoints have rate limits configured
|
||||
4. **Logging:** No PII in application logs
|
||||
|
||||
### Performance Requirements
|
||||
|
||||
- Database queries: No N+1 patterns
|
||||
- API response time: < 200ms for p95
|
||||
- Memory usage: No leaks detected in tests
|
||||
|
||||
### Documentation
|
||||
|
||||
- Public APIs have JSDoc/TSDoc comments
|
||||
- Complex algorithms have inline explanations
|
||||
- Breaking changes noted in CHANGELOG.md
|
||||
|
||||
---
|
||||
|
||||
**To use:** Copy to `.claude/context/code-review-start.md` in your project.
|
||||
32
hooks/examples/context/plan-start.md
Normal file
32
hooks/examples/context/plan-start.md
Normal file
@@ -0,0 +1,32 @@
|
||||
## Project Planning Template
|
||||
|
||||
**Location:** `.claude/context/plan-start.md`
|
||||
|
||||
**Triggered by:** Running a planning command (SlashCommandStart hook)
|
||||
|
||||
Your implementation plan must include:
|
||||
|
||||
### Architecture Impact
|
||||
- Which services/modules are affected?
|
||||
- Any new dependencies introduced?
|
||||
- Database schema changes required?
|
||||
|
||||
### API Surface
|
||||
- New endpoints or breaking changes?
|
||||
- Version bump needed?
|
||||
- Backward compatibility strategy?
|
||||
|
||||
### Testing Strategy
|
||||
- Unit test coverage target (80%+)
|
||||
- Integration tests for new flows
|
||||
- E2E tests for user-facing features
|
||||
|
||||
### Deployment Considerations
|
||||
- Feature flags required?
|
||||
- Migration scripts needed?
|
||||
- Rollback strategy?
|
||||
|
||||
### Success Criteria
|
||||
- What does "done" look like?
|
||||
- How to verify it works?
|
||||
- What metrics to monitor?
|
||||
41
hooks/examples/context/session-start.md
Normal file
41
hooks/examples/context/session-start.md
Normal file
@@ -0,0 +1,41 @@
|
||||
# Session Start Context
|
||||
|
||||
This file provides environment context at the beginning of each Claude Code session.
|
||||
|
||||
## Plugin Environment
|
||||
|
||||
**CLAUDE_PLUGIN_ROOT:** `${pwd}`
|
||||
|
||||
This variable points to the root directory of the CipherPowers plugin installation.
|
||||
|
||||
## Path Reference Convention
|
||||
|
||||
When referencing plugin files in agents, commands, or skills, always use:
|
||||
|
||||
```markdown
|
||||
@${CLAUDE_PLUGIN_ROOT}skills/skill-name/SKILL.md
|
||||
@${CLAUDE_PLUGIN_ROOT}standards/standard-name.md
|
||||
@${CLAUDE_PLUGIN_ROOT}principles/principle-name.md
|
||||
@${CLAUDE_PLUGIN_ROOT}templates/template-name.md
|
||||
```
|
||||
|
||||
**Do NOT use relative paths without the variable:**
|
||||
```markdown
|
||||
@skills/... ❌ Does not work in subagent contexts
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Copy this file to your project's `.claude/context/` directory to inject plugin environment information at session start:
|
||||
|
||||
```bash
|
||||
mkdir -p .claude/context
|
||||
cp ${CLAUDE_PLUGIN_ROOT}hooks/examples/context/session-start.md \
|
||||
.claude/context/session-start.md
|
||||
```
|
||||
|
||||
**Note:** SessionStart is not currently a supported hook in Claude Code. This file serves as a template for injecting environment context via other hooks (e.g., UserPromptSubmit, SlashCommandStart).
|
||||
|
||||
## Alternative: User Prompt Hook
|
||||
|
||||
If SessionStart hook becomes available, this context will auto-inject. Until then, consider using UserPromptSubmit hook or command-specific context injection.
|
||||
40
hooks/examples/context/test-driven-development-start.md
Normal file
40
hooks/examples/context/test-driven-development-start.md
Normal file
@@ -0,0 +1,40 @@
|
||||
## Project TDD Standards
|
||||
|
||||
**Location:** `.claude/context/test-driven-development-start.md`
|
||||
|
||||
**Triggered by:** When `test-driven-development` skill loads (SkillStart hook)
|
||||
|
||||
This project uses:
|
||||
|
||||
- **Test framework:** Vitest
|
||||
- **Test location:** `src/**/__tests__/*.test.ts`
|
||||
- **Coverage requirement:** 80% line coverage minimum
|
||||
- **Property testing:** Use fast-check for algorithms
|
||||
|
||||
### File Structure
|
||||
```
|
||||
src/
|
||||
components/
|
||||
Button/
|
||||
Button.tsx
|
||||
__tests__/
|
||||
Button.test.tsx
|
||||
```
|
||||
|
||||
### Naming Convention
|
||||
- Use `describe/it` blocks (not `test()`)
|
||||
- Test names: "should [behavior] when [condition]"
|
||||
- File naming: `{Component}.test.ts`
|
||||
|
||||
### Mocking Strategy
|
||||
- Mock external services (APIs, databases)
|
||||
- Do NOT mock internal modules (test real behavior)
|
||||
- Use MSW for HTTP mocking
|
||||
|
||||
### RED-GREEN-REFACTOR
|
||||
1. Write failing test first
|
||||
2. Run test (verify it fails for right reason)
|
||||
3. Write minimal code to pass
|
||||
4. Run test (verify it passes)
|
||||
5. Refactor (if needed)
|
||||
6. Commit
|
||||
26
hooks/examples/convention-based.json
Normal file
26
hooks/examples/convention-based.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"description": "Demonstrates convention-based context injection with explicit gates",
|
||||
"comment": "Combines zero-config conventions with explicit verification gates",
|
||||
|
||||
"gates": {
|
||||
"test": {
|
||||
"description": "Run project test suite",
|
||||
"comment": "Examples: 'npm test' | 'cargo test' | 'mise run test'",
|
||||
"command": "npm test",
|
||||
"on_pass": "CONTINUE",
|
||||
"on_fail": "BLOCK"
|
||||
}
|
||||
},
|
||||
|
||||
"hooks": {
|
||||
"SlashCommandEnd": {
|
||||
"comment": "Convention file .claude/context/code-review-end.md auto-injects if exists",
|
||||
"enabled_commands": ["/code-review"],
|
||||
"gates": ["test"]
|
||||
},
|
||||
"SkillStart": {
|
||||
"comment": "Convention file .claude/context/test-driven-development-start.md auto-injects",
|
||||
"enabled_skills": ["test-driven-development"]
|
||||
}
|
||||
}
|
||||
}
|
||||
31
hooks/examples/permissive.json
Normal file
31
hooks/examples/permissive.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"description": "Permissive mode - warn only, never block. Supports convention-based context injection.",
|
||||
"comment": "Context files in .claude/context/ auto-inject without configuration. See CONVENTIONS.md",
|
||||
|
||||
"gates": {
|
||||
"check": {
|
||||
"description": "Quality checks (warn only)",
|
||||
"comment": "Examples: 'npm run lint' | 'cargo clippy' | 'mise run check'",
|
||||
"command": "mise run check",
|
||||
"on_pass": "CONTINUE",
|
||||
"on_fail": "CONTINUE"
|
||||
},
|
||||
"test": {
|
||||
"description": "Tests (warn only)",
|
||||
"comment": "Examples: 'npm test' | 'cargo test' | 'mise run test'",
|
||||
"command": "mise run test",
|
||||
"on_pass": "CONTINUE",
|
||||
"on_fail": "CONTINUE"
|
||||
}
|
||||
},
|
||||
"hooks": {
|
||||
"PostToolUse": {
|
||||
"enabled_tools": ["Edit", "Write"],
|
||||
"gates": ["check"]
|
||||
},
|
||||
"SubagentStop": {
|
||||
"enabled_agents": [],
|
||||
"gates": ["check", "test"]
|
||||
}
|
||||
}
|
||||
}
|
||||
38
hooks/examples/pipeline.json
Normal file
38
hooks/examples/pipeline.json
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"gates": {
|
||||
"format": {
|
||||
"description": "Auto-format code",
|
||||
"comment": "Examples: 'npm run format' | 'cargo fmt' | 'mise run format'",
|
||||
"command": "mise run format",
|
||||
"on_pass": "check",
|
||||
"on_fail": "STOP"
|
||||
},
|
||||
"check": {
|
||||
"description": "Quality checks",
|
||||
"comment": "Examples: 'npm run lint' | 'cargo clippy' | 'mise run check'",
|
||||
"command": "mise run check",
|
||||
"on_pass": "test",
|
||||
"on_fail": "BLOCK"
|
||||
},
|
||||
"test": {
|
||||
"description": "Run tests",
|
||||
"comment": "Examples: 'npm test' | 'cargo test' | 'mise run test'",
|
||||
"command": "mise run test",
|
||||
"on_pass": "build",
|
||||
"on_fail": "BLOCK"
|
||||
},
|
||||
"build": {
|
||||
"description": "Build project",
|
||||
"comment": "Examples: 'npm run build' | 'cargo build' | 'mise run build'",
|
||||
"command": "mise run build",
|
||||
"on_pass": "CONTINUE",
|
||||
"on_fail": "BLOCK"
|
||||
}
|
||||
},
|
||||
"hooks": {
|
||||
"SubagentStop": {
|
||||
"enabled_agents": [],
|
||||
"gates": ["format"]
|
||||
}
|
||||
}
|
||||
}
|
||||
38
hooks/examples/strict.json
Normal file
38
hooks/examples/strict.json
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"description": "Strict enforcement - block on all failures. Supports convention-based context injection.",
|
||||
"comment": "Context files in .claude/context/ auto-inject without configuration. See CONVENTIONS.md",
|
||||
|
||||
"gates": {
|
||||
"check": {
|
||||
"description": "Quality checks must pass",
|
||||
"comment": "Examples: 'npm run lint' | 'cargo clippy' | 'mise run check'",
|
||||
"command": "mise run check",
|
||||
"on_pass": "CONTINUE",
|
||||
"on_fail": "BLOCK"
|
||||
},
|
||||
"test": {
|
||||
"description": "All tests must pass",
|
||||
"comment": "Examples: 'npm test' | 'cargo test' | 'mise run test'",
|
||||
"command": "mise run test",
|
||||
"on_pass": "CONTINUE",
|
||||
"on_fail": "BLOCK"
|
||||
},
|
||||
"build": {
|
||||
"description": "Build must succeed",
|
||||
"comment": "Examples: 'npm run build' | 'cargo build' | 'mise run build'",
|
||||
"command": "mise run build",
|
||||
"on_pass": "CONTINUE",
|
||||
"on_fail": "BLOCK"
|
||||
}
|
||||
},
|
||||
"hooks": {
|
||||
"PostToolUse": {
|
||||
"enabled_tools": ["Edit", "Write", "mcp__serena__replace_symbol_body"],
|
||||
"gates": ["check"]
|
||||
},
|
||||
"SubagentStop": {
|
||||
"enabled_agents": [],
|
||||
"gates": ["check", "test", "build"]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user