Official编程与开发github.com

算法艺术

使用 p5.js 创建算法艺术,支持种子随机性和交互式参数探索。当用户请求使用代码创作艺术、生成艺术、算法艺术、流场或粒子系统时使用。创作原创算法艺术,而非复制现有艺术家。

算法艺术 是什么?

该技能指导 AI 代理(如 Claude Code、Cursor、Codex)通过两阶段过程创建算法艺术:首先制定算法哲学,然后使用 p5.js 实现为交互式生成艺术。用户提供初始灵感(通常是模糊提示),代理起草一份详细阐述计算美学运动的算法哲学(以 .md 文件输出),然后通过编码自包含的 HTML 工件(.html + .js 文件)来表达该哲学。关键原则包括使用种子随机性(Art Blocks 模式)确保可重现性,从模板创建交互式查看器,以及通过手工精心调优的参数实现受控混沌——算法应感觉像是由顶级计算美学专家的无数次迭代打磨而成。该技能强调过程重于产品:每段代码都会产生独特的、涌现的作品,其美感源自算法的执行,而非静态图像。如果哲学是基于粒子的,实现可能使用力导向流场;如果基于数学,则使用几何关系和谐波。始终在 p5.js 中构建,并包含用于种子控制、参数调整和重新生成的 UI。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/anthropics/skills/tree/main/skills/algorithmic-art

Installed? Explore more 编程与开发 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

算法哲学是通过代码表达的计算美学运动。输出 .md 文件(哲学)、.html 文件(交互式查看器)和 .js 文件(生成算法)。

这分两步完成:

  1. 算法哲学创建(.md 文件)
  2. 通过创建 p5.js 生成艺术来表达(.html + .js 文件)

首先,承担以下任务:

算法哲学创建

首先,创建一个算法哲学(而非静态图像或模板),该哲学将通过以下方式诠释:

  • 计算过程、涌现行为、数学之美
  • 种子随机性、噪声场、有机系统
  • 粒子、流动、场、力
  • 参数变化与受控混沌

关键理解

  • 接收内容:用户提供的某些细微输入或指示作为基础,但不应限制创作自由。
  • 创建内容:一个算法哲学/生成美学运动。
  • 后续步骤:同一版本接收该哲学并用代码表达——创建 p5.js 草图,其中 90% 是算法生成,10% 是关键参数。

请考虑以下方法:

  • 为生成艺术运动撰写宣言
  • 下一阶段涉及编写将其付诸实现的算法

哲学必须强调:算法表达、涌现行为、计算之美、种子变异。

如何生成算法哲学

命名运动(1-2 个词):如“有机湍流”/“量子谐波”/“涌现静寂”

阐述哲学(4-6 段——简洁但完整):

要捕捉算法的精髓,请表达该哲学如何通过以下方式体现:

  • 计算过程和数学关系?
  • 噪声函数和随机性模式?
  • 粒子行为和场动力学?
  • 时间演化和系统状态?
  • 参数变化和涌现复杂性?

关键指南:

  • 避免冗余:每个算法方面应只提及一次。避免重复噪声理论、粒子动力学或数学原理的概念,除非增加新的深度。
  • 反复强调手工精调:哲学必须多次强调最终算法应看起来像经过无数小时的开发、精心打磨,并由其领域顶尖专家创作。这一点至关重要——重复使用“精心打造的算法”、“深度计算专业知识的产物”、“痛苦的优化”、“大师级实现”等短语。
  • 留出创意空间:在算法方向上具体,但足够简洁,以便下一个 Claude 有空间以极高的工艺水平做出解释性实现选择。

哲学必须指导下一版本通过算法表达思想,而非通过静态图像。美存在于过程之中,而非最终帧。

哲学示例

“有机湍流” 哲学:混沌受自然法则约束,秩序从无序中涌现。 算法表达:由多层 Perlin 噪声驱动的流场。数千个粒子跟随矢量力,它们的轨迹累积成有机密度图。多个噪声倍频程创建湍流区域和静寂区。颜色由速度和密度决定——快速粒子燃烧明亮,慢速粒子褪为阴影。算法运行直至平衡——一个精心调优的平衡,每个参数都经过大师级计算美学专家的无数次迭代打磨。

“量子谐波” 哲学:离散实体表现出波状干涉图案。 算法表达:粒子在网格上初始化,每个粒子携带一个通过正弦波演化的相位值。当粒子接近时,它们的相位相互干涉——相长干涉产生亮节点,相消干涉产生空隙。简谐运动生成复杂的涌现曼陀罗。这是通过痛苦的频率校准产生的结果,每个比例都经过精心选择以产生共鸣之美。

“递归低语” 哲学:跨尺度的自相似性,有限空间中的无限深度。 算法表达:递归细分的分支结构。每个分支略有随机化,但受黄金比例约束。L 系统或递归细分生成既数学又有机的树状形式。细微的噪声扰动打破完美对称。线宽随递归层级缩小。每个分支角度都是深度数学探索的产物。

