Skip to main content
Glama
16-best-practices.md10 kB
# Best Practices - Cross-Domain Guide ## Software Engineering Best Practices ### Code Quality ``` CLEAN CODE PRINCIPLES: 1. MEANINGFUL NAMES Bad: int d; // elapsed time in days Good: int elapsedTimeInDays; 2. SMALL FUNCTIONS - Do one thing - One level of abstraction - Max 20 lines (guideline) 3. DRY (Don't Repeat Yourself) - Extract common code - Single source of truth - But: Avoid premature abstraction 4. COMMENTS - Explain WHY, not WHAT - Code should be self-documenting - Update comments with code 5. ERROR HANDLING - Fail fast, fail loudly - Use exceptions, not error codes - Don't return null; use Optional 6. TESTING - Write tests first (TDD) - Test behavior, not implementation - Keep tests fast and independent ``` ### Git Workflow ``` BRANCH NAMING: feature/user-authentication bugfix/login-error hotfix/security-patch release/v2.1.0 COMMIT MESSAGES: type(scope): description feat(auth): add OAuth2 login fix(api): handle null response docs(readme): update installation refactor(db): optimize queries test(user): add unit tests PULL REQUEST CHECKLIST: □ Code reviewed by 2+ people □ All tests passing □ No merge conflicts □ Documentation updated □ Breaking changes noted □ Screenshots for UI changes ``` ### API Design ``` REST BEST PRACTICES: 1. USE NOUNS, NOT VERBS Good: GET /users Bad: GET /getUsers 2. USE PLURAL NOUNS Good: /users, /orders Bad: /user, /order 3. USE HTTP METHODS CORRECTLY GET - Read (idempotent) POST - Create PUT - Update (full) PATCH - Update (partial) DELETE - Delete 4. USE HTTP STATUS CODES 200 OK 201 Created 204 No Content 400 Bad Request 401 Unauthorized 403 Forbidden 404 Not Found 500 Internal Server Error 5. VERSION YOUR API /v1/users /v2/users 6. PAGINATE COLLECTIONS GET /users?page=2&limit=20 7. FILTER AND SORT GET /users?status=active&sort=-createdAt 8. USE HATEOAS (Optional) Include links to related resources ``` --- ## Product Management Best Practices ### Feature Prioritization ``` PRIORITIZATION FRAMEWORK: 1. ALIGN WITH STRATEGY □ Does it support company goals? □ Does it fit product vision? □ What's the opportunity cost? 2. MEASURE IMPACT □ How many users affected? □ How much value created? □ What metrics will move? 3. ASSESS EFFORT □ Engineering complexity? □ Design requirements? □ Dependencies? 4. CONSIDER TIMING □ Market window? □ Competitive pressure? □ Technical dependencies? 5. VALIDATE ASSUMPTIONS □ User research done? □ Data supports hypothesis? □ Can we test small first? ``` ### User Research ``` RESEARCH PLANNING: BEFORE RESEARCH: □ Define research questions □ Choose appropriate method □ Recruit right participants □ Prepare discussion guide □ Set up recording DURING RESEARCH: □ Build rapport first □ Ask open-ended questions □ Follow up on interesting points □ Avoid leading questions □ Take notes AFTER RESEARCH: □ Debrief immediately □ Synthesize findings □ Identify patterns □ Share with team □ Document insights QUESTION TYPES: Opening: "Tell me about your typical day..." Exploration: "Walk me through how you..." Deep dive: "Why is that important to you?" Clarification: "Can you give me an example?" Closing: "Is there anything else?" ``` --- ## Leadership Best Practices ### One-on-One Meetings ``` STRUCTURE (30-60 min): THEIR TOPICS (15 min) - What's on your mind? - What do you want to discuss? - Let them drive YOUR TOPICS (10 min) - Feedback to share - Information to convey - Alignment check CAREER/GROWTH (5-10 min) - Long-term goals - Development areas - Support needed ACTION ITEMS (5 min) - Summarize commitments - Set follow-ups - Next meeting topics QUESTIONS TO ASK: - What's going well? - What's frustrating you? - How can I help? - What should I start/stop/continue? - Where do you want to grow? ``` ### Giving Feedback ``` SBI MODEL: S - SITUATION Specific time and place "In yesterday's meeting..." B - BEHAVIOR Observable actions "...when you interrupted the speaker..." I - IMPACT Effect on you/team/business "...it made the presenter lose their train of thought and the discussion went off track." FOLLOW WITH: - Pause for response - Discuss alternatives - Agree on next steps FEEDBACK PRINCIPLES: ✓ Be specific, not general ✓ Focus on behavior, not person ✓ Give it promptly ✓ Make it actionable ✓ Balance positive and constructive ✗ Don't save up feedback ✗ Don't feedback by email (usually) ✗ Don't assume intent ``` ### Running Effective Meetings ``` BEFORE MEETING: □ Is this meeting necessary? □ Right people invited? □ Clear agenda shared? □ Pre-read distributed? □ Time appropriate? DURING MEETING: □ Start on time □ State objective □ Keep on track □ Encourage participation □ Capture decisions □ Assign action items □ End on time AFTER MEETING: □ Send notes within 24h □ Include decisions made □ List action items + owners □ Set follow-up if needed MEETING TYPES: - Decision meeting: Come with options, leave with decision - Brainstorm: Generate ideas, no judgment - Status update: Consider async alternative - 1:1: Their agenda first - All-hands: Inform and inspire ``` --- ## Business Strategy Best Practices ### Strategic Planning ``` ANNUAL PLANNING CYCLE: Q4 (PLANNING) ├── Review previous year ├── Environmental scan ├── Set strategic priorities ├── Define success metrics └── Allocate resources Q1 (EXECUTION) ├── Detailed quarterly plans ├── Team alignment ├── Quick wins └── Early indicators Q2 (ADJUSTMENT) ├── Mid-year review ├── Course corrections ├── Resource reallocation └── Emerging opportunities Q3 (ACCELERATION) ├── Double down on working ├── Cut losses on failing ├── Prepare next year └── Strategic experiments STRATEGY DOCUMENTS: 1. Vision (10 years) 2. Mission (ongoing) 3. Strategic priorities (3 years) 4. Annual objectives (1 year) 5. Quarterly OKRs ``` ### OKR Best Practices ``` OBJECTIVE RULES: ✓ Qualitative and inspiring ✓ Time-bound (quarterly) ✓ Achievable but ambitious ✓ Aligned to strategy KEY RESULT RULES: ✓ Quantitative and measurable ✓ 3-5 per objective ✓ Outcome, not output ✓ 60-70% achievement = success EXAMPLE: Objective: Become the #1 customer service in our industry Key Results: 1. Increase NPS from 32 to 50 2. Reduce first response time from 24h to 4h 3. Achieve 95% customer satisfaction rating 4. Reduce ticket volume by 20% through self-service COMMON MISTAKES: ✗ Too many OKRs ✗ Key results are tasks ✗ Not ambitious enough ✗ Set and forget ✗ No regular check-ins ``` --- ## Security Best Practices ### Application Security ``` OWASP TOP 10 PREVENTION: 1. INJECTION → Use parameterized queries → Validate and sanitize input → Use ORM 2. BROKEN AUTHENTICATION → Multi-factor authentication → Secure session management → Password requirements 3. SENSITIVE DATA EXPOSURE → Encrypt at rest and transit → Minimize data collection → Proper key management 4. XML EXTERNAL ENTITIES → Disable DTD processing → Use less complex formats 5. BROKEN ACCESS CONTROL → Deny by default → Implement RBAC → Server-side validation 6. SECURITY MISCONFIGURATION → Automated hardening → Remove defaults → Regular audits 7. CROSS-SITE SCRIPTING (XSS) → Output encoding → Content Security Policy → Sanitize HTML 8. INSECURE DESERIALIZATION → Validate serialized data → Implement integrity checks 9. USING VULNERABLE COMPONENTS → Keep dependencies updated → Use SCA tools → Remove unused dependencies 10. INSUFFICIENT LOGGING → Log security events → Monitor for anomalies → Retain logs appropriately ``` ### Data Privacy ``` GDPR COMPLIANCE CHECKLIST: DATA COLLECTION: □ Lawful basis identified □ Purpose clearly stated □ Consent properly obtained □ Minimum data collected DATA STORAGE: □ Encrypted at rest □ Access controls in place □ Retention periods defined □ Secure deletion process DATA PROCESSING: □ Processing agreements signed □ Third parties vetted □ Cross-border transfers compliant INDIVIDUAL RIGHTS: □ Access requests handled □ Deletion requests honored □ Portability supported □ Correction process exists DOCUMENTATION: □ Privacy policy updated □ Records of processing □ DPIA where required □ Breach response plan ``` --- ## Communication Best Practices ### Written Communication ``` EMAIL BEST PRACTICES: SUBJECT LINE: ✓ Specific and actionable ✓ Include deadline if relevant ✗ "Quick question" or vague STRUCTURE: 1. Bottom line up front (BLUF) 2. Context (brief) 3. Details (if needed) 4. Clear ask/next steps EXAMPLE: Subject: Decision needed by Friday: Q4 marketing budget Team, I need your approval on the Q4 marketing budget by Friday EOD. Recommendation: Increase digital spend by 20% ($50K) based on Q3 performance data showing 3x ROI on digital vs traditional. Options: A) Approve as proposed B) Approve with modifications C) Discuss in Thursday meeting Please reply with your preference. Thanks, [Name] ``` ### Presentation Skills ``` PRESENTATION STRUCTURE: OPENING (10%) - Hook / attention grabber - Establish credibility - Preview main points - Why should they care? BODY (80%) - 3 main points (rule of 3) - Evidence for each - Transitions between - Stories and examples CLOSING (10%) - Summarize key points - Clear call to action - Memorable final statement - Q&A SLIDE DESIGN: ✓ One idea per slide ✓ Minimal text (6 words per line, 6 lines) ✓ High contrast colors ✓ Large fonts (24pt minimum) ✓ Quality images ✗ Clip art ✗ Reading slides aloud ✗ Bullet point overload ```

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/seanshin0214/persona-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server