Initial commit: antigravity-claudekit

This commit is contained in:
nvtien
2026-02-16 14:02:42 +09:00
commit 2d31c0a137
93 changed files with 9518 additions and 0 deletions

View File

@@ -0,0 +1,125 @@
---
name: ck-code-quality-guard
description: Enforces code quality standards automatically after file edits. Reminds to simplify code after significant changes, injects development rules on every prompt, enforces file naming conventions, prevents skill duplication. Activates automatically on file writes and user prompts.
---
# ck-code-quality-guard
Automatic guard that enforces code quality standards throughout a session. Composed of four behaviors that fire at different points. Never invoked manually.
## When Active
- **Post-Edit Simplify Reminder**: Fires after every file write or edit operation
- **Dev Rules Reminder**: Fires on every user prompt submission
- **Descriptive Name Guidance**: Fires before every file creation
- **Skill Dedup** (disabled): Was designed for session start/end — see note below
## Don't Use When
- This is a background guard — never invoke manually
---
## Post-Edit Simplify Reminder
**Trigger:** After `Edit`, `Write`, or multi-edit operations on source code files.
**Behavior:**
- Tracks modified files count in the current session (resets after 2 hours of inactivity)
- After **5 or more** file edits in a session, injects a reminder:
> "You have modified N files in this session. Consider using the `code-simplifier` review before proceeding to code review. This is a MANDATORY step in the workflow."
- Reminder throttled: fires at most once every 10 minutes
- Counter resets when code simplification is mentioned in conversation
**Purpose:** Prevents accumulating technical debt across a long session by prompting periodic simplification passes before code review.
---
## Dev Rules Reminder
**Trigger:** Every user prompt submission (throttled — skips if recently injected).
**Injected context includes:**
```
## Development Rules
- YAGNI / KISS / DRY
- Files under 200 lines — split if larger
- Follow ./docs/code-standards.md and ./docs/development-rules.md
- No syntax errors — code must compile
- Use try/catch error handling
- No fake data, mocks, or cheats to pass tests
- After editing code files, run compile/typecheck
## Plan Context
- Plan: {active-plan or none}
- Reports: {reports-path}
## Naming
- Report: {reports-path}/{agent-type}-{name-pattern}.md
- Plan dir: {plans-path}/{name-pattern}/
```
**Purpose:** Ensures development rules are always present in context, even in long sessions where the initial system prompt may have scrolled out of the effective window.
---
## Descriptive Name Guidance
**Trigger:** Before every file write or creation.
**Injected guidance:**
```
## File naming guidance:
- Skip this guidance if creating markdown or plain text files
- Prefer kebab-case for JS/TS/Python/shell (.js, .ts, .py, .sh)
- C#/Java/Kotlin/Swift: PascalCase (.cs, .java, .kt, .swift)
- Go/Rust: snake_case (.go, .rs)
- Other languages: follow ecosystem conventions
- Goal: self-documenting names for search tools (grep, glob, find)
```
**Purpose:** Ensures file names are descriptive and follow language conventions, making the codebase navigable by LLM tools without reading file contents.
---
## Compact Marker Tracking
**Trigger:** Before conversation compaction.
**Behavior:**
- Writes a session-specific marker file to `/tmp/ck/markers/`
- Records calibration data: tokens-at-compact vs. context window size
- Uses exponential moving average (alpha=0.3) to improve compact threshold estimates over time
- On next session start, marker is used to detect post-compact state and warn about potential lost approval state
**Purpose:** Enables accurate detection of context compaction events and self-improving threshold calibration across sessions.
---
## Skill Dedup (Disabled — Reference Only)
**Original design:** Move local project skills that duplicate global skills to `.shadowed/` at session start; restore at session end. Global versions take priority.
**Disabled in v2.9.1** due to race condition: concurrent sessions sharing a directory caused non-atomic file operations to orphan skills.
**Current mitigation:** At session start, any orphaned `.claude/skills/.shadowed/` directories are automatically restored.
---
## Configuration
```json
// $HOME/.claude/.ck.json
{
"hooks": {
"post-edit-simplify-reminder": true,
"dev-rules-reminder": true,
"write-compact-marker": true,
"skill-dedup": false
}
}
```