“场动力学” 哲学:无形之力通过其对物质的影响变得可见。 算法表达:由数学函数或噪声构建的矢量场。粒子在边缘诞生,沿场线流动,在到达平衡或边界时消亡。多个场可以吸引、排斥或旋转粒子。可视化仅显示轨迹——无形之力的幽灵般证据。一个通过力平衡精心编排的计算之舞。

“随机结晶” 哲学:随机过程结晶成有序结构。 算法表达:随机圆填充或 Voronoi 镶嵌。从随机点开始,通过松弛算法演化。细胞相互推开直到平衡。基于细胞大小、邻居数量或离中心距离着色。产生的有机镶嵌既随机又必然。每个种子产生独特的结晶之美——大师级生成算法的标志。

这些是精简示例。实际的算法哲学应为 4-6 个实质性段落。

基本原则

  • 算法哲学:创建一种要通过代码表达的计算世界观
  • 过程重于产品:始终强调美从算法的执行中涌现——每次运行都是独一无二的
  • 参数化表达:思想通过数学关系、力、行为来传达——而非静态构图
  • 艺术自由:下一个 Claude 以算法方式诠释哲学——提供创作实现空间
  • 纯生成艺术:这是关于创建“活的算法”,而非带有随机性的静态图像
  • 专家工艺:反复强调最终算法必须感觉经过精心打造、通过无数次迭代精炼,并由计算美学领域顶尖专家的深度专业知识创作

算法哲学应为 4-6 段。 用富有诗意的计算哲学填充它,将预期愿景融为一体。避免重复相同的要点。将此算法哲学输出为 .md 文件。


推导概念种子

关键步骤:在实现算法之前,从原始请求中识别出微妙的概念线索。

基本原则: 概念是嵌入算法本身之中的微妙、小众参考——不总是字面意义,总是精巧的。熟悉该主题的人应直觉地感受到它,而其他人则体验到一个大师级的生成作品。算法哲学提供了计算语言。推导出的概念提供了灵魂——无形地编织进参数、行为和涌现模式的安静概念 DNA。

这非常重要:参考必须如此精炼,以至于能增强作品的深度而不张扬。想象一个爵士音乐家通过算法和声引用另一首歌——只有知道的人才会捕捉到,但每个人都能欣赏生成之美。


P5.JS 实现

在建立了哲学和概念框架之后,通过代码表达。暂停一下,整理思路后再继续。仅使用所创建的算法哲学和以下指示。

⚠️ 步骤 0:先阅读模板 ⚠️

关键:在编写任何 HTML 之前:

  1. 使用“读取”工具读取 templates/viewer.html
  2. 研究其确切结构、样式和 Anthropic 品牌标识
  3. 将该文件作为字面起点——而不仅仅是灵感
  4. 保留所有固定部分完全按样显示(头部、侧边栏结构、Anthropic 颜色/字体、种子控制、操作按钮)
  5. 只替换文件中注释标记的可变部分(算法、参数、参数的 UI 控制)

避免:

  • ❌ 从头创建 HTML
  • ❌ 发明自定义样式或配色方案
  • ❌ 使用系统字体或深色主题
  • ❌ 更改侧边栏结构

遵循以下做法:

  • ✅ 复制模板的确切 HTML 结构
  • ✅ 保留 Anthropic 品牌标识(Poppins/Lora 字体、浅色、渐变背景)
  • ✅ 保持侧边栏布局(种子 → 参数 → 颜色? → 操作)
  • ✅ 只替换 p5.js 算法和参数控制

模板是基础。在其上构建,而非重建。


要创建鲜活呼吸的画廊级计算艺术,以算法哲学为基础。

技术要求

种子随机性(Art Blocks 模式):

// 始终使用种子以确保可重现性
let seed = 12345; // 或来自用户输入的哈希值
randomSeed(seed);
noiseSeed(seed);

参数结构——遵循哲学:

要建立从算法哲学中自然涌现的参数,请考虑:“该系统的哪些属性可以调整?”

let params = {
  seed: 12345,  // 始终包含种子以确保可重现性
  // 颜色
  // 添加控制你算法的参数:
  // - 数量(多少?)
  // - 尺度(多大?多快?)
  // - 概率(多可能?)
  // - 比例(什么比例?)
  // - 角度(什么方向?)
  // - 阈值(行为何时改变?)
};

要设计有效的参数,专注于系统需要可调优的属性,而不是考虑“模式类型”。

核心算法——表达哲学:

关键:算法哲学应决定构建什么。

要通过代码表达哲学,避免思考“应该用哪种模式?”,而是思考“如何通过代码表达这种哲学?”

如果哲学关乎有机涌现,考虑使用:

  • 随时间累积或增长的元素
  • 受自然规则约束的随机过程
  • 反馈循环和交互

如果哲学关乎数学之美,考虑使用:

  • 几何关系和比例
  • 三角函数和谐波
  • 产生意外模式的精确计算

如果哲学关乎受控混沌,考虑使用:

  • 严格范围内的随机变化
  • 分叉和相变
  • 从无序中涌现的秩序

算法源自哲学,而非选项菜单。

