Token导航 LogoToken导航TokenDH.com
研究检索只读github未标认证来源可访问clear审计未展示

nitro-ui硝基 UI

Agent Skill

用于辅助界面设计、视觉规范、排版、配色、布局和交互体验优化。它适合让 Agent 根据产品场景整理页面结构、生成 UI 方案、检查视觉一致性或改进组件层级。使用时需要结合现有品牌、设计系统和用户任务,不应只堆装饰元素;涉及真实页面改动时,应通过截图或浏览器预览检查文本溢出、对齐和响应式表现。

总安装

874

周安装

35

GitHub Stars

公开资料未说明

下载量

283
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:nitro-ui(硝基 UI)
来源仓库:https://github.com/nitrosh/nitro-ui
仓库路径:skills/nitro-ui
安装命令:
npx skills add nitrosh/nitro-ui --skill "nitro-ui"
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

AgentSkills.tonpx skills
npx skills add nitrosh/nitro-ui --skill "nitro-ui"

简介

辅助界面视觉规范、布局与交互体验设计。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中生成 UI 方案或优化组件层级。
  • 通过 npx 命令从 GitHub 仓库安装使用。
  • 涉及真实页面改动时应通过浏览器预览检查响应式表现。
  • nitro-ui 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

name
nitro-ui
description
Generate NitroUI code - a Python library for programmatic HTML generation using classes instead of templates

NitroUI Skill Guide

Quick reference for Claude to generate NitroUI code.

What is NitroUI?

A zero-dependency Python library for programmatic HTML generation. Build HTML with Python classes instead of string templates.

from nitro_ui import Div, H1, Paragraph

page = Div(
    H1("Welcome"),
    Paragraph("Built with NitroUI"),
    cls="container"
)
print(page.render())
# <div class="container"><h1>Welcome</h1><p>Built with NitroUI</p></div>

Two Import Styles

PascalCase (Traditional)

from nitro_ui import Div, H1, Paragraph, UnorderedList, ListItem, Image

Lowercase HTML-like (Looks like real HTML)

from nitro_ui.html import div, h1, p, ul, li, img, a, table, tr, td

page = div(
    h1("Title"),
    p("This looks like HTML!"),
    ul(
        li(a("Home", href="/")),
        li(a("About", href="/about")),
    ),
    cls="container"
)

Python Keyword Conflicts (use trailing underscore)

from nitro_ui.html import del_, input_, object_, map_

form_field = input_(type="text", name="username")  # <input>
deleted = del_("removed text")                      # <del>

Element Constructor Pattern

All elements follow this pattern:

Element(*children, **attributes)
  • *children: HTMLElement instances, strings, or nested lists
  • **attributes: HTML attributes as keyword arguments

