360 Secure SkillHub
360 安全技能中心

RedHat Code Generation

根据显式规格与验收标准生成可测试的 TypeScript/JavaScript/Python 代码:先校验规格并检查目标区域既有风格,生成最小、模块化实现并补充测试,输出变更文件清单、变更摘要、有序校验命令与假设说明。禁止嵌入密钥、避免动态代码执行,测试中的网络调用需显式受控或模拟。

mzfshark
mzfshark
热度 39.99
最近更新 2026-05-11 17:45:37
分类:开发依赖:读写文件 / 内部调用大模型应用场景:代码生成

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add axodus-code-generation
Metadata
name
code-generation
description
Generate production-ready code aligned to repo conventions and constraints.
metadata
{"author":"RedHat Dev","version":"1.0.0","owner":"RedHat Dev Agent","category":"core"}

SKILL: code-generation

Purpose

Generate production-ready code (TypeScript/JavaScript/Python) that matches the repo’s conventions, is testable, and is safe to run.

When to Use

  • You have an explicit spec and acceptance criteria.
  • A new module/component/function is needed.
  • Small-to-medium scoped implementation work is requested.

Inputs

  • spec (required, string|object): functional requirements + acceptance criteria.
  • language (required, enum: ts|js|py).
  • targets (optional, string[]): files/modules to create or modify.
  • constraints (optional, string[]): security/perf/compat requirements.
  • test_expectations (optional, string): tests to add/run.

Steps

  1. Validate the spec:
    • confirm inputs/outputs
    • confirm error handling
    • identify missing requirements (ask if material)
  2. Inspect existing code style and patterns in the target area.
  3. Generate minimal, modular code:
    • small functions
    • explicit types (TS) where useful
    • clear error paths
  4. Add or update tests aligned to acceptance criteria.
  5. Update docs/config only if required by the change.
  6. Provide a deterministic validation command sequence (lint/test/build).

Validation

  • Code is syntactically valid and follows project conventions.
  • Tests cover the critical behavior and fail before the fix (when applicable).
  • No secrets or credentials are introduced.
  • Any external API usage is explicit and configurable (env/config), with timeouts and retries.

Output

  • files_changed: list of paths
  • summary: what changed
  • validation_commands: ordered commands to run
  • notes: any assumptions or follow-ups

Safety Rules

  • Never embed secrets, private keys, or tokens.
  • Never introduce dynamic code execution (eval, runtime compilation) unless explicitly required and sandboxed.
  • Avoid network calls in tests unless explicitly controlled/mocked.
  • Prefer additive changes over risky rewrites.

Example

Input:

  • language: ts
  • spec: “Add parseUserId(input) that rejects non-UUID values.”

Output (excerpt):

  • files_changed: ["src/utils/ids.ts", "src/utils/ids.test.ts"]
  • validation_commands: ["pnpm test", "pnpm lint"]