{"record":{"id":"b2129e8f4de2ed6e","repo":"zed-industries/zed","slug":"skill-md-file-exceeds-maximum-size-of-kb","errorCode":null,"errorMessage":"SKILL.md file exceeds maximum size of {}KB","messagePattern":"SKILL\\.md file exceeds maximum size of (.+?)KB","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/agent_skills/agent_skills.rs","lineNumber":294,"sourceCode":"        .to_path_buf();\n\n    Ok(Skill {\n        name: metadata.name,\n        description: metadata.description,\n        source,\n        directory_path,\n        skill_file_path: skill_file_path.to_path_buf(),\n        load_warnings,\n        disable_model_invocation: metadata.disable_model_invocation,\n        embedded_body: None,\n    })\n}\n\n/// Extract the YAML frontmatter and body from a SKILL.md file without\n/// validating the metadata fields.\npub fn extract_skill_frontmatter(content: &str) -> Result<(SkillMetadata, &str)> {\n    if content.len() > MAX_SKILL_FILE_SIZE {\n        anyhow::bail!(\n            \"SKILL.md file exceeds maximum size of {}KB\",\n            MAX_SKILL_FILE_SIZE / 1024\n        );\n    }\n\n    extract_frontmatter(content)\n}\n\n/// Parse and validate the YAML frontmatter and body from a SKILL.md file.\npub fn parse_skill_file_content(content: &str) -> Result<(SkillMetadata, &str)> {\n    let (metadata, body) = extract_skill_frontmatter(content)?;\n\n    validate_name(&metadata.name).map_err(anyhow::Error::msg)?;\n    validate_description(&metadata.description).map_err(anyhow::Error::msg)?;\n\n    Ok((metadata, body))\n}\n","sourceCodeStart":276,"sourceCodeEnd":312,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/agent_skills/agent_skills.rs#L276-L312","documentation":"Before extracting YAML frontmatter, `extract_skill_frontmatter` enforces `MAX_SKILL_FILE_SIZE` (100 * 1024 bytes = 100 KB) on the SKILL.md content. Skills are injected into agent context on demand, so an unbounded SKILL.md would blow up token budgets; oversized files are rejected outright.","triggerScenarios":"A SKILL.md whose total length (frontmatter + body) exceeds 100 KB — e.g. embedded base64 assets, pasted logs, inlined API references, or whole documents in the body.","commonSituations":"Authors paste comprehensive documentation into a skill body; CI-generated skills concatenate many files; a script builds SKILL.md from a large corpus without trimming.","solutions":["Trim the body under 100 KB — skills should be a concise pointer to scripts, not a full manual.","Move bulky reference material into sibling files in the skill directory and reference them by path.","Strip embedded assets/base64 blobs out of the markdown.","Check the byte size (not line count): `wc -c SKILL.md` must be <= 102400."],"exampleFix":"# skill directory layout — before: one 300KB SKILL.md\n# after: concise SKILL.md + external reference\nmyskill/\n  SKILL.md            # < 100KB: description + workflow + pointers\n  reference/api.md    # detailed tables moved here\n  scripts/run.sh      # logic moved here","handlingStrategy":"validation","validationCode":"const MAX: usize = agent_skills::MAX_SKILL_FILE_SIZE; // 100 * 1024\nif content.len() > MAX {\n    // trim the body or split reference material into sibling files before extracting frontmatter\n}","typeGuard":null,"tryCatchPattern":"match agent_skills::parse_skill_file_content(&content) {\n    Err(e) if e.to_string().contains(\"exceeds maximum size\") => {\n        // reject the skill with a size hint; ask the author to externalize bulk content\n    }\n    rest => rest,\n}","preventionTips":["Keep SKILL.md bodies short; store bulk reference in sibling files.","Run `wc -c SKILL.md` in a lint step for skill directories (limit 102400 bytes).","Never inline base64 assets or logs into a skill."],"tags":["rust","zed","agent-skills","file-size","limit-exceeded","skills"],"backgroundTag":"file-size-limit-exceeded","analyzedSha":"9d272b036335401f339d024ea94968fd51016c40","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}