AgentSkillsCN

rule-expertise

撰写高效指令与提示词。适用于文档编写、指南制定、项目规则确立,或任何具有方向性的沟通场景。关键词:指令、指南、提示词工程、文档、规则。不适用于代码实现、调试,或非指令性写作。

SKILL.md
--- frontmatter
name: rule-expertise
description: "Write effective instructions and prompts. Use when creating documentation, writing guidelines, establishing project rules, or crafting any directional communication. Keywords: instructions, guidelines, prompt engineering, documentation, rules. Not for code implementation, debugging, or non-instructional writing."

<mission_control> <objective>Create clear, actionable instructions that guide recipients to successful outcomes with verifiable completion</objective> <success_criteria>Instructions specify what to do, why it matters, how to verify success, and include concrete examples</success_criteria> </mission_control>

Effective Instruction Writing

Principles and practices for creating clear, actionable instructions that others can follow successfully.

Quick Start

If you need to write instructions: Focus on what the recipient should do, why it matters, and how to verify success → Use positive language → Provide concrete examples.

If you need to improve existing instructions: Convert negative statements to positive guidance → Add specific success criteria → Remove unnecessary content.

If you need to verify instruction quality: Check for clarity, actionability, and verifiable outcomes.

Core Principles

Positive Direction

Tell recipients what TO do, not just what NOT to do.

Less EffectiveMore Effective
"Never use inline styles""Use StyleSheet.create for better performance"
"Don't commit secrets""Keep sensitive data in environment variables"
"Avoid blocking operations""Use async patterns for responsiveness"

Why it works: Positive guidance provides clear direction and reasoning, not just prohibitions.

Specific Evidence

Define success with concrete, verifiable outcomes.

VagueSpecific
"The code works""Tests pass (12/12, Exit Code 0)"
"Files updated""Modified 3 files: main.ts, config.ts, tests/"
"Configuration valid""Config validated: all required fields present"

Why it works: Specific evidence leaves no ambiguity about completion.

Essential Content

Include only what recipients need to know. Remove what's obvious or already understood.

RemoveKeep
Generic explanationsProject-specific decisions
Obvious conventionsNon-obvious trade-offs
Detailed tutorialsVerification criteria
Historical contextSecurity constraints

Why it works: Focus prevents overwhelming the recipient with noise.

Clear Structure

Organize for scannability with logical flow.

ApproachWhen to Use
Quick start guideComplex processes with common entry points
Thematic sectionsMultiple distinct topics
Step-by-step workflowsLinear procedures
Reference formatLookup-oriented content

Why it works: Structure helps recipients find what they need quickly.


Communication Patterns

Positive Framing Formula

Transform constraints into constructive guidance:

code
[Avoided behavior] → [Preferred action] + [Reason/benefit]

Examples:

  • "Never use callbacks" → "Use async/await for more readable code"
  • "Don't hardcode values" → "Use configuration files for environment-specific values"
  • "Avoid monoliths" → "Structure code in modules for better maintainability"

Evidence-Based Claims

Support assertions with verifiable information:

markdown
## Success Criteria

| Claim | Evidence |
| :--- | :--- |
| Tests pass | Test output with exit code |
| Code reviewed | PR approved and merged |
| Build succeeds | Build artifact created |
| Documentation complete | All modules documented |

Context-Specific Guidance

Tailor instructions to the recipient's situation:

AudienceAdjust
BeginnersMore explanations, examples, and context
ExpertsConcise, assume prior knowledge
Cross-teamExplain your team's context clearly
PublicSelf-contained, no internal references

Common Patterns

Anti-Patterns to Avoid

MistakeBetter Approach
Negative-only"Don't do X" → "Use Y instead for benefit"
VerboseRemove obvious explanations and justifications
VagueAdd specific evidence requirements
Over-specifiedProvide outcomes, not step-by-step scripts
DuplicatedDefine once, reference elsewhere

Effective Examples

Writing Style:

❌ Verbose: "In order to ensure that your code maintains high quality standards, you should run the linter before committing..." ✅ Concise: "Run linter before committing to catch issues early."

Constraints:

❌ Negative: "Important: Never use inline styles in production code." ✅ Positive: "Use StyleSheet.create for better performance and maintainability."

Verification:

❌ Vague: "Ensure all tests pass before continuing." ✅ Specific: "Run npm test and verify all tests pass (Exit Code 0)."


Iterative Refinement

Instructions improve through cycles of observation and adjustment.

Improvement Cycle

  1. Observe - Note where instructions are unclear or ignored
  2. Analyze - Determine root cause of confusion
  3. Revise - Rewrite problematic sections with clarity
  4. Test - Verify instructions are followed correctly
  5. Document - Record successful patterns for future

Feedback Signals

SignalAction
Recurring questionsAdd clarification or examples
Common mistakesStrengthen guidance or add warnings
Instructions ignoredCheck relevance and clarity
Confusion reportedSimplify language or structure

Recognition Questions

Evaluate instruction quality by asking:

QuestionPurpose
Is the outcome clear?Recipient knows what success looks like
Is the language positive?Guidance directs toward preferred actions
Is verification possible?Success can be objectively confirmed
Is the content essential?Everything included serves a clear purpose
Is the structure logical?Information is easy to navigate
Is the scope appropriate?Content matches recipient's knowledge level

Examples: Good vs Bad

Technical Instructions

BAD:

markdown
## Code Style Guidelines

Please make sure to follow all the best practices for writing clean code. You should use meaningful variable names and write functions that do one thing. Also, add comments where the code is complex.

GOOD:

markdown
## Code Style

- Use descriptive variable names that indicate purpose
- Write functions focused on single responsibility
- Add comments for complex logic only
- Run linter before committing: `npm run lint`

Workflow Instructions

BAD:

markdown
## Deployment Process

We need to deploy the application carefully. First build the Docker image, then push it to the registry, then update the Kubernetes configuration. Make sure to test after each step.

GOOD:

markdown
## Deployment Process

1. Build: `docker build -t app:latest .`
2. Push: `docker push app:latest`
3. Update: `kubectl apply -f deployment.yaml`
4. Verify: `kubectl rollout status deployment/app`

Requirements Definition

BAD:

markdown
## Requirements

The system should be fast and secure. It needs to handle user data properly and scale well.

GOOD:

markdown
## Requirements

- **Performance:** Respond to requests within 200ms (p95)
- **Security:** Encrypt data at rest and in transit; validate all inputs
- **Scalability:** Handle 10,000 concurrent users
- **Data:** Persist user data for 7 years; comply with GDPR

Context-Specific Guidance

For Different Recipients

ContextApproachExample
OnboardingInclude rationale and context"Use modules for better code organization..."
ReferenceConcise, assume familiarity"Use module system: import { X } from 'package'"
EmergencyDirect, actionable steps"To rollback: kubectl rollout undo deployment/app"
Cross-teamExplain your terms"Use our shared logging library (see docs/logging/)"

For Different Project Types

Project TypeFocus Areas
SoftwareCommands, workflows, verification
ResearchMethodology, reproducibility, documentation
InfrastructureConfiguration, state, security
LibrariesAPI usage, versioning, contributions

Common Pitfalls

Over-Specification

Don't prescribe exact steps when outcomes matter more:

❌ "First create directory X, then create file Y, then add content Z..." ✅ "Create component with X, Y, and Z in the components/ directory."

Under-Specification

Don't assume knowledge when specificity matters:

❌ "Follow best practices for error handling." ✅ "Use Result types for operations that can fail: Result<T, E> pattern."

Context Assumption

Don't assume recipient knows your context:

❌ "Use the shared library like we discussed." ✅ "Use the shared utility library: import { utils } from '@shared/utils'"

Missing Verification

Don't leave success ambiguous:

❌ "Implement the feature and test it." ✅ "Implement feature; verify with tests; document API changes."


Verification Methods

Different types of claims require different verification approaches.

Code and Systems

ClaimVerification
Functionality worksTest output, manual verification
Performance meets targetBenchmarks, profiling data
Security standards metSecurity scan results, audit reports
Type safety maintainedCompiler output, linter results

Processes and Workflows

ClaimVerification
Process followedChecklist completed, steps documented
Compliance achievedAudit results, certification obtained
Documentation completeAll modules documented, examples provided

Configuration

ClaimVerification
Settings correctConfiguration validation, successful startup
Secrets managedNo secrets in code, env vars used
Permissions correctAccess tests, permission checks

Learning from Feedback

Instructions improve when you pay attention to how they're used.

What Recurring Questions Tell You

Question PatternLikely IssueFix
"Where do I start?"Entry point unclearAdd quick start guide
"How do I verify X?"Success criteria vagueAdd specific verification
"Can I use Y instead?"Constraint too rigidExplain principles, allow flexibility
"What does this mean?"Jargon or concept unclearSimplify language or add examples

What Ignored Instructions Tell You

Ignored SectionLikely ReasonFix
Style guidelinesNot enforcedAdd verification or linter
Workflow stepsToo complexSimplify or automate
Background infoNot actionableRemove or move to appendix
ExamplesNot relatableUse project-specific examples

Structure Best Practices

Effective Organization

Match structure to purpose:

PurposeStructure
Quick referenceBullet points, tables, concise
LearningExplanations with examples
ProceduresNumbered steps, decision points
ReferenceSearchable, cross-referenced

Signal important information:

TechniqueUsage
PlacementPut critical information early
EmphasisUse formatting for importance (bold, tables)
RepetitionState critical points in multiple ways
ExamplesIllustrate abstract principles concretely

Navigation Aids

Help readers find what they need:

Aid TypeWhen Useful
Table of contentsLong documents with multiple sections
Section headersScanning for specific topics
Cross-referencesRelated information in other sections
Index/glossaryTechnical terms or acronyms
Quick startGetting started quickly

Writing Techniques

Clarity Techniques

TechniqueExample
Imperative mood"Create file" not "You should create"
Active voice"Run tests" not "Tests should be run"
Present tense"The build creates artifacts" not "The build will create"
Specific nouns"Users" not "end-users", "clients" not "client-side"

Precision Techniques

TechniqueExample
Concrete verbs"Implement" not "handle", "process"
Numbers over words"3 files" not "several files"
Exact values"200ms limit" not "fast response"
File paths"src/config.ts" not "the config file"

Brevity Techniques

TechniqueExample
Remove fillerDelete "in order to", "for the purpose of"
Simplify explanationsKeep one sentence per concept
Use listsReplace paragraph with bullet points
Trust knowledgeDon't explain what recipient knows

Quality Indicators

Signs of Effective Instructions

IndicatorExample
Questions decreaseRecurring questions stop after clarification
Compliance increasesInstructions followed consistently
Errors decreaseCommon mistakes become rare
Onboarding fasterNew users become productive quickly
Ambiguity rareFew requests for clarification

Signs of Problematic Instructions

IndicatorExample
Questions repeatSame questions asked repeatedly
Workarounds emergePeople create their own processes
Sections skippedParts of instructions consistently ignored
Confusion commonFrequent clarification requests
Outdated infoInstructions describe old processes

Recognition Questions

Use these questions to evaluate instruction quality:

QuestionWhy It Matters
Is the outcome clear?Recipient knows what success looks like
Is the language positive?Guidance directs toward preferred actions
Is verification possible?Success can be objectively confirmed
Is the scope appropriate?Content matches recipient's needs and knowledge
Is the structure logical?Information flows naturally
Is the tone right?Language is appropriate for context
Can it evolve?Format allows for updates and growth