{"record":{"id":"ab9a5deb28674d6b","repo":"langchain-ai/deepagents","slug":"error-invalid-skill-name-error-msg","errorCode":null,"errorMessage":"Error: Invalid skill name: {error_msg}","messagePattern":"Error: Invalid skill name: (.+?)","errorType":"console","errorClass":"SystemExit","httpStatus":null,"severity":"warning","filePath":"libs/code/deepagents_code/skills/commands.py","lineNumber":436,"sourceCode":"\n    Raises:\n        SystemExit: If the skill name is invalid or the directory cannot be created.\n    \"\"\"\n    from rich.markup import escape as escape_markup\n\n    from deepagents_code.config import Credentials, console, get_glyphs\n\n    # Validate skill name first (per Agent Skills spec)\n    is_valid, error_msg = _validate_name(skill_name)\n    if not is_valid:\n        console.print(f\"[bold red]Error:[/bold red] Invalid skill name: {error_msg}\")\n        console.print(\n            \"[dim]Per Agent Skills spec: names must be lowercase alphanumeric \"\n            \"with hyphens only.\\n\"\n            \"Examples: web-research, code-review, data-analysis[/dim]\",\n            style=theme.MUTED,\n        )\n        raise SystemExit(1)\n\n    # Determine target directory\n    credentials = Credentials.from_environment()\n    if project:\n        if not credentials.project_root:\n            console.print(\"[bold red]Error:[/bold red] Not in a project directory.\")\n            console.print(\n                \"[dim]Project skills require a .git directory \"\n                \"in the project root.[/dim]\",\n                style=theme.MUTED,\n            )\n            raise SystemExit(1)\n        skills_dir = ensure_project_skills_dir(credentials.project_root)\n        if skills_dir is None:\n            console.print(\n                \"[bold red]Error:[/bold red] Could not create project skills directory.\"\n            )\n            raise SystemExit(1)","sourceCodeStart":418,"sourceCodeEnd":454,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/skills/commands.py#L418-L454","documentation":"Raised inside the /skills create command when the chosen skill name violates the Agent Skills spec (lowercase alphanumeric plus hyphens). The command prints guidance and exits with SystemExit(1) rather than creating an invalid skill directory.","triggerScenarios":"Running the skills create flow (execute_skills_command -> _create) with a name containing uppercase letters, spaces, underscores, dots, or other non-conforming characters.","commonSituations":"Typing \"My Skill\" or \"code_review\" as a skill name; copy-pasting a display title; using CamelCase out of habit.","solutions":["Rename the skill to lowercase alphanumeric with hyphens, e.g. code-review","Strip/normalize the name before invoking: re.sub(r'[^a-z0-9-]', '-', name.lower()).strip('-')","Follow the printed examples (web-research, code-review, data-analysis)"],"exampleFix":"// before\nskills create Code_Review\n\n// after\nskills create code-review","handlingStrategy":"validation","validationCode":"import re\ndef valid_skill_name(name: str) -> bool:\n    return bool(re.fullmatch(r\"[a-z0-9]+(-[a-z0-9]+)*\", name))\nname = re.sub(r\"[^a-z0-9-]\", \"-\", name.lower()).strip(\"-\")","typeGuard":null,"tryCatchPattern":"try:\n    run_skills_create(name=name, ...)\nexcept SystemExit:\n    console.print(f\"' {name}' invalid; try {slugify(name)}\")","preventionTips":["Slugify names: lowercase, replace spaces/underscores with hyphens","Follow the Agent Skills naming spec (lowercase alphanumeric + hyphens)","Prevent names starting/ending with a hyphen","Show the naming rules in your UI before accepting input"],"tags":["skills","cli","validation","naming"],"backgroundTag":"invalid-skill-name","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}