Special attribute mappings:

  • cls or class_nameclass (use cls - it's shorter and more Pythonic)
  • for_elementfor (Python keyword workaround)
  • data_*data-* (underscores become hyphens)
div = Div(
    H1("Title"),
    "Some text",
    id="main",
    cls="container",
    data_value="123"
)
# <div id="main" class="container" data-value="123"><h1>Title</h1>Some text</div>

Quick Reference: All Tags

Document Structure

PascalCaseLowercaseHTML Tag
HTMLhtml<html> (includes DOCTYPE)
Headhead<head>
Bodybody<body>
Titletitle<title>
Metameta<meta>
Linklink<link>
Scriptscript<script>
Stylestyle<style>

Layout

PascalCaseLowercaseHTML Tag
Divdiv<div>
Sectionsection<section>
Articlearticle<article>
Headerheader<header>
Footerfooter<footer>
Navnav<nav>
Mainmain<main>
Asideaside<aside>
HorizontalRulehr<hr>

Text

PascalCaseLowercaseHTML Tag
H1-H6h1-h6<h1>-<h6>
Paragraphp<p>
Spanspan<span>
Strongstrong<strong>
Emem<em>
Boldb<b>
Italici<i>
Underlineu<u>
Strikethroughs<s>
Codecode<code>
Prepre<pre>
Hrefa<a>
Brbr<br>
Deldel_<del>

Lists

PascalCaseLowercaseHTML Tag
UnorderedListul<ul>
OrderedListol<ol>
ListItemli<li>
DescriptionListdl<dl>
DescriptionTermdt<dt>
DescriptionDetailsdd<dd>

Forms

PascalCaseLowercaseHTML Tag
Formform<form>
Inputinput_<input>
Buttonbutton<button>
Textareatextarea<textarea>
Selectselect<select>
Optionoption<option>
Labellabel<label>
Fieldsetfieldset<fieldset>

Tables

PascalCaseLowercaseHTML Tag
Tabletable<table>
TableRowtr<tr>
TableDataCelltd<td>
TableHeaderCellth<th>
TableHeaderthead<thead>
TableBodytbody<tbody>
TableFootertfoot<tfoot>

Media

PascalCaseLowercaseHTML Tag
Imageimg<img>
Videovideo<video>
Audioaudio<audio>
Figurefigure<figure>
Figcaptionfigcaption<figcaption>
Canvascanvas<canvas>

Key Methods (All Return self for Chaining)

Adding/Removing Children

element.append(child1, child2)      # Add to end
element.prepend(child1, child2)     # Add to start
element.clear()                      # Remove all children
element.pop(0)                       # Remove and return child at index

Attributes

element.add_attribute("id", "main")
element.add_attributes([("id", "main"), ("role", "button")])
element.get_attribute("id")          # Returns str or None
element.has_attribute("id")          # Returns bool
element.remove_attribute("id")

Inline Styles

element.add_style("color", "red")
element.add_styles({"color": "red", "padding": "10px"})
element.get_style("color")           # Returns str or None
element.remove_style("color")

Querying

element.count_children()             # Returns int
element.first()                      # First child or None
element.last()                       # Last child or None
element.find_by_attribute("id", "x") # Find descendant
element.filter(lambda e: e.tag == "p")  # Iterator of matching children

Rendering

element.render()                     # Compact HTML string
element.render(pretty=True)          # Indented HTML string
str(element)                         # Same as render()

Serialization

# To/from JSON
json_str = element.to_json(indent=2)
element = HTMLElement.from_json(json_str)

# To/from dict
data = element.to_dict()
element = HTMLElement.from_dict(data)

# Parse HTML string
element = from_html('<div class="x">Hello</div>')
elements = from_html('<p>One</p><p>Two</p>', fragment=True)  # List

Utility

element.clone()                      # Deep copy
element.generate_id()                # Add unique ID if none exists

Fragment (No Wrapper Tag)

from nitro_ui import Fragment, H1, Paragraph

# Renders children without wrapper
frag = Fragment(H1("Title"), Paragraph("Content"))
print(frag.render())
# <h1>Title</h1><p>Content</p>

Partial (Raw HTML)

Embed raw HTML for trusted content like analytics tags. Bypasses escaping.

from nitro_ui import Head, Meta, Title, Partial

# Inline raw HTML
Head(
    Meta(charset="utf-8"),
    Partial("""
        <!-- Google Analytics -->
        <script async src="https://www.googletagmanager.com/gtag/js?id=GA_ID"></script>
        <script>gtag('config', 'GA_ID');</script>
    """),
    Title("My Page")
)

# Or load from file (lazy-loaded at render time)
Partial(file="partials/analytics.html")

Warning: Only use with trusted content - bypasses XSS protections.


Styling System

Inline Styles

div = Div("Content")
div.add_style("color", "blue")
div.add_styles({"padding": "20px", "margin": "10px"})

External StyleSheet

from nitro_ui.styles import CSSStyle, StyleSheet, Theme

# Create stylesheet with theme
theme = Theme.modern()  # or Theme.classic(), Theme.minimal()
stylesheet = StyleSheet(theme=theme)

# Register CSS classes
btn = stylesheet.register("btn", CSSStyle(
    background_color="var(--color-primary)",
    color="white",
    padding="10px 20px",
    _hover=CSSStyle(background_color="var(--color-primary-dark)")
))

# Use in elements
button = Button("Click", cls=btn)

# Generate CSS
css = stylesheet.render()
style_tag = stylesheet.to_style_tag()

BEM Naming

card = stylesheet.register_bem("card", style=CSSStyle(padding="20px"))
# Returns: "card"

header = stylesheet.register_bem("card", element="header", style=CSSStyle(font_weight="bold"))
# Returns: "card__header"

featured = stylesheet.register_bem("card", modifier="featured", style=CSSStyle(border="2px solid"))
# Returns: "card--featured"

Responsive Breakpoints

container = stylesheet.register("container", CSSStyle(
    padding="10px",
    _sm=CSSStyle(padding="15px"),  # 640px+
    _md=CSSStyle(padding="20px"),  # 768px+
    _lg=CSSStyle(padding="30px"),  # 1024px+
))

Common Patterns

Complete Page

from nitro_ui import HTML, Head, Body, Title, Meta, Div, H1, Paragraph

page = HTML(
    Head(
        Title("My Page"),
        Meta(charset="utf-8"),
        Meta(name="viewport", content="width=device-width, initial-scale=1")
    ),
    Body(
        Div(
            H1("Welcome"),
            Paragraph("Hello, world!"),
            cls="container"
        )
    )
)
html = page.render(pretty=True)

Navigation

from nitro_ui.html import nav, ul, li, a

navbar = nav(
    ul(
        li(a("Home", href="/")),
        li(a("About", href="/about")),
        li(a("Contact", href="/contact")),
    ),
    cls="navbar"
)

Form

from nitro_ui.html import form, label, input_, button, select, option

login_form = form(
    label("Email:", for_element="email"),
    input_(type="email", id="email", name="email", required=True),
    label("Password:", for_element="password"),
    input_(type="password", id="password", name="password", required=True),
    button("Log In", type="submit"),
    action="/login",
    method="post"
)

Table from Data

from nitro_ui.html import table, thead, tbody, tr, th, td

data = [
    {"name": "Alice", "age": 30},
    {"name": "Bob", "age": 25},
]

t = table(
    thead(tr(th("Name"), th("Age"))),
    tbody(*[
        tr(td(row["name"]), td(str(row["age"])))
        for row in data
    ])
)

Card Component

from nitro_ui.html import div, h3, p, a

def card(title, content, link_url=None):
    children = [h3(title), p(content)]
    if link_url:
        children.append(a("Learn more", href=link_url))
    return div(*children, cls="card")

# Usage
cards = div(
    card("Feature 1", "Description here", "/feature-1"),
    card("Feature 2", "Another description", "/feature-2"),
    cls="card-grid"
)

Dynamic List

from nitro_ui.html import ul, li

items = ["Apple", "Banana", "Orange"]
list_element = ul(*[li(item) for item in items])

Method Chaining

container = (Div()
    .add_attribute("id", "hero")
    .add_styles({"background": "#f0f0f0", "padding": "2rem"})
    .append(H1("Welcome"))
    .append(Paragraph("Get started today.")))

Custom Component Class

from nitro_ui import HTMLElement, H2, Paragraph

class Card(HTMLElement):
    def __init__(self, title, content, **kwargs):
        super().__init__(tag="div", cls="card", **kwargs)
        self.append(
            H2(title, cls="card-title"),
            Paragraph(content, cls="card-body")
        )

# Usage
card = Card("My Card", "Card content here", id="card-1")

Security Notes

  • Automatic HTML escaping: All text content and attribute values are escaped
  • CSS value validation: Inline styles reject javascript:, expression(), etc.
  • CSS class validation: StyleSheet rejects malicious class names
  • No raw HTML injection: Cannot inject unescaped HTML (prevents XSS)

Framework Integration

FastAPI

from fastapi import FastAPI
from fastapi.responses import HTMLResponse
from nitro_ui.html import html, head, body, title, h1

app = FastAPI()

@app.get("/", response_class=HTMLResponse)
async def home():
    return html(
        head(title("FastAPI + NitroUI")),
        body(h1("Hello!"))
    ).render()

Flask

from flask import Flask
from nitro_ui.html import html, head, body, title, h1

app = Flask(__name__)

@app.route("/")
def home():
    return html(
        head(title("Flask + NitroUI")),
        body(h1("Hello!"))
    ).render()

Django

from django.http import HttpResponse
from nitro_ui.html import html, head, body, title, h1

def home(request):
    page = html(
        head(title("Django + NitroUI")),
        body(h1("Hello!"))
    )
    return HttpResponse(page.render())

Quick Checklist

When generating NitroUI code:

  • [ ] Choose import style: PascalCase (from nitro_ui import) or lowercase (from nitro_ui.html import)
  • [ ] Use cls for CSS classes (or class_name - both work, cls is shorter)
  • [ ] Use for_element not for (Python keyword)
  • [ ] Use input_, del_, object_, map_ for Python conflicts
  • [ ] Children go as positional args, attributes as keyword args
  • [ ] Call .render() to get HTML string
  • [ ] Use pretty=True for readable output during development
  • [ ] All manipulation methods return self for chaining (except replace_child, generate_id)
  • [ ] Use Fragment when you need multiple elements without a wrapper
  • [ ] Use Partial for raw HTML (analytics, embeds) - bypasses escaping

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

26.1%
按下载量换算74

OpenCode

22.4%
按下载量换算63

Antigravity

15.99%
按下载量换算45

Gemini CLI

13.24%
按下载量换算37

windsurf

7.61%
按下载量换算22

Cursor

3.66%
按下载量换算10

安全审计

暂无安全审计结果可展示。

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills