agentsclimarketplace

Ui template with cotton or partials

Skill dimitrismistriotis/django-agentic-skills/skills/ui-template-with-cotton-or-partials

Creates Django template UI using Cotton components and/or Django partials for DRY, reusable code.From its SKILL.md

Install
npx -y skills add dimitrismistriotis/django-agentic-skills --skill ui-template-with-cotton-or-partials

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 3 stars3 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

2.2 KB, as published. Nobody here has run it

Django Template Author with Cotton or Django Partials

https://github.com/wrabit/django-cotton

Make sure that documentation is present

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.

Read Documentation When Needed

Documentation for cotton is available in the "documentation" directory. Documentation for Django's templates is available in reference/django_template_partial.md

Purpose

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

  • When UI code is to be used within the same template, use a Django Partial
  • If a component is to be used in different places and different templates, then it should live in a Cotton component

Cotton Installation

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'.

Usage Instructions

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.

Keep looking

Skills are one crate of 627,801. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.