Skip to content

feat(skills): add ajv-validate and background-task skills with eval framework#5834

Merged
gxkl merged 6 commits intonextfrom
feat/skills-ajv-and-background-task
Mar 17, 2026
Merged

feat(skills): add ajv-validate and background-task skills with eval framework#5834
gxkl merged 6 commits intonextfrom
feat/skills-ajv-and-background-task

Conversation

@gxkl
Copy link
Copy Markdown
Contributor

@gxkl gxkl commented Mar 17, 2026

Summary

  • Add ajv-validate.md reference for egg-controller skill (Ajv + TypeBox parameter validation)
  • Add background-task.md reference for egg-core skill (BackgroundTaskHelper async tasks)
  • Extract skills guidelines from root CLAUDE.md to packages/skills/CLAUDE.md
  • Add eval cases and document evaluation workflow

Changes

New skill content

  • egg-controller/references/ajv-validate.md — Common errors table, TypeBox schema definition, built-in formats, transform preprocessing
  • egg-core/references/background-task.md — Common errors table (setTimeout vs run()), timeout config, error handling, lifecycle explanation
  • egg-core/SKILL.md — Added async task decision tree (BackgroundTask vs EventBus vs Schedule), import path guidance
  • egg-controller/SKILL.md — Added ajv validation quick reference
  • egg/SKILL.md — Added BackgroundTaskHelper routing keywords

Eval cases

  • 7 ajv-validate cases (evals-egg-controller.json id 19-25)
  • 8 background-task cases (evals-egg-core.json id 19-26)
  • Eval workflow documented in packages/skills/CLAUDE.md with prompt templates and environment constraints

CLAUDE.md refactoring

  • Moved skills writing conventions and eval workflow to packages/skills/CLAUDE.md (loaded on demand by Claude Code)
  • Root CLAUDE.md reduced by ~160 lines

Eval results (iteration-4, 59 cases)

Category Skill wins Site-docs wins Ties
egg-core (26) 15 2 9
egg-controller (25) 14 3 8
routing (8) 6 0 2
Total 35 (59%) 5 (8%) 19 (32%)

With-skill pass rate: 100% (59/59 based on expected_output)

Test plan

  • Verify skill content accuracy with framework maintainers
  • Review eval prompt templates for fairness
  • Confirm packages/skills/CLAUDE.md loads correctly in subdirectory context

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • Documentation
    • Added comprehensive guides for API parameter validation using Ajv and TypeBox schemas
    • Introduced background task execution patterns for post-request asynchronous operations
    • Enhanced Egg Skills architecture documentation with expanded decision guides
    • Expanded evaluation examples demonstrating validation and async workflow best practices

gxkl and others added 6 commits March 16, 2026 23:25
- Add ajv-validate.md reference for egg-controller skill covering
  TypeBox schema definition, @Inject() Ajv pattern, built-in formats,
  and transform preprocessing
- Update egg-controller SKILL.md with ajv validation quick reference
  and decision tree entry
- Add import path guidance to egg-core SKILL.md (use 'egg' not
  '@eggjs/tegg')
- Add 7 ajv-related eval cases (id 19-25) to evals-egg-controller.json
- Update CLAUDE.md with skill evaluation workflow and case design
  principles

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The formatter broke the last row of the common errors table by
prepending '## ' to the pipe character.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move skill writing conventions, reference doc guidelines, and eval
workflow from root CLAUDE.md to packages/skills/CLAUDE.md. Claude Code
loads subdirectory CLAUDE.md on demand when accessing files in that
directory, keeping the root file focused on monorepo-wide concerns.

Root CLAUDE.md reduced from 1226 to 1067 lines.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add references/background-task.md covering common errors, usage,
  timeout configuration, error handling, and lifecycle explanation
- Update egg-core SKILL.md with async task decision tree and
  BackgroundTaskHelper in quick reference table
- Update entry skill routing keywords for background task queries
- Add 8 background-task eval cases (id 19-26) to evals-egg-core.json

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…te-docs)

