NIP-C0: Code Snippets
NIP-C0 defines kind 1337 for code snippets, adding language, filename, extension, runtime, license, dependency and repository metadata so shared code can be rendered and discovered as code instead of plain notes.
Code needs syntax, license and origin metadata
Developers can paste code into any text note, but the result is poor for search, rendering and reuse. A code snippet needs language metadata, filename, extension, runtime, dependencies, license and sometimes a repository origin.
NIP-C0 defines kind 1337 for that object. The code itself lives in content. Tags describe the programming language, file name, extension, short description, runtime, SPDX license, dependencies and repository reference.
The result is not full Git collaboration. NIP-34 handles richer Git-adjacent workflows. NIP-C0 is the small shareable code object: paste a function, make it readable, make its context portable.
Kind 1337 with developer-facing tags
The l tag names the programming language in lowercase. name can be a filename, extension the file extension, description a short explanation and runtime the environment. license should use a standard SPDX short identifier. dep tags can repeat for dependencies.
The repo tag can point to a normal URL or to a NIP-34 Git repository announcement in the form 30617:<pubkey>:<d-tag>, with a relay hint.
A client that supports C0 should preserve whitespace, syntax-highlight based on language, offer copy and download actions and show licensing clearly.
Code snippets moved from NIP-95 history into C0
Christian Chiarulli added NIP-C0 Code snippets in March 2025 through PR #1852, and fiatjaf renamed the earlier 95 slot to C0 the same day. Valentino Giudice improved the file in November 2025, and mattn and Vincenzo Imperati fixed typos and links in December.
A December 2025 issue asks whether the extension tag repeats information already present in a filename and whether extension values should be lowercase. That is the kind of small detail that matters for search and client consistency.
The NIP is therefore practical and still young: useful enough to build, but not as mature as the core event and relay specs.
A code client should protect formatting and licensing
Whitespace is content in code. A client should avoid smart typography, wrapped indentation or hidden truncation that changes meaning. Copy should copy the exact snippet.
License display matters because snippets can be reused. If a user publishes code without a license, the UI should not imply it is automatically free to copy into commercial projects.
Runtime and dependencies can turn a pretty snippet into something executable. When clients offer run buttons, they need sandboxing and clear trust boundaries.
Runnable code is a security surface
A snippet can be malicious, wrong, outdated or context-dependent. Rendering code is low risk; executing it is not. Run features need isolation and user warnings.
Searchable code snippets can also leak secrets if clients make publishing too easy. Compose flows should make users review what they are signing.
Direct sources
Use the official file first, then the commit history, implementation references and adjacent standards. NIPs move, and product guidance gets weaker when those source trails are hidden.





