Prompts users to prefer editing existing files over creating new ones to maintain project health.
Install
mkdir -p .claude/skills/hf-warn-new-file-creation && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/12787" && unzip -o skill.zip -d .claude/skills/hf-warn-new-file-creation && rm skill.zipInstalls to .claude/skills/hf-warn-new-file-creation
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
hf.warn-new-file-creationKey capabilities
- →Detect the creation of new, untracked files
- →Issue a soft warning for new file creation
- →Suggest editing existing files to avoid file bloat
- →Provide guidance on necessary new files (tests, imports)
- →Skip warnings for specific file types (tests, configs, markdown)
- →Avoid repeated warnings for the same new file
How it works
The skill intercepts file creation events, checks if the file is new and untracked by Git, and issues a soft warning to stderr, while skipping specific file types.
Inputs & outputs
When to use hf.warn-new-file-creation
- →Reduce project file bloat
- →Enforce modularity
About this skill
hf.warn-new-file-creation
#!/bin/bash
# Hook: Soft warning when creating a new file (prefer editing existing).
# Fires on PostToolUse for Write tool.
# Does not block. Warns once per file.
set -euo pipefail
INPUT=$(cat)
FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty')
if [ -z "$FILE_PATH" ]; then
exit 0
fi
# Skip test files, configs, and known new-file scenarios
if echo "$FILE_PATH" | grep -qE '(test_|conftest\.py|__init__\.py|\.md$|migrations/versions/)'; then
exit 0
fi
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-$(pwd)}"
# Check if this file is tracked by git (i.e., existed before)
if git -C "$PROJECT_DIR" ls-files --error-unmatch "$FILE_PATH" > /dev/null 2>&1; then
# File already tracked — this is an overwrite of an existing file, not a new file
exit 0
fi
# File is new (untracked) — soft warning
MARKER_DIR="/tmp/claude-code-markers/$(echo -n "$PROJECT_DIR" | md5)"
mkdir -p "$MARKER_DIR"
WARNED_MARKER="$MARKER_DIR/warned-newfile-$(echo -n "$FILE_PATH" | md5)"
if [ -f "$WARNED_MARKER" ]; then
exit 0
fi
echo "NOTE: New file created: $FILE_PATH" >&2
echo " Prefer editing existing files when possible to avoid file bloat." >&2
echo " If this file is necessary, ensure it has:" >&2
echo " - Corresponding test file (if source code)" >&2
echo " - Proper imports and integration with existing modules" >&2
touch "$WARNED_MARKER"
exit 0
When not to use it
- →When creating test files, config files, or markdown files
- →When the task explicitly requires creating new, untracked files without warning
Prerequisites
Limitations
- →The warning is a soft warning and does not block file creation.
- →It relies on Git to determine if a file is tracked.
- →The skill skips warnings for specific file patterns.
How it compares
This skill provides an automated, non-blocking warning system for new file creation, promoting modularity and preventing file bloat in a way that manual code reviews might miss.
Compared to similar skills
hf.warn-new-file-creation side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| hf.warn-new-file-creation (this skill) | 0 | 5mo | Review | Beginner |
| webapp-testing | 353 | 3mo | Review | Intermediate |
| resolve-conflicts | 81 | 8mo | Review | Intermediate |
| telegram-bot-builder | 106 | 6mo | Review | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by T-rav
View all by T-rav →You might also like
webapp-testing
anthropics
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
resolve-conflicts
antinomyhq
Use this skill immediately when the user mentions merge conflicts that need to be resolved. Do not attempt to resolve conflicts directly - invoke this skill first. This skill specializes in providing a structured framework for merging imports, tests, lock files (regeneration), configuration files, and handling deleted-but-modified files with backup and analysis.
telegram-bot-builder
davila7
Expert in building Telegram bots that solve real problems - from simple automation to complex AI-powered bots. Covers bot architecture, the Telegram Bot API, user experience, monetization strategies, and scaling bots to thousands of users. Use when: telegram bot, bot api, telegram automation, chat bot telegram, tg bot.
dev-browser
SawyerHood
Browser automation with persistent page state. Use when users ask to navigate websites, fill forms, take screenshots, extract web data, test web apps, or automate browser workflows. Trigger phrases include "go to [url]", "click on", "fill out the form", "take a screenshot", "scrape", "automate", "test the website", "log into", or any browser interaction request.
openspec-onboard
studyzy
Guided onboarding for OpenSpec - walk through a complete workflow cycle with narration and real codebase work.
codex-cli-bridge
alirezarezvani
Bridge between Claude Code and OpenAI Codex CLI - generates AGENTS.md from CLAUDE.md, provides Codex CLI execution helpers, and enables seamless interoperability between both tools