cookiecutter

Use Cruft when you need to pull new changes from a Cookiecutter template into an existing generated repository without rebuilding the project from scratch. The process tracks the template source, previews differences, applies updates, and preserves saved answers and local customizations in the repository where possible.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "cookiecutter" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-c1060a3af6f641a2553c4f8af1f055e7252e8081146984b9d791a467fa23170b. Verify the upstream source and version against https://skillhub.cn/skills/user_3c6cb52e/refresh-cookiecutter-based-repositories-from-upstream-template before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Use Cruft when you need to pull new changes from a Cookiecutter template into an existing generated repository without rebuilding the project from scratch. The process tracks the template source, previews differences, applies updates, and preserves saved answers and local customizations in the repository where possible.

0 Downloads

Introduction source: third_party · user_3c6cb52e · 0.1.0 Reference

SkillPi interpretation

Tasks
Use when adding, changing, testing, or debugging Cookiecutter templates, including cookiecutter.json variables, Jinja-rendered files, hooks, _copy_without_render, optional feature cleanup, and generated-project validation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: cookiecutter
description: Use when adding, changing, testing, or debugging Cookiecutter templates, including cookiecutter.json variables, Jinja-rendered files, hooks, _copy_without_render, optional feature cleanup, and generated-project validation.
license: MIT
compatibility: Codex, Claude Code, and other Agent Skills-compatible clients.
metadata:
  version: "0.1.0"
  displayName: Cookiecutter
  category: Developer Tooling
  tags: cookiecutter,templates,jinja,scaffolding

Cookiecutter Template Work

Use this skill before changing a repository that has cookiecutter.json, hooks/, or a generated project directory such as {{ cookiecutter.project_slug }}/.

First Pass

  1. Read the repo instructions, README.md, cookiecutter.json, existing tests, and any hooks before editing.
  2. Identify the template root and the generated project root. Make changes in the template files, not in one rendered sample.
  3. Search for the relevant Cookiecutter variables and feature flags with rg before adding new ones.
  4. Check how the repo validates rendered projects. Prefer existing render tests and smoke-check commands over inventing a separate validation path.

Template Boundaries

  • cookiecutter.json is the user-facing interface. Every new prompt, default, derived value, private value, and choice should be deliberate and documented where the repo documents options.
  • The generated project directory may itself contain Jinja in file names and paths. Treat both file contents and paths as render surfaces.
  • Follow the repo's current variable style. If it already uses y/n strings, keep using that style for new feature flags. If it uses Cookiecutter boolean values, keep those as real JSON booleans.
  • Optional features must be valid in both enabled and disabled states. Remove or gate app files, imports, URL routes, settings, dependencies, docs, tests, workflows, and migrations together.
  • Do not add maintainer-specific names, local paths, secrets, or one-agent assumptions to generated output.

Jinja Rules

  • Keep rendered files valid in their target language: Python, JSON, TOML, YAML, shell, Markdown, HTML, JavaScript, or CSS.
  • Watch for dangling commas after conditional blocks in JSON, TOML, Python data structures, YAML lists, package manifests, and GitHub Actions.
  • Use whitespace control ({%- ... -%}) only when it improves rendered syntax or formatting. Validate the rendered result, not only the template source.
  • Use safe serialization for strings inserted into code or data files. Prefer the repo's existing JSON/Jinja filter pattern, such as |tojson, when it is already used.
  • If generated output must preserve literal Jinja, template syntax, or agent placeholders, either escape the braces, wrap the content in raw blocks, or add the path to _copy_without_render.
  • _copy_without_render prevents rendering file contents, but paths are still rendered. Include both directory and recursive glob entries when a whole tree must be copied verbatim.

Hooks

  • Put Cookiecutter hooks in hooks/ as pre_prompt, pre_gen_project, or post_gen_project scripts. Prefer Python for cross-platform templates unless the repo is intentionally platform-specific.
  • pre_gen_project and post_gen_project run from the generated project root and can use rendered Cookiecutter variables.
  • Make hooks deterministic, idempotent, and relative-path based. Avoid network calls, secrets, interactive prompts, and machine-local paths.
  • A non-zero hook exit stops generation and Cookiecutter cleans the generated directory. Fail early for invalid user input; be defensive for cleanup.
  • Use post-generation cleanup for whole optional files or directories. Use inline Jinja for small syntax-aware changes inside files that must remain.

Testing

  • Add or update tests that render the template with explicit context values. Cover each changed option both enabled and disabled when practical.
  • Include assertions for absence, not only presence: disabled optional features should not leave imports, dependencies, routes, docs, workflows, migrations, or placeholder text behind.
  • Exercise the real Cookiecutter CLI when changing generation behavior, hooks, template selection, or command-line assumptions.
  • For runtime behavior changes, generate a project in a temp directory and run that project's documented checks.
  • Inspect rendered files that are sensitive to syntax: JSON, TOML, YAML, Python modules, shell scripts, and package manifests.

Common Failure Patterns

  • Jinja renders syntactically valid template source into invalid generated code.
  • A disabled option removes files but leaves settings, imports, URLs, dependencies, docs, tests, migrations, or CI references.
  • Literal {{ ... }} placeholders intended for the generated project are consumed by Cookiecutter.
  • Hooks assume the template repo as the working directory instead of the generated project root.
  • Tests render one happy-path context but miss another supported option combination.
  • Generated files include local paths, personal names, secrets, or assumptions about a specific AI tool.

Definition of Done

  • Template changes are made at the template level.
  • Relevant enabled and disabled option combinations render successfully.
  • The generated output has no stale placeholders, syntax errors, orphan imports, or hard-coded maintainer-specific values.
  • The repo's template test suite passes.
  • Docs and changelog entries are updated when users or generated-project contributors need to know about the change.

References

Current listing version

0.1.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value78/100

Highlights

  • Cookiecutter模板开发是开发者常见需求,Skill提供了详细的模板修改、测试、Jinja规则等实用指导
  • 覆盖了模板边界、Jinja规则、hooks、测试等完整工作流程,具有广泛受众的实用能力
Trigger Precision85/100

Highlights

  • 触发词精准完整,description明确指出了使用场景包括添加、修改、测试、调试Cookiecutter模板等
  • 覆盖多种变体,边界清晰,能够有效区分Cookiecutter相关工作与其他开发任务
Structure and Standards92/100

Highlights

  • Phase/步骤清晰,有First Pass、Template Boundaries、Jinja Rules、Hooks、Testing等明确章节
  • 包含Common Failure Patterns和Definition of Done作为出口条件,frontmatter完整,结构规范
Execution Reliability88/100

Highlights

  • 工具来源明确,参数正确,覆盖了主要异常情况如Jinja渲染错误、可选功能处理、hooks执行等
  • 提供了详细的最佳实践和常见失败模式,执行流程可靠
Evidence Verifiability (mean of the first four)86/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

Domains or addresses referenced in the document

These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.

  • cookiecutter.readthedocs.io
  • github.com

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.