npx claudepluginhub peteski22/agent-pragma --plugin pragmaThis skill is limited to using the following tools:
Implement the requested feature/fix, then validate before completing.
Guides creation of .claude/rules/ files for path-scoped project conventions using TDD workflow: RED (test gaps), GREEN (write rule), REFACTOR (optimize). Triggers on 'add rule', 'create convention', 'scope guideline'.
Validates git changes against .hoyeon/rules/ checklists, reports PASS/WARN for missed cascading changes, and proposes new rules for unmatched patterns before push.
Suggests manual /compact at logical task boundaries in long Claude Code sessions and multi-phase tasks to avoid arbitrary auto-compaction losses.
Share bugs, ideas, or general feedback.
Implement the requested feature/fix, then validate before completing.
Phase 0 is mandatory and must complete successfully before any other phase.
$ARGUMENTS
Before starting work, collect and read all applicable project rules.
Based on the task, identify which directories will contain files to be created or modified.
If uncertain, err on the side of including more directories rather than fewer. Extra rules being applied is safe; missing rules is not.
Collect project rules from the project's rule directory. Rule file locations vary by agent platform:
.claude/rules/*.mdopencode.json instructions arrayFor Claude Code, use the Glob tool to discover .claude/rules/*.md files, then the Read tool to load them. OpenCode auto-loads rules from opencode.json at the platform level. Collect those that exist and are readable. A file is considered "found" only if it exists and can be successfully read.
Note: Path-scoped rules (those with paths: frontmatter) may be auto-loaded by the agent platform only for matching files. When collecting rules manually, read the frontmatter and apply path-scoped rules only to the target directories they match.
Check for a local supplements file (e.g., CLAUDE.local.md for Claude Code) at the project root and read it if present. This is a per-user, unversioned file for machine-specific overrides (e.g., custom validation commands).
If it exists, read it. Pay particular attention to any "Validation Commands" section, which overrides defaults.
Read each discovered rule file. Apply rules in order of precedence (most specific first):
1. Path-scoped language rules with matching paths (highest precedence)
2. Universal rules
Earlier rules override later rules where they conflict.
If two rules conflict and precedence is unclear, prefer the more specific rule and note the conflict in the final report.
This step only applies if NO project rule files were found in Step 2.
If project-specific rules were found and loaded, skip this step entirely and note in report: "Project rules: loaded (N files)"
If no project-specific rules were found, attempt to load the universal baseline from the plugin:
Resolve plugin root: The skill loader provides the base directory in the header: Base directory for this skill: <path>. Derive PLUGIN_ROOT as <base directory>/../.. (skills live at <plugin-root>/skills/<name>/, so two levels up).
Validate plugin root: Check that $PLUGIN_ROOT/.claude-plugin/plugin.json exists.
Validate baseline file: Does $PLUGIN_ROOT/claude-md/universal/base.md exist and is it readable?
Load baseline: If both checks pass, read $PLUGIN_ROOT/claude-md/universal/base.md as the baseline rules.
This fallback ensures projects without /setup-project still get essential rules (branch creation, scope verification, etc.).
Track which rule files were loaded for the final report, including:
The "Pre-Implementation Setup" section of the loaded rules contains actions to execute, not just guidance to follow. The rules file is the single source of truth; this step is the executor.
If no "Pre-Implementation Setup" section exists in any loaded rules, skip this step and note in the final report that no pre-implementation setup was defined.
How to execute:
Locate the section: Find the "Pre-Implementation Setup" section in the loaded rules.
Identify actionable items: Look for:
```bash) - these are commands to runExecute in order: For each actionable item:
Handle failures: If any command fails or a situation isn't covered by the rules, ask the user for guidance before proceeding.
Record for report: Track what was executed and outcomes (e.g., branch created, steps skipped, user decisions).
After implementation is complete, run validation.
Before running validators: Re-check whether any new directories were introduced during implementation. If so, repeat Phase 0 for those directories and include any newly discovered rules.
Run linters first (deterministic checks):
Check rules for custom validation commands: Look for a "Validation Commands" section in loaded project rules, in precedence order:
If custom commands exist at any level, use the highest-precedence match. Otherwise, fall back to these defaults:
golangci-lint run --fix -vuv run pre-commit run --all-filespnpm run lint or npx biome check .Priority order: Local supplements > path-scoped language rules > universal rules > built-in defaults. Local supplements have the highest priority to allow per-machine customization without modifying version-controlled rules.
Fix any issues before proceeding.
Run semantic validators (LLM checks):
subagent_type: "general-purpose" and a prompt instructing the subagent to invoke the validator skill via the Skill tool (e.g., skill: "security") and return the JSON result verbatim.subagent_type — most validators are skills, not agents. Always use general-purpose as the subagent type.validate intentionally — implement needs inline control for the fix-and-re-validate loop. Keep both in sync.
security (always)state-machine (always)error-handling (always)go-effective (if Go files changed)go-proverbs (if Go files changed)python-style (if Python files changed)typescript-style (if TypeScript files changed)Fix violations:
Re-validate if fixes were made.
After all validators pass, proceed to Phase 4. Do not stop here — the final output must be the Phase 4 summary, not raw validator output.
Only after validation passes:
## Implementation Complete
**Task:** [what was requested]
**Branch:** `branch-name` (created | existing | continued | skipped)
**Rules Applied:**
- python rules (scoped to backend/**)
- universal rules
- local supplements
**Changes:**
- file.go: [what changed]
- file_test.go: [what changed]
**Validation:**
- Linting: ✓ passed
- Security: ✓ passed (no HARD, no unexplained SHOULD)
- Go Effective: ✓ passed (no HARD, 1 SHOULD justified, 1 WARN noted)
**Justified SHOULD items:**
- security:42 - Deferred input sanitization (handled by upstream middleware)
- go-effective:78 - 6-parameter function (options pattern would over-complicate here)
**Warnings:**
- [any WARN items to be aware of]
Ready for review or commit.