一键导入
ui-template-with-cotton-or-partials
Creates Django template UI using Cotton components and/or Django partials for DRY, reusable code.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Creates Django template UI using Cotton components and/or Django partials for DRY, reusable code.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | ui-template-with-cotton-or-partials |
| description | Creates Django template UI using Cotton components and/or Django partials for DRY, reusable code. |
| allowed-tools | Read, Grep, Glob, Bash(bash scripts/*), Bash(git clone:*github.com/wrabit/django-cotton*) |
https://github.com/wrabit/django-cotton
To use documentation make sure that Cotton's documentation is present and has been updated in the last two weeks. Use scripts/update_cotton_documentation.bash for this, it is idempotent and can be run before consulting documentation.
Documentation for cotton is available in the "documentation" directory.
Documentation for Django's templates is available in reference/django_template_partial.md
Create DRY code with regards to template UI so that when we change elements there will not be inconsistencies. Also reuse UI code to have the same UI elements within the application
If pip is used:
pip install django-cotton
If uv is used:
uv add django-cotton
In settings.py make sure that INSTALLED_APPS contains 'django_cotton'.
Create UI elements per usual for Django. Then for each one which is used more than once contemplate if it should be abstracted to a partial or to a Cotton component as described above.
Check if Tailwind CSS is present in the project. If so, use it as much as you can while creating UI code. Check for existing CSS, usually an input.css in the project which may contain classes and definitions of the project; use those everywhere you can on generated code.
Request the user to have Django 5.2+ installed to be able to use partials. Install Cotton if it is not there. Write cotton components in the appropriate directory for the module, "COTTON_DIR" in settings or default to "cotton". Refer to the documentation for tool's usage.
Do not suggest to create cotton components in layout files inherited from other templates.
Creates a new app from a template if present and adds it to settings and URLs
Use feature switches to control introduction of new functionality and regressions with Django Waffle