Use before writing any frontend artifact (component, page, hook, layout, utility, style, test) to detect duplicates by path, name, content similarity, and structural overlap. Blocks duplicate creation with P1 BLOCK and requests human intervention when confidence is ambiguous.
How this skill is triggered — by the user, by Claude, or both
Slash command
/frontend-coding-agent:artifact-validatorThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Prevents the agent from creating or committing duplicate frontend code artifacts. Runs as a pre-write
Prevents the agent from creating or committing duplicate frontend code artifacts. Runs as a pre-write
gate (before Write/Edit) and as a post-work validation pass.
Write or Edit that creates or modifies a frontend source fileartifactPath — absolute path of the file about to be written (pre-write) or list of all session files (post-work)artifactContent — content about to be written (pre-write only)framework — resolved framework (react | angular)componentType — from component-detection skill (page | component | hook | layout | utility | style)scanDirs — directories to scan for existing artifacts (default: ["src/", "components/", "pages/", "app/", "hooks/", "layouts/", "utils/", "styles/", "lib/"])If artifactPath already exists on disk and the agent is using Write (full file create):
Edit to modify an existing file, or choose a different path."This prevents accidental overwrites of existing artifacts.
Scan scanDirs for files defining a component/hook/utility with the same name:
React artifacts:
export default function X, export const X, function X, const X: React.FCUserProfile.tsx) and named exports (export function UserProfile)Angular artifacts:
@Component, @Directive, @Pipe, @Injectable decoratorsselector value from @Component({ selector: '...' })For all frameworks, also check:
useAuth defined in two files)formatDate exported from two modules)If match found: Require human confirmation before writing.
For page/route files:
React (Next.js / React Router):
pages/, app/ directory structure) or explicit route definitions (<Route path="...">, createBrowserRouter)Angular:
RouterModule.forRoot([...]), RouterModule.forChild([...]), Routes arrays, and standalone route configsCompare the artifact content against all files in scanDirs using line-level similarity:
shared_lines / max(lines_a, lines_b)>= 0.90 — P1 BLOCK — "New artifact is ≥90% similar to '[existingFile]'. This appears to be a duplicate.">= 0.70 — P2 WARN — "New artifact is ≥70% similar to '[existingFile]'. Review for unintentional duplication."< 0.70 — no actionIf similarity is between 0.70 and 0.90: request human confirmation before writing.
For style files (CSS, SCSS, CSS Modules, styled-components, Tailwind config):
For component-scoped styles (CSS Modules, Angular styleUrls): skip this check (scoped by design).
For index files (index.ts, index.js) and barrel exports:
export { X } from '...', export * from '...')If any check produces an ambiguous result — e.g., name similarity is close but not exact, structural overlap is partial, or the agent cannot determine intent:
Do not guess. Do not auto-resolve.
Surface to human:
"I detected a potential duplicate artifact but cannot determine with certainty whether this is intentional. Please review:
- New file: [path]
- Potential duplicate: [existingPath]
- Detection reason: [check name + details]
- Component type: [componentType]
Should I proceed with writing this file? (yes / no / rename)"
Wait for explicit human confirmation before proceeding. If the human responds:
Before any git add or git commit that includes agent-generated artifacts:
scanDirs) to catch duplicates introduced outside the current session{
"artifactValidation": {
"phase": "pre-write | post-work | commit",
"artifactPath": "<path>",
"framework": "<framework>",
"componentType": "<componentType>",
"checks": [
{
"check": "exact-path-duplicate | component-name-collision | route-path-duplicate | content-similarity | style-definition-duplicate | barrel-conflict",
"result": "PASS | BLOCK | WARN | HUMAN_REVIEW",
"severity": "P0 | P1 | P2",
"detail": "<description>",
"existingFile": "<path or null>",
"confidence": 0.0-1.0
}
],
"overallResult": "PASS | BLOCK | HUMAN_REVIEW",
"humanConfirmationRequired": true | false,
"humanResponse": "yes | no | rename | null"
}
}
artifactValidation.enabled (default: true) — enable/disable duplicate detectionartifactValidation.similarityThreshold (default: 0.70) — minimum overlap ratio to trigger WARNartifactValidation.blockThreshold (default: 0.90) — minimum overlap ratio to trigger BLOCKartifactValidation.scanDirs (default: ["src/", "components/", "pages/", "app/", "hooks/", "layouts/", "utils/", "styles/", "lib/"]) — directories to scanartifactValidation.excludePatterns (default: ["*.bak", "*.tmp", "*.log", "node_modules/", "dist/", ".next/", ".angular/"]) — file/directory patterns to excludeartifactValidation.commitTimeValidation (default: true) — enable commit-time re-validationDuring the post-work phase, the validator also checks for common workspace misconfigurations:
memory.vectorStore.enabled is true in the agent or guardrails config but chromadb cannot be imported (not installed), emit a P3 INFO warning: "vectorStore.enabled is true but chromadb is not installed. Vector memory writes will be silently skipped. Install: pip install -r guardrails/guardrails-coding-agent/requirements.txt". This is informational only — never blocks.npx claudepluginhub gagandeepp/software-agent-teams --plugin frontend-coding-agentGuides completion of development work by verifying tests, detecting environment, and presenting structured options for merge, PR, or cleanup.
Enforces test-driven development: write failing test first, then minimal code to pass. Use when implementing features or bugfixes.
Guides creation and editing of skills using test-driven development with pressure scenarios and subagents to verify agent compliance.