Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions .agents/skills/mpx2rn/references/rn-style-practice.md
Original file line number Diff line number Diff line change
Expand Up @@ -478,13 +478,15 @@ px 和 rpx 在 RN 与小程序平台都具备良好兼容性,建议优先使

**⚠️ 需要辅助属性的场景:**

1. **`font-size` 的百分比**需要传递 `parent-font-size` 辅助属性
1. **字体相关百分比**会优先基于当前或继承文本字号解析;没有可继承字号时按默认字号 `16` 计算
2. **`calc()` 中出现的任何百分比**都需要传递相应的 `parent-width` / `parent-height` 辅助属性(`calc()` 是框架模拟支持的特性)

```html
<template>
<!-- 场景1:font-size 百分比需要 parent-font-size -->
<view parent-font-size="{{16}}" class="text" />
<!-- 场景1:优先通过文本样式继承提供 font-size 百分比基准 -->
<view class="text-parent">
<text class="text">文本</text>
</view>

<!-- 场景2:仅在无法替代时,calc() 中的百分比需要父级布局宽高辅助计算 -->
<view id="calc-parent" class="calc-parent" wx:ref>
Expand Down Expand Up @@ -524,7 +526,11 @@ export default {

<style>
.text {
font-size: 120%; /* 需要 parent-font-size */
font-size: 120%; /* 优先基于继承字号;无继承字号时按默认字号 16 计算 */
}

.text-parent {
font-size: 16px;
}

.calc-parent {
Expand All @@ -549,9 +555,8 @@ export default {

1. **优先使用 rpx**:对于固定尺寸,rpx 是最可靠的选择
2. **放心使用百分比**:`width`, `height`, `padding`, `margin` 等属性的百分比由 RN 原生支持,可以放心使用
3. **谨慎使用字体百分比**:`font-size` 的百分比需要 `parent-font-size` 辅助属性,建议使用 rpx 代替
4. **谨慎使用 calc() 中的百分比**:该写法需要 `parent-width` / `parent-height` 辅助计算,通常还要查询父级布局并延迟展示,存在性能与体验开销;优先使用原生百分比、Flex、rpx / vw / vh 或固定尺寸替代
5. **使用 vh/vw**:对于视口相关的尺寸,vh/vw 是更好的选择
3. **谨慎使用 calc() 中的百分比**:该写法需要 `parent-width` / `parent-height` 辅助计算,通常还要查询父级布局并延迟展示,存在性能与体验开销;优先使用原生百分比、Flex、rpx / vw / vh 或固定尺寸替代
4. **使用 vh/vw**:对于视口相关的尺寸,vh/vw 是更好的选择

### 1 像素边框(极细线)

Expand Down
8 changes: 5 additions & 3 deletions .agents/skills/mpx2rn/references/rn-style-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,12 @@ mpx.config.rnConfig = Object.assign({}, mpx.config.rnConfig, {

1. **原生支持(基于父节点宽高)**: `width`、`height`、`left`、`right`、`top`、`bottom`、`margin`、`padding` 等属性。

2. **需辅助属性(基于父节点字体)**: `font-size` 的百分比计算依赖开发者传入的 `parent-font-size` 属性
2. **文本字号相关百分比**:`font-size` / `line-height` 的百分比在文本样式透传阶段解析,基准优先使用当前已解析的 `font-size`、继承文本样式中的 `font-size`,若都不存在则使用默认字号 `16`

```html
<text parent-font-size="16" style="font-size: 120%;">文本内容</text>
<view style="font-size: 16px;">
<text style="font-size: 120%;">文本内容</text>
</view>
```

3. **基于自身宽高计算**: `translateX`、`translateY`、`border-radius` 的百分比都是根据自身宽高来计算的(首次渲染不展示,在 `onLayout` 后计算生效)。其中 `translateX` / `translateY` 的百分比计算依赖 class 样式的编译转换;内联 `style` 中的字符串 transform 不会触发该计算。
Expand Down Expand Up @@ -559,7 +561,7 @@ Mpx 在 RN 平台支持 CSS 背景图及渐变背景,框架会自动处理样
| `color` | `color` | - | 文本颜色 | `color: #333`;`color: rgba(0, 0, 0, 0.8)` |
| `font` | `[font-style] [small-caps] [font-weight] font-size [ / line-height ] font-family` | - | 字体简写,展开为字体相关长属性;`font-size` 与 `font-family` 必填,`/` 两侧可有空格 | `font: italic bold 16px / 1.5 Arial` |
| `font-family` | `string` | - | 字体(仅支持单字体),多字体 fallback 自动取首值并去除引号 | `font-family: PingFangSC-Regular` |
| `font-size` | `length` | - | 字体大小 | `font-size: 28rpx`;`font-size: 16px` |
| `font-size` | `length` \| `%` | - | 字体大小;百分比按文本透传字号基准解析 | `font-size: 28rpx`;`font-size: 16px`;`font-size: 120%` |
| `font-weight` | `normal` \| `bold` \| `100-900` | `normal` | 字体粗细 | `font-weight: bold`;`font-weight: 500` |
| `font-style` | `normal` \| `italic` | `normal` | 字体样式 | `font-style: italic` 斜体 |
| `line-height` | `length` \| `number` \| `%` | - | 行高,纯数字值自动转换为百分比(如 `1.5` → `150%`) | `line-height: 40rpx`;`line-height: 1.5` |
Expand Down
1 change: 0 additions & 1 deletion .agents/skills/mpx2rn/references/rn-template-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,6 @@ Mpx 输出 RN 内置支持了大部分常用的基础组件,详情见下方文
| enable-offset | boolean | `false` | 设置是否要获取组件的布局信息,若设置了该属性,会在 e.target 中返回组件的 offsetLeft、offsetWidth 信息 |
| enable-var | boolean | `true` | 默认支持使用 css variable,若想关闭该功能可设置为 false |
| enable-text-pass-through | boolean | `false` | RN 环境特有属性,开启文本样式和文本属性透传上下文,请在动态添加文本样式或文本属性时开启 |
| parent-font-size | number | | 父组件字体大小,主要用于百分比计算的场景,如 font-size: 100% |
| parent-width | number | | 父组件宽度,主要用于百分比计算的场景,如 width: calc(100% - 20px),需要在外部传递父组件的宽度 |
| parent-height | number | | 父组件高度,主要用于百分比计算的场景,如 height: calc(100% - 20px),需要在外部传递父组件的高度 |

Expand Down
70 changes: 70 additions & 0 deletions .agents/skills/review-loop/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
name: review-loop
description: Use this skill whenever the user asks for a review loop, self-review workflow, planner/reviewer/coder/code-reviewer collaboration, plan-before-code process, multi-round agent review, or a stable subagent workflow that must produce a plan, wait for user confirmation, implement code, review the diff, and preserve revision records. This skill requires real subagent support and must not fall back to single-agent roleplay.
protocolVersion: 1.0.0
---

# Review Loop

Use this skill to run a two-phase workflow:

1. Plan loop: `planner` writes or revises `plan.md`; `plan-reviewer` reviews it.
2. Code loop: after user confirmation, `coder` implements the confirmed plan; `code-reviewer` reviews the resulting diff.

The workflow requires real subagents. If the current environment cannot create real subagents, stop and tell the user that `review-loop` cannot run in this session.

## Required Setup

Before doing task work:

1. Read `references/protocol.md`, `references/state-machine.md`, and `references/role-contracts.md`.
2. Read `references/codex.md` or `references/claude-code.md` when that platform applies.
3. Create a task id.
4. Run `scripts/init-workspace.js` to create `.agent-workflows/review-loop/<task-id>/`.
5. Run `scripts/prepare-agent-roles.js` to prepare real subagent roles.
6. Run `scripts/validate-state.js` before advancing.

Default `maxRounds` is `3`. If the user specifies a maximum loop count, pass it to `init-workspace.js`.

## Hard Rules

- Do not implement code until the plan loop has ended and the user explicitly confirms the plan.
- Do not let reviewer roles modify `plan.md` or source files; reviewers write JSON review files only.
- Use `scripts/validate-review-json.js` after every reviewer output.
- Use `scripts/snapshot-diff.js` after every code loop implementation round.
- Use `scripts/advance-state.js` for every state transition; never hand-edit `state.json`.
- Stop a loop when the reviewer returns `approved` or when the loop reaches `state.json.maxRounds`.
- When a loop stops because `maxRounds` is reached, summarize remaining findings and ask the user whether to continue, accept, or revise.
- Preserve every round's revision record in `plan.md`.

## Subagent Roles

The four required roles are:

- `planner`
- `plan-reviewer`
- `coder`
- `code-reviewer`

Use the templates under `templates/roles/` to prepare role definitions. If project-level roles already exist, reuse them. If not, ask whether to create temporary roles under the task workspace or persist roles to the project agent config.

## User Confirmation Gates

After the plan loop ends, show the user:

- `plan.md` path
- plan loop termination reason
- review summary by round
- unaccepted findings and reasons

Ask whether to enter the code loop. Only after explicit confirmation, run `advance-state.js --event confirm-plan`.

After the code loop ends, show the user:

- `plan.md` path
- diff summary
- code loop termination reason
- validation commands and results
- remaining risks

Ask whether to accept the final result. Only after explicit confirmation, run `advance-state.js --event confirm-final`.
23 changes: 23 additions & 0 deletions .agents/skills/review-loop/evals/evals.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"skill_name": "review-loop",
"evals": [
{
"id": 1,
"prompt": "使用 review-loop 工作流实现一个小的 bugfix,先产出方案并 review,等我确认后再写代码。",
"expected_output": "Creates a review-loop workspace, initializes state.json with maxRounds=3, enters plan loop, and waits for user confirmation before code loop.",
"files": []
},
{
"id": 2,
"prompt": "使用 review-loop 工作流实现需求,最多 review 5 轮。",
"expected_output": "Initializes state.json with maxRounds=5 and uses that value to stop plan/code loops.",
"files": []
},
{
"id": 3,
"prompt": "继续上次中断的 review-loop 任务。",
"expected_output": "Runs recoverability/state checks, reads state.json, and resumes from the recorded phase instead of starting over.",
"files": []
}
]
}
51 changes: 51 additions & 0 deletions .agents/skills/review-loop/references/claude-code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Claude Code Integration

Claude Code support requires real subagents. Do not run this workflow as single-agent roleplay.

## Role Discovery

Check project agents first:

```text
.claude/agents/planner.md
.claude/agents/plan-reviewer.md
.claude/agents/coder.md
.claude/agents/code-reviewer.md
```

If all four exist, reuse them.

If any are missing, ask the user to choose:

- temporary roles under `.agent-workflows/review-loop/<task-id>/runtime/roles/`
- persistent project agents under `.claude/agents/`

Use `scripts/prepare-agent-roles.js` for either path.

## Temporary Roles

Temporary roles are copied from `templates/roles/` to:

```text
.agent-workflows/review-loop/<task-id>/runtime/roles/
```

They are valid only for the current task.

## Persistent Roles

Persistent roles are copied from `templates/roles/` to:

```text
.claude/agents/
```

This requires explicit user confirmation because it modifies project-level agent configuration.

## Failure

If Claude Code cannot create real subagents in the current session, stop the workflow and tell the user:

```text
review-loop requires real subagent support. Current Claude Code session cannot create subagents, so the workflow cannot continue.
```
57 changes: 57 additions & 0 deletions .agents/skills/review-loop/references/codex.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Codex Integration

Codex support requires real subagents. Do not run this workflow as single-agent roleplay.

## Role Discovery

Check project custom agents first:

```text
.codex/agents/planner.toml
.codex/agents/plan-reviewer.toml
.codex/agents/coder.toml
.codex/agents/code-reviewer.toml
```

If all four exist, reuse them.

If any are missing, ask the user to choose:

- temporary roles under `.agent-workflows/review-loop/<task-id>/runtime/roles/`
- persistent project custom agents under `.codex/agents/`

Use `scripts/prepare-agent-roles.js` for either path.

## Persistent Agent Format

Codex custom agents are TOML files. Each file must define:

```toml
name = "planner"
description = "Planner for review-loop workflows."
developer_instructions = """
Read the review-loop workspace inputs and produce or revise plan.md.
Do not implement code.
"""
```

## Starting Roles

Codex does not spawn subagents without an explicit request. After roles are prepared, the orchestrator must explicitly start the four role subagents as the state machine requires.

For each role, include:

- role name
- task id
- workspace path
- input files
- required output path
- instruction to return a concise summary to the orchestrator

## Failure

If Codex cannot create real subagents in the current session, stop the workflow and tell the user:

```text
review-loop requires real subagent support. Current Codex session cannot create subagents, so the workflow cannot continue.
```
Loading
Loading