skills/code-modification/SKILL.md
Use this skill when modifying, refactoring, or optimizing code. Enforces strict engineering standards and project-specific constraints.
npx skillsauth add till-crazy-tears-us-apart/claude-code-engineering-suite code-modificationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Although strict schema validation is disabled, you MUST internally structure your approach around these inputs:
context7 / documentation tools to verify signatures before writing code.Phase 0: Packet Loading (Conditional)
Execute only if a task_packet_file argument was provided.
If argument IS provided:
.claude/temp_task/{task_packet_file} using the Read tool.
evidence_packet.proposed_changes[] as the authoritative change scope.
evidence[] item with status: "suspected": re-read the referenced path and range and confirm before proceeding.If NO argument provided:
.claude/temp_task/.active_packet exists: run Bash("rm -f '.claude/temp_task/.active_packet'") to clear stale state.Phase 1: Discovery & Tracing (Mandatory)
Bash("test -f .claude/logic_index.json && echo EXISTS || echo MISSING").Bash("python \"~/.claude/skills/update-logic-index/impact.py\" <target_file_1> <target_file_2> ...") with the files targeted for modification. Use the output as the definitive dependency list. If exit code = 2 (no call graph data), fall through to the manual path below.grep or glob to locate all files that import or call the target_files.[L120-L155]) and the file exceeds PRECISION_READ_THRESHOLD lines (default: 500), use Read(file_path, offset=start_line, limit=end_line - start_line + 1) for each listed function. Group adjacent functions into a single Read when their ranges overlap or are within 10 lines.Read the entire file.Phase 2: Framework Compliance Check (Conditional)
Execute only if target files contain compiler decorators, metaprogramming patterns, or performance-critical annotations.
@jit, @compiled, @cached, framework-specific markers).Phase 3: Execution (Read-Plan-Edit)
For each file to be modified, execute the following sub-steps in order. Maintain a _rollback_cache (mapping file path → original content) for the duration of Phase 3.
_rollback_cache[file_path].Skip this sub-step entirely if no packet was loaded in Phase 0.
Before each Edit call, evaluate the following 3 conditions:
| # | Condition | Trigger |
| :--- | :--- | :--- |
| H1 | The file about to be edited is NOT listed in any proposed_changes[].description or referenced evidence[].path | Scope overflow |
| H2 | The target function's signature or structure has changed since the audit's evidence[].excerpt | Stale plan |
| H3 | The edit would violate a constraint stated in sender_payload.analysis | Constraint conflict |
If ANY condition is TRUE → Hard Interrupt:
AskUserQuestion with 3 options:
_rollback_cache, then print: "已回滚所有修改。请重新运行 /deep-plan 进行审计。"_rollback_cache, use Edit or Write to restore the original content. Then HALT Phase 3. Do NOT proceed to Phase 4.If ALL conditions are FALSE → Proceed to Edit.
Skip if no packet was loaded in Phase 0.
During editing, if you make a behavioral choice NOT explicitly covered by proposed_changes[] or sender_payload.analysis (e.g., choosing a specific error type, deciding on a default value, selecting between two valid patterns):
Record the decision in memory.
After ALL edits in Phase 3 are complete, if any decisions were recorded:
mkdir -p ".claude/temp_decisions".claude/temp_decisions/decisions_{PACKET_ID}.md:# Decisions Log — {PACKET_ID}
| 文件路径 | 决策描述 | 类别 |
| :--- | :--- | :--- |
| path/to/file | 选择抛出 ValueError 而非返回 None | Behavior |
Categories: Interface / Resource / Behavior / Ordering / Boundary.
If NO undocumented decisions were made, do NOT create the file.
Repeat sub-steps 3.1–3.4 for each file in the modification set.
Phase 4: Validation
Grep for test files that import or reference the modified symbols.If tests fail:
AskUserQuestion to present options:
Edit to restore original content).If no relevant tests exist:
/post-verify for test generation and coverage analysis."data-ai
Deep repository analysis with multi-agent parallel perspectives. Requires /init + /remy-index as prerequisites. Produces structured research reports.
tools
Analyze CI/CD failure logs to diagnose build, test, and gate failures. Supports GitHub Actions (gh CLI), local log files, and pasted logs. Produces evidence packets for /remy-patch.
development
Generate persistent unit tests for existing or stub code. Supports post-hoc testing (default) and TDD mode (--tdd). Multi-angle agent analysis at medium/high effort levels.
tools
--- name: remy-secure description: Review branch changes for security vulnerabilities. Multi-stage: regex pre-scan, parallel agents, and false-positive filtering. allowed-tools: Read, Grep, Glob, Bash, AskUserQuestion, Agent argument-hint: "[low|medium|high] [diff_range (optional, e.g. HEAD~3...HEAD)]" disable-model-invocation: true --- # Security Audit Protocol Security-focused review of code changes on the current branch. Identifies exploitable vulnerabilities with high confidence (≥ 8/10),