Agent-Skill-Architecture-Guide new-skill
Install, create, scaffold, and validate new skills in the .claude/skills/ folder. Use when adding a skill from a URL, GitHub repo, zip file, or markdown content, or when creating a new skill from scratch. Also use for validating existing skills, fixing registration issues, or restructuring the .claude folder.
git clone https://github.com/shane9coy/Agent-Skill-Architecture-Guide
T=$(mktemp -d) && git clone --depth=1 https://github.com/shane9coy/Agent-Skill-Architecture-Guide "$T" && mkdir -p ~/.claude/skills && cp -r "$T/.agent/skills/new-skill-builder" ~/.claude/skills/shane9coy-agent-skill-architecture-guide-new-skill && rm -rf "$T"
.agent/skills/new-skill-builder/SKILL.mdNew Skill Installer & Scaffolder
Overview
This skill helps you install, create, and manage skills in your
.claude/skills/ directory. It handles the full lifecycle: scaffolding new skills from scratch, installing skills from external sources, validating skill structure, and troubleshooting registration issues.
Workflow 1: Create a New Skill From Scratch
When the user wants to create a brand new skill:
-
Ask for details (if not provided):
- Skill name (lowercase, hyphenated, e.g.
)api-tester - What it should do (purpose)
- When it should trigger (contexts)
- Whether it needs scripts, references, or assets
- Skill name (lowercase, hyphenated, e.g.
-
Scaffold the folder structure:
SKILL_NAME="the-skill-name" PROJECT_DIR="$(pwd)" SKILL_DIR="${PROJECT_DIR}/.claude/skills/${SKILL_NAME}" mkdir -p "${SKILL_DIR}" mkdir -p "${SKILL_DIR}/scripts" mkdir -p "${SKILL_DIR}/references" mkdir -p "${SKILL_DIR}/assets"
- Generate the SKILL.md with proper frontmatter:
--- name: {skill-name} description: "{What it does}. Use when {trigger conditions}. Handles {capabilities}." --- # {Skill Title} ## Overview {One paragraph purpose statement} ## Instructions 1. {Step-by-step instructions} ## Examples ### Example 1 **Input:** "{example user request}" **Action:** {what the skill does} **Output:** {expected result} ## Error Handling - {How to handle failures} ## Notes - {Caveats and edge cases}
-
Validate the skill (run Workflow 4 below)
-
Report back with the file tree and confirmation it's registered.
Workflow 2: Install a Skill From External Source
When the user provides a URL, GitHub repo, zip file, or raw markdown:
From a GitHub Repository URL
REPO_URL="$1" SKILL_NAME="$2" # Extract from repo name if not given SKILL_DIR=".claude/skills/${SKILL_NAME}" # Clone just the skill content git clone --depth 1 "${REPO_URL}" "/tmp/${SKILL_NAME}-clone" # Find the SKILL.md SKILL_FILE=$(find "/tmp/${SKILL_NAME}-clone" -name "SKILL.md" -type f | head -1) if [ -z "$SKILL_FILE" ]; then echo "ERROR: No SKILL.md found in repository." echo "This repo may not be a valid AgentSkills package." exit 1 fi # Get the skill's parent directory (contains SKILL.md + siblings) SKILL_SRC=$(dirname "$SKILL_FILE") # Copy to .claude/skills/ mkdir -p "${SKILL_DIR}" cp -r "${SKILL_SRC}/"* "${SKILL_DIR}/" # Cleanup rm -rf "/tmp/${SKILL_NAME}-clone" echo "Installed ${SKILL_NAME} to ${SKILL_DIR}"
From Raw Markdown Content
If the user pastes or uploads a SKILL.md file:
- Extract the
field from YAML frontmattername - Create
.claude/skills/{name}/SKILL.md - Write the content
- Check if it references external files (scripts/, references/, assets/)
- Warn the user about any missing referenced files
From a Zip File
ZIP_FILE="$1" TEMP_DIR="/tmp/skill-install-$$" mkdir -p "$TEMP_DIR" unzip -q "$ZIP_FILE" -d "$TEMP_DIR" # Find SKILL.md (may be nested in a folder) SKILL_FILE=$(find "$TEMP_DIR" -name "SKILL.md" -type f | head -1) if [ -z "$SKILL_FILE" ]; then echo "ERROR: No SKILL.md found in zip." exit 1 fi SKILL_SRC=$(dirname "$SKILL_FILE") SKILL_NAME=$(grep "^name:" "$SKILL_FILE" | head -1 | sed 's/name: *//' | tr -d '"' | tr ' ' '-' | tr '[:upper:]' '[:lower:]') if [ -z "$SKILL_NAME" ]; then SKILL_NAME=$(basename "$SKILL_SRC") fi SKILL_DIR=".claude/skills/${SKILL_NAME}" mkdir -p "$SKILL_DIR" cp -r "$SKILL_SRC/"* "$SKILL_DIR/" rm -rf "$TEMP_DIR" echo "Installed ${SKILL_NAME} to ${SKILL_DIR}"
Workflow 3: Install the Uploaded MCP Builder Skill
When the user wants to install the
mcp-builder skill specifically:
- Create the directory structure:
mkdir -p .claude/skills/mcp-builder/reference
-
Copy or create the SKILL.md from the user's uploaded file into
.claude/skills/mcp-builder/SKILL.md -
Note that the SKILL.md references these files that need to be populated:
{baseDir}/reference/mcp_best_practices.md{baseDir}/reference/python_mcp_server.md{baseDir}/reference/node_mcp_server.md{baseDir}/reference/evaluation.md
-
Either fetch them from the source repo (if URL provided) or create stub files:
for ref in mcp_best_practices python_mcp_server node_mcp_server evaluation; do if [ ! -f ".claude/skills/mcp-builder/reference/${ref}.md" ]; then echo "# ${ref}" > ".claude/skills/mcp-builder/reference/${ref}.md" echo "" >> ".claude/skills/mcp-builder/reference/${ref}.md" echo "TODO: Populate with content from the original skill repository." >> ".claude/skills/mcp-builder/reference/${ref}.md" echo "Source: https://github.com/ComposioHQ/awesome-claude-skills/tree/main/mcp-builder/reference" >> ".claude/skills/mcp-builder/reference/${ref}.md" fi done
- Warn the user that stub reference files need real content for full functionality.
Workflow 4: Validate Skills
Run these checks on any skill to ensure it will register properly:
Validation Checklist
SKILL_DIR="$1" # e.g., .claude/skills/my-skill # 1. Check SKILL.md exists if [ ! -f "${SKILL_DIR}/SKILL.md" ]; then echo "FAIL: No SKILL.md found in ${SKILL_DIR}" exit 1 fi # 2. Check frontmatter exists if ! head -1 "${SKILL_DIR}/SKILL.md" | grep -q "^---"; then echo "FAIL: SKILL.md must start with --- (YAML frontmatter)" exit 1 fi # 3. Check name field if ! grep -q "^name:" "${SKILL_DIR}/SKILL.md"; then echo "FAIL: Missing 'name:' in frontmatter" exit 1 fi # 4. Check description field if ! grep -q "^description:" "${SKILL_DIR}/SKILL.md"; then echo "FAIL: Missing 'description:' in frontmatter" exit 1 fi # 5. Check description is quoted if it has special chars DESC_LINE=$(grep "^description:" "${SKILL_DIR}/SKILL.md" | head -1) if echo "$DESC_LINE" | grep -qE '[\[\]#]' && ! echo "$DESC_LINE" | grep -q '"'; then echo "WARN: Description contains special characters but is not quoted. This may cause YAML parse failures." fi # 6. Check line count LINES=$(wc -l < "${SKILL_DIR}/SKILL.md") if [ "$LINES" -gt 500 ]; then echo "WARN: SKILL.md is ${LINES} lines (recommended max: 500). Move detail to references/." fi # 7. Check for referenced files that don't exist grep -oE '\{baseDir\}/[^ )"]+' "${SKILL_DIR}/SKILL.md" | while read -r ref; do REAL_PATH="${SKILL_DIR}/${ref#{baseDir}/}" if [ ! -f "$REAL_PATH" ]; then echo "WARN: Referenced file not found: ${ref} -> ${REAL_PATH}" fi done echo "PASS: Skill structure is valid."
Workflow 5: Restructure / Audit Entire .claude Folder
When the user wants to audit or fix their entire
.claude/ setup:
- Scan current structure:
echo "=== Current .claude structure ===" find .claude -type f | head -50 echo "" echo "=== Skills found ===" find .claude/skills -name "SKILL.md" 2>/dev/null || echo "No skills directory found"
-
For each SKILL.md found, run validation (Workflow 4)
-
Check for common problems:
- SKILL.md files not inside a named subfolder
- Missing CLAUDE.md at project root
- Skills with duplicate names
- Orphan folders (no SKILL.md inside)
-
Report findings and offer to fix issues.
-
If no .claude/ folder exists, scaffold one:
mkdir -p .claude/skills mkdir -p .claude/commands # Create starter CLAUDE.md cat > .claude/CLAUDE.md << 'EOF' # Project Configuration ## Stack - TODO: List your tech stack ## Commands - `npm run dev` — Start dev server - `npm test` — Run tests - `npm run build` — Production build ## Conventions - TODO: Add your code style preferences - TODO: Add your naming conventions ## Notes - TODO: Add project-specific context for Claude EOF echo "Created .claude/ folder with starter CLAUDE.md"
Important Rules
- Always validate after install — run the validation checklist on every new skill
- Never overwrite without asking — if a skill folder already exists, confirm before replacing
- Quote all descriptions — use double quotes around description values as a default habit
- Keep SKILL.md lean — under 500 lines, use references/ for depth
- Test the trigger — after installing, suggest the user try a prompt that should activate the skill
- Preserve existing structure — when restructuring, don't delete files without confirmation
- Handle both project-local and global installs — ask the user which scope they want:
- Project:
./.claude/skills/ - Global:
~/.claude/skills/
- Project:
Error Handling
- Git clone fails: Check if URL is valid, suggest HTTPS vs SSH
- No SKILL.md in source: The source isn't a valid AgentSkills package — offer to create one from the content
- YAML parse error: Almost always unquoted special characters in description — auto-fix by quoting
- Skill doesn't trigger: Check description keywords match what users would actually say
- Skill triggers but fails: Check that referenced scripts/files exist and are executable