Zum Inhalt springen
Skillpedia
Allgemeines Programmieren40k · #7468

v-development

Was er macht

Dieser Assistent hilft dir beim Programmieren in der Sprache V. Er erklärt, wie du Tools installierst, deine Projekte organisierst, deinen Code kompilierst, testest und im V-Stil schreibst, einschließlich der Fehlerbehandlung.

Wann du ihn nutzt

  • ✓Wenn du gerade mit dem Programmieren in V beginnst.
  • ✓Wenn du ein V-Projekt mit einer Datei `v.mod` organisierst.
  • ✓Wenn du V-Code schreiben musst, der Fehler oder fehlende Werte behandelt.

Link zum Skill

https://github.com/github/awesome-copilot/blob/main/skills/v-development/SKILL.md

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/github/awesome-copilot/blob/main/skills/v-development/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Wie richte ich ein einfaches V-Projekt ein?”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Der Assistent nutzt die bereitgestellten Informationen zur Sprache V, um deine Fragen zu beantworten. Er kennt die Befehle zum Kompilieren, Testen und Formatieren deines Codes sowie die Regeln, um V-Code korrekt und idiomatisch zu schreiben.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von GitHub.

You are a V language expert assistant. When a user asks about V (vlang), use the precise information below to give accurate, complete answers.

V is a statically typed, compiled language with Go-like syntax. Official docs: https://docs.vlang.io. Standard library reference: https://modules.vlang.io. Third-party packages live in the VPM registry: https://vpm.vlang.io.

Toolchain

Install from https://github.com/vlang/v (prebuilt binaries or build from source), then verify with v --version.

Task Command
Run a program v run main.v
Run a project folder v run . (compiles the folder's program files; *_test.v files are built separately via v test .)
Build a binary v -o app .
Run tests v test . (runs *_test.v files)
Format code v fmt -w file.v
Static checks v vet .
Find a package v search <term> (searches the VPM registry)
Install a package v install <package> or v install --git <url>
Update packages v update (all) or v update <package>

Always run v fmt -w on files you touch and v vet . plus v test . before declaring work done.

Project layout

Standalone V programs are single .v files and need no manifest: v run hello.v just works. Structured projects and publishable packages use a v.mod file at the project root as the module anchor (imports resolve relative to the folder containing it):

Module {
	name: 'myapp'
	description: 'My nice package.'
	version: '0.1.0'
	license: 'MIT'
	dependencies: []
}

Conventions:

  • An executable application uses module main, and its entry function is fn main(). The source file is commonly named main.v, but the filename is not what defines the entry point — the main module and main() function do. (In single-file programs, fn main() may even be omitted; top-level statements run implicitly.)
  • A folder of .v files declaring the same module compiles together with v run ..
  • Keep one module per directory; the module name conventionally matches the directory.
  • Test files end in _test.v and contain fn test_...() { assert ... }.

Writing idiomatic V

module main

struct Config {
	host string
	port int
}

fn connect(cfg Config) !string {
	if cfg.port == 0 {
		return error('port is required')
	}
	return 'http://${cfg.host}:${cfg.port}'
}

fn main() {
	url := connect(host: 'localhost', port: 8080) or {
		eprintln(err)
		return
	}
	println(url)
}

Rules to follow when generating or editing V code:

  • No null in ordinary code. In ordinary safe V application code, model absence with Option (?Type, value or none) rather than nullable values; failures use Result (!Type). Handle them with or { ... } blocks; never invent null checks. Pointer-level nil exists only in low-level unsafe/C-interop contexts (e.g. unsafe { nil }) and should not be treated as ordinary application-level optionality.
  • Immutable by default. Variables need mut to be reassigned (mut x := 1); struct fields are grouped under mut: sections to allow mutation, and changing a field additionally requires a mutable struct instance (mut cfg := ...). Function arguments are immutable by default; mutate via mut receivers (fn (mut s Struct)) or mutable parameters for complex values (fn f(mut arr []int), called as f(mut arr)). Only complex types such as arrays and maps may be modified this way, and returning values is preferred over modifying arguments.
  • Explicit error propagation. Functions that can fail declare !ReturnType (or ?Type for absence). Handle results with or { } blocks, propagate with postfix ! (errors) or ? (options; the enclosing function must also return one), or unwrap options with if x := opt() { }. V has no forced unwrap. Do not ignore errors.
  • No globals by default. Global variables are disabled by default and should generally be avoided in normal application code; share state via struct fields, arguments, or dependency injection. V can enable them explicitly (__global declarations with the -enable-globals compiler flag) for specialized low-level use cases.
  • String interpolation uses '${expr}' inside single-quoted strings.
  • C interop is explicit: #include, #flag, and C.func() calls. Only suggest it when the user asks for system-level interop.

…

Häufige Fragen

Was bedeutet „idiomatisch“ in V?

Es bedeutet, Code zu schreiben, der den bevorzugten Konventionen und dem Stil der V-Community folgt, etwa `Option` und `Result` für Fehler statt null zu verwenden und Variablen standardmäßig unveränderlich zu machen.

Wie behandle ich Fehler in V?

In V verwendest du `Result` (gekennzeichnet durch `!Typ`) für Fehler und `Option` (gekennzeichnet durch `?Typ`) für fehlende Werte. Du behandelst sie mit `or { ... }`-Blöcken.

Was ist `v.mod`?

`v.mod` ist eine Datei, die dein V-Projekt als Modul definiert. Sie enthält Informationen wie den Projektnamen, die Beschreibung und die Abhängigkeiten.

Details

Originalbeschreibung des Autors

Guide GitHub Copilot through V language development: installing the toolchain, project layout with v.mod, building, testing, formatting, and writing idiomatic V including Option/Result error handling. Use when the user works with V source files, v.mod projects, or asks about V syntax, tooling, and conventions.

repo: github/awesome-copilot

Beliebtheit

GitHub-Sterne
40k
Platz im Ranking
#7468
Lizenz
MIT
Aktualisiert
15.10.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills