code-generator

A guide for generating source code, project scaffolds, configuration files, documentation, and tests from requirements or templates.

In plain words
What is it for?
Creating functions, classes, modules, packages, complete project structures, configuration files, examples, and unit tests in several common programming languages.
Why use it?
It reduces repetitive setup work and encourages consistent structure, error handling, documentation, and testing.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/full-stack-skills/agent-skills/code-generator
Any agent
npx skills add full-stack-skills/agent-skills --skill code-generator
Clone the repo
git clone --depth 1 https://github.com/full-stack-skills/agent-skills

Made for: Claude Code, Codex.

Per session 49 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 923 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00049 $0.00923
Opus 5 $0.00024 $0.00462
Sonnet 5 $0.00010 $0.00185
Haiku 4.5 $0.00005 $0.00092

Measured 2d ago against content hash 063481f4ac6b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

code-generator scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/code-generator/SKILL.md · 115 lines

What it actually says

代码生成技能

概述

本技能帮助您生成高质量的代码,支持多种编程语言,遵循最佳实践和设计模式。

关键词: 代码生成、编程、函数、类、模块、项目开发、代码示例

核心功能

1. 函数和类生成

  • 生成符合规范的函数和类
  • 添加完整的文档注释
  • 实现错误处理和边界检查
  • 遵循语言特定的最佳实践

2. 模块和包开发

  • 创建结构化的模块和包
  • 设计清晰的 API 接口
  • 实现模块间的依赖管理
  • 创建配置文件和初始化代码

3. 项目脚手架

  • 生成完整的项目结构
  • 创建配置文件(package.json, requirements.txt 等)
  • 设置构建和测试环境
  • 添加 README 和文档

4. 代码优化和重构

  • 优化代码性能和可读性
  • 应用设计模式和最佳实践
  • 重构代码结构
  • 添加单元测试

使用指南

代码生成原则

  1. 清晰性: 代码应清晰易懂,命名规范
  2. 可维护性: 结构良好,易于修改和扩展
  3. 健壮性: 包含错误处理和边界检查
  4. 文档化: 提供完整的注释和文档
  5. 测试性: 代码应易于测试

支持的编程语言

  • Python
  • JavaScript/TypeScript
  • Java
  • Go
  • Rust
  • 其他常见编程语言

代码结构要求

  • 导入部分: 清晰的导入语句
  • 文档字符串: 函数和类的文档
  • 实现代码: 核心逻辑实现
  • 测试代码: 单元测试(如需要)
  • 示例代码: 使用示例(如需要)

输出格式

生成的代码应包含:

  • 代码文件: 完整的源代码文件
  • 文档注释: 函数、类、模块的文档
  • 使用示例: 代码使用示例
  • 依赖说明: 所需的依赖和版本
  • 测试代码: 相关的测试用例

最佳实践

  • 遵循语言的编码规范和风格指南
  • 使用有意义的变量和函数名
  • 添加类型提示(如适用)
  • 实现适当的错误处理
  • 编写清晰的文档注释
  • 考虑性能和可扩展性
  • 遵循 SOLID 原则和设计模式

常见陷阱 (Gotchas)

  1. 版本兼容性:注意框架版本与依赖库的兼容性,不同版本 API 可能有差异
  2. 配置文件格式:配置文件格式错误是最常见的问题,建议使用编辑器的语法检查
  3. 环境变量:确保所有必要的环境变量已正确设置,敏感信息不要硬编码
  4. 依赖冲突:多版本共存时注意依赖冲突,使用 lock 文件锁定版本
  5. 性能陷阱:大数据量场景下注意性能优化,避免 N+1 查询等常见问题

使用流程

Step 1: 环境准备

确保开发环境已安装必要的依赖和工具。

Step 2: 配置初始化

根据项目需求进行基础配置。

Step 3: 核心功能使用

按照示例代码实现核心功能。

Step 4: 测试验证

运行测试确保功能正常。

Step 5: 部署上线

完成开发后进行部署和监控。

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 115 lines · 49 tokens per session scan A 063481f4ac6b

Subscribe to this mod's changes

code-generator is a skill published in the GitHub repository full-stack-skills/agent-skills (2 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 49 tokens to every session and 923 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.

obra/superpowers · 37 tokens

auto-perf-optimize

Run agent-driven VS Code performance or memory investigations. Use when asked to launch Code OSS, automate a VS Code scenario, run the Chat memory smoke runner, capture renderer heap snapshots, take workflow screenshots, compare run summaries, or drive a repeatable scenario before heap-snapshot analysis.

microsoft/vscode · 62 tokens

chat-perf

Run chat perf benchmarks and memory leak checks against the local dev build or any published VS Code version. Use when investigating chat rendering regressions, validating perf-sensitive changes to chat UI, or checking for memory leaks in the chat response pipeline.

microsoft/vscode · 51 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens