Skills.MD
# Prompt Craft - Claude 4 Best Practices
Craft effective prompts for Claude workers using proven patterns.
## Core Principles
### 1. Be Explicit
Claude 4.x follows instructions precisely. Use action verbs.
| Less Effective | More Effective |
|----------------|----------------|
| "Can you suggest improvements?" | "Update the function to improve performance." |
| "Look at this code" | "Find and fix the null check bug" |
| "Help with testing" | "Write unit tests for the auth module" |
### 2. Add Context/Motivation
Explain WHY, not just WHAT. Claude generalizes from explanations.
| Less Effective | More Effective |
|----------------|----------------|
| "NEVER use ellipses" | "Never use ellipses since the TTS engine won't pronounce them correctly." |
| "Always add error handling" | "Add error handling so users see helpful messages instead of stack traces." |
### 3. Natural Skill Triggers
Use natural language, avoid aggressive markers.
| Avoid | Use |
|-------|-----|
| "CRITICAL: You MUST use this tool when..." | "Use the X skill for Y." |
| "ALWAYS: This is REQUIRED" | "Use this approach when..." |
| "IMPORTANT!!!: Never forget to..." | "Remember to..." |
### 4. Positive Framing
Tell Claude what TO do, not just what to avoid.
| Less Effective | More Effective |
|----------------|----------------|
| "Don't write long functions" | "Keep functions under 20 lines" |
| "Avoid complex logic" | "Use simple, readable patterns" |
## Prompt Structure
```markdown
## Context
[1-2 sentences: Why this work matters, what problem it solves]
## Task
[Clear, explicit action instruction using action verbs]
## Approach
[Optional: Skill hints, patterns to follow, key considerations]
Use the [skill] skill for [specific purpose].
## Key Files
[3-5 most relevant files to start with]
- path/to/main/file.ts
- path/to/related/file.ts
## When Done
[How to complete: close issue, what to include in summary]
Close issue: bd close ISSUE-ID --reason "summary"
```
## Skill Matching
Match skills based on content:
| Content Signal | Suggested Skill |
|----------------|-----------------|
| `.tsx`, `.jsx`, React | frontend-development |
| terminal, xterm, resize | xterm-js |
| auth, login, session | better-auth |
| database, SQL, query | databases |
| API, REST, endpoint | backend-development |
| CSS, styling, theme | ui-styling |
| docs, markdown | docs-seeker |
## Subagent Hints
Claude 4.5 naturally delegates. Add hints when beneficial:
```markdown
Use subagents in parallel to scaffold Dashboard, Settings, and Profile pages.
```
```markdown
Use an Explore agent to find the relevant authentication files first.
```
## Parallelization Hints
For tasks with independent subtasks:
```markdown
These components can be developed in parallel:
- HeaderComponent
- FooterComponent
- SidebarComponent
```
## Complexity Guidelines
| Prompt Length | When to Use |
|---------------|-------------|
| Short (3-5 lines) | Simple bug fixes, single-file changes |
| Medium (10-15 lines) | Feature work, multi-file changes |
| Long (20+ lines) | Complex features, architectural changes |
**Rule**: If you need more than 20 lines, the issue might need breaking down.
## Anti-Patterns
Avoid these common mistakes:
1. **Overloading**: Too many skills, too many files, too much context
2. **Vague tasks**: "Make it better" without specific criteria
3. **All caps**: CRITICAL, IMPORTANT, MUST - creates anxiety, not clarity
4. **Negative framing**: Lists of don'ts without corresponding dos
5. **No completion criteria**: Worker doesn't know when they're done
## References
- [Claude 4 Best Practices](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-4-best-practices)
- [Prompt Engineering Guide](https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering)
评论 0
还没有评论,来抢沙发。
相关内容
同类或同场景的收录内容
building-with-kafka-strimzi
在 Kubernetes 上构建基于 Apache Kafka 的事件驱动系统,支持高可靠的消息传递、事务性处理与精确一次语义,结合 Strimzi 运营商实现集群自动化管理,利用 Schema Registry 保障事件模式演进,适用于微服务间解耦通信与实时数据流处理场景。
站外数据与分析
609 0.0
personal-tool-builder
专注于从个人真实痛点出发快速构建实用工具,涵盖命令行程序、本地优先应用和自动化脚本的开发与演进,强调先满足自身需求再逐步扩展,通过持续自用打磨功能,避免过度设计,确保工具简洁有效且长期可维护。
站外商业与营销
196 0.0
threejs-lighting
实现三维场景中的光照与阴影控制,支持多种光源类型及环境光照明,提供从基础布光到高级阴影优化的完整方案,适用于需要真实感渲染或性能平衡的可视化项目。
站外效率工具
442 0.0
aggregation-helper
提供数据聚合场景的自动化辅助能力,涵盖 SQL 查询编写、统计分析建模、可视化方案设计及商业智能配置,支持从需求理解到生产级代码生成的全流程指导。
站外效率工具数据与分析
217 0.0
举报「prompt-craft」
举报信息仅审核团队可见,同一资产 24 小时内仅可举报一次