c-systems-programming
БесплатноБез исполняемых скриптовНе проверенUse when writing low-level system software in C requiring file I/O, process management, signals, and system calls.
от TheBushidoCollective★ 202 звезды на GitHubОб этом скилле
C Systems Programming
Master C systems programming including file I/O, process management, inter-process communication, signals, and system calls for writing robust low-level system software.
File I/O Operations
File Descriptors
File descriptors are integers that represent open files in Unix-like systems. Standard file descriptors:
0- Standard input (STDIN_FILENO)1- Standard output (STDOUT_FILENO)2- Standard error (STDERR_FILENO)
Basic File Operations
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
int main(void) {
int fd;
char buffer[1024];
ssize_t bytes_read, bytes_written;
// Open file for reading
fd = open("input.txt", O_RDONLY);
if (fd == -1) {
perror("open");
return 1;
}
// Read from file
bytes_read = read(fd, buffer, sizeof(buffer) - 1);
if (bytes_read == -1) {
perror("read");
close(fd);
return 1;
}
buffer[bytes_read] = '\0';
// Close file
if (close(fd) == -1) {
perror("close");
return 1;
}
printf("Read %zd bytes: %s\n", bytes_read, buffer);
return 0;
}
Writing to Files
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
int write_file(const char *filename, const char *data) {
int fd;
ssize_t bytes_written;
size_t len = strlen(data);
// Open file for writing, create if doesn't exist, truncate if exists
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (fd == -1) {
perror("open");
return -1;
}
// Write data
bytes_written = write(fd, data, len);
if (bytes_written == -1) {
perror("write");
close(fd);
return -1;
}
if ((size_t)bytes_written != len) {
fprintf(stderr, "Partial write: %zd of %zu bytes\n",
bytes_written, len);
close(fd);
return -1;
}
if (close(fd) == -1) {
perror("close");
return -1;
}
return 0;
}
File Positioning
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
int main(void) {
int fd;
char buffer[10];
off_t offset;
fd = open("data.txt", O_RDONLY);
if (fd == -1) {
perror("open");
return 1;
}
// Seek to byte 10 from start
offset = lseek(fd, 10, SEEK_SET);
if (offset == -1) {
perror("lseek");
close(fd);
return 1;
}
// Read 10 bytes
if (read(fd, buffer, sizeof(buffer)) == -1) {
perror("read");
close(fd);
return 1;
}
// Seek to end of file
offset = lseek(fd, 0, SEEK_END);
printf("File size: %lld bytes\n", (long long)offset);
close(fd);
return 0;
}
Process Management
Creating Processes with fork()
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
int main(void) {
pid_t pid;
int status;
printf("Parent process (PID: %d)\n", getpid());
pid = fork();
if (pid == -1) {
perror("fork");
return 1;
}
if (pid == 0) {
// Child process
printf("Child process (PID: %d, Parent: %d)\n",
getpid(), getppid());
sleep(2);
printf("Child exiting\n");
return 42;
} else {
// Parent process
printf("Parent created child (PID: %d)\n", pid);
// Wait for child to exit
if (waitpid(pid, &status, 0) == -1) {
perror("waitpid");
return 1;
}
if (WIFEXITED(status)) {
printf("Child exited with status: %d\n",
WEXITSTATUS(status));
}
}
return 0;
}
Executing Programs with exec()
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
int main(void) {
pid_t pid;
pid = fork();
if (pid == -1) {
perror("fork");
return 1;
}
if (pid == 0) {
// Child process - execute ls command
char *args[] = {"ls", "-l", "/tmp", NULL};
char *envp[] = {NULL};
execve("/bin/ls", args, envp);
// If execve returns, an error occurred
perror("execve");
return 1;
} else {
// Parent process - wait for child
int status;
waitpid(pid, &status, 0);
printf("Child completed\n");
}
return 0;
}
Process Information
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
void print_process_info(void) {
printf("Process ID (PID): %d\n", getpid());
printf("Parent Process ID (PPID): %d\n", getppid());
printf("Process Group ID (PGID): %d\n", getpgrp());
printf("User ID (UID): %d\n", getuid());
printf("Effective User ID (EUID): %d\n", geteuid());
printf("Group ID (GID): %d\n", getgid());
printf("Effective Group ID (EGID): %d\n", getegid());
}
int main(void) {
print_process_info()
Установить c-systems-programming в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
BashReadWriteEditFAQ
Что делает скилл c-systems-programming?
Use when writing low-level system software in C requiring file I/O, process management, signals, and system calls.
Как установить скилл c-systems-programming?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл c-systems-programming запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-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…
от Anthropicinternal-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…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic