Spaces:
Sleeping
Sleeping
Upload code.md with huggingface_hub
Browse files
code.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Code Output Guidelines
|
| 2 |
+
|
| 3 |
+
## Code Style
|
| 4 |
+
|
| 5 |
+
- Write clean, efficient code
|
| 6 |
+
- Use proper indentation
|
| 7 |
+
- Add necessary imports at the top
|
| 8 |
+
- Use meaningful variable names
|
| 9 |
+
|
| 10 |
+
## Language-Specific Conventions
|
| 11 |
+
|
| 12 |
+
### Python
|
| 13 |
+
```python
|
| 14 |
+
def function_name(params):
|
| 15 |
+
"""Docstring if needed."""
|
| 16 |
+
# Code here
|
| 17 |
+
return result
|
| 18 |
+
```
|
| 19 |
+
|
| 20 |
+
### JavaScript/TypeScript
|
| 21 |
+
```javascript
|
| 22 |
+
const functionName = (params) => {
|
| 23 |
+
// Code here
|
| 24 |
+
return result;
|
| 25 |
+
};
|
| 26 |
+
```
|
| 27 |
+
|
| 28 |
+
### React
|
| 29 |
+
```jsx
|
| 30 |
+
function ComponentName({ props }) {
|
| 31 |
+
return (
|
| 32 |
+
<JSX />
|
| 33 |
+
);
|
| 34 |
+
}
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
## Error Handling
|
| 38 |
+
|
| 39 |
+
- Handle exceptions appropriately
|
| 40 |
+
- Usetry/catch for risky operations
|
| 41 |
+
- Validate inputs
|
| 42 |
+
|
| 43 |
+
## Security
|
| 44 |
+
|
| 45 |
+
- Sanitize user inputs
|
| 46 |
+
- Avoideval() when possible
|
| 47 |
+
- Use parameterized queries for databases
|