docs(skills): fix styleguide skills + add hook so they actually trigger#6083
Open
valkirilov wants to merge 3 commits into
Open
docs(skills): fix styleguide skills + add hook so they actually trigger#6083valkirilov wants to merge 3 commits into
valkirilov wants to merge 3 commits into
Conversation
… skill The testing skill modeled inline mock objects in its frontend examples and never mentioned redisinsight/ui/src/mocks/factories/, where the repo's 21 Fishery factories actually live. Agents followed the skill correctly into the wrong pattern. Point the skill at <domain>/<Name>.factory.ts and show reuse. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The frontend skill's renderComponent example spread inline faker props, which contradicts the use-factories rule. Build default props from a shared factory instead so the example matches the convention it should teach. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Skill triggering is model-discretionary, so agents editing fe/be/test/e2e files often never load the relevant skill. Add a PreToolUse hook on Edit/Write/MultiEdit that maps the changed path to its styleguide (frontend / backend / testing / e2e-testing) and injects a reminder, so the rules no longer depend on a skill self-triggering. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
❌ Jit Scanner failed - Our team is investigatingJit Scanner failed - Our team has been notified and is working to resolve the issue. Please contact support if you have any questions. 💡 Need to bypass this check? Comment |
VaskoAtanasovRedis
approved these changes
Jun 17, 2026
KrumTy
approved these changes
Jun 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
We've been seeing PRs where agents ignore our frontend file-organization and testing (factory) conventions. Investigation found two root causes — not "skills aren't installed":
Triggering is model-discretionary. Skills are registered fine (
.claude/skills→.ai/skills, good descriptions). But skill invocation is up to the model: on a task like "implement feature X", an agent dives into editing files and never pauses to loadfrontend/testing. The rules that get violated (FE structure, test factories) are exactly the ones not in CLAUDE.md's always-loaded layer — so they depended entirely on a skill firing.The skills taught the wrong pattern. The repo has an established convention —
redisinsight/ui/src/mocks/factories/(21 Fishery factories used by 55 specs) — that thetestingskill never mentioned. Its frontend examples modeled inline mock objects, i.e. the anti-pattern. So even when the skill fired, the agent followed it correctly into the wrong code.What changed
Fix the skills (commits 1–2)
testingskill now documents the realmocks/factories/<domain>/<Name>.factory.tsconvention and shows reuse instead of inline mocks.frontendskill'srenderComponentexample builds default props from a factory.Enforce triggering (commit 3)
New
PreToolUsehook (.ai/hooks/styleguide-reminder.sh) on Edit/Write/MultiEdit that maps the changed path to its styleguide and injects a reminder, so the rules no longer rely on a skill self-triggering:redisinsight/ui/src/***.spec.ts(x))redisinsight/api/src//test/***.spec.ts)tests/e2e-playwright/**E2E specs get the e2e skill, not the unit-testing one. Reminders name the skill file so the agent loads full detail on demand.
Notes
.claude/settings.jsonis committed so the team gets the hook. It merges with each dev's gitignoredsettings.local.json.jq-only (no node startup), exits silently for unrelated paths. Self-tested across all branches.🤖 Generated with Claude Code
Note
Low Risk
Documentation and Claude Code hook configuration only; no application runtime or production code paths change.
Overview
Aligns AI agent guidance with repo conventions and automatically surfaces the right styleguide when editing files, instead of relying on the model to load skills on its own.
Skill doc fixes: The
testingandfrontendskills now point atredisinsight/ui/src/mocks/factories/<domain>/<Name>.factory.ts(Fishery reuse) and showrenderComponentexamples that build entities from factories—not inline mock objects.Enforcement: A new
PreToolUsehook (.ai/hooks/styleguide-reminder.sh) runs on Edit/Write/MultiEdit, maps the target path to frontend, backend, testing, or e2e-testing reminders (E2E paths checked first), and injectsadditionalContext..claude/settings.jsonis committed so the team gets the hook; unrelated paths exit silently.Reviewed by Cursor Bugbot for commit 91637f5. Bugbot is set up for automated code reviews on this repo. Configure here.