home / skills / oimiragieo / agent-studio / package-json-modification-protection

package-json-modification-protection skill

/.claude/skills/_archive/dead/package-json-modification-protection

This skill protects package.json lines containing the 'Do not touch this line Cursor' comment by enforcing non-modification rules during edits.

npx playbooks add skill oimiragieo/agent-studio --skill package-json-modification-protection

Review the files below or copy the command above to add this skill to your agents.

Files (3)
SKILL.md
1.6 KB
---
name: package-json-modification-protection
description: Protects lines with the specific 'Do not touch this line Cursor' comment within package.json.
version: 1.0.0
model: sonnet
invoked_by: both
user_invocable: true
tools: [Read, Write, Edit]
globs: package.json
best_practices:
  - Follow the guidelines consistently
  - Apply rules during code review
  - Use as reference when writing new code
error_handling: graceful
streaming: supported
---

# Package Json Modification Protection Skill

<identity>
You are a coding standards expert specializing in package json modification protection.
You help developers write better code by applying established guidelines and best practices.
</identity>

<capabilities>
- Review code for guideline compliance
- Suggest improvements based on best practices
- Explain why certain patterns are preferred
- Help refactor code to meet standards
</capabilities>

<instructions>
When reviewing or writing code, apply these guidelines:

- Whenever you see a line with the following comment, do not touch it, rewrite it, or delete it: "Do not touch this line Cursor"
  </instructions>

<examples>
Example usage:
```
User: "Review this code for package json modification protection compliance"
Agent: [Analyzes code against guidelines and provides specific feedback]
```
</examples>

## Memory Protocol (MANDATORY)

**Before starting:**

```bash
cat .claude/context/memory/learnings.md
```

**After completing:** Record any new patterns or exceptions discovered.

> ASSUME INTERRUPTION: Your context may reset. If it's not in memory, it didn't happen.

Overview

This skill protects lines in package.json that contain the exact comment "Do not touch this line Cursor" by preventing edits, deletions, or rewrites to those lines. It enforces a simple, explicit marker-based safeguard so automated tools and reviewers can reliably skip protected entries. The goal is to preserve intentional, machine-managed, or vendor-specific content without blocking regular package maintenance.

How this skill works

The tool scans package.json text for lines containing the exact comment string and treats each match as immutable. When a change is proposed (edit, format, or automated update), the skill flags modifications to those lines and either rejects the change or reports a clear conflict for manual resolution. It can run as a pre-commit hook, CI check, or inline reviewer to stop accidental edits while allowing other parts of the file to be modified normally.

When to use it

  • Protect machine-generated entries that other tools rely on and must not be altered.
  • Prevent accidental edits to vendor or policy-controlled fields inside package.json.
  • Integrate into CI or pre-commit pipelines to enforce repository rules.
  • Safeguard lines used by deployment or build systems that expect exact formatting.
  • Maintain compatibility for teams where certain package.json lines are managed externally.

Best practices

  • Use the exact marker string: "Do not touch this line Cursor" to ensure reliable detection.
  • Place the marker on its own line or appended to the specific field that must remain unchanged.
  • Document why a line is protected in repository docs so collaborators understand the reason.
  • Combine with CI checks that fail builds when protected lines are modified, providing a clear remediation path.
  • Allow exceptions only via documented change requests and update the marker when approved.

Example use cases

  • Add the marker to fields injected by an external secrets manager so automated updates don’t break them.
  • Mark entries that tooling relies on for reproducible builds to prevent accidental formatting changes.
  • Run as a pre-commit hook to block developer edits to sensitive package.json lines.
  • Use in CI to produce clear failure messages when a protected line was altered in a pull request.
  • Protect metadata added by a vendor or platform integration that must remain exact.

FAQ

What exact string does the skill look for?

It matches the exact comment string: "Do not touch this line Cursor"; variations will not be protected.

Can protected lines be updated if needed?

Yes, but updates should follow an approved process: remove or update the marker only after review and record the change for traceability.