Add section explaining the two evaluation environments: with-skill
(using packages/skills/ content) and site-docs (using site/docs/
content), with naming conventions and guidance on interpreting results.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Delegate eval execution, grading, and result display to /skill-creator
- Remove generate_review.py and directory structure implementation details
- Keep only project-specific content: prompt templates, env constraints,
  eval case design principles
- Update egg-workspace directory structure to match /skill-creator format

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 17, 2026 02:11
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the AI agent capabilities for the Egg framework by introducing two new skills: one for robust parameter validation using Ajv and TypeBox, and another for managing asynchronous background tasks. These additions aim to provide AI assistants with more precise and practical guidance for common development scenarios. Concurrently, the PR streamlines the skill documentation structure and strengthens the evaluation process, ensuring the quality and effectiveness of the AI's code generation and problem-solving abilities.

Highlights

  • New AI Agent Skills: Introduced new AI agent skills for ajv-validate (parameter validation) and background-task (asynchronous tasks) within the Egg framework, enhancing AI assistant guidance for common development scenarios.
  • Documentation Refactoring: Refactored detailed skill guidelines from the root CLAUDE.md to a dedicated packages/skills/CLAUDE.md, improving organization and enabling on-demand loading for AI assistants.
  • Enhanced Evaluation Framework: Expanded the evaluation framework with 7 new test cases for ajv-validate and 8 new test cases for background-task, and thoroughly documented the evaluation workflow to ensure skill quality.
  • Skill Integration: Updated existing SKILL.md files (egg-controller/SKILL.md, egg-core/SKILL.md, egg/SKILL.md) to seamlessly integrate the new skills, providing relevant guidance, import paths, and routing keywords.
Changelog
  • CLAUDE.md
    • Simplified the root CLAUDE.md by moving detailed skill guidelines to a new dedicated file.
  • packages/skills/CLAUDE.md
    • Created a new file to centralize comprehensive skill writing conventions and the evaluation workflow.
  • packages/skills/egg-controller/SKILL.md
    • Updated the controller skill to include a quick reference for Ajv parameter validation and linked to its detailed reference document.
  • packages/skills/egg-controller/references/ajv-validate.md
    • Added a new reference document providing detailed guidance on Ajv parameter validation, covering common errors, usage, schema definition, and best practices.
  • packages/skills/egg-core/SKILL.md
    • Enhanced the core skill with import path guidance and a decision tree for selecting appropriate asynchronous task mechanisms, linking to the background task reference.
  • packages/skills/egg-core/references/background-task.md
    • Added a new reference document for BackgroundTaskHelper, explaining its usage, timeout configuration, error handling, and underlying principles.
  • packages/skills/egg/SKILL.md
    • Modified the entry skill to include "BackgroundTaskHelper" as a routing keyword, improving AI's ability to route queries related to asynchronous tasks.
  • packages/skills/eval/evals-egg-controller.json
    • Updated the evaluation description and incorporated 7 new test cases specifically for Ajv parameter validation.
  • packages/skills/eval/evals-egg-core.json
    • Updated the evaluation description and added 8 new test cases for background tasks.
Activity
  • The author implemented new AI agent skills for ajv-validate and background-task.
  • Skill guidelines were refactored from the root CLAUDE.md to packages/skills/CLAUDE.md.
  • New evaluation cases were added for both ajv-validate (7 cases) and background-task (8 cases).
  • Evaluation results for iteration-4 (59 cases) were provided, showing 35 skill wins, 5 site-docs wins, and 19 ties, with a 100% pass rate for with-skill based on expected output.
  • A test plan was outlined to verify skill content accuracy, fairness of eval prompt templates, and correct loading of packages/skills/CLAUDE.md.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 17, 2026

📝 Walkthrough

Walkthrough

Restructures and expands the Skills Package documentation in the Egg framework. Replaces the root CLAUDE.md guide with a concise summary, adds comprehensive skill architecture documentation at packages/skills/CLAUDE.md, introduces new reference guides for Ajv parameter validation and background task handling, updates existing skill SKILL.md files with new guidance, and adds evaluation test cases covering these new topics.

Changes