为了指导实现,让概念本质启发创意和原创选择。构建一些表达此特定请求愿景的东西。

画布设置:标准 p5.js 结构:

function setup() {
  createCanvas(1200, 1200);
  // 初始化你的系统
}

function draw() {
  // 你的生成算法
  // 可以是静态的(noLoop)或动画的
}

工艺要求

关键:要实现大师级,创建的算法应感觉像由大师级生成艺术家通过无数次迭代涌现。仔细调优每个参数。确保每个模式都是有目的地涌现的。这不是随机噪声——这是通过深度专业知识精炼的受控混沌。

  • 平衡:复杂而不视觉噪杂,有序而不僵硬
  • 色彩和谐:深思熟虑的调色板,而非随机 RGB 值
  • 构图:即使在随机性中,也要保持视觉层次和流动
  • 性能:流畅执行,如果动画则优化为实时
  • 可重现性:相同的种子始终产生相同的输出

输出格式

输出:

  1. 算法哲学——作为解释生成美学的 markdown 或文本
  2. 单个 HTML 工件——从 templates/viewer.html 构建的自包含交互式生成艺术(见步骤 0 和下一节)

HTML 工件包含一切:p5.js(来自 CDN)、算法、参数控制和 UI——全部在一个文件中,可立即在 claude.ai 工件或任何浏览器中工作。从模板文件开始,而非从头开始。


交互式工件创建

提醒:templates/viewer.html 应该已经被读取(见步骤 0)。使用该文件作为起点。

为了允许探索生成艺术,创建一个自包含的 HTML 工件。确保此工件能立即在 claude.ai 或任何浏览器中工作——无需设置。将所有内容内联嵌入。

关键:固定与可变部分

templates/viewer.html 文件是基础。它包含了所需的确切结构和样式。

固定部分(始终完全按样包含):

  • 布局结构(头部、侧边栏、主画布区域)
  • Anthropic 品牌标识(UI 颜色、字体、渐变)
  • 侧边栏中的种子部分:
    • 种子显示
    • 上一个/下一个按钮
    • 随机按钮
    • 跳转到种子输入 + 执行按钮
  • 侧边栏中的操作部分:
    • 重新生成按钮
    • 重置按钮

可变部分(为每个艺术作品自定义):

  • 整个 p5.js 算法(setup/draw/类)
  • 参数对象(定义艺术需要什么)
  • 侧边栏中的参数部分:
    • 参数控制数量
    • 参数名称
    • 滑块的最小值/最大值/步长
    • 控制类型(滑块、输入等)
  • 颜色部分(可选):
    • 有些艺术需要颜色选择器
    • 有些艺术可能使用固定颜色
    • 有些艺术可能是单色的(无需颜色控制)
    • 根据艺术的需求决定

每个艺术作品应有独特的参数和算法! 固定部分为交互式查看器提供了可靠的基础;可变部分使每个艺术作品独特且可探索。

Individual skills in this repo

This repo contains 19 individual skills — each has its own dedicated page.

academy-guide

Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials, and use cases from Claude Academy (academy.claude.com), Anthropic's learning hub. Trigger on: "how do I", "how can I", "getting started with", "what can Claude do", "teach me", "learn to use"; questions about artifacts, projects, skills, plugins, connectors, MCP; requests about rolling Claude out to a team, class, or organization; and any ask for training materials, onboarding content, or learning resources. Use it when the user is learning how to use a feature or product — not when they are mid-task and just want the task done. This skill composes with other skills: after consulting product documentation to answer how a Claude feature works, also check here for a matching course or tutorial — a docs-grounded answer and an Academy recommendation belong together. Only recommend on a strong match; never invent Academy content.

anthropics/template-skill

Replace with description of the skill and when Claude should use it.

brand-guidelines

Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.

canvas-design

Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists

claude-api

|-

discernment-nudge

After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals, or emails, estimates or projections, analysis or interpretation of data, factual claims they may rely on, or a multi-step argument — invoke this skill BEFORE finalizing your reply and then, if it applies, append 2-3 short follow-up questions, each tied to something specific in what you just produced, that help the user check key facts, probe the reasoning or assumptions, and notice missing context. Do this at most once per conversation. Skip it when the user asked a trivial how-to or simple lookup, wants a purely educational explanation, asked you only to format, convert, or assemble a file from content they provided, is writing code they will run, is doing creative writing or casual chat, or already asked you to double-check, cite, or review — the skill file explains these boundaries and the exact output format.

doc-coauthoring

Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks.

docx

Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of

frontend-design

Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.

internal-comms

A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill whenever asked to write some sort of internal communications (status reports, leadership updates, 3P updates, company newsletters, FAQs, incident reports, project updates, etc.).

mcp-builder

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

pdf

Use this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill.

pptx

Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions \

skill-creator

Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill

slack-gif-creator

Knowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like

theme-factory

Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors/fonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.

webapp-testing

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

web-artifacts-builder

Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use for complex artifacts requiring state management, routing, or shadcn/ui components - not for simple single-file HTML/JSX artifacts.

xlsx

Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like \

相关技能