This skill should be used when the user asks for "defensive coding", "input validation", "prevent bugs", "multiple validation layers", or when fixing bugs caused by invalid data reaching deep execution. Validates at every layer.
Adds defense-in-depth validation by adding checks at every layer data passes through. Triggers when users request defensive coding, input validation, or fixing bugs caused by invalid data reaching deep execution.
/plugin marketplace add pproenca/dot-claude/plugin install dev-workflow@pproencaThis skill cannot use any tools. It operates in read-only mode without the ability to modify files or execute commands.
When fixing a bug caused by invalid data, adding validation at one place feels sufficient. But that single check can be bypassed.
Core principle: Validate at EVERY layer data passes through. Make the bug structurally impossible.
Reject obviously invalid input at API boundary:
function createProject(name: string, workingDirectory: string) {
if (!workingDirectory || workingDirectory.trim() === "") {
throw new Error("workingDirectory cannot be empty");
}
if (!existsSync(workingDirectory)) {
throw new Error(`workingDirectory does not exist: ${workingDirectory}`);
}
}
Ensure data makes sense for this operation:
function initializeWorkspace(projectDir: string, sessionId: string) {
if (!projectDir) {
throw new Error("projectDir required for workspace initialization");
}
}
Prevent dangerous operations in specific contexts:
async function gitInit(directory: string) {
if (process.env.NODE_ENV === "test") {
const normalized = normalize(resolve(directory));
const tmpDir = normalize(resolve(tmpdir()));
if (!normalized.startsWith(tmpDir)) {
throw new Error(`Refusing git init outside temp dir during tests`);
}
}
}
Capture context for forensics:
async function gitInit(directory: string) {
logger.debug("About to git init", {
directory,
cwd: process.cwd(),
stack: new Error().stack,
});
}
When fixing a bug:
Single validation: "We fixed the bug" Multiple layers: "We made the bug impossible"
Different layers catch different cases:
Referenced by systematic-debugging after root cause is found. Add validation at each layer the data passed through.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.