Cohort / File(s) Summary
Root documentation restructuring
CLAUDE.md
Replaced extensive bilingual detailed guide with concise English-focused summary pointing to packages/skills/CLAUDE.md for full guidance.
Comprehensive skill guidance
packages/skills/CLAUDE.md
New documentation covering skills architecture, frontmatter conventions, professional skill organization modes, content structure, workflow guidelines, adding new skills/references, and skill evaluation framework.
Parameter validation documentation
packages/skills/egg-controller/SKILL.md, packages/skills/egg-controller/references/ajv-validate.md
Added Ajv + TypeBox parameter validation guidance with import paths, usage patterns, common issues, and comprehensive controller-based examples.
Background task documentation
packages/skills/egg-core/SKILL.md, packages/skills/egg-core/references/background-task.md
Added import path clarification, async task selection guidance, and detailed BackgroundTaskHelper reference covering lifecycle, configuration, error handling, and timeout management.
Skill inventory updates
packages/skills/egg/SKILL.md
Minor additions to decision guide and trigger keywords for background task support.
Evaluation test cases
packages/skills/eval/evals-egg-controller.json, packages/skills/eval/evals-egg-core.json
Added evaluation scenarios for Ajv parameter validation (ids 19–25) and background task handling (ids 18–26) with multiple test prompts and implementation examples.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • docs: init skills #5783 — Directly related "init skills" PR that similarly modifies packages/skills documentation and skill files structure.

Suggested reviewers

  • fengmk2
  • akitaSummer
  • killagu

Poem

🐰 A rabbit hops through skills so bright,
With Ajv validation done just right,
And background tasks that gently run,
Documentation makes it fun!
More guides to hop, more eval to test, 🌟

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main additions: two new skill references (ajv-validate and background-task) and an evaluation framework with corresponding eval cases.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/skills-ajv-and-background-task
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

You can disable sequence diagrams in the walkthrough.

Disable the reviews.sequence_diagrams setting to disable sequence diagrams in the walkthrough.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying egg with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2bfa2fb
Status: ✅  Deploy successful!
Preview URL: https://4b8724bf.egg-cci.pages.dev
Branch Preview URL: https://feat-skills-ajv-and-backgrou.egg-cci.pages.dev

View logs

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying egg-v3 with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2bfa2fb
Status: ✅  Deploy successful!
Preview URL: https://e4b65b11.egg-v3.pages.dev
Branch Preview URL: https://feat-skills-ajv-and-backgrou.egg-v3.pages.dev

View logs

@gxkl gxkl requested review from akitaSummer and killagu March 17, 2026 02:14
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces two new skills, ajv-validate and background-task, for the AI agent, along with their corresponding documentation and evaluation frameworks. The changes also include a significant refactoring of the skills documentation, moving detailed guidelines into a dedicated packages/skills/CLAUDE.md file. My review focuses on ensuring consistency within the new and updated documentation. I've pointed out a couple of minor inconsistencies: one regarding outdated skill descriptions in the new central documentation file, and another where an example doesn't follow a recommended best practice mentioned elsewhere. Overall, this is a well-structured addition that enhances the agent's capabilities and maintainability of the skills documentation.

Comment on lines +13 to +14
- `egg-core/` — 核心概念:模块、依赖注入、生命周期、AccessLevel
- `controller/` — 实现指导:HTTPController、MCPController、Schedule
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There are a few minor inconsistencies in this document that could be aligned with the rest of the project's conventions and the changes in this PR:

  1. The skill descriptions for egg-core and egg-controller are slightly out of date. egg-core is missing the new background task capability, and egg-controller is missing the Ajv validation capability.
  2. The skill name controller/ should be egg-controller/ to align with the naming convention. This also applies to line 42 and line 99.
Suggested change
- `egg-core/` — 核心概念:模块、依赖注入、生命周期、AccessLevel
- `controller/` — 实现指导:HTTPController、MCPController、Schedule
- `egg-core/` — 核心概念:模块、依赖注入、生命周期、AccessLevel、后台任务
- `egg-controller/` — 实现指导:HTTPController、MCPController、Schedule、Ajv 校验

});

