code-generation
Trigger: new file, function, code generation, script, boilerplate, scaffold. Write code matching codebase patterns.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-10
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- code-generation
- triggers
- new file, new function, code generation, script, boilerplate, scaffold, create code, write code
- changelog
- docs/ciclos/cycle28-20260815.md
- description
- Trigger: new file, function, code generation, script, boilerplate, scaffold. Write code matching codebase patterns.
- token_budget
- 2850
03 SKILL.md 正文
When to Use
New files, new functions, scripts, boilerplate. NOT for debugging (→ deep-debugging) or single-line fixes on existing files (→ quick-executor).
WORKFLOW
- CONTEXT: Read target dir → identify 2-3 relevant files by: (a) files imported by target path, (b) files in same module, (c) similar naming. Read each. Match patterns (imports, naming, error handling, types).
- GENERATE: Match codebase conventions. Quality floor: if neighbors use anti-patterns (raw SQL, no error handling, global state), flag to user: "Neighboring code uses X (anti-pattern). Suggesting Y instead." Match conventions, but don't propagate bad patterns silently.
- VALIDATE: Syntax check. Run lint/typecheck if exists.
- EDGE CASES: For each public function: null/empty, error states, boundary values. Domain-specific: data layer (connection failures, timeouts), API (auth, rate limiting, malformed input), UI (empty states, loading), CLI (invalid flags, help text).
STANDARDS
- Match import style, naming, error handling, type system
- Every function: input validation + error handling + one clear purpose
- No new deps unless codebase already uses them
- Tests → detect framework → write matching patterns
OUTPUT
Created/modified [file]. Pattern matched from [source]. Ready for review.
Rules
- Read before write. Never generate without seeing patterns. 2. Existing files → patch-first. New files → full write. 3. New dependency → STOP, report [name]+[why]+[alternative].
Anti-Rationalization
| Rationalization | Red Flag | Verification |
|---|---|---|
| "boilerplate sin leer patrones del repo" | Generar sin leer 2-3 archivos vecinos | WORKFLOW CONTEXT: Read target dir + match patterns |
| "un archivo gigante en vez de módulos" | Monolito sin one clear purpose |
STANDARDS one purpose + patch-first rule |
| "tests después si queda tiempo" | Tests postergados | WORKFLOW VALIDATE + Rule Tests detect framework |
Red Flags
- Doing work without checking output format → STOP, re-read skill
- Second occurrence of same rationalization → force RED zone
Verification
- Output matches skill ## Output contract + file:line citaton
- cross-ref-check.ps1 → SKILL.md OK
Refs
quick-executor · commit-crafter · quality-gate
docs/skills/code-generation/reference.md
04 同仓库更多 Skills
web-quality-audit
Comprehensive web audit: performance, a11y, SEO, responsive, animation, design tokens.
ui-engine
UI system — Grid/Flexbox/@layer/:has(), container queries, compositor-only animation, OKLCH tokens, component patterns
baseline-ui
Anti-slop UI — layout, typography, responsive, animation, tokens. Use for cleanup or polish.
skill-creator
Create new AI agent skills following Agent Skills spec -- auto-bootstrap unknown tasks, define structure, register in AGENTS.md
senior-engineer
Apply senior engineering competencies — system design, trade-off analysis, delegation, mentoring, and tech debt strategy
prompt-engineering
Design effective prompts using SPEARS framework — scope, principles, examples, assertions, refinements, with ReAct and multi-agent patterns