From backend-coding-agent
Use before writing any backend artifact (controller, service, repository, model, middleware, 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
/backend-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 backend code artifacts. Runs as a pre-write
Prevents the agent from creating or committing duplicate backend 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 backend 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)language — resolved language (csharp | golang | java | nodejs)scanDirs — directories to scan for existing artifacts (default: ["src/", "lib/", "controllers/", "services/", "repositories/", "models/", "middleware/", "tests/"])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 with the same base name (case-insensitive, ignoring extension differences for the same language):
Language-specific rules:
| Language | Collision scope | Example |
|---|---|---|
| C# | Same class/interface name across *.cs files in the project | UserService.cs vs UserService.cs in different folders |
| Go | Same package + exported function/type name across *.go files | user_service.go defining UserService vs another user_service.go |
| Java | Same fully-qualified class name across *.java files | com.app.UserService in two locations |
| Node.js | Same module name across *.ts/*.js files in the same layer | userService.ts vs UserService.ts |
If match found:
Parse the artifact content for structural elements and compare against existing files:
C# artifacts:
Go artifacts:
type X struct), function signatures, interface definitionsJava artifacts:
Node.js artifacts:
export class, export function, module.exports)Detail: "Type/symbol '[name]' is already defined in '[existingFile]'. Creating a duplicate will cause compilation/import conflicts."
Compare 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 controller/handler files:
[Route("...")], [HttpGet("...")], [HttpPost("...")], etc.r.HandleFunc("...", ...), e.GET("...", ...), framework-specific route registrations@RequestMapping("..."), @GetMapping("..."), @PostMapping("..."), etc.router.get("..."), app.post("..."), @Get("..."), @Post("...") (NestJS)For dependency injection registration files (Startup.cs, Program.cs, module files):
AddScoped<T>, AddSingleton<T>, bind(X).to(Y), providers: [...])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]
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>",
"language": "<language>",
"checks": [
{
"check": "exact-path-duplicate | name-collision | structural-duplicate | content-similarity | api-route-duplicate | di-registration-duplicate",
"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/", "lib/", "controllers/", "services/", "repositories/", "models/", "middleware/", "tests/"]) — directories to scanartifactValidation.excludePatterns (default: ["*.bak", "*.tmp", "*.log", "bin/", "obj/", "node_modules/", "vendor/"]) — 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 backend-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.