// 2. 从 Schema 推导类型
type CreateUserParams = Static<typeof CreateUserSchema>;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This example uses a type alias to derive the TypeScript type from the schema. However, packages/skills/egg-controller/SKILL.md (in the '常见问题排查' table) recommends using interface ... extends Static<...> for better type inference. To maintain consistency and promote best practices, this example should also use an interface.

Suggested change
type CreateUserParams = Static<typeof CreateUserSchema>;
interface CreateUserParams extends Static<typeof CreateUserSchema> {}

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (1)
packages/skills/egg/SKILL.md (1)

29-39: Keep routing tables consistent with the new background-task intent.

Line 29 and Line 38 add BackgroundTaskHelper routing signals, but the “协议/用例”表 and “快速参考表” still don’t include this scenario. Consider adding one row in each table so all decision sections stay aligned.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/skills/egg/SKILL.md` around lines 29 - 39, The docs added
BackgroundTaskHelper to the trigger keywords but did not update the routing
decision tables; update both the “协议/用例” table and the “快速参考表” to include a row
describing the background-task scenario (use BackgroundTaskHelper, background
task/async task, post-response execution) so the routing tables reflect the new
background-task intent and remain consistent with the triggers shown in the
list; ensure the new rows reference BackgroundTaskHelper and a concise
decision/action for routing.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/skills/CLAUDE.md`:
- Line 14: Update the documentation line that currently names the skill
directory as "controller/" to the correct specialized skill name
"egg-controller/" so it matches the frontmatter convention and related files
(e.g., egg-controller/SKILL.md and evals-egg-controller.json); locate the string
in CLAUDE.md (the line listing controller/) and replace it with
"egg-controller/" ensuring the naming is consistent with the rest of the PR.
- Line 115: In CLAUDE.md update the fenced code block that contains the path
"packages/skills/eval/" to include a language specifier (e.g., change the
opening triple backticks from ``` to ```text) so the block renders and lints
correctly; locate the fence in the file CLAUDE.md around the
"packages/skills/eval/" snippet and replace the code fence accordingly.
- Line 172: The fenced code block that begins before the prompt template ("你是
EGG 框架开发专家。你只能通过 Read 工具读取 packages/skills/ 目录下的文件,不能访问 site/docs/ 或项目源码。") is
missing a language specifier; update the opening fence to include a language
(e.g., change ``` to ```text or ```markdown) so the code block renders and lints
correctly in CLAUDE.md.
- Line 183: The fenced code block in CLAUDE.md is missing a language specifier;
update the code fence that currently reads "```" to include a language (e.g.,
"```text" or "```markdown") so the prompt template renders and lints
correctly—locate the code block around the text starting "你是 EGG 框架开发专家..." and
change the opening fence to "```text" as shown in the proposed fix.

---

Nitpick comments:
In `@packages/skills/egg/SKILL.md`:
- Around line 29-39: The docs added BackgroundTaskHelper to the trigger keywords
but did not update the routing decision tables; update both the “协议/用例” table
and the “快速参考表” to include a row describing the background-task scenario (use
BackgroundTaskHelper, background task/async task, post-response execution) so
the routing tables reflect the new background-task intent and remain consistent
with the triggers shown in the list; ensure the new rows reference
BackgroundTaskHelper and a concise decision/action for routing.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 65d6e0cc-ec08-4f13-a48d-ed52b1857a1a

📥 Commits

Reviewing files that changed from the base of the PR and between 29eac24 and 2bfa2fb.

📒 Files selected for processing (9)
  • CLAUDE.md
  • packages/skills/CLAUDE.md
  • packages/skills/egg-controller/SKILL.md
  • packages/skills/egg-controller/references/ajv-validate.md
  • packages/skills/egg-core/SKILL.md
  • packages/skills/egg-core/references/background-task.md
  • packages/skills/egg/SKILL.md
  • packages/skills/eval/evals-egg-controller.json
  • packages/skills/eval/evals-egg-core.json

- **入口 skill** (`egg/`) — 分析用户意图,通过关键词匹配和决策逻辑路由到专业 skill
- **专业 skills** — 提供特定领域的深度指导:
- `egg-core/` — 核心概念:模块、依赖注入、生命周期、AccessLevel
- `controller/` — 实现指导:HTTPController、MCPController、Schedule
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix skill directory naming to match frontmatter convention.

This line lists controller/ but should be egg-controller/ to match the frontmatter naming convention stated at line 18 (specialized skills prefixed with egg-). Other files in this PR (egg-controller/SKILL.md, evals-egg-controller.json) confirm the correct name is egg-controller.

📝 Proposed fix
-  - `controller/` — 实现指导:HTTPController、MCPController、Schedule
+  - `egg-controller/` — 实现指导:HTTPController、MCPController、Schedule
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- `controller/` — 实现指导:HTTPController、MCPController、Schedule
- `egg-controller/` — 实现指导:HTTPController、MCPController、Schedule
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/skills/CLAUDE.md` at line 14, Update the documentation line that
currently names the skill directory as "controller/" to the correct specialized
skill name "egg-controller/" so it matches the frontmatter convention and
related files (e.g., egg-controller/SKILL.md and evals-egg-controller.json);
locate the string in CLAUDE.md (the line listing controller/) and replace it
with "egg-controller/" ensuring the naming is consistent with the rest of the
PR.


**评测文件结构:**

```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add language specifier to code block.

The fenced code block should specify a language for proper rendering and linting compliance.

📝 Proposed fix
-```
+```text
 packages/skills/eval/
🧰 Tools
🪛 markdownlint-cli2 (0.21.0)

[warning] 115-115: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/skills/CLAUDE.md` at line 115, In CLAUDE.md update the fenced code
block that contains the path "packages/skills/eval/" to include a language
specifier (e.g., change the opening triple backticks from ``` to ```text) so the
block renders and lints correctly; locate the fence in the file CLAUDE.md around
the "packages/skills/eval/" snippet and replace the code fence accordingly.


with-skill 环境:

```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add language specifier to code block.

The prompt template should specify a language (e.g., text or markdown) for proper rendering and linting compliance.

📝 Proposed fix
-```
+```text
 你是 EGG 框架开发专家。你只能通过 Read 工具读取 packages/skills/ 目录下的文件,不能访问 site/docs/ 或项目源码。
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```
🧰 Tools
🪛 markdownlint-cli2 (0.21.0)

[warning] 172-172: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/skills/CLAUDE.md` at line 172, The fenced code block that begins
before the prompt template ("你是 EGG 框架开发专家。你只能通过 Read 工具读取 packages/skills/
目录下的文件,不能访问 site/docs/ 或项目源码。") is missing a language specifier; update the
opening fence to include a language (e.g., change ``` to ```text or ```markdown)
so the code block renders and lints correctly in CLAUDE.md.


site-docs 环境:

```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add language specifier to code block.

The prompt template should specify a language (e.g., text or markdown) for proper rendering and linting compliance.

📝 Proposed fix
-```
+```text
 你是 EGG 框架开发专家。你只能通过 Read 工具读取 site/docs/ 目录下的文件,不能访问 packages/skills/ 或项目源码。项目文档目录如下:
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```
🧰 Tools
🪛 markdownlint-cli2 (0.21.0)

[warning] 183-183: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/skills/CLAUDE.md` at line 183, The fenced code block in CLAUDE.md is
missing a language specifier; update the code fence that currently reads "```"
to include a language (e.g., "```text" or "```markdown") so the prompt template
renders and lints correctly—locate the code block around the text starting "你是
EGG 框架开发专家..." and change the opening fence to "```text" as shown in the
proposed fix.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR expands the @eggjs/skills documentation/eval corpus by adding new reference guides for Ajv validation and background tasks, wiring them into the existing skill routing, and documenting the skills authoring + evaluation workflow.

Changes:

  • Add new reference docs: egg-controller/references/ajv-validate.md and egg-core/references/background-task.md, and link them from the relevant SKILL.md files.
  • Extend eval suites for egg-core and egg-controller with new cases covering background-task and ajv-validate scenarios.
  • Move skills authoring/eval conventions from root CLAUDE.md into packages/skills/CLAUDE.md and simplify the root doc.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
packages/skills/eval/evals-egg-core.json Adds background-task eval cases and updates eval suite description.
packages/skills/eval/evals-egg-controller.json Adds ajv-validate eval cases and updates eval suite description.
packages/skills/egg/SKILL.md Adds routing keywords/coverage for BackgroundTaskHelper.
packages/skills/egg-core/references/background-task.md New BackgroundTaskHelper reference guide (usage, timeout, error handling, rationale).
packages/skills/egg-core/SKILL.md Adds import-path guidance and async-task decision guidance linking to the new reference.
packages/skills/egg-controller/references/ajv-validate.md New Ajv + TypeBox validation reference guide (imports, schema patterns, formats, transforms).
packages/skills/egg-controller/SKILL.md Adds Ajv validation quick reference and troubleshooting entries.
packages/skills/CLAUDE.md New centralized skills writing + evaluation workflow documentation.
CLAUDE.md Removes the moved skills guideline section and replaces it with a pointer to packages/skills/CLAUDE.md.

You can also share your feedback on Copilot code review. Take the survey.

### 完整示例

```typescript
// app/modules/demo/FooController.ts
- **入口 skill** (`egg/`) — 分析用户意图,通过关键词匹配和决策逻辑路由到专业 skill
- **专业 skills** — 提供特定领域的深度指导:
- `egg-core/` — 核心概念:模块、依赖注入、生命周期、AccessLevel
- `controller/` — 实现指导:HTTPController、MCPController、Schedule
Comment on lines +19 to +20
通过 `@Inject()` 注入 `BackgroundTaskHelper`,调用 `run()` 方法。`run()` 接受一个异步函数,在请求返回后执行。

Comment on lines +31 to +34
this.backgroundTaskHelper.run(async () => {
// 这里的代码在 HTTP 响应发送后执行
// 可以安全访问注入的服务和上下文
await this.sendMetrics(data);
this.backgroundTaskHelper.run(async () => {
// 即使这里抛出异常,也不会影响其他后台任务或框架
throw new Error('something went wrong');
// 错误会被记录为: [BackgroundTaskHelper] background throw error: something went wrong
path: '/api/users',
})
async create(@HTTPBody() body: CreateUserParams) {
// 校验失败自动抛出 AjvInvalidParamError(422)
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.63%. Comparing base (29eac24) to head (2bfa2fb).
⚠️ Report is 1 commits behind head on next.

Additional details and impacted files
@@           Coverage Diff           @@
##             next    #5834   +/-   ##
=======================================
  Coverage   85.62%   85.63%           
=======================================
  Files         665      665           
  Lines       13004    13004           
  Branches     1495     1495           
=======================================
+ Hits        11135    11136    +1     
+ Misses       1745     1744    -1     
  Partials      124      124           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

@killagu killagu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gxkl gxkl merged commit 4417c8f into next Mar 17, 2026
53 of 55 checks passed
@gxkl gxkl deleted the feat/skills-ajv-and-background-task branch March 17, 2026 09:51

`packages/skills/` 目录包含 AI agent skills — 纯 markdown 文档,指导 AI 助手使用 Egg 框架。以 `@eggjs/skills` npm 包发布,仅含 `.md` 文件。

> **Skill 编写基础知识**:SKILL.md 格式、frontmatter 规范、目录结构、progressive disclosure、写作风格等通用知识请使用 `/ant-skill-creator` skill 获取指导。以下仅记录 Egg 项目特有的约定。
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/ant-skill-creator 这是在那里配置的?我试了一下 cc 里面没有出来这个命令

gxkl added a commit that referenced this pull request Mar 17, 2026
- Fix skill directory naming: controller/ → egg-controller/ in CLAUDE.md
- Fix /ant-skill-creator → /skill-creator reference
- Add language specifiers to fenced code blocks
- Update egg-core/egg-controller descriptions with new capabilities
- Fix BackgroundTaskHelper.run() execution timing: task starts
  immediately, framework waits at Context preDestroy
- Fix error log format to match implementation (no space after colon)
- Fix example file path to match module directory convention
- Remove hardcoded 422 status from AjvInvalidParamError description

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@gxkl gxkl mentioned this pull request Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants